Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.scopemvc.application.timewarp.utilities
Class GridSPanel  view GridSPanel download GridSPanel.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.scopemvc.view.swing.SwingView
                      extended byorg.scopemvc.view.swing.SPanel
                          extended byorg.scopemvc.application.timewarp.utilities.GridSPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, org.scopemvc.view.util.ModelBindable, org.scopemvc.core.PropertyView, org.scopemvc.view.swing.Refreshable, java.io.Serializable, org.scopemvc.core.View

public class GridSPanel
extends org.scopemvc.view.swing.SPanel

Class will create a panel based on a SPanel with a Gridbag layout. Add methods are overriden to allow for positioning the components within the panel.

Version:
1.0

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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
private  java.awt.GridBagConstraints c
           
private  java.awt.GridBagLayout gblayout
           
 
Fields inherited from class org.scopemvc.view.swing.SPanel
 
Fields inherited from class org.scopemvc.view.swing.SwingView
CENTRED, MODAL_DIALOG, MODELESS_DIALOG, PRIMARY_WINDOW
 
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.Container
 
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
GridSPanel()
          Constructor for the GridSPanel object
 
Method Summary
 void add(java.awt.Component comp, int gridx, int gridy)
          The basic add method for GridSPanel.
 void add(java.awt.Component comp, int gridx, int gridy, int gridwidth, int gridheight)
          Specify the number of columns (for gridwidth)
or rows (for gridheight) in the component's display area.
 void add(java.awt.Component comp, int gridx, int gridy, int ipadx, int ipady, java.lang.String fill, java.lang.String anchor)
          This method combines the above add method with a anchor argument.
 void add(java.awt.Component comp, int gridx, int gridy, java.lang.String fill)
          Used when the component's display area is larger than the component's requested size
to determine whether and how to resize the component.
 void add(java.awt.Component comp, int gridx, int gridy, java.lang.String fill, java.lang.String anchor)
          Similar to add(Component comp,int gridx, int gridy, int ipadx, int ipady, String fill, String anchor)

except does not implement the ipadx and ipady;
 void initTabOrder()
          Method to initilize the tab order on a GridSPanel.
static void main(java.lang.String[] args)
          Main for test purposes only
 java.awt.Component nextFocusComponent(java.awt.Component comp)
          Method used within initTabOrder().
 void setFill(java.awt.Component comp, java.lang.String fill)
          Method to set the fill constraint.
 void setGridspan(java.awt.Component comp, int gridwidth, int gridheight)
          
Specify the number of columns (for gridwidth) or rows (for gridheight) in the component's
display area.
 void setInsets(java.awt.Component comp, int top, int left, int bottom, int right)
          Specifies the external padding of the component -- the minimum amount of space
between the component and the edges of its display area.
 void setWeight(java.awt.Component comp, double weightx, double weighty)
          11/07/01 Added new setWeight method.
 void setWeight(java.awt.Component comp, java.lang.String weightx, java.lang.String weighty)
          Specifying weights is an art that can have a significant impact on the appearance of the
components a GridSPanel controls.
 
Methods inherited from class org.scopemvc.view.swing.SPanel
getBoundModel, getSelector, getShownModel, getViewValue, refresh, setBoundModel, setSelector, setSelectorString, updateFromProperty, validationFailed, validationSuccess
 
Methods inherited from class org.scopemvc.view.swing.SwingView
getCloseControl, getController, getDisplayMode, getLastShownBounds, getMenuBar, getTitle, getViewBounds, isResizable, issueControl, setController, setLastShownBounds, setViewBounds, toString
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, 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, 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, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, 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, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.scopemvc.core.View
getController, issueControl, setController
 

Field Detail

gblayout

private java.awt.GridBagLayout gblayout

c

private java.awt.GridBagConstraints c
Constructor Detail

GridSPanel

public GridSPanel()
Constructor for the GridSPanel object

Method Detail

main

public static void main(java.lang.String[] args)
Main for test purposes only


setInsets

public void setInsets(java.awt.Component comp,
                      int top,
                      int left,
                      int bottom,
                      int right)
Specifies the external padding of the component -- the minimum amount of space
between the component and the edges of its display area. The value is specified
as an Insets object. By default, each component has no external padding.
Note: becasue of the way GridBagLayout works if you set the left or right Insets on a component then this
will effectively change the Insets for the entire column.
Likewise setting top or bottom Insets will effectively set Insets for the entire row.


setGridspan

public void setGridspan(java.awt.Component comp,
                        int gridwidth,
                        int gridheight)

Specify the number of columns (for gridwidth) or rows (for gridheight) in the component's
display area. These constraints specify the number of cells the component uses, not the
number of pixels it uses. The default value is 1.

Note: GridSPanel doesn't allow components to span multiple rows unless the component is in the
leftmost column or you've specified positive gridx and gridy values for the component.
11/07/01
After testing, is is found that to successfully use the setGridspan(Comp,int,int) method, at least one component after
the the initial component (on which the setGridspan method is run) must have the setGridspan applied to it.

Example: JLabel lab1 = new JLabel(" Label 1 ");
JLabel lab2 = new JLabel("Label 2");
JTextField field = new JTextField(40);

gridSpanel.setGridspan(field,2,1);
gridSpanel.add(field,0,0);


gridSpanel.setGridspan(lab1,1,1);
gridSpanel.add(lab1,0,1);

gridSpanel.add(lab2,1,1);


setWeight

public void setWeight(java.awt.Component comp,
                      java.lang.String weightx,
                      java.lang.String weighty)
Specifying weights is an art that can have a significant impact on the appearance of the
components a GridSPanel controls. Weights are used to determine how to distribute space
among columns (weightx) and among rows (weighty); this is important for specifying resizing behavior. Unless you specify at least one nonzero value for weightx or weighty, all the components clump
together in the center of their container. This is because when the weight is 0.0 (the default),
the GridSPanel puts any extra space between its grid of cells and the edges of the container.
Generally weights are specified with 0.0 and 1.0 as the extremes: the numbers in between are used
as necessary. Larger numbers indicate that the component's row or column should get more space.
For each column, the weight is related to the highest weightx specified for a component within
that column, with each multicolumn component's weight being split somehow between the columns the
component is in. Similarly, each row's weight is related to the highest weighty specified for a
component within that row. Extra space tends to go toward the rightmost column and bottom row.



setWeight

public void setWeight(java.awt.Component comp,
                      double weightx,
                      double weighty)
11/07/01 Added new setWeight method. This method is more like the actual Gridbag weightx/weighty method in that it takes a actual double.
Eventually the setWeight(Component comp, String weightx, String weighty) will be deprecated.
Use this method instead of setWeight(Component comp,String weightx, String weighty)


setFill

public void setFill(java.awt.Component comp,
                    java.lang.String fill)
Method to set the fill constraint. This method must be used in conjunction with an add command.

Signiture is: setFile(Component,String) where Component to set the fill for and String is the fill constant.
String could be any one of the following: HORIZONTAL, VERTICAL, HORI, VERT, BOTH, BOT, NONE, NON, horizontal,
vertical, none, both.

Examples: setFill(label,"HORIZONTAL");
add(label,0,0);

setFill(button,"VERT");
add(button,0,1,"","WEST");

setFill(combo,"vertical");
add(combo,2,2);


add

public void add(java.awt.Component comp,
                int gridx,
                int gridy)
The basic add method for GridSPanel. Overloads the add method which is in JPanel ( which SPanel extends ).


add

public void add(java.awt.Component comp,
                int gridx,
                int gridy,
                int gridwidth,
                int gridheight)
Specify the number of columns (for gridwidth)
or rows (for gridheight) in the component's display area. These constraints specify
the number of cells the component uses, not the number of pixels it uses.


add

public void add(java.awt.Component comp,
                int gridx,
                int gridy,
                java.lang.String fill)
Used when the component's display area is larger than the component's requested size
to determine whether and how to resize the component. Valid values
are "NONE" , "HORIZONTAL" (make the component wide enough to fill its display area horizontally,
but don't change its height), "VERTICAL" (make the component tall enough to fill its display area vertically,
but don't change its width), and BOTH (make the component fill its display area entirely).
A short form of these may be used. For HORIZONTAL, HORI or any combination from HORI to HORIZONTAL may be used.

examples:
add(label,0,0,"HORIZONTAL");
add(label,0,1,"HORI");
add(label,0,2,"HORIZ");
add(label,0,3,"HORIZON");
add(button,1,2,"VERTICAL");
add(button,1,3,"VERT");
add(button,1,4,"BOTH");
add(button,1,5,"BOT");
add(button,1,6,"NONE");
add(button,1,6,""); This is the same as above.


add

public void add(java.awt.Component comp,
                int gridx,
                int gridy,
                int ipadx,
                int ipady,
                java.lang.String fill,
                java.lang.String anchor)
This method combines the above add method with a anchor argument. Used when the component is smaller than its display area to determine where (within the area)
to place the component. Valid values (defined as GridBagConstraints constants) are CENTER (the default),
NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, and NORTHWEST.

It also implemnts ipadx and ipady arguments.
Specifies the internal padding: how much to add to the minimum size of the component.
The default value is zero. The width of the component will be at least its minimum width plus
ipadx*2 pixels, since the padding applies to both sides of the component. Similarly, the height
of the component will be at least its minimum height plus ipady*2 pixels.

examples:
add(label,0,0,10,10,"NONE","NORTH");
add(label,0,1,20,20,"VERTICAL","SOUTH");
add(label,0,2,5,5,"","");
add(label,0,2,5,5,"NONE","CENTER") same as above


add

public void add(java.awt.Component comp,
                int gridx,
                int gridy,
                java.lang.String fill,
                java.lang.String anchor)
Similar to add(Component comp,int gridx, int gridy, int ipadx, int ipady, String fill, String anchor)

except does not implement the ipadx and ipady;


initTabOrder

public void initTabOrder()
Method to initilize the tab order on a GridSPanel. Must be called after all components are added to a GridSPanel
Utilizes the FocusOrder.properties file.


nextFocusComponent

public java.awt.Component nextFocusComponent(java.awt.Component comp)
Method used within initTabOrder(). Returns the next compoent to send the focus to given a valid component which has its properties
properly set in the FocusOrder.properties file.