java.lang.Object
org.autogui.swing.GuiSwingViewDocumentEditor
- All Implemented Interfaces:
GuiSwingElement
,GuiSwingView
a swing view for
GuiReprValueDocumentEditor
swing-value
GuiSwingViewDocumentEditor.PropertyDocumentEditorPane.getSwingViewValue()
or
GuiSwingViewDocumentEditor.PropertyDocumentTextPane.getSwingViewValue()
:
Document
, AbstractDocument.Content
, StringBuilder
,
or SwingDeferredRunner.TaskResultFuture
handled by
GuiReprValueDocumentEditor.toUpdateValue(GuiMappingContext, Object, Consumer)
- setting to the value is processed by
setSwingViewValue(JEditorPane, GuiSwingView.SpecifierManager, GuiMappingContext, Object, boolean, GuiTaskClock)
. it callsGuiReprValueDocumentEditor.toUpdateValue(GuiMappingContext, Object, Consumer)
. if the given value is aSwingDeferredRunner.TaskResultFuture
,. it immediately obtains the result value as a Document by re-run toUpdateValue with the value of the future, or returns null with runs a delayed task. - For another non-Document value, toUpdateValue returns a Document wrapping the value
- As the delayed task,
setSwingViewValueDocument(JEditorPane, GuiSwingView.SpecifierManager, GuiMappingContext, Object, Document, boolean, GuiTaskClock)
. is used. the method updates Document of the pane byJTextComponent.setDocument(Document)
and callsGuiSwingView.updateFromGui(ValuePane, Object, GuiTaskClock)
(if contextUpdate=true)
history-value
TODO unsupported yetstring-transfer
TODO unsupported yetpreferences
{ "lineSpacing": Number, "spaceAbove": Number, "fontFamily": String, "fontSize": Number, "bold": Boolean, "italic": Boolean, "backgroundColor": "[intR, intG, intB, intA]", "foregroundColor": "[intR, intG, intB, intA]", "backgroundCustom": Boolean, "foregroundCustom": Boolean, "wrapText": Boolean }
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
a setting pane for document default stype; a GUI forGuiSwingViewDocumentEditor.PreferencesForDocumentSetting
static class
static class
prefs obj for document-settings; currently the settings have properties of entire document styling only for editing plain-texts; minimize properties.static class
static class
static class
static class
static class
static interface
the interface for the target pane ofGuiSwingViewDocumentEditor.DocumentSettingPane
; if the pane implements the interface, it will be called at updating the wrapping-line property from the setting pane.Nested classes/interfaces inherited from interface org.autogui.swing.GuiSwingView
GuiSwingView.ContextRefreshAction, GuiSwingView.SettingsWindowClient, GuiSwingView.SpecifierManager, GuiSwingView.SpecifierManagerDefault, GuiSwingView.ToStringCopyAction, GuiSwingView.ValuePane<ValueType>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final double
static final double
static final double
static final double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateView
(GuiMappingContext context, Supplier<GuiReprValue.ObjectSpecifier> parentSpecifier) static Dimension
getPreferredSize
(JTextComponent field, boolean wrapLine) static Dimension
an implementation forJComponent.getPreferredSize()
supporting wrapping-line; checks the horizontal policy of parentJScrollPane
byisWrapLine(JScrollPane)
and callsgetPreferredSize(JTextComponent, boolean)
.static boolean
an implementation forJTextComponent.getScrollableTracksViewportWidth()
static Object
getSwingViewValue
(JEditorPane pane, GuiMappingContext context) getTextMenuItems
(GuiSwingView.ValuePane<?> pane, MenuBuilder.MenuLabel infoLabel) boolean
isComponentResizable
(GuiMappingContext context) static boolean
isWrapLine
(JScrollPane pane) static boolean
isWrapLineNotMatch
(JScrollPane pane, boolean tested) static JScrollPane
static JScrollPane
static void
setSwingViewValue
(JEditorPane pane, GuiSwingView.SpecifierManager specifierManager, GuiMappingContext context, Object newValue, boolean contextUpdate, GuiTaskClock viewClock) static void
setSwingViewValueDocument
(JEditorPane pane, GuiSwingView.SpecifierManager specifierManager, GuiMappingContext context, Object newValue, Document doc, boolean contextUpdate, GuiTaskClock viewClock) static void
setWrapLine
(JScrollPane pane, boolean f)
-
Field Details
-
DOCUMENT_SETTING_PANE_SPACE_ABOBE_MIN
public static final double DOCUMENT_SETTING_PANE_SPACE_ABOBE_MIN- See Also:
-
DOCUMENT_SETTING_PANE_SPACE_ABOBE_MAX
public static final double DOCUMENT_SETTING_PANE_SPACE_ABOBE_MAX- See Also:
-
DOCUMENT_SETTING_PANE_SPACE_LINE_MIN
public static final double DOCUMENT_SETTING_PANE_SPACE_LINE_MIN- See Also:
-
DOCUMENT_SETTING_PANE_SPACE_LINE_MAX
public static final double DOCUMENT_SETTING_PANE_SPACE_LINE_MAX- See Also:
-
DOCUMENT_SETTING_PANE_FONT_SIZE_MIN
public static final int DOCUMENT_SETTING_PANE_FONT_SIZE_MIN- See Also:
-
DOCUMENT_SETTING_PANE_FONT_SIZE_MAX
public static final int DOCUMENT_SETTING_PANE_FONT_SIZE_MAX- See Also:
-
-
Constructor Details
-
GuiSwingViewDocumentEditor
public GuiSwingViewDocumentEditor()
-
-
Method Details
-
createView
public JComponent createView(GuiMappingContext context, Supplier<GuiReprValue.ObjectSpecifier> parentSpecifier) - Specified by:
createView
in interfaceGuiSwingView
-
isComponentResizable
- Specified by:
isComponentResizable
in interfaceGuiSwingView
-
getTextMenuItems
public static List<PopupCategorized.CategorizedMenuItem> getTextMenuItems(GuiSwingView.ValuePane<?> pane, MenuBuilder.MenuLabel infoLabel) -
setSwingViewValue
public static void setSwingViewValue(JEditorPane pane, GuiSwingView.SpecifierManager specifierManager, GuiMappingContext context, Object newValue, boolean contextUpdate, GuiTaskClock viewClock) -
setSwingViewValueDocument
public static void setSwingViewValueDocument(JEditorPane pane, GuiSwingView.SpecifierManager specifierManager, GuiMappingContext context, Object newValue, Document doc, boolean contextUpdate, GuiTaskClock viewClock) -
getSwingViewValue
- Parameters:
pane
- the pane of the documentcontext
- the context of the view.- Returns:
- always return a
Document
-
getPreferredSizeWithParentScrollWrapLine
an implementation forJComponent.getPreferredSize()
supporting wrapping-line; checks the horizontal policy of parentJScrollPane
byisWrapLine(JScrollPane)
and callsgetPreferredSize(JTextComponent, boolean)
. A text-component can support wrapping-line by overridingJComponent.getPreferredSize()
andJTextComponent.getScrollableTracksViewportWidth()
with this method andgetScrollableTracksViewportWidth(JTextComponent)
.- Parameters:
field
- the target text-component- Returns:
- the preferred-size suitable for the current wrapping-line setting
- Since:
- 1.7
- See Also:
-
getScrollableTracksViewportWidth
an implementation forJTextComponent.getScrollableTracksViewportWidth()
- Parameters:
field
- the target text-component- Returns:
- true if
isWrapLine(JScrollPane)
of the parent of the field - Since:
- 1.7
-
getPreferredSize
-
scrollPane
- Parameters:
c
- the text-component- Returns:
- the parent scroll-pane by calling
scrollPaneContainer(Container)
with the parent - Since:
- 1.7
-
scrollPaneContainer
- Parameters:
c
- the parent container of a text-comonent- Returns:
- an upper scroll-pane
-
isWrapLine
- Parameters:
pane
- a scroll-pane or null- Returns:
- true if null or horizontal-scroll-bar-policy not "always"; i.e. "never" or "as_needed"
-
isWrapLineNotMatch
- Parameters:
pane
- a scroll-pane or nulltested
- the tested wrapping-line property- Returns:
- true if the horizonta-scroll-bar-policy is not the tested value; if true, it should update the wrapping-line property and revalidate the layout.
-
setWrapLine
- Parameters:
pane
- the target panef
- the new property value of wrapping-line- Since:
- 1.7
-