com.ontimize.util.gis.client.gui.panels.components
Class BasicToolbarButton

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.AbstractButton
                  extended by javax.swing.JToggleButton
                      extended by com.ontimize.util.gis.client.gui.panels.components.BasicToolbarButton
All Implemented Interfaces:
com.ontimize.gui.field.AccessForm, com.ontimize.gui.field.FormComponent, com.ontimize.gui.field.IdentifiedElement, com.ontimize.gui.i18n.Internationalization, com.ontimize.gui.SecureElement, StateChangeListener, IGisClientComponent, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants
Direct Known Subclasses:
ChooseLocationButton

public class BasicToolbarButton
extends javax.swing.JToggleButton
implements com.ontimize.gui.field.AccessForm, IGisClientComponent, com.ontimize.gui.field.FormComponent, com.ontimize.gui.SecureElement, com.ontimize.gui.field.IdentifiedElement, com.ontimize.gui.i18n.Internationalization, StateChangeListener

Gis client component used to add new buttons to the basic gis toolbar.

The xml configuration for this component is equal to the Ontimize form buttons.

Example code to add new buttons to the basic gis toolbar:

<com.ontimize.util.gis.client.gui.panels.BasicToolbar
    attr="windPointsToolbar" edition="no">
    <com.ontimize.util.gis.client.gui.panels.components.BasicToolbarButton
        attr="buttonA" text="SelectArea"
        icon="com/ontimize/gui/images/select.png" />
    <com.ontimize.util.gis.client.gui.panels.components.BasicToolbarButton
        attr="buttonB" text="ApplyFilter"
        icon="com/ontimize/gui/images/filter.png" />
    </com.ontimize.util.gis.client.gui.panels.BasicToolbar>
    <com.ontimize.util.gis.client.gui.panels.components.BasicToolbarButton
      attr="buttonC" text="ShowLegend"
      icon="com/ontimize/util/gis/client/gui/images/legends.png"
      actionClass="com.ontimize.util.gis.client.gui.panels.actions.ShowLegendAction"
      stateChangeListener="com.ontimize.util.gis.client.gui.panels.components.DisableOnEditionListener" />

To get the reference of this buttons from the form interaction manager use the following code:

protected BasicToolbarButton buttonA = null;
  ...
 Object obj = managedForm.getDataFieldReference("buttonA");
 if (obj != null && obj instanceof BasicToolbarButton) {
     buttonA = ((BasicToolbarButton) obj);
 }

See Also:
Button, StateChangeEvent, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JToggleButton
javax.swing.JToggleButton.AccessibleJToggleButton, javax.swing.JToggleButton.ToggleButtonModel
 
Nested classes/interfaces inherited from class javax.swing.AbstractButton
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.lang.String actionClassPath
           
protected  java.lang.Object attribute
           
protected  boolean enabled
          The condition to indicate when field is active.
protected  IGisViewer gisViewer
           
protected  java.lang.String iconPath
           
protected  boolean isEnabled
           
protected  boolean modifiable
           
static java.lang.String PARAM_ACTION_CLASS
           
static java.lang.String PARAM_ATTR
           
static java.lang.String PARAM_ICON
           
static java.lang.String PARAM_STATE_CHANGE_LISTENER
           
static java.lang.String PARAM_TEXT
           
static java.lang.String PARAM_TIP
           
protected  com.ontimize.gui.Form parentForm
          The reference to parent form.
protected  com.ontimize.security.FormPermission permissionActivate
          The reference to activate permission.
protected  com.ontimize.security.FormPermission permissionVisible
          The reference to visible permission in form.
protected  boolean required
           
protected  boolean restricted
          The restricted condition.
protected  StateChangeListener stateListener
           
protected  java.lang.String stateListenerClass
           
protected  java.lang.String tipText
           
protected  java.lang.String titleText
           
protected  java.lang.Object value
           
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
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 com.ontimize.gui.field.FormComponent
DEBUG
 
Fields inherited from interface com.ontimize.gui.i18n.Internationalization
DEBUG_LANGUAGE
 
Fields inherited from interface com.ontimize.gui.SecureElement
DESACTIVATE_COMPONENT_BY_PERMISSION_TIP
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BasicToolbarButton()
           
BasicToolbarButton(java.util.Hashtable<java.lang.String,java.lang.Object> parameters)
           
BasicToolbarButton(java.lang.String title)
           
 
Method Summary
protected  boolean checkEnabledPermission()
          Check enabled permission.
protected  boolean checkVisiblePermission()
          Return the visible permission condition.
 void enableButton(boolean b)
           
 java.lang.Object getAttribute()
           
 java.awt.Rectangle getComponentLimits()
          Get the component drawing limits, since the component it's not painted on all the extension of the panel.
 java.lang.Object getConstraints(java.awt.LayoutManager layoutManager)
           
 IGisViewer getGisViewer()
           
 java.util.Vector getTextsToTranslate()
           
 void init(java.util.Hashtable params)
           
 void initPermissions()
           
 boolean isRestricted()
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void setAttribute(java.lang.Object attribute)
           
 void setComponentLocale(java.util.Locale locale)
           
 void setEnabled(boolean enabled)
           
 void setGisViewer(IGisViewer gisViewer)
          Set the gis viewer instance for the actual component
 void setParentForm(com.ontimize.gui.Form form)
           
 void setResourceBundle(java.util.ResourceBundle bundle)
           
 void setStateChangeListener(StateChangeListener stateListener)
           
 void setVisible(boolean visible)
          Sets the component visible
 void stateChanged(StateChangeEvent event)
          Invoked when the gis viewer state changes
 void updateUI()
           
 
Methods inherited from class javax.swing.JToggleButton
getAccessibleContext, getUIClassID, paramString
 
