|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectcz.cuni.pogamut.shed.presenter.ExpandedActionPresenter
public class ExpandedActionPresenter
Presenter to update expanded attachment
representation of the SlotEnvelope.
The SlotEnvelope wants accurate representation of its attachment. The
attachment by itself is a string identifier (in the lap tree represented by TriggeredAction)
that can reference to ActionPattern or Competence of the
plan. When it does reference them, we want to see the visual representation
of the AP/C. If it doesn't reference them, it is plain action that is
executed by the IWorkExecutor.
Since this is an editor, many things can change, e.g. the attachment doesn't
reference anything in the begiinning and then AP is added with same
identifier. In such case we need to update the atatchment. That is what this
presenter does.
This presenter listenes to all AP/C for name change, on DC for
adding/removing AP/C (in such case, we add/remove listener for name) and
finally we listen on the attachment action itself for name change.
| Field Summary | |
|---|---|
protected ShedPresenter |
presenter
Presenter that is mainly used to modify the scene |
protected ShedScene |
scene
Scene this presenter is modifying. |
| Constructor Summary | |
|---|---|
ExpandedActionPresenter(ShedScene scene,
ShedPresenter presenter,
ExpandedActionEnvelope envelope,
TriggeredAction action,
LapChain chain)
Create new presenter for updating the attachment in the SlotEnvelope. |
|
| Method Summary | ||
|---|---|---|
protected TriggeredAction |
extractAction(List<TriggeredAction> actions,
PoshElement action)
|
|
protected ActionPattern |
extractActionPattern(List<ActionPattern> actionPatterns,
PoshElement actionPattern)
Assert that @actionPattern is in the @actionPatterns and return it. |
|
protected Competence |
extractCompetence(List<Competence> competences,
PoshElement competence)
Assert that @competence is in the @competences and return it. |
|
protected DriveElement |
extractDrive(List<DriveElement> drives,
PoshElement drive)
|
|
protected CompetenceElement |
extractChoice(List<CompetenceElement> choices,
PoshElement choice)
Assert that @choice is in the @choices and return it. |
|
protected Sense |
extractSense(Trigger<?> trigger,
PoshElement sense)
Assert that sense is a part of the trigger and return it. |
|
AbstractAcceptAction[] |
getAcceptProviders()
Get array of accept providers of this |
|
org.netbeans.api.visual.action.WidgetAction |
getEditAction()
Get edit action that will be invoked upon double click. |
|
Action[] |
getMenuActions()
Get(create) actions that should be displayed in the context menu of the widgets that use this presenter. |
|
protected
|
getPosition(List<T> list,
T element)
Get position of the element in the list. |
|
protected boolean |
isAction(PoshElement element)
|
|
protected boolean |
isActionPattern(PoshElement element)
Is the element ActionPattern? |
|
protected boolean |
isCompetence(PoshElement element)
Is the element Competence? |
|
protected boolean |
isDrive(PoshElement element)
|
|
protected boolean |
isChoice(PoshElement element)
Is the element CompetenceElement? |
|
protected boolean |
isSense(PoshElement element)
Is passed element a Sense? |
|
void |
register()
Register its listeners into the lap tree. |
|
void |
replaceExpandedAction(TriggeredAction actionToExpand)
Must call Scene.validate() at the end. |
|
void |
unregister()
Unregister its listeners that were registered in the IPresenter.register()
method. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface cz.cuni.pogamut.shed.presenter.IPresenter |
|---|
getAcceptProviders |
| Field Detail |
|---|
protected final ShedScene scene
protected final ShedPresenter presenter
| Constructor Detail |
|---|
public ExpandedActionPresenter(ShedScene scene,
ShedPresenter presenter,
ExpandedActionEnvelope envelope,
TriggeredAction action,
LapChain chain)
SlotEnvelope.
scene - Scene the @envelope is in and the one where attachment will
be.presenter - Main presenter.envelope - Envelope for displaying the attachment.action - Basically reference to ActionPattern or Competence.
This action is used to determine what attachment will be displayed. When
its name is changed, presenter will reflect that.chain - Chain up to the branch node right before the @action
(@action is not included in the chain.).| Method Detail |
|---|
public void register()
IPresenter
register in interface IPresenterpublic void unregister()
IPresenterIPresenter.register()
method.
unregister in interface IPresenterpublic Action[] getMenuActions()
IPresenter
getMenuActions in interface IPresenterpublic void replaceExpandedAction(TriggeredAction actionToExpand)
Scene.validate() at the end.
public org.netbeans.api.visual.action.WidgetAction getEditAction()
IPresenter
getEditAction in interface IPresenterprotected final boolean isSense(PoshElement element)
Sense?
element - element to check.
protected final Sense extractSense(Trigger<?> trigger,
PoshElement sense)
trigger - Trigger against which the method is testing.sense - tested sense
protected final boolean isAction(PoshElement element)
protected final TriggeredAction extractAction(List<TriggeredAction> actions,
PoshElement action)
protected final boolean isDrive(PoshElement element)
protected final DriveElement extractDrive(List<DriveElement> drives,
PoshElement drive)
protected final boolean isChoice(PoshElement element)
CompetenceElement?
element - Tested element
CompetenceElement or its
subclass, false otherwise.
protected final CompetenceElement extractChoice(List<CompetenceElement> choices,
PoshElement choice)
choices - List of choices that must contain the @choice.choice - Choice must be contained in the @choices
protected final boolean isActionPattern(PoshElement element)
ActionPattern?
element - Tested element
ActionPattern or its subclass,
false otherwise.
protected final ActionPattern extractActionPattern(List<ActionPattern> actionPatterns,
PoshElement actionPattern)
PoshElement to ActionPattern.
actionPatterns - List of ActionPatterns that must contain
the @actionPattern.actionPattern - The ActionPattern that must be contained in
the @actionPatterns
protected final boolean isCompetence(PoshElement element)
Competence?
element - Tested element
Competence or its subclass, false
otherwise.
protected final Competence extractCompetence(List<Competence> competences,
PoshElement competence)
PoshElement to Competence.
competences - List of Competences that must contain thecompetence - The Competence that must be contained in the
protected final <T extends PoshElement> int getPosition(List<T> list,
T element)
T - Type of elementlist - list in which we determine position of the elemnt.element - The element for whic we want position in the list. Must be
there, otherwise assert error.
public AbstractAcceptAction[] getAcceptProviders()
IPresenter
getAcceptProviders in interface IPresenter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||