org.formaria.editor.project.pages
Class PagePanel

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 org.formaria.editor.project.pages.PagePanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, Modifiable, EventHandlerEditor, IPagePanel

public class PagePanel
extends javax.swing.JPanel
implements Modifiable, EventHandlerEditor, IPagePanel

UI support for editing the a page. Opens the the XML in a separate window

Copyright (c) Formaria Ltd., 2002-2003

$Revision: 1.60 $

License: see License.txt

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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String DEFAULT_COMPONENT_INSPECTOR_MODE
           
static java.lang.String DEFAULT_COMPONENT_PALETTE_MODE
           
static java.lang.String DEFAULT_COMPONENT_PROPERTIES_MODE
           
static java.lang.String DEFAULT_LAYER_PALETTE_MODE
           
static java.lang.String DEFAULT_STYLE_PALETTE_MODE
           
static int MODE_VISUAL
           
static int MODE_XML
           
protected  int xmlEditorHash
           
 
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 org.formaria.editor.project.pages.IPagePanel
NO_OPTION, YES_OPTION
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PagePanel(java.lang.Object parent, EditorProject project, java.lang.String name, java.lang.String builder)
           
 
Method Summary
 void add(java.lang.Object component, java.lang.Object constraint)
          Add a component to the container
 void componentChanged()
           
 IComponentInspector createInspector()
           
 ILayerPalette createLayerPalette()
           
 IComponentPalette createPalette()
           
 IComponentProperties createPropertiesPanel()
           
 IStylePalette createStylePalette()
           
 java.lang.Object getChild(int i)
           
 int getChildCount()
           
 PageResource getCurrentPage()
           
 ILayerManager getLayerManager()
           
 int getMode()
           
 Notifiable getNotifiable()
           
 javax.swing.JPanel getPageContainer()
           
 PageDesigner getPageDesigner()
           
 EditorProject getProject()
          Get the project to which this page belongs.
 javax.swing.JComponent getToolbarRepresentation()
           
 javax.swing.JComponent getVisualRepresentation()
           
 int getXmlEditorHash()
          Get the hash code of the xml text
 void hideComponents(boolean isClosing)
           
 boolean isModified()
           
 boolean isXmlDirty()
           
 void regenerateXml()
           
 void remove(java.lang.Object o)
          Remove an object from the container
 boolean reparsePageXml(PageResource pageRes, java.lang.String pageName)
          Reparse the page XML if it has changed.
 boolean reparsePageXml(java.lang.String pageName)
           
 void setAllModified(java.lang.String pageName, java.lang.String ext)
           
 void setMode(int mode)
           
 void setModified(boolean newState)
           
 void showComponents()
           
 int showConfirmDialog(java.lang.Object parent, java.lang.String message, java.lang.String title, int type)
           
 void showEventHandler(PageResource page, java.awt.Component source, java.lang.String methodName, java.lang.Class klass, boolean ctrlDown)
          Show the Java source code at the point of the specified method
 void showEventHandler(PageResource page, java.awt.Component source, java.lang.String methodName, long mask, boolean ctrlDown)
          Show the Java source code at the point of the specified method
 void showPage(int pageIdx)
           
 void showPageEventHandler(PageResource page, java.lang.String methodName, boolean ctrlDown)
           
 void updatePageEditor()
           
 void updateXmlEditor(java.lang.String xml)
           
 
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, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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
 
Methods inherited from interface org.formaria.editor.project.pages.IPagePanel
doLayout, getComponent, getComponentCount, validate
 

Field Detail

DEFAULT_COMPONENT_PROPERTIES_MODE

public static java.lang.String DEFAULT_COMPONENT_PROPERTIES_MODE

DEFAULT_COMPONENT_INSPECTOR_MODE

public static java.lang.String DEFAULT_COMPONENT_INSPECTOR_MODE

DEFAULT_COMPONENT_PALETTE_MODE

public static java.lang.String DEFAULT_COMPONENT_PALETTE_MODE

DEFAULT_STYLE_PALETTE_MODE

public static java.lang.String DEFAULT_STYLE_PALETTE_MODE

DEFAULT_LAYER_PALETTE_MODE

public static java.lang.String DEFAULT_LAYER_PALETTE_MODE

xmlEditorHash

protected int xmlEditorHash

MODE_VISUAL

public static final int MODE_VISUAL
See Also:
Constant Field Values

MODE_XML

public static final int MODE_XML
See Also:
Constant Field Values
Constructor Detail

PagePanel

public PagePanel(java.lang.Object parent,
                 EditorProject project,
                 java.lang.String name,
                 java.lang.String builder)
Method Detail

setMode

