de.cbse.jeasy
Class JEComboBox
java.lang.Object
de.cbse.jeasy.JEObject
de.cbse.jeasy.JEComponent
de.cbse.jeasy.JEComboBox
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.FocusListener, java.awt.event.InputMethodListener, java.awt.event.ItemListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.awt.event.WindowFocusListener, java.awt.event.WindowListener, java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.CaretListener, javax.swing.event.ChangeListener, javax.swing.event.DocumentListener, javax.swing.event.ListSelectionListener, javax.swing.event.MenuKeyListener, javax.swing.event.PopupMenuListener, javax.swing.event.TableModelListener, javax.swing.event.TreeExpansionListener, javax.swing.event.TreeModelListener, javax.swing.event.TreeSelectionListener
- Direct Known Subclasses:
- JEComboList
public class JEComboBox
- extends JEComponent
Implements a JComboBox and a JLabel.
Properties :
- id
The unique id of the root object.
- XMLTag
The xml tag used when serializing or deserializing the component in a JEMessage.
- referenceId
A reference for this jeasy object used to identify this type of jeasy object even if it was cloned. It is used for locale properties of the object and may be used for identification in messages. If no reference is set, the jeasy id will be set as default.
- label
The label of this component.
- selectable
Sets whether or not this component may select a value.
- font (reference to JEFont)
The font for this component.
- labelFont (reference to JEFont)
The font for the label.
- toolTipText
The text to display in a tool tip. The text displays when the cursor lingers over the component.
- buttonBehind (reference to JEButton)
The id of a button behind the field. The button will send the id of the root component in front as an ActionCommand to the callBack.
- border (reference to JEBorder)
The border of this component.
- constraints (reference to JEConstraints)
The contraints for this component used for GridBagLayout Manager.
- labelConstraints (reference to JEConstraints)
The contraints for the label used for GridBagLayout Manager.
- width
The width of the component.
- height
The height of the component.
- background (reference to JEColor)
Id of a color used as the background of the component.
- labelForeground (reference to JEColor)
Id of a color used as the foreground of the components label.
- labelFocusForeground (reference to JEColor)
Id of a color used as the foreground of the components label if it has the focus.
- editable
Sets whether or not this component can be edited.
- visible
Sets whether or not this component is visible.
- enabled
Sets whether or not this component is enabled.
- mandatory
Sets whether or not this component is mandatory. A mandatory component must have a value before serializing.
- entries
A list entries used to select by this component.
- numSelectionCharacters
Number of characters used to search matching entries of the combobox. When typing one of these firsts characters a new selection is made.
- XMLTagValue
The xml tag used when serializing or deserializing the corresponding value of a combobox entry in a JEMessage.
- referenceButtonBehind
A reference for this jeasy object used to identify this type of jeasy object even if it was cloned. It is used for locale properties of the object and may be used for identification in messages. If no reference is set, the jeasy id will be set as default.
- Author:
- Harry Pfohl
| Fields inherited from class de.cbse.jeasy.JEComponent |
animated, backup, buttonBehind, caretPosition, component, endMarkPosition, enterPressed, isPressed, jeButtonBehind, label, labelBehind, labelText, parentId, scrollPane, tree, treeNode, window |
| Fields inherited from class de.cbse.jeasy.JEObject |
aaa, ACTIVITYBAR, ANIMATION, BORDER, BUSINESSOBJECT_NAME, BUTTON, BUTTONGROUP, CHECKBOX, CHECKBOXMENUITEM, COLOR, COMBOBOX, ComboBoxButtonWidth, COMBOLIST, CONSTRAINTS, CONTEXT_HELP_FOCUS_GAINED, CONTEXT_HELP_FOCUS_LOST, CONTEXT_HELP_MOUSE_ENTERED, CONTEXT_HELP_MOUSE_EXITED, DATAFIELD, DATATYPE, DESKTOPPANE, DIALOG, EDITORPANE, FONT, FORMAT, FRAME, GANTTGRID, GLOBAL, GRADIENTPAINT, HELP, ICON, ID_JESTART, INPUT_ERROR_DATE, INPUT_ERROR_LENGTH, INPUT_ERROR_MANDATORY, INPUT_ERROR_PARSE, INPUT_ERROR_RANGE, INPUT_ERROR_REGULAREXPRESSION, INPUT_ERROR_TIME, INPUT_ERRORS, INSETS, INTERNALFRAME, intType, LABEL, LIST, LOCALE, MENU, MENUBAR, MENUITEM, MESSAGE, METHODINVOCATION, NO_CONSTANT, NO_INPUT_ERROR, OPTIONPANE, PANEL, POPUP, PROGRESSBAR, PROPERTIE_NAME, propertyHashMap, RADIOBUTTON, RADIOBUTTONMENUITEM, refresh, SPINNER, SPLITPANE, START, STORE, STRING, TABBEDPANE, TABLE, TASKPANE, TEXTUREPAINT, THEME, TIPS, TOOLBAR, TREE, TREENODE, type, WINDOW |
|
Method Summary |
void |
addItem(JENode node)
Add an item regarding the locale property |
int |
addItem(java.lang.String item)
Add an item to the combobox if it not exist yet. |
void |
addItemAndValue(java.lang.String text,
java.lang.Object value)
Add an item to the combobox and an corresponding value |
void |
clear()
Selection of the first item. |
void |
disableListeners()
|
void |
enableListeners()
|
int |
examine(java.lang.String s)
Checks if an entry is mandatory |
java.lang.Integer |
getIndexByValue(java.lang.Object value)
Gets the index by the value that was added with addItemAndValue |
java.lang.Object |
getItemAt(int n)
Gets the textelement of index n JCombobox |
java.lang.Object |
getItemByValue(java.lang.Object o)
Gets the item that was added with this value by addItemAndValue |
int |
getItemCount()
Gets the number of items in the combobox. |
javax.swing.JComboBox |
getJComboBox()
Gets the number of items in the combobox. |
int |
getSelectedIndex()
|
java.lang.String |
getSelectedItem()
Gets the selected item. |
java.lang.String |
getValue()
Gets the value of the selected item. |
java.lang.Object |
getValueAsObject()
Get the value of the selected item as an object |
java.lang.String |
getValueAt(int n)
Gets the value of index n JCombobox |
protected void |
init()
Initialization of the SWING objects. |
boolean |
isItemAndValue()
|
void |
remove()
Removes all entries |
void |
removeItem(java.lang.String item)
Removes the specified entry. |
void |
restoreEntry()
Selects the item that was backuped before |
void |
setItemAndValue(boolean itemAndValue)
|
void |
setRemoveOnClear(boolean b)
Set to true will remove all items on clear() |
void |
setSelectedIndex(int i)
Select index |
void |
setSelectedItem(java.lang.Object o)
Select item |
void |
setSelectedItemByValue(java.lang.Object o)
Set the selected item to the given vaule added ba addItemAndValue(...) |
void |
setText(java.lang.String text)
Sets the selected item to text |
void |
setupComponent()
Set the property values to the component. |
void |
setValue(java.lang.String item)
Calls addItem and selects the entry. |
void |
setValues(java.util.Vector items)
Calls addItem for all elements of the vector. |
| Methods inherited from class de.cbse.jeasy.JEComponent |
actionPerformed, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, addListeners, backupEntry, caretPositionChanged, caretUpdate, changedUpdate, componentHidden, componentMoved, componentResized, componentShown, examine, focusGained, focusLost, getAddableComponent, getAnimation, getBackupEntry, getButtonBehind, getClosedIcon, getColumns, getComponent, getDataType, getIcon, getJEButtonBehind, getJLabel, getJScrollpane, getLabel, getLabelBehind, getLabelText, getLeafIcon, getMandatory, getName, getOpenIcon, getParentId, getToolTipText, getTreeNode, getValueBeforeFocus, getValueNotNull, getValues, getWindow, inputMethodTextChanged, insertUpdate, isAnimated, isEditable, isExiting, isListening, isShowing, isVerified, isVisible, itemStateChanged, jCallBackInputVerifier, keyPressed, keyReleased, keyTyped, menuKeyPressed, menuKeyReleased, menuKeyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, popupMenuCanceled, popupMenuWillBecomeInvisible, popupMenuWillBecomeVisible, propertyChange, refresh, remove, removeActionListeners, removeUpdate, repaint, restoreValueBeforeFocus, setAnimated, setBackground, setBackground, setEnabled, setEnabled, setExiting, setFocus, setForeground, setForeground, setIcon, setListening, setMandatory, setParentId, setProperties, setToolTipText, setTreeNode, setValueBeforeFocus, setVerified, setVisible, setVisible, stateChanged, tableChanged, textUpdate, timerTask, transferFocus, transferFocusBackward, treeCollapsed, treeExpanded, treeNodesChanged, treeNodesInserted, treeNodesRemoved, treeStructureChanged, valueChanged, valueChanged, wasEntryChanged, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened |
| Methods inherited from class de.cbse.jeasy.JEObject |
clearPreview, clone, getApplLocale, getBorderConstantProperty, getBorderProperty, getCharGProperty, getCharProperty, getColorProperty, getConstraintsProperty, getFontProperty, getGProperty, getGradientPaintProperty, getId, getImageConstantProperty, getImageIconProperty, getInsetsProperty, getJEGlobal, getJETexturePaintProperty, getLayoutProperty, getLocaleProperties, getObjectsHashMap, getObjectsNonPreviewHashMap, getPreviewHashMap, getPreviewObject, getProjectDirectory, getPropertieHashMap, getProperty, getProperty, getPropertyAsArray, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsInteger, getPropertyAsObject, getPropertyAsObject, getPropertyAsVector, getPropertyAsVector, getReferenceButtonBehind, getReferenceId, getRegisterText, getResourceUrl, getRootPane, getRootPaneId, getSwingConstantProperty, getTabbedPaneConstantProperty, getTexturePaintProperty, getType, getUniqueNumber, hasSuperclass, invoke, invoke, invoke, invoke, isApplet, isEnterprise, isGlobalAnimation, isGlobalListening, isInited, isPreview, isPreviewMember, isProfessional, isRefresh, isSetuped, isStandard, registerJEObject, removeProperties, removeProperty, removeProperty, setApplet, setApplLocale, setGlobalAnimation, setGlobalListening, setInited, setJeGlobal, setLocaleProperties, setPreview, setPreviewHashMap, setPreviewMember, setPreviewObject, setProjectDirectory, setPropertieHashMap, setProperties, setProperties, setProperty, setProperty, setRefresh, setRootPane, setRootPaneId, setSetuped, setType, show |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JEComboBox
public JEComboBox(JELocaleProperties hm)
- Reads the properties from a HashMap
- Parameters:
hm - HashMap
JEComboBox
public JEComboBox(JENode jen)
- Constructor based on a XML file parsed to a TreeNode.
- Parameters:
jen - - See Also:
JESaxParser
isItemAndValue
public boolean isItemAndValue()
setItemAndValue
public void setItemAndValue(boolean itemAndValue)
getJComboBox
public javax.swing.JComboBox getJComboBox()
- Gets the number of items in the combobox.
- Returns:
getItemCount
public int getItemCount()
- Gets the number of items in the combobox.
- Returns:
addItem
public int addItem(java.lang.String item)
- Add an item to the combobox if it not exist yet.
- Parameters:
text -
- Returns:
- the index of the item
addItemAndValue
public void addItemAndValue(java.lang.String text,
java.lang.Object value)
- Add an item to the combobox and an corresponding value
- Parameters:
text - the string to be setvalue - the value you can give this entry. Get it by getValue
clear
public void clear()
- Selection of the first item. If removeOnClear all entries will be removed.
examine
public int examine(java.lang.String s)
- Checks if an entry is mandatory
- Overrides:
examine in class JEComponent
- Parameters:
s -
- Returns:
- 0 if an entry is set or mandatory is false else JEObject.INPUT_ERROR_MANDATORY
getIndexByValue
public java.lang.Integer getIndexByValue(java.lang.Object value)
- Gets the index by the value that was added with addItemAndValue
- Returns:
- Integer index or null if no entry for this value
getItemAt
public java.lang.Object getItemAt(int n)
- Gets the textelement of index n JCombobox
- Parameters:
n - index beginning by zero
- Returns:
- String
getItemByValue
public java.lang.Object getItemByValue(java.lang.Object o)
- Gets the item that was added with this value by addItemAndValue
- Returns:
- Object
getValue
public java.lang.String getValue()
- Gets the value of the selected item.
- Overrides:
getValue in class JEComponent
- Returns:
- value of the selected Textelement of the ComboBox or null if nothing is selectd
getValueAsObject
public java.lang.Object getValueAsObject()
- Get the value of the selected item as an object
- Returns:
- value of the selected Textelement as Object
getValueAt
public java.lang.String getValueAt(int n)
- Gets the value of index n JCombobox
- Parameters:
n - index beginning by zero
- Returns:
- Object
remove
public void remove()
- Removes all entries
removeItem
public void removeItem(java.lang.String item)
- Removes the specified entry.
restoreEntry
public void restoreEntry()
- Selects the item that was backuped before
- Overrides:
restoreEntry in class JEComponent
setRemoveOnClear
public void setRemoveOnClear(boolean b)
- Set to true will remove all items on clear()
- Parameters:
boolean -
setSelectedIndex
public void setSelectedIndex(int i)
- Select index
getSelectedIndex
public int getSelectedIndex()
- Returns:
- Select index
getSelectedItem
public java.lang.String getSelectedItem()
- Gets the selected item. Calls getValue().
- Returns:
- Selected item
setSelectedItem
public void setSelectedItem(java.lang.Object o)
- Select item
setSelectedItemByValue
public void setSelectedItemByValue(java.lang.Object o)
- Set the selected item to the given vaule added ba addItemAndValue(...)
setText
public void setText(java.lang.String text)
- Sets the selected item to text
- Overrides:
setText in class JEComponent
- Parameters:
text - the string to be set
setupComponent
public void setupComponent()
- Set the property values to the component.
- Overrides:
setupComponent in class JEComponent
setValue
public void setValue(java.lang.String item)
- Calls addItem and selects the entry.
- Overrides:
setValue in class JEComponent
- Parameters:
item -
setValues
public void setValues(java.util.Vector items)
- Calls addItem for all elements of the vector.
- Overrides:
setValues in class JEComponent
- Parameters:
itemVector -
addItem
public void addItem(JENode node)
- Add an item regarding the locale property
init
protected void init()
- Initialization of the SWING objects.
- Overrides:
init in class JEComponent
disableListeners
public void disableListeners()
enableListeners
public void enableListeners()