Difference: DpHipeCommonUtilities (1 vs. 39)

Revision 392014-02-20 - AlvarGarcia

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
<-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END -->
Line: 406 to 406
  As part of giving better support to developers and to help diagnose GUI problems, a Debug preferences category has been added to HIPE.
Changed:
<
<
The preference Enable debug in that new category shall be switched on to let debug services be run individually. When this preference is set, debug services will also be controllable through the Tools > Debug menu, which will be invisible while that master preference is unset. Current options for debug:
>
>
The preference Enable debug in that new category shall be switched on to let debug services be run individually. When this preference is set, debug services will also be controllable through the Tools -> Debug menu, which will be invisible while that master preference is unset. Current options for debug:
 
Changed:
<
<
  • Check the painting of graphical components: it checks that all painting is done in the EDT. If it is not the case then you have to move code to the EDT.
  • Check that the application is responsive: checks that no event in the EDT takes more than a second to process and that threads are not (inter)blocked. If it is the first case then you need to move code out of the EDT. If it is the second case then you need to redesign shared resource access.
  • Paint special border on the pointed component: this helps to diagnose GUI layout problems.
>
>
  • Check the painting of graphical components: it checks that all painting is done in the EDT. If it is not the case then you have to move code to the EDT.
  • Check that the application is responsive: checks that no event in the EDT takes more than a second to process and that threads are not (inter)blocked. If it is the first case then you need to move code out of the EDT. If it is the second case then you need to redesign shared resource access.
  • Paint special border on the component pointed at: this helps to diagnose GUI layout problems.
 

Provide an image preview of a FITS file

Line: 441 to 441
  If you want to store data at application exit like these, for being recovered at next HIPE start up, you can do it yourself by writing files within a site area (see previous tip).
Changed:
<
<
However, using the session persistor framework instead may save you some coding. Moreover, your session items would be exported and imported automatically with the File > Session > Export / Import options for free.
>
>
However, using the session persistor framework instead may save you some coding. Moreover, your session items would be exported and imported automatically with the File -> Session -> Export / Import options for free.
  The following example shows how to use it:
Line: 545 to 545
 
Navigator ia_gui_apps herschel.ia.gui.apps.views.navigator.NavigatorView
Outline
 
 
ia_gui_apps
 
 
herschel.ia.gui.apps.views.outline.OutlineView
herschel.ia.gui.apps.views.outline.OutlineComponent
herschel.ia.gui.apps.components.outline.*
Script editor
 
ia_jconsole
 
herschel.ia.jconsole.views.JythonEditorComponent
herschel.ia.jconsole.views.TextEditorComponent
Changed:
<
<
Console
 
 
ia_jconsole
 
 
herschel.ia.jconsole.views.ConsoleView
herschel.ia.jconsole.jython.Interpreter
herschel.ia.jconsole.jython.CommandExecutor
Variables view
 
ia_gui_apps
 
herschel.ia.gui.apps.views.variables.VariablesView
herschel.ia.gui.apps.views.variables..NameSpaceTree
>
>
Console
 
 
ia_jconsole
 
 
herschel.ia.jconsole.views.ConsoleView
herschel.ia.jconsole.jython.Interpreter
herschel.ia.gui.kernel.command.CommandExecutor
Variables view
 
ia_gui_apps
 
herschel.ia.gui.apps.views.variables.VariablesView
herschel.ia.gui.apps.views.variables.NameSpaceTree
 
Tasks view
 
ia_task
 
herschel.ia.task.views.TasksView
herschel.ia.task.views.TaskTree

Revision 382014-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: 21 to 21
 

Revision 372013-12-02 - JaimeSaiz

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
<-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END -->
Line: 540 to 540
 
Editor area
 
ia_gui_kernel
 
herschel.ia.gui.kernel.parts.EditorArea
herschel.ia.gui.kernel.parts.impl.EditorAreaImpl
Menus & toolbars
 
ia_gui_kernel
 
herschel.ia.gui.kernel.menus.MenuManager
herschel.ia.gui.kernel.menus.MenuManagerImpl
Look & feel ia_gui_kernel herschel.ia.gui.kernel.parts.impl.AbstractSite
Changed:
<
<
Start-up
 
 
ia_gui_kernel
ia_gui_apps
 
herschel.ia.gui.kernel.util.SplashWindow
herschel.ia.gui.apps.Hipe
herschel.ia.gui.apps.HipeStarter
>
>
Start-up
 
 
ia_gui_apps
ia_gui_kernel
 
herschel.ia.gui.apps.HipeStarter
herschel.ia.gui.kernel.SiteApplication
herschel.ia.gui.kernel.util.SplashWindow
 
Welcome pages ia_gui_apps herschel.ia.gui.apps.views.welcome.WelcomeView
Navigator ia_gui_apps herschel.ia.gui.apps.views.navigator.NavigatorView
Outline
 
 
ia_gui_apps
 
 
herschel.ia.gui.apps.views.outline.OutlineView
herschel.ia.gui.apps.views.outline.OutlineComponent
herschel.ia.gui.apps.components.outline.*
Script editor
 
ia_jconsole
 
herschel.ia.jconsole.views.JythonEditorComponent
herschel.ia.jconsole.views.TextEditorComponent
Console
 
 
ia_jconsole
 
 
herschel.ia.jconsole.views.ConsoleView
herschel.ia.jconsole.jython.Interpreter
herschel.ia.jconsole.jython.CommandExecutor
Variables view
 
ia_gui_apps
 
herschel.ia.gui.apps.views.variables.VariablesView
herschel.ia.gui.apps.views.variables..NameSpaceTree
Changed:
<
<
Tasks view
 
ia_task
 
herschel.ia.task.views.TasksView
herschel.ia.task.views..TaskTree
>
>
Tasks view
 
ia_task
 
herschel.ia.task.views.TasksView
herschel.ia.task.views.TaskTree
 
Line: 572 to 572
 
<-- END OF COMMENT BOX CODE -->

Deleted:
<
<
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like warning dialog" date="1219146496" name="hipe-warning.png" path="hipe-warning.png" size="13301" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="h" autoattached="1" comment="Script for Google Analytics" date="1350657576" name="GoogleAnalytics.txt" path="GoogleAnalytics.txt" size="549" user="Main.DavideRizzo" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like information dialog" date="1219146551" name="java-information.png" path="java-information.png" size="16352" user="Main.JaimeSaiz" version="1"
Deleted:
<
<
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like error dialog" date="1219146531" name="java-error.png" path="java-error.png" size="13505" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like error dialog" date="1219146474" name="hipe-error.png" path="hipe-error.png" size="11671" user="Main.JaimeSaiz" version="1"
Added:
>
>
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like warning dialog" date="1219146496" name="hipe-warning.png" path="hipe-warning.png" size="13301" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="" date="1322143188" name="Developing_GUIs_in_HIPE.pdf" path="Developing_GUIs_in_HIPE.pdf" size="395374" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like confirmation dialog" date="1219146514" name="java-confirmation.png" path="java-confirmation.png" size="11085" user="Main.JaimeSaiz" version="1"
Added:
>
>
META FILEATTACHMENT attr="h" autoattached="1" comment="Script for Google Analytics" date="1350657576" name="GoogleAnalytics.txt" path="GoogleAnalytics.txt" size="549" user="Main.DavideRizzo" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like error dialog" date="1219146531" name="java-error.png" path="java-error.png" size="13505" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like confirmation dialog" date="1219146453" name="hipe-confirmation.png" path="hipe-confirmation.png" size="11328" user="Main.JaimeSaiz" version="1"
META TOPICMOVED by="DavideRizzo" date="1272528356" from="Hcss.DpHipeCommonUtilities" to="Public.DpHipeCommonUtilities"

