ilog.views.maps.beans
Class IlvJMapScaleControl

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by ilog.views.maps.beans.IlvJMapScaleControl
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class IlvJMapScaleControl
extends JPanel

This class extends a JPanel and contains a JTextField to display and allow editing of the scale of the map.
By default, this text field is displayed using a JLabel border and font. Double clicking on the text field (or clicking on the "set" button) makes it enter edit mode and allows the user to enter the scale.
The scale is displayed using a prefix, a formatted number and a suffix. For example, by default, this bean will display something like 1/100,000 for a US locale. This component is packaged as a Bean and is designed to be used very easily in a JAVA development environment supporting visual programming with Beans.

Since:
JViews 7.5
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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
IlvJMapScaleControl()
          Default constructor.
IlvJMapScaleControl(IlvManagerView view)
          Creates an IlvJMapScaleControl attached to a manager view.
 
Method Summary
 boolean checkScale(double level)
          Checks the level entered by the user.
 String getPrefix()
          Returns the prefix.
 JTextField getScaleField()
          Returns the scale text Field.
 DecimalFormat getScaleFormat()
          Returns the scale format.
 JButton getSetButton()
          Returns the "set" Button.
 String getSuffix()
          Returns the suffix.
 IlvManagerView getView()
          Returns the view.
 boolean isAllowScaleEdition()
          Indicates if double-clicking on the scale for editing is allowed.
 boolean isEditable()
          Indicates whether or not this IlvJMapScaleControl is editable.
 void setAllowScaleEdition(boolean allowScaleEdition)
          Determines whether or not the user is allowed to change the view scale with this bean.
 void setEditable(boolean editable)
          Sets the specified boolean to indicate whether or not this IlvJMapScaleControl should be editable.
 void setPrefix(String prefix)
          Sets the prefix displayed before the actual scale value.
 void setScaleFormat(DecimalFormat scaleFormat)
          Defines the format to display the numerical scale value.
 void setSuffix(String suffix)
          Sets the prefix displayed after the formatted numerical scale value.
 void setView(IlvManagerView view)
          When setting the view, a listener will be added on the transformer of the view.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, 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, 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, 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, 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
 

Constructor Detail

IlvJMapScaleControl

public IlvJMapScaleControl()
Default constructor.


IlvJMapScaleControl

public IlvJMapScaleControl(IlvManagerView view)
Creates an IlvJMapScaleControl attached to a manager view.

Parameters:
view - The manager View that the bean controls.
Method Detail

getView

public IlvManagerView getView()
Returns the view.

Returns:
Returns the view.

getScaleField

public JTextField getScaleField()
Returns the scale text Field.

Returns:
Returns the scale text Field.

getSetButton

public JButton getSetButton()
Returns the "set" Button.

Returns:
Returns the "set" Button.

setView

public void setView(IlvManagerView view)
When setting the view, a listener will be added on the transformer of the view. This listener, when fired, will update the scale value.

Parameters:
view - The manager View that the bean controls.

setEditable

public void setEditable(boolean editable)
Sets the specified boolean to indicate whether or not this IlvJMapScaleControl should be editable.

Parameters:
editable - true to set the control to its editable mode.

isEditable

public boolean isEditable()
Indicates whether or not this IlvJMapScaleControl is editable.

Returns:
the editable flag.
Since:
JViews 8.1

getPrefix

public String getPrefix()
Returns the prefix.

Returns:
Returns the prefix.

setPrefix

public void setPrefix(String prefix)
Sets the prefix displayed before the actual scale value. By default it is "1/".

Parameters:
prefix - The prefix to set or null.

getScaleFormat

public DecimalFormat getScaleFormat()
Returns the scale format.

Returns:
Returns the scale format.

setScaleFormat

public void setScaleFormat(DecimalFormat scaleFormat)
Defines the format to display the numerical scale value. By default, it is a standard DecimalFormat with a 3 digit grouping.

Parameters:
scaleFormat - The scale format to set.

getSuffix

public String getSuffix()
Returns the suffix.

Returns:
Returns the suffix.

setSuffix

public void setSuffix(String suffix)
Sets the prefix displayed after the formatted numerical scale value. By default it is null.

Parameters:
suffix - The suffix to set or null.

checkScale

public boolean checkScale(double level)
Checks the level entered by the user. By returning false, the (user entered) scale change would not be applied to the view. Default implementation always returns true.

Parameters:
level - New scale level to use for the map.
Returns:
true.

isAllowScaleEdition

public boolean isAllowScaleEdition()
Indicates if double-clicking on the scale for editing is allowed.

Returns:
Returns true if double-clicking is allowed.

setAllowScaleEdition

public void setAllowScaleEdition(boolean allowScaleEdition)
Determines whether or not the user is allowed to change the view scale with this bean. Setting allowScaleEdition to false will also set editable to false, and reset the value displayed to the current view scale.

Parameters:
allowScaleEdition - true to allow scale editing.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.