issrg.editor2
Class AbstractTreePolicies

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 issrg.editor2.AbstractTreePolicies
All Implemented Interfaces:
XMLChangeListener, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
MSoDPolicyTabbedEditor, RoleAssignmentPolicy, TargetAccessPolicy

public abstract class AbstractTreePolicies
extends javax.swing.JPanel
implements java.awt.event.ActionListener, XMLChangeListener

Abstract Class for the use of the last two sub policy editors RoleAssignmentPolicy and TargetAccessPolicy. These last two sub policies, have a similar GUI, and functionality.

This class provides the how they work and their main display.

Each sub-policy that extends this class will need to specify their own panels they want to display inside the space allocated in this one.

Author:
Christian Azzopardi
See Also:
TargetAccessPolicy, RoleAssignmentPolicy, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 int count
           
 javax.swing.JSplitPane splitPane
           
 javax.swing.JPanel topPaneltoDisplay
           
 ReadablePERMISXML viewXML
          The Readable XML policy Component
 
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
AbstractTreePolicies(PEComponent that)
           
AbstractTreePolicies(PEComponent that, java.lang.String policyRoot, java.lang.String policyTag)
          Calls getContentPanel() to specify how the main gui interface is for this type of classes.
AbstractTreePolicies(XMLEditor that, java.lang.String policyRoot, java.lang.String policyTag)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ev)
          Handles the events in the case when a button (add/delete) was pressed and calls their respective methods.
 void addPanel()
          Method that will add the relevant sectional XML.
abstract  void deletePanel()
          Abstract method to delete the relevant sectional XML.
abstract  java.lang.String[] getChildNodesToAdd()
          As each sub-policy will be adding different tags, this abstract String array will contain the names of the tags to be added.
 void getContentPanel()
          Creates the main gui for this component, and sets everything together.
 java.lang.Object getRoot()
          This method, will return an object (that can be cast to Element or Node) which is the 'root' element of the sub-policy, that has been passed to the constructor as a String.
 javax.swing.JPanel getTopPanel()
          This constructs the north JPanel that this component will display.
 void initSettings()
           
 boolean isTabName(java.lang.String str)
           
abstract  void refreshPanel(XMLChangeEvent ev)
          Abstract method to refresh the topPanel as each sub-policy will have its own requirements on what to refresh.
 void setCaption(java.lang.String internalName, java.lang.String internationalName)
          Sets the text the component will show.
 void XMLChanged(XMLChangeEvent ev)
          As a registered XMLChangeListener, when an event is received it will call the method refreshPanel() to update the contents of its composing components.
 
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
 

Field Detail

count

public int count

viewXML

public ReadablePERMISXML viewXML
The Readable XML policy Component


splitPane

public javax.swing.JSplitPane splitPane

topPaneltoDisplay

public javax.swing.JPanel topPaneltoDisplay
Constructor Detail

AbstractTreePolicies

public AbstractTreePolicies(PEComponent that,
                            java.lang.String policyRoot,
                            java.lang.String policyTag)
Calls getContentPanel() to specify how the main gui interface is for this type of classes.

Parameters:
that - the XML Editor Reference.
policyRoot - the sub-policy 'Root' Element.
policyTag - the Element that the class will be modifying.

AbstractTreePolicies

public AbstractTreePolicies(XMLEditor that,
                            java.lang.String policyRoot,
                            java.lang.String policyTag)

AbstractTreePolicies

public AbstractTreePolicies(PEComponent that)
Method Detail

initSettings

public void initSettings()

getContentPanel

public void getContentPanel()
Creates the main gui for this component, and sets everything together.

Since it uses a border layout the main XML editing will be as usual in the NORTH section of the panel, whilst to the south the component will display the readable XML policy.

Between the North & South panels is a splitpane so that the user could toggle between the two.


getTopPanel

public javax.swing.JPanel getTopPanel()
This constructs the north JPanel that this component will display.

This idea is that this panel consists of a JTabbedPane, of which each sub-policy that uses this class will have his own. Therefore an empty JPanel (treePanel) is placed for future use.
It will also consist of 2 Buttons that are placed to add or delete the amount of tabs that are displayed.

Returns:
a JPanel with the contents that will be set up on the Top section.

getChildNodesToAdd

public abstract java.lang.String[] getChildNodesToAdd()
As each sub-policy will be adding different tags, this abstract String array will contain the names of the tags to be added.

Returns:
A string array with the tags to add.

setCaption

public void setCaption(java.lang.String internalName,
                       java.lang.String internationalName)
Sets the text the component will show. If component parameter is not found in the list of parameters, the method will call its super method to attempt to find the component there.

Parameters:
internalName - The internal name used in the program.
internationalName - The international name to set the text to.

XMLChanged

public void XMLChanged(XMLChangeEvent ev)
As a registered XMLChangeListener, when an event is received it will call the method refreshPanel() to update the contents of its composing components.

Specified by:
XMLChanged in interface XMLChangeListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ev)
Handles the events in the case when a button (add/delete) was pressed and calls their respective methods.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

addPanel

public void addPanel()
Method that will add the relevant sectional XML. It will not add a Tab to the JTabbedPane.

The reasoning is that when the XMLChangeEvent is detected, the other classes that handle the displaying of the JTabbedPane, will loop through the sections of XML of interest, and will then assume how many tabs to display.


isTabName

public boolean isTabName(java.lang.String str)

deletePanel

public abstract void deletePanel()
Abstract method to delete the relevant sectional XML.


refreshPanel

public abstract void refreshPanel(XMLChangeEvent ev)
Abstract method to refresh the topPanel as each sub-policy will have its own requirements on what to refresh.


getRoot

public java.lang.Object getRoot()
This method, will return an object (that can be cast to Element or Node) which is the 'root' element of the sub-policy, that has been passed to the constructor as a String.

Returns:
an Object with the 'root' node of the policy.