Revision 362012-11-21 - JavierDiaz

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
<-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END -->
Line: 546 to 546
 
Outline
 
 
ia_gui_apps
 
 
herschel.ia.gui.apps.views.outline.OutlineView
herschel.ia.gui.apps.views.outline.OutlineComponent
herschel.ia.gui.apps.components.outline.*
Script editor
 
ia_jconsole
 
herschel.ia.jconsole.views.JythonEditorComponent
herschel.ia.jconsole.views.TextEditorComponent
Console
 
 
ia_jconsole
 
 
herschel.ia.jconsole.views.ConsoleView
herschel.ia.jconsole.jython.Interpreter
herschel.ia.jconsole.jython.CommandExecutor
Changed:
<
<
Variables view
 
ia_inspector
 
herschel.ia.inspector.views.VariablesView
herschel.ia.inspector.JNameSpaceTree
Tasks view
 
ia_inspector
 
herschel.ia.inspector.views.TaskView
herschel.ia.inspector.JTaskTree
>
>
Variables view
 
ia_gui_apps
 
herschel.ia.gui.apps.views.variables.VariablesView
herschel.ia.gui.apps.views.variables..NameSpaceTree
Tasks view
 
ia_task
 
herschel.ia.task.views.TasksView
herschel.ia.task.views..TaskTree
 
Line: 572 to 572
 
<-- END OF COMMENT BOX CODE -->

Added:
>
>
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like warning dialog" date="1219146496" name="hipe-warning.png" path="hipe-warning.png" size="13301" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="h" autoattached="1" comment="Script for Google Analytics" date="1350657576" name="GoogleAnalytics.txt" path="GoogleAnalytics.txt" size="549" user="Main.DavideRizzo" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like information dialog" date="1219146551" name="java-information.png" path="java-information.png" size="16352" user="Main.JaimeSaiz" version="1"
Added:
>
>
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like error dialog" date="1219146531" name="java-error.png" path="java-error.png" size="13505" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like error dialog" date="1219146474" name="hipe-error.png" path="hipe-error.png" size="11671" user="Main.JaimeSaiz" version="1"
Deleted:
<
<
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like warning dialog" date="1219146496" name="hipe-warning.png" path="hipe-warning.png" size="13301" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="" date="1322143188" name="Developing_GUIs_in_HIPE.pdf" path="Developing_GUIs_in_HIPE.pdf" size="395374" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like confirmation dialog" date="1219146514" name="java-confirmation.png" path="java-confirmation.png" size="11085" user="Main.JaimeSaiz" version="1"
Deleted:
<
<
META FILEATTACHMENT attr="h" autoattached="1" comment="Script for Google Analytics" date="1350657576" name="GoogleAnalytics.txt" path="GoogleAnalytics.txt" size="549" user="Main.DavideRizzo" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like error dialog" date="1219146531" name="java-error.png" path="java-error.png" size="13505" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like confirmation dialog" date="1219146453" name="hipe-confirmation.png" path="hipe-confirmation.png" size="11328" user="Main.JaimeSaiz" version="1"
META TOPICMOVED by="DavideRizzo" date="1272528356" from="Hcss.DpHipeCommonUtilities" to="Public.DpHipeCommonUtilities"

Revision 352012-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 = Common utilities in HIPE
-->
Line: 569 to 572
 
<-- END OF COMMENT BOX CODE -->

Deleted:
<
<
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like warning dialog" date="1219146496" name="hipe-warning.png" path="hipe-warning.png" size="13301" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like information dialog" date="1219146551" name="java-information.png" path="java-information.png" size="16352" user="Main.JaimeSaiz" version="1"
Deleted:
<
<
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like error dialog" date="1219146531" name="java-error.png" path="java-error.png" size="13505" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like error dialog" date="1219146474" name="hipe-error.png" path="hipe-error.png" size="11671" user="Main.JaimeSaiz" version="1"
Added:
>
>
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like warning dialog" date="1219146496" name="hipe-warning.png" path="hipe-warning.png" size="13301" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="" date="1322143188" name="Developing_GUIs_in_HIPE.pdf" path="Developing_GUIs_in_HIPE.pdf" size="395374" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like confirmation dialog" date="1219146514" name="java-confirmation.png" path="java-confirmation.png" size="11085" user="Main.JaimeSaiz" version="1"
Added:
>
>
META FILEATTACHMENT attr="h" autoattached="1" comment="Script for Google Analytics" date="1350657576" name="GoogleAnalytics.txt" path="GoogleAnalytics.txt" size="549" user="Main.DavideRizzo" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like error dialog" date="1219146531" name="java-error.png" path="java-error.png" size="13505" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like confirmation dialog" date="1219146453" name="hipe-confirmation.png" path="hipe-confirmation.png" size="11328" user="Main.JaimeSaiz" version="1"
META TOPICMOVED by="DavideRizzo" date="1272528356" from="Hcss.DpHipeCommonUtilities" to="Public.DpHipeCommonUtilities"

Revision 342012-07-12 - DavideRizzo

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

Line: 40 to 41
  If you are a maintainer of the HIPE framework, you might find useful the section below as well.
Changed:
<
<
The following advices comprise both common development in a Java application and some HIPE specific matters.
>
>
The following advice includes common development in a Java application and some HIPE specific matters.
 

Choose appropriate log levels

Changed:
<
<
Log messages written with java.util.logging.Logger are now shown in the Log view.
>
>
Log messages written with java.util.logging.Logger are shown in the Log view.
  Please choose the log level appropriately, i.e.
Line: 59 to 60
 

Let the Stop button work

Changed:
<
<
One of the hot topics when working with HIPE is the little but important Stop button, which is meant for cancelling the current job. Letting it work properly is a cooperative issue.
>
>
One of the hot topics when working with HIPE is the Stop button, which is meant for cancelling the current job. Letting it work properly is a cooperative issue.
  When talking about cancellation in HIPE, we may divide three main areas:
