issrg.policywizard
Class WSDLItemList

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.utils.gui.xml.AddDelList
                      extended by issrg.policywizard.WSDLItemList
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ListSelectionListener

public class WSDLItemList
extends AddDelList

Class that displays a list and an add and delete button to add/delete to and from the list.

The list will be used to list wsdl files.

The Add button will always be enabled and clicking on the Add Button will open up a file chooser dialog.

The Delete button will be enabled when something is present and selected in the list. Clicking on the delete button when it is enabled, will remove the item from the list.

Author:
Christian Azzopardi
See Also:
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
 
Fields inherited from class issrg.utils.gui.xml.AddDelList
addButton, addDisplay, constraints, deleteButton, deleteDisplay, items, listBox, listBoxDisplay, listData, popupMenu, replaceButton, replaceDisplay, scrollList, sizeOfPopupMenu, viewDisplay
 
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
WSDLItemList(XMLEditor xmlED)
          Creates a new instance of WSDLItemList.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
           
 boolean addFromWSDL(java.lang.String fname)
          Checks if the wsdl file path passed contains a valid Target Element and Location.
 void addItem()
          Performed when the user clicks on the Add Button.
 org.w3c.dom.Element addParameters(org.w3c.dom.Document dom, org.w3c.dom.Element actionElement, org.w3c.dom.Element input)
          Retrieves the parameters that are either stored directly in message nodes, or defined elsewhere in the WSDL, but pointed from message nodes.
 void addToActionPolicy(org.w3c.dom.Document dom)
          Extracts the Actions from the input WSDL and adds them to the policy.
 void addToTargetPolicy(org.w3c.dom.Document dom)
          Extracts the target from the input WSDL and adds it to the policy.
 void deleteItem()
          Deletes the Selected .wsdl file from the list.
 void fireActionPerformedEvent(java.awt.event.ActionEvent ev)
          Fires to any registered actionListeners to receive ActionEvents.
 java.util.Vector<org.w3c.dom.Element> getActions(org.w3c.dom.Document dom)
          Obtains the Action Elements from the WSDL, and returns them listed in a Vector.
 java.io.File getCurrentDirectory()
          Gets the Current Directory variable
 java.util.Hashtable getParameters(org.w3c.dom.Document dom, java.lang.String action)
           
 org.w3c.dom.Element getTarget(org.w3c.dom.Document dom)
          Gets the target Element from a WSDL File.
 org.w3c.dom.Element getTargetAddress(org.w3c.dom.Document dom)
          Gets the Target Address Element.
 boolean isInList(java.lang.String value)
          Checks if a WSDL file has been previously added to the list or not.
 void itemSelected()
          An abstract method that is called when an item is Selected from a list.
 org.w3c.dom.Document loadDocument(java.lang.String pathName)
          Loads the WSDL file in a Document variable.
 void removeActionListener(java.awt.event.ActionListener listener)
           
 java.lang.String removeColon(java.lang.String str)
          Removes the colon from the string, by returning a string with the stuff present after the colon.
 void removeFromActionPolicy(org.w3c.dom.Document dom)
          The instructions to remove Actions added by a specific wsdl.
 void removeFromTargetPolicy(org.w3c.dom.Document dom)
          The instructions to remove a target added by a specific wsdl.
 void removeFromWSDL(java.lang.String fname)
          Removes the contents of the WSDL located at path fname.
 void replaceItem()
          An abstract method that is called when an item is to be replaced from a list.
 void setCurrentDirectory(java.io.File f)
          Sets the Current Directory variable
 
Methods inherited from class issrg.utils.gui.xml.AddDelList
actionPerformed, addComponent, convertYToRow, getContentPanel, getListData, getSelectedIndex, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, removeAddButton, removeDeleteButton, removeListBox, removeReplaceButton, setCaption, setListData, setSelectedIndex, valueChanged
 
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

WSDLItemList

public WSDLItemList(XMLEditor xmlED)
Creates a new instance of WSDLItemList.

Since this extends AddDelList, the appropriate captions are included for the buttons and the replace button is removed.

Method Detail

isInList

public boolean isInList(java.lang.String value)
Checks if a WSDL file has been previously added to the list or not.

Parameters:
value - the path of the WSDL file to check if added already.
Returns:
true - if the passed value is added already. false - if the passed value is not added already.

setCurrentDirectory

public void setCurrentDirectory(java.io.File f)
Sets the Current Directory variable

Parameters:
f - the file holding the current directory.

getCurrentDirectory

