org.formaria.editor.eclipse.project.pages
Class PagePanel

java.lang.Object
  extended by MultiPageEditorPart
      extended by org.formaria.editor.eclipse.project.pages.PagePanel
All Implemented Interfaces:
EventHandlerEditor, IPagePanel

public class PagePanel
extends MultiPageEditorPart
implements IPagePanel, EventHandlerEditor

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

Copyright (c) Formaria Ltd., 2008

$Revision: 1.60 $

License: see License.txt


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
           
 
Fields inherited from interface org.formaria.editor.project.pages.IPagePanel
NO_OPTION, YES_OPTION
 
Constructor Summary
PagePanel()
          Creates a multi-page editor example.
 
Method Summary
 void add(java.lang.Object component, java.lang.Object constraint)
          Add a component to the container
 void componentShowing()
           
 IComponentInspector createInspector()
           
 ILayerPalette createLayerPalette()
           
protected  void createPages()
          Creates the pages of the multi-page editor.
 IComponentPalette createPalette()
           
 IComponentProperties createPropertiesPanel()
           
 IStylePalette createStylePalette()
           
 void dispose()
          The MultiPageEditorPart implementation of this IWorkbenchPart method disposes all nested editors.
 void doLayout()
          Causes this container to lay out its components.
 void doSave(IProgressMonitor monitor)
          Saves the multi-page editor's document.
 void doSaveAs()
          Saves the multi-page editor's document as another file.
 java.lang.Object getChild(int idx)
           
 int getChildCount()
           
 java.lang.Object getComponent(int idx)
           
 int getComponentCount()
          Get the number of child components owned by this component, assuming that the component is a container.
 ILayerManager getLayerManager()
           
 java.lang.String getName(java.lang.Object component)
          Get the name of the object
 javax.swing.JPanel getPageContainer()
           
 PageDesigner getPageDesigner()
           
 PageResource getPageResource(java.lang.String name)
           
 EditorProject getProject()
          Get the project to which this page belongs.
 int getXmlEditorHash()
           
 void gotoMarker(IMarker marker)
           
 void hideComponents(boolean isClosing)
           
 void init(IEditorSite site, IEditorInput editorInput)
          The MultiPageEditorExample implementation of this method checks that the input is an instance of IFileEditorInput.
 boolean isDirty()
           
 boolean isSaveAsAllowed()
           
protected  void pageChange(int newPageIndex)
          Calculates the contents of page 2 when the it is activated.
 void partActivated(IWorkbenchPart part)
          Notifies this listener that the given part has been activated.
 void partBroughtToTop(IWorkbenchPart part)
          Notifies this listener that the given part has been brought to the top.
 void partClosed(IWorkbenchPart part)
          Notifies this listener that the given part has been closed.
 void partDeactivated(IWorkbenchPart part)
          Notifies this listener that the given part has been deactivated.
 void partOpened(IWorkbenchPart part)
          Notifies this listener that the given part has been opened.
 void regenerateXml()
           
 void remove(java.lang.Object o)
          Remove an object from the container
 void resourceChanged(IResourceChangeEvent event)
          Closes all project files on project close.
 void saveState()
           
 void setAllModified(java.lang.String pageName, java.lang.String ext)
           
 void setFocus()
           
 void setInitializationData(IConfigurationElement config, java.lang.String propertyName, java.lang.Object data)
           
 void setModified(boolean state)
           
 void setOwner(java.lang.Object parent)
           
 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 showViews(boolean state)
           
 void updatePageEditor()
           
 void updateXmlEditor(java.lang.String xml)
           
 void validate()
          Validates this container and all of its subcomponents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

PagePanel

public PagePanel()
Creates a multi-page editor example.

Method Detail

getProject

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

Specified by:
getProject in interface IPagePanel

setInitializationData

public void setInitializationData(IConfigurationElement config,
                                  java.lang.String propertyName,
                                  java.lang.Object data)

showPage

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

setOwner

public void setOwner(java.lang.Object parent)

createPages

protected void createPages()
Creates the pages of the multi-page editor.


