Difference: DpMenusToolbarsDragDrop (1 vs. 10)

Revision 102014-02-19 - AlvarGarcia

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
<-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END -->
Line: 15 to 15
 

Revision 92013-10-18 - JaimeSaiz

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
<-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END -->
Line: 15 to 15
 
Line: 138 to 138
 

Drag & drop

Changed:
<
<
HIPE uses a simplified support for drag & drop, whose main target is to be able to pass references from the Jython namespace.
>
>
HIPE supports drag & drop of selections.
 
Changed:
<
<
A class that wants to implement the HIPE protocol must implement the DnDSelection interface and declare it to the Java TransferHandler system by registering it:
>
>
A component that wants to enable it must implement the DnDSelection interface and register itself:
 

Changed:
<
<
setTransferHandler(new TransferHandler("variableSelection"));
>
>
SelectionTransferHandler.register(this); // this is the Component being built
 
Deleted:
<
<
This simple mechanism allows for receiving VariableSelection.
 
Changed:
<
<
Legacy user comments

* It would be nice to put a concrete example that works by copying and pasting the code for each functionality -- JeanMichelGlorian - 05 Jan 2012 - 10:58

<--/commentPlugin-->
>
>
The selection type returned by getSelectionType() specifies the kind of selections that can be handled: variables, files...
 

Revision 82013-01-31 - PaulBalm

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
<-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END -->
Line: 117 to 117
  menus.insert(new Insert(TOOLBAR, ID, RUN_ADDON), clear);
Added:
>
>
Note that these instructions assume that the action belongs to a View, so that you can use the ViewPart of the View to access the ActionBars. If an action is not associated to any View, then you should introduce an ActionMaker for the action. For an example, see herschel.ia.gui.apps.views.status.StopActionMaker.
 

Pop-up menus

Again, support for pop up menus is just as easy:

Revision 72012-10-19 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
Added:
>
>
<-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END -->

<-- END OF ANALYTICS CODE -->
 
<-- 
  • Set TOPICTITLE = Menus, toolbars, drag and drop
-->
Line: 165 to 168
 blog comments powered by Disqus
<-- END OF COMMENT BOX CODE -->

\ No newline at end of file
Added:
>
>
META FILEATTACHMENT attachment="GoogleAnalytics.txt" attr="h" comment="Script for Google Analytics" date="1350657862" name="GoogleAnalytics.txt" path="GoogleAnalytics.txt" size="549" stream="GoogleAnalytics.txt" user="Main.DavideRizzo" version="1"

Revision 62012-07-11 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

Revision 52012-05-14 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

Revision 42012-01-05 - JeanMichelGlorian

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

Revision 32011-06-24 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
Added:
>
>
<-- 
  • Set TOPICTITLE = Menus, toolbars, drag and drop
-->

PDF Version Portrait Landscape

Help Did you spot something wrong or missing on this page? If you have an account on this TWiki, you can fix it yourself by editing the page. If you don't have an account, you can send a message to the Editorial Board to tell us about it. Thank you in advance!

 

Menus, toolbars, drag & drop

Revision 22011-06-21 - JaimeSaiz

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

Menus, toolbars, drag & drop

Line: 34 to 34
 The main contract is to implement the SiteAction interface which has an utility implementation AbstractSiteAction where the only required task is to define the actionPerformed method:


