public class NodePickerPanel extends javax.swing.JPanel implements ActionMap
Modifier and Type | Class and Description |
---|---|
protected class |
NodePickerPanel.AddButtonAction
The action associated with the 'Add' button.
|
protected class |
NodePickerPanel.ApplyButtonAction
The action associated with the 'Apply' button.
|
static class |
NodePickerPanel.AttributesTableModel
The attributesTable model.
|
protected class |
NodePickerPanel.AttributesTableModelListener
Listens for the changes in the table and updates this node picker panel
if needed.
|
static class |
NodePickerPanel.NameEditorDialog
Dialog for choosing element name.
|
static class |
NodePickerPanel.NodePickerAdapter
The adapter for the NodePicker listener.
|
protected class |
NodePickerPanel.NodePickerEditListener
Manages the edits on focus events.
|
static class |
NodePickerPanel.NodePickerEvent
Event to pass to listener.
|
static interface |
NodePickerPanel.NodePickerListener
Node picker listener.
|
protected class |
NodePickerPanel.RemoveButtonAction
The action associated with the 'Remove' button.
|
protected class |
NodePickerPanel.ResetButtonAction
The action associated with the 'Reset' button.
|
protected class |
NodePickerPanel.SVGInputPanel
The panel to view and edit the elements xml representation.
|
protected class |
NodePickerPanel.XMLAreaListener
Listens for the changes in the xml text area and updates this node picker
panel if needed.
|
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
private static int |
ADD_NEW_ELEMENT
Creates new element while in this mode.
|
private javax.swing.JButton |
addButton
The Add button.
|
private javax.swing.JButton |
applyButton
The Apply button.
|
private javax.swing.JScrollPane |
attributePane
The Attributes table ScrollPane.
|
private javax.swing.JLabel |
attributesLabel
The Attributes table label.
|
private javax.swing.JPanel |
attributesPanel
The Attributes table and buttons Panel.
|
private javax.swing.JTable |
attributesTable
The attributes table - the table that consists of attribute name and
attribute value columns.
|
private static java.util.ResourceBundle |
bundle
The resource bundle.
|
private ButtonFactory |
buttonFactory
The Button factory.
|
private javax.swing.JPanel |
choosePanel
The OK and Cancel button Panel.
|
private org.w3c.dom.Element |
clonedElement
The copy of the original (preview) element.
|
private NodePickerController |
controller
The controller for this panel.
|
private static int |
EDIT_MODE
Edit mode.
|
private javax.swing.event.EventListenerList |
eventListeners
Listeners list.
|
private boolean |
isDirty
If the element being edited is actually changed.
|
private javax.swing.JLabel |
isWellFormedLabel
The isWellFormed label.
|
private java.util.Map |
listeners
The map that contains the listeners
|
private int |
mode
The panel mode.
|
private org.w3c.dom.Node |
parentElement
The parent Element for the element to be added.
|
private org.w3c.dom.Element |
previewElement
The element that is being previewed or edited it's content (xml
representation).
|
private javax.swing.JButton |
removeButton
The Remove button.
|
private javax.swing.JButton |
resetButton
The Reset button.
|
private static ResourceManager |
resources
The resource manager.
|
private static java.lang.String |
RESOURCES
The resource file name.
|
private boolean |
shouldProcessUpdate
If the attribute table listener should process the update event and
update node picker after an update on the table had triggered.
|
private NodePickerPanel.SVGInputPanel |
svgInputPanel
The svg input panel.
|
private javax.swing.JLabel |
svgInputPanelNameLabel
The svgInputPanel name label.
|
private javax.swing.event.TableModelListener |
tableModelListener
The Attribute table model listener.
|
private static int |
VIEW_MODE
View only.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
NodePickerPanel(NodePickerController controller)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
addButtonActions()
Adds button actions.
|
void |
addListener(NodePickerPanel.NodePickerListener listener)
Adds the listener to the listener list.
|
void |
enterAddNewElementMode(org.w3c.dom.Element newElement,
org.w3c.dom.Node parent)
Enters the add new element mode.
|
void |
enterEditMode()
Enters the edit mode.
|
void |
enterViewMode()
Enters the view mode.
|
void |
fireAddNewElement(NodePickerPanel.NodePickerEvent event)
Fires the AddNewElement event.
|
void |
fireUpdateElement(NodePickerPanel.NodePickerEvent event)
Fires the updateElement event.
|
javax.swing.Action |
getAction(java.lang.String key)
Returns the action associated with the given string or null on error
|
private javax.swing.JButton |
getAddButton()
Gets the Add button.
|
private javax.swing.JButton |
getApplyButton()
Gets the Apply button.
|
private javax.swing.JPanel |
getAttributesPanel()
Gets the attributesPanel.
|
private ButtonFactory |
getButtonFactory()
Gets buttonFactory.
|
private javax.swing.JPanel |
getChoosePanel()
Gets the choosePanel.
|
private int |
getMode()
Gets the current working mode.
|
private java.lang.String |
getNamespaceURI(java.lang.String prefix)
Looks up for the namespaceURI based on the given prefix.
|
private org.w3c.dom.Element |
getPreviewElement()
Getter for the preivewElement.
|
private javax.swing.JButton |
getRemoveButton()
Gets the Remove button.
|
private javax.swing.JButton |
getResetButton()
Gets the Reset sbutton.
|
java.lang.String |
getResults()
Gets the results of this node picker panel - gets the contents of the xml
text area.
|
private NodePickerPanel.SVGInputPanel |
getSvgInputPanel()
Gets the svgInputPanel.
|
private void |
initialize()
Initalizes this panel.
|
private boolean |
isANodePickerComponent(java.awt.Component component)
Checks whether the given component is a part component of the this node
picker.
|
private boolean |
isElementModified()
Whether the element being edit is changed.
|
(package private) boolean |
panelHiding()
Invoked by the
DOMViewer to inform the
NodePickerPanel that it is being hidden. |
private org.w3c.dom.Element |
parseXml(java.lang.String xmlString)
Parses the given xml and return parsed document's root element.
|
boolean |
promptForChanges()
Shows a dialog to save changes.
|
private void |
removeAttributes(org.w3c.dom.Element element)
Removes all the attributes from an element.
|
void |
setEditable(boolean editable)
Sets the node picker components to be editable / uneditable.
|
void |
setPreviewElement(org.w3c.dom.Element elem)
Sets the preview element.
|
private boolean |
shouldUpdate(java.lang.String mutationEventType,
org.w3c.dom.Node affectedNode,
org.w3c.dom.Node currentNode)
If the panel should update its components after dom mutation event.
|
private void |
updateAttributesTable(org.w3c.dom.Element elem)
Fills the attributesTable with the given element attribute name - value
pairs.
|
private void |
updateElementAttributes(org.w3c.dom.Element elem,
org.w3c.dom.Element referentElement)
Replaces all of the attributes of the given element with the referent
element's attributes.
|
private void |
updateElementAttributes(org.w3c.dom.Element element,
NodePickerPanel.AttributesTableModel tableModel)
Replaces all of the atributes of a given element with the values from the
given table model.
|
private void |
updateNodeXmlArea(org.w3c.dom.Node node)
Shows node's String representation in svgInputPanel
|
void |
updateOnDocumentChange(java.lang.String mutationEventType,
org.w3c.dom.Node targetNode)
Updates the panel when DOM Mutation event occures.
|
private void |
updateViewAfterSvgInput(org.w3c.dom.Element referentElement,
org.w3c.dom.Element elementToUpdate)
Update the components and the element after text is being inputted in the
xml text area.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
private static final int VIEW_MODE
private static final int EDIT_MODE
private static final int ADD_NEW_ELEMENT
private static final java.lang.String RESOURCES
private static java.util.ResourceBundle bundle
private static ResourceManager resources
private javax.swing.JTable attributesTable
private javax.swing.event.TableModelListener tableModelListener
private javax.swing.JScrollPane attributePane
private javax.swing.JPanel attributesPanel
private ButtonFactory buttonFactory
private javax.swing.JButton addButton
private javax.swing.JButton removeButton
private javax.swing.JLabel attributesLabel
private javax.swing.JButton applyButton
private javax.swing.JButton resetButton
private javax.swing.JPanel choosePanel
private NodePickerPanel.SVGInputPanel svgInputPanel
private javax.swing.JLabel isWellFormedLabel
private javax.swing.JLabel svgInputPanelNameLabel
private boolean shouldProcessUpdate
private org.w3c.dom.Element previewElement
private org.w3c.dom.Element clonedElement
private org.w3c.dom.Node parentElement
private int mode
private boolean isDirty
private javax.swing.event.EventListenerList eventListeners
private NodePickerController controller
private java.util.Map listeners
public NodePickerPanel(NodePickerController controller)
controller
- The node picker panel controllerprivate void initialize()
private ButtonFactory getButtonFactory()
private void addButtonActions()
private javax.swing.JButton getAddButton()
private javax.swing.JButton getRemoveButton()
private javax.swing.JButton getApplyButton()
private javax.swing.JButton getResetButton()
private javax.swing.JPanel getAttributesPanel()
private NodePickerPanel.SVGInputPanel getSvgInputPanel()
private javax.swing.JPanel getChoosePanel()
public java.lang.String getResults()
private void updateViewAfterSvgInput(org.w3c.dom.Element referentElement, org.w3c.dom.Element elementToUpdate)
referentElement
- The updated element, referent elementelementToUpdate
- The element to update.private void updateElementAttributes(org.w3c.dom.Element elem, org.w3c.dom.Element referentElement)
elem
- The element whose attributes should be replacedreferentElement
- The referentElement to copy the attributes fromprivate void updateElementAttributes(org.w3c.dom.Element element, NodePickerPanel.AttributesTableModel tableModel)
element
- The node whose attributes should updatetableModel
- The tableModel from which to get attributesprivate void removeAttributes(org.w3c.dom.Element element)
element
- The given elementprivate java.lang.String getNamespaceURI(java.lang.String prefix)
prefix
- The given prefixprivate void updateAttributesTable(org.w3c.dom.Element elem)
elem
- The given elementprivate void updateNodeXmlArea(org.w3c.dom.Node node)
node
- The given nodeprivate org.w3c.dom.Element getPreviewElement()
public void setPreviewElement(org.w3c.dom.Element elem)
elem
- the element to setboolean panelHiding()
DOMViewer
to inform the
NodePickerPanel
that it is being hidden.private int getMode()
public void enterViewMode()
public void enterEditMode()
public void enterAddNewElementMode(org.w3c.dom.Element newElement, org.w3c.dom.Node parent)
newElement
- The element to be addedparent
- The parent node of the element to be addedpublic void updateOnDocumentChange(java.lang.String mutationEventType, org.w3c.dom.Node targetNode)
private boolean shouldUpdate(java.lang.String mutationEventType, org.w3c.dom.Node affectedNode, org.w3c.dom.Node currentNode)
private org.w3c.dom.Element parseXml(java.lang.String xmlString)
xmlString
- Xml as a Stringpublic void setEditable(boolean editable)
editable
- Whether to enable or disable editprivate boolean isANodePickerComponent(java.awt.Component component)
component
- The given componentpublic boolean promptForChanges()
private boolean isElementModified()
public javax.swing.Action getAction(java.lang.String key) throws MissingListenerException
getAction
in interface ActionMap
key
- the key mapped with the action to getMissingListenerException
- if the action is not foundpublic void fireUpdateElement(NodePickerPanel.NodePickerEvent event)
event
- The associated NodePickerEvent eventpublic void fireAddNewElement(NodePickerPanel.NodePickerEvent event)
event
- The associated NodePickerEvent eventpublic void addListener(NodePickerPanel.NodePickerListener listener)
listener
- The listener to add