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 classstatic classa setting pane for document default stype; a GUI forGuiSwingViewDocumentEditor.PreferencesForDocumentSettingstatic classstatic classprefs obj for document-settings; currently the settings have properties of entire document styling only for editing plain-texts; minimize properties.static classstatic classstatic classstatic classstatic classstatic interfacethe 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 intstatic final intstatic final doublestatic final doublestatic final doublestatic final double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateView(GuiMappingContext context, Supplier<GuiReprValue.ObjectSpecifier> parentSpecifier) static DimensiongetPreferredSize(JTextComponent field, boolean wrapLine) static Dimensionan implementation forJComponent.getPreferredSize()supporting wrapping-line; checks the horizontal policy of parentJScrollPanebyisWrapLine(JScrollPane)and callsgetPreferredSize(JTextComponent, boolean).static booleanan implementation forJTextComponent.getScrollableTracksViewportWidth()static ObjectgetSwingViewValue(JEditorPane pane, GuiMappingContext context) getTextMenuItems(GuiSwingView.ValuePane<?> pane, MenuBuilder.MenuLabel infoLabel) booleanisComponentResizable(GuiMappingContext context) static booleanisWrapLine(JScrollPane pane) static booleanisWrapLineNotMatch(JScrollPane pane, boolean tested) static JScrollPanestatic JScrollPanestatic voidsetSwingViewValue(JEditorPane pane, GuiSwingView.SpecifierManager specifierManager, GuiMappingContext context, Object newValue, boolean contextUpdate, GuiTaskClock viewClock) static voidsetSwingViewValueDocument(JEditorPane pane, GuiSwingView.SpecifierManager specifierManager, GuiMappingContext context, Object newValue, Document doc, boolean contextUpdate, GuiTaskClock viewClock) static voidsetWrapLine(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:
createViewin interfaceGuiSwingView
-
isComponentResizable
- Specified by:
isComponentResizablein 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 parentJScrollPanebyisWrapLine(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
-