Methods inherited from class javax.swing.AbstractButton
actionPropertyChanged, addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, configurePropertiesFromAction, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, removeNotify, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
Methods 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, 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
 
Methods inherited from interface com.ontimize.gui.field.FormComponent
isEnabled
 

Field Detail

PARAM_ATTR

public static final java.lang.String PARAM_ATTR
See Also:
Constant Field Values

PARAM_TEXT

public static final java.lang.String PARAM_TEXT
See Also:
Constant Field Values

PARAM_ICON

public static final java.lang.String PARAM_ICON
See Also:
Constant Field Values

PARAM_TIP

public static final java.lang.String PARAM_TIP
See Also:
Constant Field Values

PARAM_ACTION_CLASS

public static final java.lang.String PARAM_ACTION_CLASS
See Also:
Constant Field Values

PARAM_STATE_CHANGE_LISTENER

public static final java.lang.String PARAM_STATE_CHANGE_LISTENER
See Also:
Constant Field Values

gisViewer

protected IGisViewer gisViewer

stateListener

protected StateChangeListener stateListener

attribute

protected java.lang.Object attribute

titleText

protected java.lang.String titleText

iconPath

protected java.lang.String iconPath

actionClassPath

protected java.lang.String actionClassPath

stateListenerClass

protected java.lang.String stateListenerClass

tipText

protected java.lang.String tipText

required

protected boolean required

modifiable

protected boolean modifiable

value

protected java.lang.Object value

permissionVisible

protected com.ontimize.security.FormPermission permissionVisible
The reference to visible permission in form. By default, null.


permissionActivate

protected com.ontimize.security.FormPermission permissionActivate
The reference to activate permission. By default, null.


parentForm

protected com.ontimize.gui.Form parentForm
The reference to parent form. By default, null.


restricted

protected boolean restricted
The restricted condition. By default, false.


enabled

protected boolean enabled
The condition to indicate when field is active. By default, true.


isEnabled

protected boolean isEnabled
Constructor Detail

BasicToolbarButton

public BasicToolbarButton()

BasicToolbarButton

public BasicToolbarButton(java.util.Hashtable<java.lang.String,java.lang.Object> parameters)
                   throws java.lang.Exception
Throws:
java.lang.Exception

BasicToolbarButton

public BasicToolbarButton(java.lang.String title)
Method Detail

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)

updateUI

public void updateUI()
Overrides:
updateUI in class javax.swing.JToggleButton

stateChanged

public void stateChanged(StateChangeEvent event)
Description copied from interface: StateChangeListener
Invoked when the gis viewer state changes

Specified by:
stateChanged in interface StateChangeListener
Parameters:
event - Gis viewer state change event containing the actual and the previous gis viewer states

setGisViewer

public void setGisViewer(IGisViewer gisViewer)
Description copied from interface: IGisClientComponent
Set the gis viewer instance for the actual component

Specified by:
setGisViewer in interface IGisClientComponent
Parameters:
gisViewer - Gis viewer instanceof

getGisViewer

public IGisViewer getGisViewer()

getConstraints

public java.lang.Object getConstraints(java.awt.LayoutManager layoutManager)
Specified by:
getConstraints in interface com.ontimize.gui.field.FormComponent

getTextsToTranslate

public java.util.Vector getTextsToTranslate()
Specified by:
getTextsToTranslate in interface com.ontimize.gui.i18n.Internationalization

setComponentLocale

public void setComponentLocale(java.util.Locale locale)
Specified by:
setComponentLocale in interface com.ontimize.gui.i18n.Internationalization

setResourceBundle

public void setResourceBundle(java.util.ResourceBundle bundle)
Specified by:
setResourceBundle in interface com.ontimize.gui.i18n.Internationalization

init

public void init(java.util.Hashtable params)
          throws java.lang.Exception
Specified by:
init in interface com.ontimize.gui.field.FormComponent
Throws:
java.lang.Exception

setAttribute

public void setAttribute(java.lang.Object attribute)

getAttribute

public java.lang.Object getAttribute()
Specified by:
getAttribute in interface com.ontimize.gui.field.IdentifiedElement

initPermissions

public void initPermissions()
Specified by:
initPermissions in interface com.ontimize.gui.SecureElement

checkVisiblePermission

protected boolean checkVisiblePermission()
Return the visible permission condition.

Returns:
the visible condition

checkEnabledPermission

protected boolean checkEnabledPermission()
Check enabled permission.

Returns:
the enabled permission

isRestricted

public boolean isRestricted()
Specified by:
isRestricted in interface com.ontimize.gui.SecureElement

enableButton

public void enableButton(boolean b)

setStateChangeListener

public void setStateChangeListener(StateChangeListener stateListener)

setVisible

public void setVisible(boolean visible)
Description copied from interface: IGisClientComponent
Sets the component visible

Specified by:
setVisible in interface com.ontimize.gui.field.FormComponent
Specified by:
setVisible in interface IGisClientComponent
Overrides:
setVisible in class javax.swing.JComponent

setEnabled

public void setEnabled(boolean enabled)
Specified by:
setEnabled in interface com.ontimize.gui.field.FormComponent
Overrides:
setEnabled in class javax.swing.AbstractButton

getComponentLimits

public java.awt.Rectangle getComponentLimits()
Description copied from interface: IGisClientComponent
Get the component drawing limits, since the component it's not painted on all the extension of the panel. This method is used principally in events management

Specified by:
getComponentLimits in interface IGisClientComponent
Returns:
component painting area

setParentForm

public void setParentForm(com.ontimize.gui.Form form)
Specified by:
setParentForm in interface com.ontimize.gui.field.AccessForm