Line: 88 to 89
 
  • Avoid calling SiteUtil.execAndWait(String command) and its variants from EDT even when the command does not perform any GUI stuff, since it could lead to a deadlock. If you want to execute a Jython command from EDT that involves any GUI operation, please call SiteUtil.execLater(String command) or use a SwingWorker.
Changed:
<
<
  • Do not instantiate Swing's JColorChooser directly; it has a bug that can lead the GUI to suffer deadlock. The ColorChooser class of ia_gui_kernel should be used instead.
>
>
  • Do not instantiate Swing's JColorChooser directly; it has a bug that can lead the GUI to suffer deadlock. Use the ColorChooser class of ia_gui_kernel instead.
 

Further information

Changed:
<
<
More advices can be found in the presentation Developing GUIs in HIPE PDF.
>
>
More advice can be found in the presentation Developing GUIs in HIPE PDF.
 
Line: 101 to 102
 
The Java Development Toolkit provides lots of libraries that developers coming from other languages like C/C++ find wonderful, because almost all basic funcionality in these languages need to be re-invented, copied or buyed.
Changed:
<
<
The Herschel Java code base is plenty of common utilities as well. Knowing them could help you in developing your tools with much less effort.
>
>
The Herschel Java code base has plenty of common utilities as well. Knowing them could help you in developing your tools with much less effort.
  Here is a list of some of these common packages:
Changed:
<
<
# Share functionality
herschel.share.interpreter
herschel.share.io
herschel.share.predicate
herschel.share.unit
herschel.share.util

# Utilities related to GUIs
herschel.ia.gui.kernel.util
herschel.ia.gui.apps.components.util
herschel.ia.gui.apps.modifier
>
>
  Here are some classes that can be highlighted among them. Please consult their Javadoc for more information.

Package Class Description
Changed:
<
<
herschel.ia.gui.apps.components.util BottomPanel Panel whose contents occupy all the available space from its position to the panel's container's bottom.
ColumnsPanel Panel organizing components in columns.
Dereferencer Loads an object or resource in the background, by informing HIPE of its busy status.
ListModelAdapter Adapter of a ListModel to a ComboBoxModel.
FoldingSectionsPanel Panel with sections in a vertical layout, where each section can be folded (hidden) or unfolded (shown) by the user with single clicks.
herschel.ia.gui.apps.components.variable AbstractVariableTree Holds a VariableSelection that can be represented in a tree, triggering SelectionEvent when a node is clicked, providing a popup menu for opening children nodes, etc.
herschel.ia.gui.kernel.util ImageUtil Fit an image to the given dimensions, make an image from a Java component.
TableUtil Resize columns and rows of a JTable according to its contents, allow sorting the table by clicking on a column, by also letting to unsort the table afterwards.
TreeUtil Some utilities for managing a JTree.
herschel.share.io IOUtil Converts objects into byte array back and forth, through serialization, taking into account also objects handled by resolvers (like Product, Dataset, etc.).
FileUtil Write and read text files in a line of code, avoid Windows' path separator problems in Jython commands, and more.
ResolverRegistry Registers resolver instances that know how to serialize or deserialize objects not implementing Serializable.
herschel.share.interpreter InterpreterUtil Utility methods regarding Jython.
InterpreterNameSpaceUtil More on the same area.
JythonConverters Generates the Jython code that would create a given object.
herschel.share.util ClassMap Specialization of Map holding classes as keys, where values can be found taking into account class hierarchies of the key classes.
InvertibleMap Specialization of Map that allows getting keys from values too.
ObjectUtil Test of object equality taking nulls into account, straightforward implementation of hashCode(), create instances from class names with nice handling of exceptions, non wordy casts...
StringUtil Fit a string to a given length, escape characters, flatten and unflatten string collections, encode and decode URLs...
WeakHashSet Specialization of Set holding WeakReference internally, which means that they can be removed in the background if no pointed by any other reference. Useful for listener collections.
>
>
herschel.ia.gui.apps.components.util BottomPanel Panel whose contents occupy all the available space from its position to the panel's container's bottom.
ColumnsPanel Panel organizing components in columns.
Dereferencer Loads an object or resource in the background, by informing HIPE of its busy status.
ListModelAdapter Adapter of a ListModel to a ComboBoxModel.
FoldingSectionsPanel Panel with sections in a vertical layout, where each section can be folded (hidden) or unfolded (shown) by the user with single clicks.
herschel.ia.gui.apps.components.variable AbstractVariableTree Holds a VariableSelection that can be represented in a tree, triggering SelectionEvent when a node is clicked, providing a popup menu for opening children nodes, etc.
herschel.ia.gui.kernel.util ImageUtil Fit an image to the given dimensions, make an image from a Java component.
TableUtil Resize columns and rows of a JTable according to its contents, allow sorting the table by clicking on a column, by also letting to unsort the table afterwards.
TreeUtil Some utilities for managing a JTree.
herschel.share.io IOUtil Converts objects into byte array back and forth, through serialization, taking into account also objects handled by resolvers (like Product, Dataset, etc.).
FileUtil Write and read text files in a line of code, avoid Windows' path separator problems in Jython commands, and more.
ResolverRegistry Registers resolver instances that know how to serialize or deserialize objects not implementing Serializable.
herschel.share.interpreter InterpreterUtil Utility methods regarding Jython.
InterpreterNameSpaceUtil More on the same area.
JythonConverters Generates the Jython code that would create a given object.
herschel.share.util ClassMap Specialization of Map holding classes as keys, where values can be found taking into account class hierarchies of the key classes.
InvertibleMap Specialization of Map that allows getting keys from values too.
ObjectUtil Test of object equality taking nulls into account, straightforward implementation of hashCode(), create instances from class names with nice handling of exceptions, non wordy casts...
StringUtil Fit a string to a given length, escape characters, flatten and unflatten string collections, encode and decode URLs...
WeakHashSet Specialization of Set holding WeakReference internally, which means that they can be removed in the background if no pointed by any other reference. Useful for listener collections.
  This list can be expanded; feel free to enrich it with more useful classes (please respect the alphabetical order when doing so).
Line: 156 to 154
 

Trigger events

