pt.moredata.widgets
Class ComboBox

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JComboBox
                  extended bypt.moredata.widgets.ComboBox
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.ItemSelectable, javax.swing.event.ListDataListener, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
CellComboBox, ComboBoxFieldObject

public class ComboBox
extends javax.swing.JComboBox

Combo-Box bounded a uma tabela da base de dados

Genéricamen6nem o funcionamento de uma LOV, so que os dados são apresentadados na globalidade

Aceita tabelas da conexão enviada como parametro ou leitura de um ficheiro XML cujo nome e estrutura deve ser igual a BD

Author:
aricardo
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComboBox
javax.swing.JComboBox.AccessibleJComboBox, javax.swing.JComboBox.KeySelectionManager
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.awt.Color disabledColor
          Description of the Field
protected  int popupWidth
          Description of the Field
 
Fields inherited from class javax.swing.JComboBox
actionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, selectedItemReminder
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ComboBox()
          Construtora vazia usada nos IDE(s)
 
Method Summary
 void addComboElement(java.lang.Object code, java.lang.Object description)
          Adiciona um elemento a combo e a comboBox ???
 void addComboItems()
          Preenche as linhas da combo Box com os dados que tem de estar num dataControl da pool
 void addDataControlFilterListener(DAOFilterListener l)
          Adiciona listener para evento ComboFilter Este tipo de evento serve para filtrar os listeners que nao se pretende que aparecam
 void addDropDownComboListener(DropDownComboListener l)
          Adiciona listener para evento drop down (evento especifico da combo)
 void addItemSelectedListener(ItemSelectedListener l)
          Adiciona listener para evento ItemSelected
 void fillCurrentFromDataControl(DataAccessObject dao)
          Preenche o elemento corrente na combo Box tendo como origem o data control enviado como parametro ????
protected  void fireDropDownComboListeners()
          Notifica quem estiver a ouvir da ocorrencia de modificacoes
protected  void fireItemSelectedListeners()
          Notifica quem estiver a ouvir da ocorrencia de modificacoes
 java.lang.String getAditionalColumn(int index)
          Gets the aditionalColumn attribute of the DataComboBox object
 java.lang.String getCodeColumn()
          Gets the codeColumn attribute of the DataComboBox object
 int getCurrentItem()
          Devolve o indice do elemento corrente acedendo por chave primaria
 DataAccessObject getDataControl()
          Devolve o data control relativo a combo box, o que permite que se efectuem, buscas a estes dados por primary key ou nao
 int getDCSelectedIndex()
          Devolve o indice do item seleccionado no Data Control.
 java.lang.String getDescriptionColumn()
          Gets the descriptionColumn attribute of the DataComboBox object
 java.lang.Object getObject()
          Devolve a chave primaria do elemento da combo seleccionado ???
 java.awt.Dimension getPopupSize()
          Devolve o tamanho a utilizar na janela de popup
 boolean getRequired()
          Gets the required attribute of the DataComboBox object
 java.lang.Object getSelectedDescription()
          Devolve os dados relativos a coluna de descricao Assume que a coluna de descricao eh a segunda no recordSet o que nao esta la muito correcto
 boolean getShowCode()
          Gets the showCode attribute of the DataComboBox object
 java.lang.String getTable()
          Gets the table attribute of the DataComboBox object
 java.lang.String getWhere()
          Gets the where attribute of the DataComboBox object
 void populateCombo()
          Preenche a comboBox com os dados do data control que existe ou vai ser construido na pool
 void removeAllItems()
          Remove todos os dados que estao na combo e o vector de chaves primarias e acaba com a chave primaria corrente que se calhar ate deveria vir do data control e nao ser mantido na combobox
 void removeDataControlFilterListener()
          Remove listener das modificacoes ao painel corrente
 void removeDropDownComboListener(DropDownComboListener l)
          Remove listener das modificacoes ao painel corrente
 void removeItemSelectedListener(ItemSelectedListener l)
          Remove listener das modificacoes ao painel corrente
 void setAditionalColumn(int index, java.lang.String _column)
          Sets the aditionalColumn attribute of the DataComboBox object
 void setAditionalColumn(java.lang.String[] _columns)
          Sets the aditionalColumn attribute of the DataComboBox object
 void setCodeColumn(java.lang.String _codeColumn)
          Sets the codeColumn attribute of the DataComboBox object
 void setDataLoaded(boolean _dataLoaded)
          Afecta a flag que indica se os dados estão ou não carregados
 void setDataSource(DataSource _dataSource)
           
 void setDescriptionColumn(java.lang.String _descriptionColumn)
          Sets the descriptionColumn attribute of the DataComboBox object
 void setEnabled(boolean _enabled)
          Sets the enabled attribute of the DataComboBox object
 void setObject(java.lang.Object obj)
          Preenche a chave primaria com o registo que deve estar seleccionado
 void setPopupWidth(int width)
          Afecta a largura da janela de popup com determinado tamanho
 void setRequired(boolean _required)
          Sets the required attribute of the DataComboBox object
 void setShowCode(boolean _showCode)
          Sets the showCode attribute of the DataComboBox object
 void setTable(java.lang.String _table)
          Sets the table attribute of the DataComboBox object
 void setWhere(java.lang.String _where)
          Sets the where attribute of the DataComboBox object
 
