PropertyGridControl

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openswing.swing.client
Class PropertyGridControl

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JScrollPane
                      org.openswing.swing.client.PropertyGridControl

All Implemented Interfaces:
  javax.accessibility.Accessible, DataController, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.ScrollPaneConstants, java.io.Serializable

public class PropertyGridControl
extends javax.swing.JScrollPane
implements DataController

Title: OpenSwing Framework

Description: Grid control having two columns: property name and property value, where each row (each property) has its own data type (text, numeric, date, check-box, lookup, etc.), expressed as input control. Hence this control can be used to set a collection of properties. Note that PropertyGridControl is not an input control so it cannot be added to a Form panel.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Field Summary

Fields inherited from class javax.swing.JComponent
`TOOL_TIP_TEXT_KEY, 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 javax.swing.ScrollPaneConstants
`COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`PropertyGridControl()`

Method Summary
`void` | `addProperties(ValueObject valueObject)` Add a set properties to the grid, retrieving them from the specified value object: for each attribute defined in the v.o. will be created a row (a property) in the grid.
`boolean` | `addProperty(java.lang.String propertyDescription, InputControl inputControl, java.lang.Object defaultValue, java.lang.Object userObject)` Add a property to the grid.
`void` | `clearData()` Clear grid content.
`void` | `copy()` copy
`void` | `delete()` delete
`void` | `edit()` edit
`void` | `export()` export
`void` | `filterSort()` filterSort
`int` | `findRow(java.lang.String attributeName)`
`java.lang.String` | `getAttributeName(int rowIndex)`
`java.util.HashSet` | `getBindedButtons()`
`PropertyGridController` | `getController()`
`boolean` | `getCurrentValue(GenericButton button)`
`EditButton` | `getEditButton()`
`java.lang.String` | `getFunctionId()` getFunctionId
`InputControl` | `getInputControl(int rowIndex)`
`InputControl` | `getInputControl(java.lang.String attributeName)`
`InsertButton` | `getInsertButton()`
`int` | `getMode()`
`java.lang.Object` | `getOldPropertyValue(int rowIndex)`
`java.lang.Object` | `getOldPropertyValue(java.lang.String attributeName)`
`void` | `getProperties(ValueObject valueObject)` Set value object content, according to property values: for each attribute defined in the v.o. that matches with a row in the grid, its value will be retrieved from the grid and set into the v.o.
`int` | `getPropertyNameWidth(int width)`
`java.lang.Object` | `getPropertyValue(int rowIndex)`
`java.lang.Object` | `getPropertyValue(java.lang.String attributeName)`
`int` | `getPropertyValueWidth()`
`ReloadButton` | `getReloadButton()`
`SaveButton` | `getSaveButton()`
`java.lang.Object` | `getUserObject(int rowIndex)`
`java.lang.Object` | `getUserObject(java.lang.String attributeName)`
`void` | `importData()` import
`void` | `insert()` insert
`boolean` | `isButtonDisabled(GenericButton button)` isButtonDisabled
`void` | `reload()` reload
`boolean` | `save()` Method called when user clicks on save button.
`void` | `setController(PropertyGridController controller)` Set the controller used to fetch data (property values).
`void` | `setCurrentValue(GenericButton button, boolean currentValue)` Set current enabled value of button.
`void` | `setEditButton(EditButton editButton)` Set edit button linked to grid.
`void` | `setInsertButton(InsertButton insertButton)` Set insert button linked to grid.
`void` | `setMode(int mode)` Set grid mode.
`void` | `setProperties(ValueObject valueObject)` Set property values, based on the specified value object: for each attribute defined in the v.o. that matches with a row in the grid, its value will be retrieved and set in the grid.
`void` | `setPropertyNameWidth(int width)`
`void` | `setPropertyValue(int rowIndex, java.lang.Object value)`
`boolean` | `setPropertyValue(java.lang.String attributeName, java.lang.Object value)`
`void` | `setPropertyValueWidth(int width)`
`void` | `setReloadButton(ReloadButton reloadButton)` Set reload button linked to grid.
`void` | `setSaveButton(SaveButton saveButton)` Set save button linked to grid.
`boolean` | `validateRows()` Execute a validation on changed rows.