public void setMode(int mode)

getMode

public int getMode()

showPage

public void showPage(int pageIdx)
Specified by:
showPage in interface IPagePanel

getProject

public EditorProject getProject()
Description copied from interface: IPagePanel
Get the project to which this page belongs.

Specified by:
getProject in interface IPagePanel

createPalette

public IComponentPalette createPalette()
Specified by:
createPalette in interface IPagePanel

createInspector

public IComponentInspector createInspector()
Specified by:
createInspector in interface IPagePanel

createPropertiesPanel

public IComponentProperties createPropertiesPanel()
Specified by:
createPropertiesPanel in interface IPagePanel

createStylePalette

public IStylePalette createStylePalette()
Specified by:
createStylePalette in interface IPagePanel

createLayerPalette

public ILayerPalette createLayerPalette()
Specified by:
createLayerPalette in interface IPagePanel

setAllModified

public void setAllModified(java.lang.String pageName,
                           java.lang.String ext)
Specified by:
setAllModified in interface IPagePanel

isXmlDirty

public boolean isXmlDirty()

updatePageEditor

public void updatePageEditor()
Specified by:
updatePageEditor in interface IPagePanel

updateXmlEditor

public void updateXmlEditor(java.lang.String xml)
Specified by:
updateXmlEditor in interface IPagePanel

regenerateXml

public void regenerateXml()
Specified by:
regenerateXml in interface IPagePanel

setModified

public void setModified(boolean newState)
Specified by:
setModified in interface Modifiable
Specified by:
setModified in interface IPagePanel

isModified

public boolean isModified()
Specified by:
isModified in interface Modifiable

getNotifiable

public Notifiable getNotifiable()
Specified by:
getNotifiable in interface Modifiable

getVisualRepresentation

public javax.swing.JComponent getVisualRepresentation()

getToolbarRepresentation

public javax.swing.JComponent getToolbarRepresentation()

showComponents

public void showComponents()
Specified by:
showComponents in interface IPagePanel

hideComponents

public void hideComponents(boolean isClosing)
Specified by:
hideComponents in interface IPagePanel

reparsePageXml

public boolean reparsePageXml(java.lang.String pageName)

reparsePageXml

public boolean reparsePageXml(PageResource pageRes,
                              java.lang.String pageName)
Reparse the page XML if it has changed. This reparse could be handled on notification of updates to the EditorPage class via the PageSupport but it would require additional parsing.


showEventHandler

public void showEventHandler(PageResource page,
                             java.awt.Component source,
                             java.lang.String methodName,
                             long mask,
                             boolean ctrlDown)
Show the Java source code at the point of the specified method

Specified by:
showEventHandler in interface EventHandlerEditor
Parameters:
page - the page resource that owns the method
source - the component that initiates the event
methodName - the response method name
mask - the event mask

showEventHandler

public void showEventHandler(PageResource page,
                             java.awt.Component source,
                             java.lang.String methodName,
                             java.lang.Class klass,
                             boolean ctrlDown)
Show the Java source code at the point of the specified method

Specified by:
showEventHandler in interface EventHandlerEditor
Parameters:
page - the page resource that owns the method
source - the component that initiates the event
methodName - the response method name
klass - the event class

showPageEventHandler

public void showPageEventHandler(PageResource page,
                                 java.lang.String methodName,
                                 boolean ctrlDown)
Specified by:
showPageEventHandler in interface EventHandlerEditor

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface IPagePanel

getChild

public java.lang.Object getChild(int i)
Specified by:
getChild in interface IPagePanel

getCurrentPage

public PageResource getCurrentPage()

componentChanged

public void componentChanged()

getPageContainer

public javax.swing.JPanel getPageContainer()
Specified by:
getPageContainer in interface IPagePanel

getPageDesigner

public PageDesigner getPageDesigner()

getLayerManager

public ILayerManager getLayerManager()
Specified by:
getLayerManager in interface IPagePanel

add

public void add(java.lang.Object component,
                java.lang.Object constraint)
Add a component to the container

Specified by:
add in interface IPagePanel
Parameters:
component - the component to add
constraint - the layout constraint

remove

public void remove(java.lang.Object o)
Remove an object from the container

Specified by:
remove in interface IPagePanel
Parameters:
o - the component to remove

getXmlEditorHash

public int getXmlEditorHash()
Get the hash code of the xml text

Specified by:
getXmlEditorHash in interface IPagePanel
Returns:
the hash code

showConfirmDialog

public int showConfirmDialog(java.lang.Object parent,
                             java.lang.String message,
                             java.lang.String title,
                             int type)
Specified by:
showConfirmDialog in interface IPagePanel