public java.io.File getCurrentDirectory()
Gets the Current Directory variable

Returns:
the file holding the current directory.

addItem

public void addItem()
Performed when the user clicks on the Add Button.

This opens a FileChooser Dialog, and if the file has not been already added adds it to the list.

Specified by:
addItem in class AddDelList

deleteItem

public void deleteItem()
Deletes the Selected .wsdl file from the list.

Specified by:
deleteItem in class AddDelList

itemSelected

public void itemSelected()
Description copied from class: AddDelList
An abstract method that is called when an item is Selected from a list.

Specified by:
itemSelected in class AddDelList

replaceItem

public void replaceItem()
Description copied from class: AddDelList
An abstract method that is called when an item is to be replaced from a list.

Specified by:
replaceItem in class AddDelList

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)

fireActionPerformedEvent

public void fireActionPerformedEvent(java.awt.event.ActionEvent ev)
Fires to any registered actionListeners to receive ActionEvents.

Used to notify the listener, that something in the list has been modified (added/deleted).


removeColon

public java.lang.String removeColon(java.lang.String str)
Removes the colon from the string, by returning a string with the stuff present after the colon.

Parameters:
str - A string that needs to be trimmed.
Returns:
the String Value after the first appearance of ":"

loadDocument

public org.w3c.dom.Document loadDocument(java.lang.String pathName)
Loads the WSDL file in a Document variable.

IMPORTANT NOTE: the DocumentBuilderFactory must be set NameSpaceAware to obtain data well from the WSDL, since WSDL uses alot of NameSpaces & prefixes...

Parameters:
pathName - The path of the WSDL File to load.
Returns:
A org.w3c.dom.document containing the loaded WSDL.

getTarget

public org.w3c.dom.Element getTarget(org.w3c.dom.Document dom)
Gets the target Element from a WSDL File.

Parameters:
dom - the Document holding the WSDL in memory.
Returns:
the Target Element in the WSDL File.

getTargetAddress

public org.w3c.dom.Element getTargetAddress(org.w3c.dom.Document dom)
Gets the Target Address Element.

Parameters:
dom - the Document holding the WSDL in memory.
Returns:
the Element where the Target Address can be found.

getActions

public java.util.Vector<org.w3c.dom.Element> getActions(org.w3c.dom.Document dom)
Obtains the Action Elements from the WSDL, and returns them listed in a Vector.

Parameters:
dom - the Document holding the WSDL in memory.
Returns:
a list of Actions in vector Format.

getParameters

public java.util.Hashtable getParameters(org.w3c.dom.Document dom,
                                         java.lang.String action)

removeFromWSDL

public void removeFromWSDL(java.lang.String fname)
Removes the contents of the WSDL located at path fname.

Parameters:
fname - the path of the WSDL to remove the data added by it.

removeFromTargetPolicy

public void removeFromTargetPolicy(org.w3c.dom.Document dom)
The instructions to remove a target added by a specific wsdl.

Parameters:
dom - The WSDL containing the target to remove from the WSDL.

removeFromActionPolicy

public void removeFromActionPolicy(org.w3c.dom.Document dom)
The instructions to remove Actions added by a specific wsdl.

Parameters:
dom - The WSDL containing the actions to remove from the WSDL.

addToTargetPolicy

public void addToTargetPolicy(org.w3c.dom.Document dom)
Extracts the target from the input WSDL and adds it to the policy.

Parameters:
dom - The WSDL to extract the target to add.

addToActionPolicy

public void addToActionPolicy(org.w3c.dom.Document dom)
Extracts the Actions from the input WSDL and adds them to the policy.

Parameters:
dom - The WSDL to extract the actions to add.

addFromWSDL

public boolean addFromWSDL(java.lang.String fname)
Checks if the wsdl file path passed contains a valid Target Element and Location.

Calls the two methods addToTargetPolicy and addToActionPolicy, to add the relevant extractions to the policy.

Parameters:
fname - The path to the WSDL to load and extract data from.

addParameters

public org.w3c.dom.Element addParameters(org.w3c.dom.Document dom,
                                         org.w3c.dom.Element actionElement,
                                         org.w3c.dom.Element input)
Retrieves the parameters that are either stored directly in message nodes, or defined elsewhere in the WSDL, but pointed from message nodes.

Parameters:
dom - The WSDL containing the Actions & Parameters.
actionElement - The Action Element already with Name and ID Attribute.
input - The Input Tag, being a child of the Port Type.
Returns:
An Element containing the full Action Element. Containing the: Name, Types, Arguments, Target.