com.novell.admin.snapins.creator
Class CreatorSnapinPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.novell.admin.snapins.creator.CreatorSnapinPanel
All Implemented Interfaces:
javax.accessibility.Accessible, CreatorSnapin, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, Snapin, com.novell.admin.snapins.creator.VetoingCreator

public abstract class CreatorSnapinPanel
extends javax.swing.JPanel
implements CreatorSnapin, com.novell.admin.snapins.creator.VetoingCreator


Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static java.lang.String TYPE
           
 
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
 
Constructor Summary
CreatorSnapinPanel()
           
 
Method Summary
protected  void cancel()
          Call this whenever you want the ObjectCreator to close.
abstract  boolean canCreate()
          When the OK button is pressed, the Creator will call each snapin to see if it's really ok to create.
protected  void create()
          Call this whenever you want the ObjectCreator to go ahead and try to create the object.
abstract  ObjectAttribute[] getAttributes()
          This is called when it is time for the object to be created.
abstract  void layoutControls()
          This is called when it is time for the snapin to build its UI.
abstract  void onNameSet(java.lang.String name)
          This will get called every time the user updates the name of the object in the Creator's name field.
abstract  void onPostCreate(ObjectEntry oe)
          The snapin gets called via this method as soon as the object is created.
protected  void setOKButtonEnabled(boolean flag)
          Call this whenever the state of the attributes this snapin is editing has become valid or invalid.
 boolean vetoCreation(CreatorInfo info)
          The CreatorEngine will call this method to determine if it is OK to launch the CreatorDlg.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, 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, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final java.lang.String TYPE
Constructor Detail

CreatorSnapinPanel

public CreatorSnapinPanel()
Method Detail

layoutControls

public abstract void layoutControls()
This is called when it is time for the snapin to build its UI. (Do not create the UI in the constructor).

getAttributes

public abstract ObjectAttribute[] getAttributes()
This is called when it is time for the object to be created. This snapin will need to provide an array of correctly constructed ObjectAttributes. If these attributes cannot be properly formed, error codes should be checked and proper messages boxes or error handling should be implemented by the snapin. Make sure that you only return the attributes that the snapin has reservations for. Any others will be ignored.

Following is an example of a layoutControls() implementation where the snapin is trying to handle editing of the "Postal Code" attribute:


     public ObjectAttribute[] getAttributes()
     {
        try
        {
           // Create the attribute
           attribute =
               new NDSObjectAttribute((NDSAttributeDefinition)attrDef);

           ValueComponent vc =
               attrDef.getSyntax().createValueComponent(value);

           attribute.addComponent(vc);
        }
        catch (NamespaceException e)
        {
           new NSPIExceptionMsgBox(shell, e).setVisible(true);
        }
        catch (ComponentCreationException e)
        {
           // Show error message to user
        }

        return new ObjectAttribute[]{attribute};
     }

 
Returns:
Array of ObjectAttributes.

canCreate

public abstract boolean canCreate()
When the OK button is pressed, the Creator will call each snapin to see if it's really ok to create. This will handle the subset of snapins that don't do full attribute validation earlier (ie. an example would be a DN field where the snapin doesn't want to validate each keystroke to see if the DN is valid; it would rather call setOKButtonEnabled() when something has been typed, but not really make sure that the DN is valid until just prior to the create. If it is invalid, this snapin can present a message box and return false, which will prevent the object from going through with creation). This method is called before getAttributes().
Returns:
true = ok to proceed with creation.

onPostCreate

public abstract void onPostCreate(ObjectEntry oe)
The snapin gets called via this method as soon as the object is created. This allows the snapin to do post-creation processes such as further modifying the object or clearing out fields int the snapin if the user clicked the check box to create another object.
Specified by:
onPostCreate in interface CreatorSnapin
Parameters:
oe - ObjectEntry of the created object.

onNameSet

public abstract void onNameSet(java.lang.String name)
This will get called every time the user updates the name of the object in the Creator's name field. Sometime a snapin may be interested in the name of the object because they may want to use it to populate a control or set a value by default.
Parameters:
name - Current name in the creator's name field.

setOKButtonEnabled

protected void setOKButtonEnabled(boolean flag)
Call this whenever the state of the attributes this snapin is editing has become valid or invalid. For example, if your snapin is working on the "Street Address (SA)" attribute, you will want to call this method with a "false" if the characters in the edit field are less than one, because "Street Address" has a minimum length of 1. Conversely, you will want to call this with "true" when the number of characters lies in the 1..128 range. You also may wish to do other checks. If the attribute is alwasy valid (ie. has no bounds and you don't care about the values), then call this initially in layoutControls to tell the ObjectCreator that this attribute can be created. The ObjectCreator will not allow the user to create any object until all snapins have called this with "true" for all of the attributes that they are handling. Remember this flag applies to all of the snapin's attributes. If they are all valid except for one, do not call this with "true" yet; they must all be valid. If anyone becomes valid and the state was valid before, call this with "false". You will notice the OK button in the ObjectCreator become disabled.
Parameters:
allValid - Flag indicating if all attributes in the snapin are valued properly to ensure successful creation.
Returns:
true = All of the attributes are ready to be created because they are valued with proper characters within proper bounds.

create

protected void create()
Call this whenever you want the ObjectCreator to go ahead and try to create the object. This is commonly done if the user hits "VK_ENTER" in a text field that this snapin owns.

cancel

protected void cancel()
Call this whenever you want the ObjectCreator to close. This is commonly done if the user hits "VK_ESCAPE" in a control that this snapin owns.

vetoCreation

public boolean vetoCreation(CreatorInfo info)
The CreatorEngine will call this method to determine if it is OK to launch the CreatorDlg. If there is any reason to prevent creation of an object prior to launching the CreatorDlg, override this method and provide the appropriate logic. The CreatorEngine calls this method for each CreatorSnapin that implements the VetoingCreator interface. The first snapin that returns true will cancel the launching of the CreatorDlg. However, the CreatorEngine will not display any messages when the create is vetoed. It is up to the snapin to display an appropriate message within this method before returning true. As an example, Reporting Services requires that a third-party bean be installed and available before report catalog objects can be created. Rather than allow the user to enter the information into the CreatorDlg, press OK, and THEN be told that he can't create this type of object, Reporting Services displays a message and prevents the CreatorDlg from being launched.
Specified by:
vetoCreation in interface com.novell.admin.snapins.creator.VetoingCreator
Parameters:
info - information pertaining to the create operation
Returns:
false proceed with object creation, launch CreatorDlg true terminate object creation, don't launch CreatorDlg


API Documentation Copyright © 1998-2003 Novell, Inc. All rights reserved.
ConsoleOne is a registered trademark of Novell Inc.
Generated December 9 2003 1727.