| |
|
| net.refractions.udig.style.ui.StyleView
StyleView | public class StyleView extends ViewPart implements StyleManager(Code) | | Style Editing View.
StyleView is responsible for allowing the user to choose between applicable StyleConfigurators
for the current blackboard.
What does this mean?
- Listens to any workbench selection and will engage when a Layer is selected
- Will use both the Layer.getResource and StyleBlackboard when figuring out which
StyleConfigurators are applicable
- Will display a select control in the viewpart toolbar if their is more then one to choose
from, if there is only one a Label showing the StyleConfigurator name will be shown.
- The StyleConfigurator will be supplied with the Layer & Blackboard to edit, note this is
not* the same black board as used by the Layer for live rendering!
- Is responsible for applying any changes to the Blackboard, this is done using an apply
button on the viewpart toolbar. Changes will also be applied when the workbench looses focus on
the layer.
TODO: Clone the blackboard and give that to the configurator
author: jdeolive since: 0.5 |
Inner Class :class StyleViewSite implements IViewSite | |
Constructor Summary | |
public | StyleView() Construct StyleView . |
Method Summary | |
void | apply() | public void | createPartControl(Composite parent) Creates the style editor layout, and uses a PageBook placeholder for ui widgets to be placed
into as Styles are selected. | public void | dispose() | void | focusConfigurator(IStyleConfigurator config) Focuses the style configurator. | public Layer | getCurrentLayer() | public IStyleConfigurator | getStyleConfigurator() This *is* the current styleConfigurator used by this style view. | public Set<IStyleConfigurator> | getStyleConfigurators() Acquire configurators for the current layer.
- WARNING: this method is only valid to call *after* init has been called.
- ARNING: these IStyleConfigurators will only have their ui available after
createPartControl has completed.
| public void | init(IViewSite site, IMemento memento) Called before createPartControl to give us chance to organize ourselves. | public void | refresh() Refresh all the viewsites, aka force stylecon figurators to reset. | void | revert() | public void | setCurrentLayer(Layer layer) New layer, or null if there is no selected layer. | public void | setFocus() Set focus to the chooser if available. | public void | setStyleConfigurator(IStyleConfigurator config) Set the current StyleConfigurator used by this StyleView to the provided config. | void | updateChooser() Update chooser to reflect getStyleConfigurators list and currentConfig. |
VIEW_ID | final public static String VIEW_ID(Code) | | ID used in the extention point to identify this view
|
book | PageBook book(Code) | | Page book used to switch between available StyleConfigurators
|
chooserListener | SelectionListener chooserListener(Code) | | |
configChooser | Combo configChooser(Code) | | Choose which styleConfigurator to use.
This is contributed to the toolbar via an IContributionItem.
|
pleaseSelectLayer | Label pleaseSelectLayer(Code) | | |
sites | List<StyleViewSite> sites(Code) | | List of StyleViewSites each one manages a IStyleConfigurator.
Note: This list should be accessed via getStyleConfigurators, that method will only show you
sites that are applicable to the curernt layer.
|
StyleView | public StyleView()(Code) | | Construct StyleView .
Note since we are a view - nothing much happens here.
- init will be called allowing us to grab our prefs
- createPartControl control will be called allowing us to set up before display
- dispose will be called when we are closed
|
createPartControl | public void createPartControl(Composite parent)(Code) | | Creates the style editor layout, and uses a PageBook placeholder for ui widgets to be placed
into as Styles are selected.
See Also: org.eclipse.ui.IWorkbenchPart.createPartControl(org.eclipse.swt.widgets.Composite) Parameters: parent - |
dispose | public void dispose()(Code) | | Note: createPartControl may not even of been called
See Also: org.eclipse.ui.part.WorkbenchPart.dispose |
getStyleConfigurator | public IStyleConfigurator getStyleConfigurator()(Code) | | This *is* the current styleConfigurator used by this style view.
The following controls need to be kept in sync:
- configChooser (if it exists yet) needs to use getStyleConfigurator().getLabel as its
text
- book needs to use StyleViewSite page associated with this StyleConfigurator
- the toolbar from the StyleViewSite also needs to be displayed
IStyleConfigurator currently being displayed |
getStyleConfigurators | public Set<IStyleConfigurator> getStyleConfigurators()(Code) | | Acquire configurators for the current layer.
- WARNING: this method is only valid to call *after* init has been called.
- ARNING: these IStyleConfigurators will only have their ui available after
createPartControl has completed. Please don't call setFocus( IStyleConfigurator ) before
hand.
This means you should *not* assume these IStyleConfigurators are totally happy and ready to
work. They will only listen to events when they are the current page for example.
Set of configurators for the current layer, may be empty |
init | public void init(IViewSite site, IMemento memento) throws PartInitException(Code) | | Called before createPartControl to give us chance to organize ourselves.
We used this to latch onto the defined StyleConfigurators.
See Also: org.eclipse.ui.part.ViewPart.init(org.eclipse.ui.IViewSiteorg.eclipse.ui.IMemento) |
refresh | public void refresh()(Code) | | Refresh all the viewsites, aka force stylecon figurators to reset.
|
setCurrentLayer | public void setCurrentLayer(Layer layer)(Code) | | New layer, or null if there is no selected layer.
|
setFocus | public void setFocus()(Code) | | Set focus to the chooser if available.
TODO: Should set the focus to the current StyleView being displayed.
|
setStyleConfigurator | public void setStyleConfigurator(IStyleConfigurator config)(Code) | | Set the current StyleConfigurator used by this StyleView to the provided config.
Note if there is only one chooser, we should set the focus to the styleConfigurator.
Responsibilities:
- set the chooser text to the config.getLabel!
- call site.focus() for the config - so the page gets show, and the toolbar gets shown
Parameters: config - IStyleConfigurator to be displayed by StyleView See Also: org.eclipse.ui.IWorkbenchPart.setFocus |
updateChooser | void updateChooser()(Code) | | Update chooser to reflect getStyleConfigurators list and currentConfig.
|
|
|
|