Changed:
<
<
clear = new AbstractSiteAction(SiteAction.Style.AS_PUSH, CLEAR_ACTION, "Clear", IconLibrary.DELETE) {
>
>
clear = new AbstractSiteAction(SiteAction.Style.AS_PUSH, CLEAR_ACTION, "Clear", IconLibrary.DELETE) { @Override
  public void actionPerformed(ActionEvent e) { _button.setText("Cleared"); }
Line: 64 to 63
 It is possible to access the HIPE menu associated to each View via the ViewPart received at initialization time (method init of the Viewable contract for View).


Changed:
<
<
clear = new AbstractSiteAction(SiteAction.Style.AS_PUSH, CLEAR_ACTION, "Clear", IconLibrary.DELETE) { public void actionPerformed(ActionEvent e) { _button.setText("Cleared"); } };
>
>
clear = // AS BEFORE
 
Changed:
<
<
ActionBars menus = getPart().getActionBars(ID); menus.insert(new Insert(MENU, ID, RUN_ADDON), clear);
>
>
ActionBars viewMenu = getPart().getActionBars(ID); viewMenu.insert(new Insert(MENU, ID, RUN_ADDON), clear);
 
Changed:
<
<
As for the main menu, its access is still closed, since only the Editor area is allowed to redefine it. Nevertheless its internal behaviour is identical to the View one and it is described here for completeness.
>
>
As for the main menu, only the Editor area is allowed to redefine it. Nevertheless its internal behaviour is identical to the View one and it is described here for completeness.
 
Changed:
<
<
The main menu entries are accessible via herschel.ia.gui.kernel.menus.Insert.MAIN, which provides the handle to the identifier used for the main toolbar and menys.
>
>
The main menu entries are accessible via herschel.ia.gui.kernel.menus.Insert.MAIN, which provides the handle to the identifier used for the main toolbar and menus.
  Adding a new entry to the main menu:


Changed:
<
<
ActionBars mainMenu = getPart().getActionBars(herschel.ia.gui.kernel.menus.Insert.MAIN);
>
>
ActionBars mainMenu = getPart().getActionBars(MAIN);
  mainMenu.insert(new Insert(MENU,MAIN,RUN_ADDON),run);
Line: 108 to 102
 
	clear = // AS BEFORE

Changed:
<
<
ActionBars menus = getPart().getActionBars(herschel.ia.gui.kernel.menus.Insert.MAIN);
>
>
ActionBars menus = getPart().getActionBars(MAIN);
  menus.insert(new Insert(TOOLBAR, ID, RUN_ADDON), clear);

Revision 12011-06-21 - DavideRizzo

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="DpHipe"

Menus, toolbars, drag & drop

<--
   Some short-cuts  

-->

Menus, toolbars, pop-ups and drag & drop are supported in the HIPE interface and in the View components via the same set of interfaces.

The main contract is to implement the SiteAction interface which has an utility implementation AbstractSiteAction where the only required task is to define the actionPerformed method:

	clear = new AbstractSiteAction(SiteAction.Style.AS_PUSH, CLEAR_ACTION, "Clear",
		IconLibrary.DELETE) {

	    public void actionPerformed(ActionEvent e) {
		_button.setText("Cleared");
	    }
	};

Once the action is defined it is possible to associate it to a visible entry. HIPE comes with a predefined set of entries which are commonplaces for standard look and feel and similar operations. This insertion points are available via the Insert class which enumerates the allowed Extension values.

actions.insert(new Insert(Insert.Scheme.TOOLBAR, ID, Insert.Extension.RUN_ADDON), clear);

This code associates the clear action to an entry in the toolbar. More specialized examples are provided in the later paragraphs.

Menus

HIPE supports the development of menus in two areas:

  • Main menu
  • View menu

Once the action responsible for performing the code is defined, associating it with the predefined set of menus, toolbars and pop-ups just requires to get the handle to the right entity.

Each View has at its disposal an area for adding menu entries based on the general contract of the HIPE menu items.

It is possible to access the HIPE menu associated to each View via the ViewPart received at initialization time (method init of the Viewable contract for View).

	clear = new AbstractSiteAction(SiteAction.Style.AS_PUSH, CLEAR_ACTION, "Clear",
		IconLibrary.DELETE) {
	    public void actionPerformed(ActionEvent e) {
		_button.setText("Cleared");
	    }
	};

	ActionBars menus = getPart().getActionBars(ID);
	menus.insert(new Insert(MENU, ID, RUN_ADDON), clear);

As for the main menu, its access is still closed, since only the Editor area is allowed to redefine it. Nevertheless its internal behaviour is identical to the View one and it is described here for completeness.

The main menu entries are accessible via herschel.ia.gui.kernel.menus.Insert.MAIN, which provides the handle to the identifier used for the main toolbar and menys.

Adding a new entry to the main menu:

	ActionBars mainMenu = getPart().getActionBars(herschel.ia.gui.kernel.menus.Insert.MAIN);
        mainMenu.insert(new Insert(MENU,MAIN,RUN_ADDON),run);	

Retargeting the default entries:

	mainMenu.retarget(Retarget.COPY, copy);
	mainMenu.retarget(Retarget.SAVE, save);

Toolbars

Developing entries for the toolbar is identical to menu development. Only the Insert specification is different

	clear = // AS BEFORE

	ActionBars menus = getPart().getActionBars(ID);
	menus.insert(new Insert(TOOLBAR, ID, RUN_ADDON), clear);

Adding entries to the main toolbar is just as easy:

	clear = // AS BEFORE

	ActionBars menus = getPart().getActionBars(herschel.ia.gui.kernel.menus.Insert.MAIN);
	menus.insert(new Insert(TOOLBAR, ID, RUN_ADDON), clear);

Pop-up menus

Again, support for pop up menus is just as easy:

	clear = // AS BEFORE

	ActionBars menus = getPart().getActionBars(ID);
	menus.insert(new Insert(POPUP, ID, RUN_ADDON), clear);

An extra action is required to make your displayed compoment aware of the pop-up:

	this.addMouseListener(getPart().getMouseListener()); 	 

Drag & drop

HIPE uses a simplified support for drag & drop, whose main target is to be able to pass references from the Jython namespace.

A class that wants to implement the HIPE protocol must implement the DnDSelection interface and declare it to the Java TransferHandler system by registering it:

	setTransferHandler(new TransferHandler("variableSelection"));
This simple mechanism allows for receiving VariableSelection.

<--  
-->
 
This site is powered by the TWiki collaboration platform Powered by Perl