pl.edu.agh.cast.ui.dialogs.property
Class PropertiesEditorPresenter

java.lang.Object
  extended by pl.edu.agh.cast.ui.dialogs.property.PropertiesEditorPresenter

public class PropertiesEditorPresenter
extends Object

Presenter (according to Model-View-Presenter design pattern) for IPropertiesEditorView.

Author:
AGH CAST Team

Constructor Summary
PropertiesEditorPresenter(IPropertiesEditorView view, IPresentationElement<? extends IElement> model, org.eclipse.gef.commands.CommandStack commandStack)
          Constructor.
 
Method Summary
static void createAndShowEditor(IPresentationElement<? extends IElement> model, org.eclipse.gef.commands.CommandStack commandStack)
          Creates and shows properties editor.
 void onAddEvent(String propertyDisplayName)
          Handle Add event - add new property with given name.
 boolean onMarkAsLabelEvent(PropertyTreeEntry entry, boolean flag)
          Handles Mark-as-Label event.
 void onOkEvent()
          Handle OK event: save properties and disposes view.
 void onRemoveEvent(PropertyTreeEntry entry)
          Handle Remove event: removes given entry if this is possible.
 void open()
          Opens associated view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesEditorPresenter

public PropertiesEditorPresenter(IPropertiesEditorView view,
                                 IPresentationElement<? extends IElement> model,
                                 org.eclipse.gef.commands.CommandStack commandStack)
Constructor. It initializes the view: creates and set an input based on the given model.

Parameters:
view - view
model - model
commandStack - GEF command stack
Method Detail

open

public void open()
Opens associated view.


createAndShowEditor

public static void createAndShowEditor(IPresentationElement<? extends IElement> model,
                                       org.eclipse.gef.commands.CommandStack commandStack)
Creates and shows properties editor.

Parameters:
model - presentation element for which properties will be shown
commandStack - GEF command stack

onOkEvent

public void onOkEvent()
Handle OK event: save properties and disposes view.


onRemoveEvent

public void onRemoveEvent(PropertyTreeEntry entry)
Handle Remove event: removes given entry if this is possible.

Parameters:
entry - entry to remove.

onAddEvent

public void onAddEvent(String propertyDisplayName)
Handle Add event - add new property with given name.

Parameters:
propertyDisplayName - display name of new property. The property name is create by convertPropertyName(String) method.

onMarkAsLabelEvent

public boolean onMarkAsLabelEvent(PropertyTreeEntry entry,
                                  boolean flag)
Handles Mark-as-Label event.

Parameters:
entry - entry which contains property to be marked as label
flag - flag which indicates if property is to be added or removed from label
Returns:
true if operation is successful


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.