Methods inherited from class javax.swing.JScrollPane
`createHorizontalScrollBar, createVerticalScrollBar, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, 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, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, 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, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

Methods inherited from class java.awt.Container
`add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, transferFocusBackward, transferFocusDownCycle, validate`

Methods inherited from class java.awt.Component
`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PropertyGridControl

    public PropertyGridControl()

Method Detail

### setCurrentValue

    public final void setCurrentValue(GenericButton button,
                                      boolean currentValue)

  Set current enabled value of button.

  Specified by:
    `setCurrentValue` in interface `DataController`
  Parameters:
    `button` - generic button that fires this event
    `currentValue` - current enabled value

### getCurrentValue

    public final boolean getCurrentValue(GenericButton button)

  Specified by:
    `getCurrentValue` in interface `DataController`
  Parameters:
    `button` - generic button
  Returns:
    current enabled value for the specified button

### getMode

    public final int getMode()

  Returns:
    current grid mode

### setMode

    public final void setMode(int mode)

  Set grid mode.

  Parameters:
    `mode` - grid mode; possibile values: READONLY, INSERT, EDIT

### clearData

    public final void clearData()

  Clear grid content.

### addProperty

    public final boolean addProperty(java.lang.String propertyDescription,
                                     InputControl inputControl,
                                     java.lang.Object defaultValue,
                                     java.lang.Object userObject)

  Add a property to the grid.

  Parameters:
    `propertyDescription` - description of the property; this is NOT automatically translated: use ClientSettings.getInstance().getResources().getResource() to translate it
    `inputControl` - type of property; this input control must have setted "attributeName" and "required" properties
    `defaultValue` - default value, used when the grid is in INSERT mode
    `userObject` - additional info (optional)
  Returns:
    `false` if the specified attribute name has already been used for another row, `true` otherwise

### findRow

    public final int findRow(java.lang.String attributeName)

  Parameters:
    `attributeName` - attribute name that identify a row
  Returns:
    row index related to the specified attribute name

### setPropertyValue

    public final boolean setPropertyValue(java.lang.String attributeName,
                                          java.lang.Object value)

  Parameters:
    `attributeName` - attribute name that identify the row
    `value` - property value to set
  Returns:
    `false` if the specified attribute name has not been found in the model, `true` otherwise

### setPropertyValue

    public final void setPropertyValue(int rowIndex,
                                       java.lang.Object value)

  Parameters:
    `rowIndex` - row index in the model
    `value` - property value to set

### getPropertyValue

    public final java.lang.Object getPropertyValue(java.lang.String attributeName)

  Parameters:
    `attributeName` - attribute name that identify the row
  Returns:
    property value related to the specified attribute name

### getPropertyValue

    public final java.lang.Object getPropertyValue(int rowIndex)

  Parameters:
    `rowIndex` - row index in the model
  Returns:
    property value related to the specified attribute name

### getOldPropertyValue

    public final java.lang.Object getOldPropertyValue(java.lang.String attributeName)

  Parameters:
    `attributeName` - attribute name that identify the row
  Returns:
    property value related to the specified attribute name

### getOldPropertyValue

    public final java.lang.Object getOldPropertyValue(int rowIndex)

  Parameters:
    `rowIndex` - row index in the model
  Returns:
    property value related to the specified attribute name

### getUserObject

    public final java.lang.Object getUserObject(java.lang.String attributeName)

  Parameters:
    `attributeName` - attribute name that identify the row
  Returns:
    user object related to the specified attribute name

### getUserObject

    public final java.lang.Object getUserObject(int rowIndex)

  Parameters:
    `rowIndex` - row index in the model
  Returns:
    user object related to the specified row index

### getInputControl

    public final InputControl getInputControl(java.lang.String attributeName)

  Parameters:
    `attributeName` - attribute name that identify the row
  Returns:
    input control related to the specified row index

### getInputControl

    public final InputControl getInputControl(int rowIndex)

  Parameters:
    `rowIndex` - row index in the model
  Returns:
    input control related to the specified row index