dispose

public void dispose()
The MultiPageEditorPart implementation of this IWorkbenchPart method disposes all nested editors. Subclasses may extend.


partActivated

public void partActivated(IWorkbenchPart part)
Notifies this listener that the given part has been activated.

Parameters:
part - the part that was activated
See Also:
IWorkbenchPage#activate

partBroughtToTop

public void partBroughtToTop(IWorkbenchPart part)
Notifies this listener that the given part has been brought to the top.

These events occur when an editor is brought to the top in the editor area, or when a view is brought to the top in a page book with multiple views. They are normally only sent when a part is brought to the top programmatically (via IPerspective.bringToTop). When a part is activated by the user clicking on it, only partActivated is sent.

Parameters:
part - the part that was surfaced
See Also:
IWorkbenchPage#bringToTop

partClosed

public void partClosed(IWorkbenchPart part)
Notifies this listener that the given part has been closed.

Parameters:
part - the part that was closed
See Also:
IWorkbenchPage#hideView(IViewPart)

partDeactivated

public void partDeactivated(IWorkbenchPart part)
Notifies this listener that the given part has been deactivated.

Parameters:
part - the part that was deactivated
See Also:
IWorkbenchPage#activate(IWorkbenchPart)

partOpened

public void partOpened(IWorkbenchPart part)
Notifies this listener that the given part has been opened.

Parameters:
part - the part that was opened
See Also:
IWorkbenchPage#showView(String)

doSave

public void doSave(IProgressMonitor monitor)
Saves the multi-page editor's document.


doSaveAs

public void doSaveAs()
Saves the multi-page editor's document as another file. Also updates the text for page 0's tab, and updates this multi-page editor's input to correspond to the nested editor's.


gotoMarker

public void gotoMarker(IMarker marker)

init

public void init(IEditorSite site,
                 IEditorInput editorInput)
          throws PartInitException
The MultiPageEditorExample implementation of this method checks that the input is an instance of IFileEditorInput.

Throws:
PartInitException

isSaveAsAllowed

public boolean isSaveAsAllowed()

pageChange

protected void pageChange(int newPageIndex)
Calculates the contents of page 2 when the it is activated.


saveState

public void saveState()

isDirty

public boolean isDirty()

resourceChanged

public void resourceChanged(IResourceChangeEvent event)
Closes all project files on project close.


getName

public java.lang.String getName(java.lang.Object component)
Get the name of the object

Parameters:
component - The component instance
Returns:
The name

getComponentCount

public int getComponentCount()
Get the number of child components owned by this component, assuming that the component is a container.

Specified by:
getComponentCount in interface IPagePanel
Returns:
the number of children

getComponent

public java.lang.Object getComponent(int idx)
Specified by:
getComponent in interface IPagePanel

setAllModified

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

setModified

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

getXmlEditorHash

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

getChildCount

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

getChild

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

getPageContainer

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

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

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

doLayout

public void doLayout()
Causes this container to lay out its components. Most programs should not call this method directly, but should invoke the validate method instead.

Specified by:
doLayout in interface IPagePanel
Since:
JDK1.1
See Also:
LayoutManager.layoutContainer(java.awt.Container), #setLayout, validate()

validate

public void validate()
Validates this container and all of its subcomponents.

The validate method is used to cause a container to lay out its subcomponents again. It should be invoked when this container's subcomponents are modified (added to or removed from the container, or layout-related information changed) after the container has been displayed.

Specified by:
validate in interface IPagePanel
See Also:
#add(java.awt.Component), Component.invalidate(), JComponent.revalidate()

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

createStylePalette

public IStylePalette createStylePalette()
Specified by:
createStylePalette 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

createLayerPalette

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

showViews

public void showViews(boolean state)

showComponents

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

hideComponents

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

showConfirmDialog

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

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

setFocus

public void setFocus()

componentShowing

public void componentShowing()

getPageResource

public PageResource getPageResource(java.lang.String name)

getPageDesigner

public PageDesigner getPageDesigner()

getLayerManager

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