Methods inherited from class javax.swing.JComboBox
actionPerformed, addActionListener, addItem, addItemListener, addPopupMenuListener, configureEditor, configurePropertiesFromAction, contentsChanged, createActionPropertyChangeListener, createDefaultKeySelectionManager, fireActionEvent, fireItemStateChanged, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getAction, getActionCommand, getActionListeners, getEditor, getItemAt, getItemCount, getItemListeners, getKeySelectionManager, getMaximumRowCount, getModel, getPopupMenuListeners, getPrototypeDisplayValue, getRenderer, getSelectedIndex, getSelectedItem, getSelectedObjects, getUI, getUIClassID, hidePopup, insertItemAt, installAncestorListener, intervalAdded, intervalRemoved, isEditable, isLightWeightPopupEnabled, isPopupVisible, paramString, processKeyEvent, removeActionListener, removeItem, removeItemAt, removeItemListener, removePopupMenuListener, selectedItemChanged, selectWithKeyChar, setAction, setActionCommand, setEditable, setEditor, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setModel, setPopupVisible, setPrototypeDisplayValue, setRenderer, setSelectedIndex, setSelectedItem, setUI, showPopup, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

disabledColor

public static final java.awt.Color disabledColor
Description of the Field


popupWidth

protected int popupWidth
Description of the Field

Constructor Detail

ComboBox

public ComboBox()
Construtora vazia usada nos IDE(s)

Method Detail

getRequired

public boolean getRequired()
Gets the required attribute of the DataComboBox object

Returns:
The required value

setRequired

public void setRequired(boolean _required)
Sets the required attribute of the DataComboBox object

Parameters:
_required - The new required value

setTable

public void setTable(java.lang.String _table)
Sets the table attribute of the DataComboBox object

Parameters:
_table - The new table value

getTable

public java.lang.String getTable()
Gets the table attribute of the DataComboBox object

Returns:
The table value

setWhere

public void setWhere(java.lang.String _where)
Sets the where attribute of the DataComboBox object

Parameters:
_where - The new where value

getWhere

public java.lang.String getWhere()
Gets the where attribute of the DataComboBox object

Returns:
The where value

setShowCode

public void setShowCode(boolean _showCode)
Sets the showCode attribute of the DataComboBox object

Parameters:
_showCode - The new showCode value

getShowCode

public boolean getShowCode()
Gets the showCode attribute of the DataComboBox object

Returns:
The showCode value

setCodeColumn

public void setCodeColumn(java.lang.String _codeColumn)
Sets the codeColumn attribute of the DataComboBox object

Parameters:
_codeColumn - The new codeColumn value

getCodeColumn

public java.lang.String getCodeColumn()
Gets the codeColumn attribute of the DataComboBox object

Returns:
The codeColumn value

setEnabled

public void setEnabled(boolean _enabled)
Sets the enabled attribute of the DataComboBox object

Parameters:
_enabled - The new enabled value

setDescriptionColumn

public void setDescriptionColumn(java.lang.String _descriptionColumn)
Sets the descriptionColumn attribute of the DataComboBox object

Parameters:
_descriptionColumn - The new descriptionColumn value

getDescriptionColumn

public java.lang.String getDescriptionColumn()
Gets the descriptionColumn attribute of the DataComboBox object

Returns:
The descriptionColumn value

setPopupWidth

public void setPopupWidth(int width)
Afecta a largura da janela de popup com determinado tamanho

Parameters:
width - The new popupWidth value

getPopupSize

public java.awt.Dimension getPopupSize()
Devolve o tamanho a utilizar na janela de popup

Returns:
The popupSize value

setDataLoaded

public void setDataLoaded(boolean _dataLoaded)
Afecta a flag que indica se os dados estão ou não carregados