### addProperties

    public final void addProperties(ValueObject valueObject)

  Add a set properties to the grid, retrieving them from the specified value object: for each attribute defined in the v.o. will be created a row (a property) in the grid. Also attribute values are retrieved from the v.o. and set in the grid as property values. All properties are defined as mandatory.

  Parameters:
    `valueObject` - value object used to create a set of properties, whose description is determined by translating attribute names

### setProperties

    public final void setProperties(ValueObject valueObject)

  Set property values, based on the specified value object: for each attribute defined in the v.o. that matches with a row in the grid, its value will be retrieved and set in the grid.

### getProperties

    public final void getProperties(ValueObject valueObject)

  Set value object content, according to property values: for each attribute defined in the v.o. that matches with a row in the grid, its value will be retrieved from the grid and set into the v.o.

### getAttributeName

    public final java.lang.String getAttributeName(int rowIndex)

  Parameters:
    `rowIndex` - row index
  Returns:
    attribute name, related to the specified row index

### getInsertButton

    public InsertButton getInsertButton()

  Returns:
    insert button linked to grid

### getEditButton

    public EditButton getEditButton()

  Returns:
    edit button linked to grid

### setEditButton

    public void setEditButton(EditButton editButton)

  Set edit button linked to grid.

  Parameters:
    `editButton` - edit button linked to grid

### setInsertButton

    public void setInsertButton(InsertButton insertButton)

  Set insert button linked to grid.

  Parameters:
    `insertButton` - insert button linked to grid

### getReloadButton

    public ReloadButton getReloadButton()

  Returns:
    reload button linked to grid

### setReloadButton

    public void setReloadButton(ReloadButton reloadButton)

  Set reload button linked to grid.

  Parameters:
    `reloadButton` - reload button linked to grid

### getSaveButton

    public SaveButton getSaveButton()

  Returns:
    save button linked to grid.

### setSaveButton

    public void setSaveButton(SaveButton saveButton)

  Set save button linked to grid.

  Parameters:
    `saveButton` - save button linked to grid

### reload

    public void reload()

  reload

  Specified by:
    `reload` in interface `DataController`

### insert

    public void insert()

  insert

  Specified by:
    `insert` in interface `DataController`

### copy

    public void copy()

  copy

  Specified by:
    `copy` in interface `DataController`

### edit

    public void edit()

  edit

  Specified by:
    `edit` in interface `DataController`

### delete

    public void delete()

  delete

  Specified by:
    `delete` in interface `DataController`

### validateRows

    public final boolean validateRows()

  Execute a validation on changed rows.

  Returns:
    `true` if all changed rows are in a valid state, `false` otherwise

### save

    public final boolean save()

  Method called when user clicks on save button.

  Specified by:
    `save` in interface `DataController`
  Returns:
    `true` if saving operation was correctly completed, `false` otherwise

### export

    public void export()

  export

  Specified by:
    `export` in interface `DataController`

### importData

    public void importData()

  import

  Specified by:
    `importData` in interface `DataController`

### getFunctionId

    public java.lang.String getFunctionId()

  getFunctionId

  Specified by:
    `getFunctionId` in interface `DataController`
  Returns:
    String

### isButtonDisabled

    public boolean isButtonDisabled(GenericButton button)

  isButtonDisabled

  Specified by:
    `isButtonDisabled` in interface `DataController`
  Parameters:
    `button` - GenericButton
  Returns:
    boolean

### filterSort

    public void filterSort()

  filterSort

  Specified by:
    `filterSort` in interface `DataController`

### getController

    public final PropertyGridController getController()

  Returns:
    controller used to fetch data (property values)

### setController

    public final void setController(PropertyGridController controller)

  Set the controller used to fetch data (property values).

  Parameters:
    `controller` - controller used to fetch data (property values)

### setPropertyNameWidth

    public final void setPropertyNameWidth(int width)

### setPropertyValueWidth

    public final void setPropertyValueWidth(int width)

### getPropertyNameWidth

    public final int getPropertyNameWidth(int width)

### getPropertyValueWidth

    public final int getPropertyValueWidth()

### getBindedButtons

    public final java.util.HashSet getBindedButtons()

  Specified by:
    `getBindedButtons` in interface `DataController`
  Returns:
    collection of buttons binded to grid (InsertButton, EditButton, etc)

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD