Package org.gvsig.gui.beans.listview
Class ListViewComponent
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.gvsig.gui.beans.listview.ListViewComponent
- All Implemented Interfaces:
ActionListener,FocusListener,KeyListener,MouseListener,MouseMotionListener,ImageObserver,MenuContainer,Serializable,EventListener,AncestorListener
public class ListViewComponent
extends JComponent
implements MouseListener, MouseMotionListener, ActionListener, KeyListener, FocusListener, AncestorListener
Componente grafico para representar una lista de valores
- Version:
- 28/06/2007
- Author:
- BorSanZa - Borja Sánchez Zamorano (borja.sanchez@iver.es)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddItem(int pos, ListViewItem item) Agrega el item en la posicion especificada de la lista.voidaddItem(ListViewItem item) Agrega un item al componentevoidaddItem(ListViewItem item, boolean acceptRepeatNames) Agrega un item al componente, si acceptRepeatNames es false no se aceptaran nombres repetidosvoidaddListSelectionListener(ListViewListener listener) Añadir un listener a la lista de eventosvoidAgrega una vista al componentevoidancestorAdded(AncestorEvent event) Quito los eventos del JScrollPane para gestionarlos yovoidancestorMoved(AncestorEvent event) voidancestorRemoved(AncestorEvent event) voidchangeName(String newName, int pos) voidvoidvoidgetItems()Devuelve un ArrayList con todos los itemsDevuelve el último item seleccionado.intReturns the first selected index; returns -1 if there is no selected item.int[]Returns an array of all of the selected indices in increasing order.Returns the first selected value, ornullif the selection is empty.Returns an array of the values for the selected cells.intgetView()Obtiene que vista se esta usando en el componentebooleanDevuelve si se puede cambiar el nombre de los itemsbooleanvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidremoveItem(int index) Agrega un item al componentevoidremoveListSelectionListener(ListViewListener listener) Borrar un listener de la lista de eventosvoidBorra todos los items seleccionadosvoidrenameItem(int item) voidsetEditable(boolean editable) Define si se puede cambiar el nombre de los itemsvoidsetEnabled(boolean enabled) voidsetMultiSelect(boolean multiSelect) voidsetSelectedIndex(int value) Select the index valuevoidsetView(int view) Define que vista es la que se va a usarvoidsort()Sorts the specified array of objects into ascending orderMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUIMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
ListViewComponent
public ListViewComponent()Construye unListViewComponent
-
-
Method Details
-
getView
public int getView()Obtiene que vista se esta usando en el componente- Returns:
-
setView
public void setView(int view) Define que vista es la que se va a usar- Parameters:
view-
-
addListViewPainter
Agrega una vista al componente- Parameters:
item-
-
sort
public void sort()Sorts the specified array of objects into ascending order -
addItem
Agrega un item al componente- Parameters:
item-
-
addItem
Agrega un item al componente, si acceptRepeatNames es false no se aceptaran nombres repetidos- Parameters:
item-acceptRepeatNames-
-
addItem
Agrega el item en la posicion especificada de la lista.- Parameters:
pos-item-
-
removeItem
public void removeItem(int index) Agrega un item al componente- Parameters:
item-
-
removeSelecteds
public void removeSelecteds()Borra todos los items seleccionados -
getItems
Devuelve un ArrayList con todos los items- Returns:
-
paint
- Overrides:
paintin classJComponent
-
isMultiSelect
public boolean isMultiSelect() -
setMultiSelect
public void setMultiSelect(boolean multiSelect) -
mousePressed
- Specified by:
mousePressedin interfaceMouseListener
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
getSelectedValues
Returns an array of the values for the selected cells. The returned values are sorted in increasing index order.- Returns:
- the selected values or an empty list if nothing is selected
-
getSelectedIndex
public int getSelectedIndex()Returns the first selected index; returns -1 if there is no selected item.- Returns:
- the value of
getMinSelectionIndex
-
setSelectedIndex
public void setSelectedIndex(int value) Select the index value -
getSelectedValue
Returns the first selected value, ornullif the selection is empty.- Returns:
- the first selected value
-
getSelectedIndices
public int[] getSelectedIndices()Returns an array of all of the selected indices in increasing order.- Returns:
- all of the selected indices, in increasing order
-
addListSelectionListener
Añadir un listener a la lista de eventos- Parameters:
listener-
-
removeListSelectionListener
Borrar un listener de la lista de eventos- Parameters:
listener-
-
renameItem
public void renameItem(int item) -
getJRenameEdit
-
changeName
-
closeRenameEdit
public void closeRenameEdit() -
keyPressed
- Specified by:
keyPressedin interfaceKeyListener
-
keyReleased
- Specified by:
keyReleasedin interfaceKeyListener
-
focusLost
- Specified by:
focusLostin interfaceFocusListener
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener
-
isEditable
public boolean isEditable()Devuelve si se puede cambiar el nombre de los items- Returns:
-
setEditable
public void setEditable(boolean editable) Define si se puede cambiar el nombre de los items- Parameters:
editable-
-
ancestorAdded
Quito los eventos del JScrollPane para gestionarlos yo- Specified by:
ancestorAddedin interfaceAncestorListener
-
getLastSelectedItem
Devuelve el último item seleccionado. Solo el que provoco el evento.- Returns:
-
setEnabled
public void setEnabled(boolean enabled) - Overrides:
setEnabledin classJComponent
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-
keyTyped
- Specified by:
keyTypedin interfaceKeyListener
-
focusGained
- Specified by:
focusGainedin interfaceFocusListener
-
ancestorMoved
- Specified by:
ancestorMovedin interfaceAncestorListener
-
ancestorRemoved
- Specified by:
ancestorRemovedin interfaceAncestorListener
-