org.eclipse.graphiti.tb
Class DefaultContextButtonPadData

java.lang.Object
  extended by org.eclipse.graphiti.tb.DefaultContextButtonPadData
All Implemented Interfaces:
IContextButtonPadData

public class DefaultContextButtonPadData
extends Object
implements IContextButtonPadData

A very simple implementation of IContextButtonPadData without any real functionality. Users may subclass this class.

NOTE: By doing so it is also possible to alter the standard behavior of the editor (e.g. change the location of the standard context button pad). This might lead to inconsistent behavior in different editor implemented on top of Graphiti, which might be irritating to users. From a consistency point of view it is advisable in such cases to stick to the Graphiti standard, and to only change it in case you really need to.


Field Summary
private  IContextButtonEntry collapseContextButton
           
private  List<IContextButtonEntry> domainSpecificContextButtons
           
private  List<IContextButtonEntry> genericContextButtons
           
private  IRectangle location
           
 
Constructor Summary
DefaultContextButtonPadData()
          Creates a new DefaultContextButtonPadData.
 
Method Summary
 IContextButtonEntry getCollapseContextButton()
          Returns the collapse context button to show in the context button pad.
 List<IContextButtonEntry> getDomainSpecificContextButtons()
          Returns the domain specific context buttons to show in the context button pad.
 List<IContextButtonEntry> getGenericContextButtons()
          Returns the generic context buttons (remove, delete, update, ...) to show in the context button pad.
 IRectangle getPadLocation()
          Returns the location of the context button pad.
 void setCollapseContextButton(IContextButtonEntry collapseContextButton)
          Sets the collapse context button to show in the context button pad.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

genericContextButtons

private List<IContextButtonEntry> genericContextButtons

domainSpecificContextButtons

private List<IContextButtonEntry> domainSpecificContextButtons

collapseContextButton

private IContextButtonEntry collapseContextButton

location

private IRectangle location
Constructor Detail

DefaultContextButtonPadData

public DefaultContextButtonPadData()
Creates a new DefaultContextButtonPadData.

Method Detail

getGenericContextButtons

public List<IContextButtonEntry> getGenericContextButtons()
Description copied from interface: IContextButtonPadData
Returns the generic context buttons (remove, delete, update, ...) to show in the context button pad. It can not be null, but it can be empty. Note, that the differentiation between the button semantics (generic, domain-specific, collapse, ...) is only made to display the buttons differently.

The button list can be changed by working directly on the result list (e.g. getGenericContextButtons().add()).

To ensure, that the generic context buttons are identical in all tools, you have to create them using DefaultToolBehaviorProvider.setGenericContextButtons(IContextButtonPadData, org.eclipse.graphiti.mm.pictograms.PictogramElement, int).

Specified by:
getGenericContextButtons in interface IContextButtonPadData
Returns:
The generic context buttons (remove, delete, update, ...) to show in the context button pad.
See Also:
DefaultToolBehaviorProvider.setGenericContextButtons(IContextButtonPadData, org.eclipse.graphiti.mm.pictograms.PictogramElement, int)

getDomainSpecificContextButtons

public List<IContextButtonEntry> getDomainSpecificContextButtons()
Description copied from interface: IContextButtonPadData
Returns the domain specific context buttons to show in the context button pad. It can not be null, but it can be empty. Note, that the differentiation between the button semantics (generic, domain-specific, collapse, ...) is only made to display the buttons differently.

The button list can be changed by working directly on the result list (e.g. getDomainSpecificContextButtons().add()).

Specified by:
getDomainSpecificContextButtons in interface IContextButtonPadData
Returns:
The domain specific context buttons to show in the context button pad.

getCollapseContextButton

public IContextButtonEntry getCollapseContextButton()
Description copied from interface: IContextButtonPadData
Returns the collapse context button to show in the context button pad. It can be null. Note, that the differentiation between the button semantics (generic, domain-specific, collapse, ...) is only made to display the buttons differently.

Specified by:
getCollapseContextButton in interface IContextButtonPadData
Returns:
The collapse context button to show in the context button pad.

setCollapseContextButton

public void setCollapseContextButton(IContextButtonEntry collapseContextButton)
Description copied from interface: IContextButtonPadData
Sets the collapse context button to show in the context button pad. Note, that the differentiation between the button semantics (generic, domain-specific, collapse, ...) is only made to display the buttons differently.

To ensure, that the collapse context button is identical in all tools, you have to create it using ContextEntryHelper.createCollapseContextButton(boolean, org.eclipse.graphiti.features.IFeature, org.eclipse.graphiti.features.context.IContext).

Specified by:
setCollapseContextButton in interface IContextButtonPadData
Parameters:
collapseContextButton - The collapse context button to show in the context button pad. A value of null means, that there is no collapse context button.
See Also:
ContextEntryHelper.createCollapseContextButton(boolean, org.eclipse.graphiti.features.IFeature, org.eclipse.graphiti.features.context.IContext)

getPadLocation

public IRectangle getPadLocation()
Description copied from interface: IContextButtonPadData
Returns the location of the context button pad. It can not be null. These are not the outer bounds of the context button pad, but the inner rectangle, around which the context button pad is shown. Often these are the outer bounds of the figure, for which the context button pad is shown. But in some cases it makes sense to use the outer bounds of an inner figure or to shrink/enlarge the rectangle.

The location can be changed by working directly on the result rectangle (e.g. getPadLocation().setRectangle()).

Specified by:
getPadLocation in interface IContextButtonPadData
Returns:
The location of the context button pad.


Copyright (c) SAP AG 2005, 2012.