Changed:
<
<
The standard way of triggering events is to get a reference to the %EVENTHADLER% interface, which contains all related methods to the HIPE event system. This is typically done via the ViewPart interface that is passed on through the init method of the Viewable.
>
>
The standard way of triggering events is to get a reference to the SiteEventHandler interface, which contains all related methods to the HIPE event system. This is typically done via the ViewPart interface that is passed on through the init method of the Viewable.
 
    private void someMethod() {
        :

Line: 571 to 569
 
<-- END OF COMMENT BOX CODE -->

Added:
>
>
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like warning dialog" date="1219146496" name="hipe-warning.png" path="hipe-warning.png" size="13301" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like information dialog" date="1219146551" name="java-information.png" path="java-information.png" size="16352" user="Main.JaimeSaiz" version="1"
Added:
>
>
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like error dialog" date="1219146531" name="java-error.png" path="java-error.png" size="13505" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like error dialog" date="1219146474" name="hipe-error.png" path="hipe-error.png" size="11671" user="Main.JaimeSaiz" version="1"
Deleted:
<
<
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like warning dialog" date="1219146496" name="hipe-warning.png" path="hipe-warning.png" size="13301" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="" date="1322143188" name="Developing_GUIs_in_HIPE.pdf" path="Developing_GUIs_in_HIPE.pdf" size="395374" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like confirmation dialog" date="1219146514" name="java-confirmation.png" path="java-confirmation.png" size="11085" user="Main.JaimeSaiz" version="1"
Deleted:
<
<
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like error dialog" date="1219146531" name="java-error.png" path="java-error.png" size="13505" user="Main.JaimeSaiz" version="1"
 
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like confirmation dialog" date="1219146453" name="hipe-confirmation.png" path="hipe-confirmation.png" size="11328" user="Main.JaimeSaiz" version="1"
META TOPICMOVED by="DavideRizzo" date="1272528356" from="Hcss.DpHipeCommonUtilities" to="Public.DpHipeCommonUtilities"

Revision 332012-05-14 - DavideRizzo

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

Revision 322012-04-24 - JaimeSaiz

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

Revision 312012-03-29 - JaimeSaiz

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

Revision 302012-03-27 - JaimeSaiz

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

Revision 292012-03-07 - JavierDiaz

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

Revision 282012-02-23 - JaimeSaiz

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

Revision 272011-12-19 - JaimeSaiz

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

Revision 262011-11-29 - JaimeSaiz

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

Revision 252011-11-24 - JaimeSaiz

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

Revision 242011-06-24 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
Added:
>
>
<-- 
  • Set TOPICTITLE = Common utilities in HIPE
-->

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!

 

Common utilities in HIPE

Line: 224 to 231
 
Added:
>
>
Please add your comments!
<--/commentPlugin-->
 
<--  
-->

Revision 232010-08-30 - RoBaS

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

Common utilities in HIPE

Line: 154 to 154
 
Object variable = ...;

Changed:
<
<
VariablesUtil.setVariable("yourVariable", variable);
>
>
VariablesUtil.addVariable("yourVariable", variable);
 

Revision 222010-08-17 - JaimeSaiz

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

Common utilities in HIPE

Line: 165 to 165
 

The PopupDialog class

Changed:
<
<
The Java Swing library provides a class for showing popup dialogs: JOptionPane.
>
>
The Java Swing library provides a class for showing popup dialogs: JOptionPane.
 This class is used in different modules along the project.

Now, in order to unify the look and feel of dialogs, and to simplify the API as well (the calls to JOptionPane are normally too long), there is a wrapper class which should be used for showing popup dialogs in HIPE: PopupDialog.

Line: 217 to 217
  Instead of needing to work with the Java API directly, when you want to load icons, HIPE provides some utilities for making the job easier:
Changed:
<
<
  • ia.gui.kernel.util.IconLibrary provides some static icons already loaded. If the icon you want to use is there, you are done.
  • ia.gui.kernel.util.IconLoader provides static methods for loading an icon: getIcon accepts a full path to an icon image, while getKernelIcon gets the provided icon image from the ia_gui_kernel location for icons.
>
>
  • ia.gui.kernel.util.IconLibrary provides some static icons already loaded. If the icon you want to use is there, you are done.
  • ia.gui.kernel.util.IconLoader provides static methods for loading an icon: getIcon accepts a full path to an icon image, while getKernelIcon gets the provided icon image from the ia_gui_kernel location for icons.
  If you want to add an icon to the system in your own module, use IconLoader.getIcon with the full path.

Revision 212010-06-10 - DavideRizzo

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

Common utilities in HIPE

Line: 13 to 13
 

Line: 184 to 184
 java-error.png java-information.png
Changed:
<
<
PopupDialog belongs to ia_gui_kernel, so it can be used from virtually any module in the project (see jake.depend for exceptions).
>
>
<-- PopupDialog belongs to ia_gui_kernel, so it can be used from virtually any module in the project (see jake.depend for exceptions). -->
  Help You can use PopupDialog as well if your component is used by both HIPE and JIDE. It internally checks whether to show the HIPE style icons or the Java standard ones.
Line: 218 to 217
  Instead of needing to work with the Java API directly, when you want to load icons, HIPE provides some utilities for making the job easier:
Changed:
<
<
  • IconLibrary provides some static icons already loaded. If the icon you want to use is there, you are done.
  • IconLoader provides static methods for loading an icon: getIcon accepts a full path to an icon image, while getKernelIcon gets the provided icon image from the ia_gui_kernel location for icons.
>
>
  • ia.gui.kernel.util.IconLibrary provides some static icons already loaded. If the icon you want to use is there, you are done.
  • ia.gui.kernel.util.IconLoader provides static methods for loading an icon: getIcon accepts a full path to an icon image, while getKernelIcon gets the provided icon image from the ia_gui_kernel location for icons.
 
Changed:
<
<
If you want to add a new icon to the system in your own module, just use IconLoader.getIcon with the full path.
>
>
If you want to add an icon to the system in your own module, use IconLoader.getIcon with the full path.
 

Revision 202010-06-09 - DavideRizzo

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

Common Utilities In Hipe

>
>

Common utilities in HIPE

 

<-- summary -->
Changed:
<
<
This section explains some common and recurrent tasks in Hipe, like:
>
>
This section explains some common and recurrent tasks in HIPE, like:
 
  • Communicating Views or Components with other Views or Components, by triggering events.
  • Send Jython statements for being executed by the Console.
Line: 36 to 36
 

Triggering events

SiteEventHandler interface

Changed:
<
<
The standard way of triggering events is to get a reference to the %EVENTHADLER% interface, which contains all related methods to the Hipe event system. This is typically done via the ViewPart interface that is passed on through the init method of the Viewable.
>
>
The standard way of triggering events is to get a reference to the %EVENTHADLER% interface, which contains all related methods to the HIPE event system. This is typically done via the ViewPart interface that is passed on through the init method of the Viewable.
 
    private void someMethod() {
        :

Line: 52 to 52
 

SiteUtil class

Changed:
<
<
The SiteUtil class provides a set of convenience methods to get access to the Hipe architecture. In order to get its access one condition must be met:
>
>
The SiteUtil class provides a set of convenience methods to get access to the HIPE architecture. In order to get its access one condition must be met:
 
Changed:
<
<
you know at least a reference to a Component that is part of Hipe (i.e. you know at least one java.awt.Component visible in Hipe).
>
>
you know at least a reference to a Component that is part of HIPE (i.e. you know at least one java.awt.Component visible in HIPE).
 
Changed:
<
<
Just assume that you are developing a Modifier for a task dialog and you want to inform Hipe about executing a required statement: the Modifier interface gives you no reference to a ViewPart so that you cannot trigger events in the previous way. However you know that the Modifier is visible in Hipe and therefore you accomplish the SiteUtil constraint:
>
>
Just assume that you are developing a Modifier for a task dialog and you want to inform HIPE about executing a required statement: the Modifier interface gives you no reference to a ViewPart so that you cannot trigger events in the previous way. However you know that the Modifier is visible in HIPE and therefore you accomplish the SiteUtil constraint:
 
    private void someMethod() {
        :

Line: 72 to 72
 

Sending execution events

Changed:
<
<
Hipe has a dedicated Event for asking the execution of Jython statement: CommandExecutionRequestEvent.
>
>
HIPE has a dedicated Event for asking the execution of Jython statement: CommandExecutionRequestEvent.
 The event is served by the ConsoleView and the result of its execution is visible both in the screen of the ConsoleView and in the list of the HistoryView (but you don't need to know about these views and their api).
Changed:
<
<
Every time a CommandExecutionRequestEvent event is served, Hipe generates an equivalent CommandExecutedEvent tracing the original CommandExecutionRequestEvent, so you can easily synchronize on the completion of the execution. However, this is not needed either, since SiteUtil class provides a convenient method for doing it: execAndWait.
>
>
Every time a CommandExecutionRequestEvent event is served, HIPE generates an equivalent CommandExecutedEvent tracing the original CommandExecutionRequestEvent, so you can easily synchronize on the completion of the execution. However, this is not needed either, since SiteUtil class provides a convenient method for doing it: execAndWait.
 
    private void someMethod() {

Line: 168 to 168
 The Java Swing library provides a class for showing popup dialogs: JOptionPane.
This class is used in different modules along the project.
Changed:
<
<
Now, in order to unify the look and feel of dialogs, and to simplify the API as well (the calls to JOptionPane are normally too long), there is a wrapper class which should be used for showing popup dialogs in Hipe: PopupDialog.
>
>
Now, in order to unify the look and feel of dialogs, and to simplify the API as well (the calls to JOptionPane are normally too long), there is a wrapper class which should be used for showing popup dialogs in HIPE: PopupDialog.
 
Changed:
<
<
Using this class we ensure that we use Hipe-like icons instead of Java-like icons:
>
>
Using this class we ensure that we use HIPE-like icons instead of Java-like icons:
 
Changed:
<
<
Dialogs with Hipe-like icons
>
>
Dialogs with HIPE-like icons
  hipe-confirmation.png hipe-error.png
Line: 214 to 214
 

How to load icons

Changed:
<
<
Icons are widely used in Hipe.
>
>
Icons are widely used in HIPE.
 
Changed:
<
<
Instead of needing to work with the Java API directly, when you want to load icons, Hipe provides some utilities for making the job easier:
>
>
Instead of needing to work with the Java API directly, when you want to load icons, HIPE provides some utilities for making the job easier:
 
  • IconLibrary provides some static icons already loaded. If the icon you want to use is there, you are done.
  • IconLoader provides static methods for loading an icon: getIcon accepts a full path to an icon image, while getKernelIcon gets the provided icon image from the ia_gui_kernel location for icons.

Revision 192010-05-17 - DavideRizzo

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

Common Utilities In Hipe

Line: 225 to 225
 
Added:
>
>
<--  
-->
 
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like information dialog" date="1219146551" name="java-information.png" path="java-information.png" size="16352" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like error dialog" date="1219146474" name="hipe-error.png" path="hipe-error.png" size="11671" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like warning dialog" date="1219146496" name="hipe-warning.png" path="hipe-warning.png" size="13301" user="Main.JaimeSaiz" version="1"

Revision 182010-04-29 - DavideRizzo

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

Common Utilities In Hipe

Line: 231 to 231
 
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like confirmation dialog" date="1219146514" name="java-confirmation.png" path="java-confirmation.png" size="11085" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like error dialog" date="1219146531" name="java-error.png" path="java-error.png" size="13505" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like confirmation dialog" date="1219146453" name="hipe-confirmation.png" path="hipe-confirmation.png" size="11328" user="Main.JaimeSaiz" version="1"
Changed:
<
<
META TOPICMOVED by="JaimeSaiz" date="1219135252" from="Hcss.DpHipeEventExecution" to="Hcss.DpHipeCommonUtilities"
>
>
META TOPICMOVED by="DavideRizzo" date="1272528356" from="Hcss.DpHipeCommonUtilities" to="Public.DpHipeCommonUtilities"

Revision 172010-04-20 - JaimeSaiz

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

Common Utilities In Hipe

Line: 136 to 136
  Tip, idea Prefer this way when you want the variable creation be recorded in the history, so it can be reproduced later.
Changed:
<
<
Example : For the PolygonHistogramPanel we need to construct a Double1d with the corners of the polygon (which are listed in Double1d edges) and add it to the variables map of the task panel :
>
>
Example: For the PolygonHistogramPanel we need to construct a Double1d with the corners of the polygon (which are listed in Double1d edges) and add it to the variables map of the task panel :
 
        Command c = SiteUtil.execAndWait("Double1d(" + edges.toString() + ")", "pyedges");
	String name = c.getOutputName();

Changed:
<
<
Object value = InterpreterFactory.getInterpreter().get(name, Double1d.class);
>
>
Object value = c.getOutputValue();
  VariableSelection edgesPixel = new VariableSelection(name, value);
Changed:
<
<
this.getMap().put(this.getTask().getSignature().getTaskParameter("edgesPixel"), edgesPixel);
>
>
getMap().put(getTask().getSignature().getTaskParameter("edgesPixel"), edgesPixel);
 

Revision 162010-04-20 - SaraRegibo

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

Common Utilities In Hipe

Line: 136 to 136
  Tip, idea Prefer this way when you want the variable creation be recorded in the history, so it can be reproduced later.
Added:
>
>
Example : For the PolygonHistogramPanel we need to construct a Double1d with the corners of the polygon (which are listed in Double1d edges) and add it to the variables map of the task panel :
        Command c = SiteUtil.execAndWait("Double1d(" + edges.toString() + ")", "pyedges");
	String name = c.getOutputName();
	Object value = InterpreterFactory.getInterpreter().get(name, Double1d.class);
	VariableSelection edgesPixel = new VariableSelection(name, value);
	this.getMap().put(this.getTask().getSignature().getTaskParameter("edgesPixel"), edgesPixel);
 

Without echo to the console

In this case, you can create the variable with any Java code (not to be executed by the interpreter), and then publish it like this:

Revision 152010-04-15 - JaimeSaiz

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

Common Utilities In Hipe

Line: 142 to 142
 
Object variable = ...;

Changed:
<
<
InterpreterFactory.getInterpreter().set("yourVariable", variable); SiteUtil.trigger(new VariablesCreatedEvent(this, Collections.singletonMap("yourVariable", variable)));
>
>
VariablesUtil.setVariable("yourVariable", variable);
 

Revision 142009-12-02 - DavideRizzo

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

Common Utilities In Hipe

Line: 27 to 27
 
Added:
>
>
 
<--
-->
Line: 210 to 212
  If you want to add a new icon to the system in your own module, just use IconLoader.getIcon with the full path.
Added:
>
>
 
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like information dialog" date="1219146551" name="java-information.png" path="java-information.png" size="16352" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like error dialog" date="1219146474" name="hipe-error.png" path="hipe-error.png" size="11671" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like warning dialog" date="1219146496" name="hipe-warning.png" path="hipe-warning.png" size="13301" user="Main.JaimeSaiz" version="1"

Revision 132009-06-17 - JaimeSaiz

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

Common Utilities In Hipe

Line: 117 to 117
 
Added:
>
>

Creating variables

During the processing of a particular view, it may be wanted to create a variable, so that it is shown in the Variables view and the user can do a further work with it.

Creating a variable can be done either with or without echo to the console.

With echo to the console

Just use one of the methods provided by SiteUtil:

  • Synchronous call: Command result = SiteUtil.execAndWait("yourVariable", "Something()");  // result will inform about the executed command

  • Asynchronous call: SiteUtil.execLater("yourVariable", "Something()");  // request execution to the interpreter but return immediately

Tip, idea Prefer this way when you want the variable creation be recorded in the history, so it can be reproduced later.

Without echo to the console

In this case, you can create the variable with any Java code (not to be executed by the interpreter), and then publish it like this:

Object variable = ...;
InterpreterFactory.getInterpreter().set("yourVariable", variable);
SiteUtil.trigger(new VariablesCreatedEvent(this, Collections.singletonMap("yourVariable", variable)));

Tip, idea Prefer this way when the creation of the variable is so complex that doing it with Jython commands would be too difficult.

 

Showing popup dialogs

The PopupDialog class

Revision 122009-06-17 - JaimeSaiz

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

Common Utilities In Hipe

Line: 98 to 98
 

Changed:
<
<
from herschel.ia.gui.kernel import SiteUtil
>
>
from herschel.ia.gui.kernel.util import SiteUtil
 from javax.swing import *

frame = JFrame("Hello Jython")

Revision 112008-10-08 - JaimeSaiz

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

Common Utilities In Hipe

Revision 102008-08-27 - JaimeSaiz

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

Common Utilities In Hipe

Line: 142 to 142
 

PopupDialog belongs to ia_gui_kernel, so it can be used from virtually any module in the project (see jake.depend for exceptions).

Added:
>
>
Help You can use PopupDialog as well if your component is used by both HIPE and JIDE. It internally checks whether to show the HIPE style icons or the Java standard ones.
 

Sample Java code

Revision 92008-08-20 - JaimeSaiz

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

Common Utilities In Hipe

Line: 141 to 141
 java-information.png
Changed:
<
<
PopupDialog belongs to ia_gui_kernel, so it can be used from any module in the project.
>
>
PopupDialog belongs to ia_gui_kernel, so it can be used from virtually any module in the project (see jake.depend for exceptions).
 

Sample Java code

Revision 82008-08-19 - JaimeSaiz

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

Common Utilities In Hipe

Line: 154 to 154
 int option = PopupDialog.YES_NO_CANCEL_OPTION; String title = "Unsaved changes"; String message = fileName + " has unsaved changes.\nSave before closing?";
Changed:
<
<
int res = PopupDialog.showConfirm(this, message, title, option);
>
>
int res = PopupDialog.showConfirm(this, message, option, title);
 if (res == PopupDialog.YES) { saveFile(); }

Revision 72008-08-19 - JaimeSaiz

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

Common Utilities In Hipe

Line: 128 to 128
  Using this class we ensure that we use Hipe-like icons instead of Java-like icons:
Changed:
<
<
Dialogs with Hipe-like icons
>
>
Dialogs with Hipe-like icons
 
Changed:
<
<
Dialogs with Java-like icons
>
>
hipe-confirmation.png hipe-error.png hipe-warning.png

Dialogs with Java-like icons

java-confirmation.png java-error.png java-information.png

PopupDialog belongs to ia_gui_kernel, so it can be used from any module in the project.

 

Sample Java code

Line: 155 to 166
 
Added:
>
>

How to load icons

Icons are widely used in Hipe.

Instead of needing to work with the Java API directly, when you want to load icons, Hipe provides some utilities for making the job easier:

  • IconLibrary provides some static icons already loaded. If the icon you want to use is there, you are done.
  • IconLoader provides static methods for loading an icon: getIcon accepts a full path to an icon image, while getKernelIcon gets the provided icon image from the ia_gui_kernel location for icons.

If you want to add a new icon to the system in your own module, just use IconLoader.getIcon with the full path.

META FILEATTACHMENT attr="" autoattached="1" comment="Java-like information dialog" date="1219146551" name="java-information.png" path="java-information.png" size="16352" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like error dialog" date="1219146474" name="hipe-error.png" path="hipe-error.png" size="11671" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like warning dialog" date="1219146496" name="hipe-warning.png" path="hipe-warning.png" size="13301" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like confirmation dialog" date="1219146514" name="java-confirmation.png" path="java-confirmation.png" size="11085" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Java-like error dialog" date="1219146531" name="java-error.png" path="java-error.png" size="13505" user="Main.JaimeSaiz" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="Hipe-like confirmation dialog" date="1219146453" name="hipe-confirmation.png" path="hipe-confirmation.png" size="11328" user="Main.JaimeSaiz" version="1"
 
META TOPICMOVED by="JaimeSaiz" date="1219135252" from="Hcss.DpHipeEventExecution" to="Hcss.DpHipeCommonUtilities"

Revision 62008-08-19 - JaimeSaiz

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

Triggering Events and Executing Statements In Hipe

>
>

Common Utilities In Hipe

 

<-- summary -->
Changed:
<
<
It is possible to communicate to Hipe and to all its Views by triggering events, with this you can also achieve to execute Jython statement whenever is necessary.
>
>
This section explains some common and recurrent tasks in Hipe, like:
 
Changed:
<
<
This section explains how you can send events to Hipe.
>
>
  • Communicating Views or Components with other Views or Components, by triggering events.
  • Send Jython statements for being executed by the Console.
  • The common way of showing errors and messages.
  • How to load icons.
 

Line: 29 to 31
 
<--
-->
Changed:
<
<

SiteEventHandler interface

>
>

Triggering events

SiteEventHandler interface

 
Changed:
<
<
The standard way to trigger events is to get a reference to the %EVENTHADLER% interface, which contains all related methods to the Hipe event system. This is typically done via the ViewPart interface that is passed on through the init method of the Viewable.
>
>
The standard way of triggering events is to get a reference to the %EVENTHADLER% interface, which contains all related methods to the Hipe event system. This is typically done via the ViewPart interface that is passed on through the init method of the Viewable.
 
    private void someMethod() {
        :

Line: 46 to 48
 However there are cases where you do not have access to a Viewable and you still want to trigger events for informing the rest of the system about something. In order to achieve this you can use a utility method available in a dedicated utility class.
Changed:
<
<

SiteUtil class

>
>

SiteUtil class

 
The SiteUtil class provides a set of convenience methods to get access to the Hipe architecture. In order to get its access one condition must be met:
Line: 64 to 66
 
Changed:
<
<

Executing Jython statements via the Event system

>
>

Executing Jython statements

Sending execution events

 
Hipe has a dedicated Event for asking the execution of Jython statement: CommandExecutionRequestEvent. The event is served by the ConsoleView and the result of its execution is visible both in the screen of the ConsoleView and in the list of the HistoryView (but you don't need to know about these views and their api).
Changed:
<
<
Every time a CommandExecutionRequestEvent event is served Hipe generates an equivalent CommandExecutedEvent event tracing the original CommandExecutionRequestEvent so you can easily synchronize on the completion of the execution. However this is not needed neither as SiteUtil class provides a convenient method for doing it: execAndWait.
>
>
Every time a CommandExecutionRequestEvent event is served, Hipe generates an equivalent CommandExecutedEvent tracing the original CommandExecutionRequestEvent, so you can easily synchronize on the completion of the execution. However, this is not needed either, since SiteUtil class provides a convenient method for doing it: execAndWait.
 
    private void someMethod() {

Line: 79 to 83
  : }
Deleted:
<
<
The execAndWait method returns a Command tracing all the information about its execution including the statement result (isSuccesful()), last but not least, SiteUtil contains other utility methods that allow for more options including a un-synchronized execution method.
 
Changed:
<
<
See SiteUtil for the full detail.
>
>
The execAndWait method returns a Command tracing all the information about its execution including the statement result (isSuccesful()).

Last but not least, SiteUtil contains other utility methods that allow for more options including a un-synchronized execution method. See SiteUtil for the full detail.

 
Changed:
<
<

A Jython Example

>
>

A Jython Example

 
Changed:
<
<
This example provides a quick script for testing the SiteUtil execution functionality directly from the console.
>
>
This example provides a short script for testing the SiteUtil execution functionality directly from the console.
 Please note:
Changed:
<
<
  • the reference used is _jconsole which is name available in jython and pointing to the jconsole (indeed visible)
  • the call is synchronous and therefore it stops the gui thread for the time of the execution (see http://java.sun.com/docs/books/tutorial/uiswing/concurrency/ for a general discussion about gui and thread).
>
>
  • the reference used is _jconsole, which is a name available in jython and pointing to the jconsole (indeed visible).
  • the call is synchronous and therefore it stops the gui thread for the time of the execution (see http://java.sun.com/docs/books/tutorial/uiswing/concurrency/ for a general discussion about gui and threads).
 
Added:
>
>
 
from herschel.ia.gui.kernel import SiteUtil
from javax.swing import *

Line: 107 to 113
 frame.setSize(300, 300) frame.show()
Added:
>
>

Showing popup dialogs

The PopupDialog class

The Java Swing library provides a class for showing popup dialogs: JOptionPane.
This class is used in different modules along the project.

Now, in order to unify the look and feel of dialogs, and to simplify the API as well (the calls to JOptionPane are normally too long), there is a wrapper class which should be used for showing popup dialogs in Hipe: PopupDialog.

 
Added:
>
>
Using this class we ensure that we use Hipe-like icons instead of Java-like icons:

Dialogs with Hipe-like icons

Dialogs with Java-like icons

Sample Java code

The API is easy and self-explanatory, just consult PopupDialog.

For example, the first dialog above could be generated with the following code:

int option = PopupDialog.YES_NO_CANCEL_OPTION;
String title = "Unsaved changes";
String message = fileName + " has unsaved changes.\nSave before closing?";
int res =  PopupDialog.showConfirm(this, message, title, option);
if (res == PopupDialog.YES) {
    saveFile();
}
if (res != PopupDialog.CANCEL && res != PopupDialog.CLOSED) {
    closeEditor();
}
 
Added:
>
>
 
Changed:
<
<
-- NicolaDeCandussio - 05 Jun 2008
>
>
META TOPICMOVED by="JaimeSaiz" date="1219135252" from="Hcss.DpHipeEventExecution" to="Hcss.DpHipeCommonUtilities"

Revision 52008-07-24 - JaimeSaiz

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

Triggering Events and Executing Statements In Hipe

Line: 14 to 14
 
Changed:
<
<
>
>
 
Line: 72 to 72
 Every time a CommandExecutionRequestEvent event is served Hipe generates an equivalent CommandExecutedEvent event tracing the original CommandExecutionRequestEvent so you can easily synchronize on the completion of the execution. However this is not needed neither as SiteUtil class provides a convenient method for doing it: execAndWait.


Changed:
<
<
private void somemethod() {
>
>
private void someMethod() {
  : // this is the reference to the modifier
Changed:
<
<
Command c = SiteUtil.execAndWait(this, "PRINT \"SOMETHING\"");
>
>
Command c = SiteUtil.execAndWait(this, "print 'something'");
  : }

Revision 42008-07-17 - JaimeSaiz

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

Triggering Events and Executing Statements In Hipe

Line: 50 to 50
 
The SiteUtil class provides a set of convenience methods to get access to the Hipe architecture. In order to get its access one condition must be met:
Changed:
<
<
you know at least a reference to a Component that is part of Hipe (i.e. you know at least one javax.swing.Component visible in Hipe).
>
>
you know at least a reference to a Component that is part of Hipe (i.e. you know at least one java.awt.Component visible in Hipe).
  Just assume that you are developing a Modifier for a task dialog and you want to inform Hipe about executing a required statement: the Modifier interface gives you no reference to a ViewPart so that you cannot trigger events in the previous way. However you know that the Modifier is visible in Hipe and therefore you accomplish the SiteUtil constraint:

Revision 32008-06-06 - JaimeSaiz

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

Triggering Events and Executing Statement In Hipe

>
>

Triggering Events and Executing Statements In Hipe

 

<-- summary -->
Line: 30 to 30
 -->

Changed:
<
<

SiteEventHandler interface

>
>

SiteEventHandler interface

 
Changed:
<
<
The standard way to trigger events is to get a reference to the %EVENTHADLER% interface which contains all related methods to the Hipe event system. This is typically achieved via the the ViewPart interface that is passed on through the init method of the Viewable.
>
>
The standard way to trigger events is to get a reference to the %EVENTHADLER% interface, which contains all related methods to the Hipe event system. This is typically done via the ViewPart interface that is passed on through the init method of the Viewable.
 

Changed:
<
<
private void somemethod() {
>
>
private void someMethod() {
  :
Changed:
<
<
getPart().getEventHandler().trigger(aSiteEvent)
>
>
getPart().getEventHandler().trigger(aSiteEvent);
  : }

Changed:
<
<
However there are cases where you do not have access to a Viewable and you still want to trigger events for informing the rest of the system about something. In order to achieve it you can use a utility method available in a dedicated utility class.
>
>
However there are cases where you do not have access to a Viewable and you still want to trigger events for informing the rest of the system about something. In order to achieve this you can use a utility method available in a dedicated utility class.
 
Changed:
<
<

SiteUtil class

>
>

SiteUtil class

 
The SiteUtil class provides a set of convenience methods to get access to the Hipe architecture. In order to get its access one condition must be met:
Changed:
<
<
you know at least a reference to a Component that is part of Hipe (i.e. you know at lest one javax.swing.Component visible in Hipe).
>
>
you know at least a reference to a Component that is part of Hipe (i.e. you know at least one javax.swing.Component visible in Hipe).
 
Changed:
<
<
Just assume that you are developing a Modifier for a task dialog and you want inform Hipe about executing a required statement: the Modifier interface gives you no reference to a VIEWPART so that you cannot trigger events.
>
>
Just assume that you are developing a Modifier for a task dialog and you want to inform Hipe about executing a required statement: the Modifier interface gives you no reference to a ViewPart so that you cannot trigger events in the previous way.
 However you know that the Modifier is visible in Hipe and therefore you accomplish the SiteUtil constraint:

Changed:
<
<
private void somemethod() {
>
>
private void someMethod() {
  : // this is the reference to the modifier SiteUtil.trigger(this, aSiteEvent);
Line: 64 to 64
 
Changed:
<
<

Executing Jython statements via the Event system.

>
>

Executing Jython statements via the Event system

 
Hipe has a dedicated Event for asking the execution of Jython statement: CommandExecutionRequestEvent. The event is served by the ConsoleView and the result of its execution is visible both in the screen of the ConsoleView and in the list of the HistoryView (but you don't need to know about these views and their api).
Line: 84 to 84
  See SiteUtil for the full detail.
Changed:
<
<

A Jtyhon Example

>
>

A Jython Example

 
This example provides a quick script for testing the SiteUtil execution functionality directly from the console. Please note:

Revision 22008-06-06 - NicolaDeCandussio

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

Triggering Events and Executing Statement In Hipe

Line: 12 to 12
 
Line: 67 to 67
 

Executing Jython statements via the Event system.

Hipe has a dedicated Event for asking the execution of Jython statement: CommandExecutionRequestEvent.
Changed:
<
<
The event is served by the ConsoleView and the result of its execution is visible both in the screen of the ConsoleView and in the list of the HistoryView (you don't need to know about these views and their api). http://java.sun.com/docs/books/tutorial/uiswing/concurrency/ Every time an CommandExecutionRequestEvent event is served Hipe generates an equivalent CommandExecutedEvent event traces the original CommandExecutionRequestEvent event so that you can easily synchronize on the completion of execution. However this is not needed neither as SiteUtil class provides a convenient method for doing it: execAndWait.
>
>
The event is served by the ConsoleView and the result of its execution is visible both in the screen of the ConsoleView and in the list of the HistoryView (but you don't need to know about these views and their api).

Every time a CommandExecutionRequestEvent event is served Hipe generates an equivalent CommandExecutedEvent event tracing the original CommandExecutionRequestEvent so you can easily synchronize on the completion of the execution. However this is not needed neither as SiteUtil class provides a convenient method for doing it: execAndWait.

 
    private void somemethod() {

Revision 12008-06-05 - NicolaDeCandussio

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

Triggering Events and Executing Statement In Hipe

<-- summary -->
It is possible to communicate to Hipe and to all its Views by triggering events, with this you can also achieve to execute Jython statement whenever is necessary.

This section explains how you can send events to Hipe.

<--
   Some short-cuts  
-->


<--
-->

SiteEventHandler interface

The standard way to trigger events is to get a reference to the %EVENTHADLER% interface which contains all related methods to the Hipe event system. This is typically achieved via the the ViewPart interface that is passed on through the init method of the Viewable.
    private void somemethod() {
        :
        getPart().getEventHandler().trigger(aSiteEvent)
        :
    }

However there are cases where you do not have access to a Viewable and you still want to trigger events for informing the rest of the system about something. In order to achieve it you can use a utility method available in a dedicated utility class.

SiteUtil class

The SiteUtil class provides a set of convenience methods to get access to the Hipe architecture. In order to get its access one condition must be met:

you know at least a reference to a Component that is part of Hipe (i.e. you know at lest one javax.swing.Component visible in Hipe).

Just assume that you are developing a Modifier for a task dialog and you want inform Hipe about executing a required statement: the Modifier interface gives you no reference to a VIEWPART so that you cannot trigger events. However you know that the Modifier is visible in Hipe and therefore you accomplish the SiteUtil constraint:

    private void somemethod() {
        :
        // this is the reference to the modifier
        SiteUtil.trigger(this, aSiteEvent);
        :
    }

Executing Jython statements via the Event system.

Hipe has a dedicated Event for asking the execution of Jython statement: CommandExecutionRequestEvent. The event is served by the ConsoleView and the result of its execution is visible both in the screen of the ConsoleView and in the list of the HistoryView (you don't need to know about these views and their api). http://java.sun.com/docs/books/tutorial/uiswing/concurrency/ Every time an CommandExecutionRequestEvent event is served Hipe generates an equivalent CommandExecutedEvent event traces the original CommandExecutionRequestEvent event so that you can easily synchronize on the completion of execution. However this is not needed neither as SiteUtil class provides a convenient method for doing it: execAndWait.

    private void somemethod() {
        :
        // this is the reference to the modifier
        Command c = SiteUtil.execAndWait(this, "PRINT \"SOMETHING\"");
        :
    }
The execAndWait method returns a Command tracing all the information about its execution including the statement result (isSuccesful()), last but not least, SiteUtil contains other utility methods that allow for more options including a un-synchronized execution method.

See SiteUtil for the full detail.

A Jtyhon Example

This example provides a quick script for testing the SiteUtil execution functionality directly from the console. Please note:
  • the reference used is _jconsole which is name available in jython and pointing to the jconsole (indeed visible)
  • the call is synchronous and therefore it stops the gui thread for the time of the execution (see http://java.sun.com/docs/books/tutorial/uiswing/concurrency/ for a general discussion about gui and thread).

from herschel.ia.gui.kernel import SiteUtil
from javax.swing import *

frame = JFrame("Hello Jython")

def perform(event):
   SiteUtil.execAndWait(_jconsole, "2*2", "A")
   
button = JButton("Press me", actionPerformed=perform)

frame.add(button)
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
frame.setSize(300, 300)
frame.show()

-- NicolaDeCandussio - 05 Jun 2008

 
This site is powered by the TWiki collaboration platform Powered by Perl