Parameters:
_dataLoaded - The new dataLoaded value

setDataSource

public void setDataSource(DataSource _dataSource)

setObject

public void setObject(java.lang.Object obj)
Preenche a chave primaria com o registo que deve estar seleccionado

Parameters:
obj - The new object value

getObject

public java.lang.Object getObject()
Devolve a chave primaria do elemento da combo seleccionado ??? Isto tem de ser usado com o vector que garante o sincronismo entre ??? elemento da combo e o data control

Returns:
The object value

getSelectedDescription

public java.lang.Object getSelectedDescription()
Devolve os dados relativos a coluna de descricao Assume que a coluna de descricao eh a segunda no recordSet o que nao esta la muito correcto

Returns:
The selectedDescription value

removeAllItems

public void removeAllItems()
Remove todos os dados que estao na combo e o vector de chaves primarias e acaba com a chave primaria corrente que se calhar ate deveria vir do data control e nao ser mantido na combobox


populateCombo

public void populateCombo()
Preenche a comboBox com os dados do data control que existe ou vai ser construido na pool


getDataControl

public DataAccessObject getDataControl()
Devolve o data control relativo a combo box, o que permite que se efectuem, buscas a estes dados por primary key ou nao


addComboItems

public void addComboItems()
Preenche as linhas da combo Box com os dados que tem de estar num dataControl da pool


fillCurrentFromDataControl

public void fillCurrentFromDataControl(DataAccessObject dao)
Preenche o elemento corrente na combo Box tendo como origem o data control enviado como parametro ???? Isto pode nao ser necessario

Parameters:
dao - Description of the Parameter

getCurrentItem

public int getCurrentItem()
Devolve o indice do elemento corrente acedendo por chave primaria

Returns:
The currentItem value

getDCSelectedIndex

public int getDCSelectedIndex()
Devolve o indice do item seleccionado no Data Control. Se a combo aceitar valores nulos faz um ajustamento para sincronizacao com o data control ????? Isto eh para desaparecer

Returns:
The dCSelectedIndex value

addComboElement

public void addComboElement(java.lang.Object code,
                            java.lang.Object description)
Adiciona um elemento a combo e a comboBox ??? Nao esta ainda muito generica pois nao suporta chaves compostas ??? e assume que a coluna descritiva eh a segunda do datacontrol

Parameters:
code - The feature to be added to the ComboElement attribute
description - The feature to be added to the ComboElement attribute

addDropDownComboListener

public void addDropDownComboListener(DropDownComboListener l)
Adiciona listener para evento drop down (evento especifico da combo)

Parameters:
l - The feature to be added to the DropDownComboListener attribute

removeDropDownComboListener

public void removeDropDownComboListener(DropDownComboListener l)
Remove listener das modificacoes ao painel corrente

Parameters:
l - Description of the Parameter

fireDropDownComboListeners

protected void fireDropDownComboListeners()
Notifica quem estiver a ouvir da ocorrencia de modificacoes


addItemSelectedListener

public void addItemSelectedListener(ItemSelectedListener l)
Adiciona listener para evento ItemSelected

Parameters:
l - The feature to be added to the ItemSelectedListener attribute

removeItemSelectedListener

public void removeItemSelectedListener(ItemSelectedListener l)
Remove listener das modificacoes ao painel corrente

Parameters:
l - Description of the Parameter

fireItemSelectedListeners

protected void fireItemSelectedListeners()
Notifica quem estiver a ouvir da ocorrencia de modificacoes


addDataControlFilterListener

public void addDataControlFilterListener(DAOFilterListener l)
Adiciona listener para evento ComboFilter Este tipo de evento serve para filtrar os listeners que nao se pretende que aparecam

Parameters:
l - The feature to be added to the DataControlFilterListener attribute

removeDataControlFilterListener

public void removeDataControlFilterListener()
Remove listener das modificacoes ao painel corrente


setAditionalColumn

public void setAditionalColumn(int index,
                               java.lang.String _column)
Sets the aditionalColumn attribute of the DataComboBox object

Parameters:
index - The new aditionalColumn value
_column - The new aditionalColumn value

setAditionalColumn

public void setAditionalColumn(java.lang.String[] _columns)
Sets the aditionalColumn attribute of the DataComboBox object

Parameters:
_columns - The new aditionalColumn value

getAditionalColumn

public java.lang.String getAditionalColumn(int index)
Gets the aditionalColumn attribute of the DataComboBox object

Parameters:
index - Description of the Parameter
Returns:
The aditionalColumn value