Class Component<T,C>
java.lang.Object
de.julianweinelt.datacat.dbx.api.ui.Component<T,C>
- Direct Known Subclasses:
ComponentButton,ComponentCheckbox,ComponentColorPicker,ComponentComboBox,ComponentHorizontalLine,ComponentLabel,ComponentSpinner,ComponentTextField
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract JComponentcreate()Should return the internal Swing object.protected JLabelCreates the label object for displayabstract booleanDefines if the component should be expanded to the window's width size in the component's parent screen.booleanhasLabel()Checks if a label has been set for this componentabstract CinitialValue(Object val) For setting an initial value that should be displayed before any of the user's input.
It should always return the instance of theComponent.Sets the label to be displayed for the component.
Set to an empty String to disable the label.abstract Tvalue()Should return the value of the Component's Swing Object. e.g., if implementing a text field, it should return the entered value of the text field.
-
Constructor Details
-
Component
-
-
Method Details
-
label
Sets the label to be displayed for the component.
Set to an empty String to disable the label.- Parameters:
label- A String with the content of the label- Returns:
- The modified
Componentobject
-
hasLabel
public boolean hasLabel()Checks if a label has been set for this component- Returns:
trueif the components has a non-empty label, otherwisefalse
-
createLabel
Creates the label object for display- Returns:
- A new
JLabelcontaining the text of the component
-
expandHorizontally
public abstract boolean expandHorizontally()Defines if the component should be expanded to the window's width size in the component's parent screen. Example: a horizontal line for splitting content- Returns:
trueif it should be expanded, otherwisefalse
-
initialValue
For setting an initial value that should be displayed before any of the user's input.
It should always return the instance of theComponent. Implementation example:protected JTextField textField; @Override public ComponentTextField initialValue(Object value) { if (value instanceof String) { textField.setText((String) value); } return this; }- Parameters:
val- The value to set.- Returns:
- The
Component's instance.
-
value
Should return the value of the Component's Swing Object. e.g., if implementing a text field, it should return the entered value of the text field.- Returns:
- The entered value of this component.
-
create
Should return the internal Swing object.- Returns:
- An object extending
JComponent
-