2121import org .openlowcode .client .graphic .CPageData ;
2222import org .openlowcode .client .graphic .CPageNode ;
2323import org .openlowcode .client .graphic .Callback ;
24+ import org .openlowcode .tools .misc .Pair ;
2425
2526import javafx .application .Platform ;
2627import javafx .event .ActionEvent ;
@@ -61,7 +62,7 @@ public interface ActionSourceTransformer {
6162
6263 private HashMap <String , UnsavedDataWarning > warningspernodepath ;
6364 private HashMap <Object , CPageAction > registeredevents ;
64- private HashMap <Object , HashMap <PageActionModifier , CPageAction >> registeredeventswithmodifier ;
65+ private HashMap <Object , HashMap <PageActionModifier , Pair < CPageAction , Boolean > >> registeredeventswithmodifier ;
6566 private HashMap <Object , HashMap <PageActionModifier , CPageInlineAction >> registeredinlineeventswithmodifier ;
6667 private HashMap <Object , Callback > registeredcallbacks ;
6768 private HashMap <Object , CPageInlineAction > registeredinlineactions ;
@@ -112,7 +113,7 @@ public void removedUnsavedDataWarningForNode(CPageNode node) {
112113 public void reset () {
113114 logger .fine (" --- *** --- Registered Events are cleaned" );
114115 registeredevents = new HashMap <Object , CPageAction >();
115- registeredeventswithmodifier = new HashMap <Object , HashMap <PageActionModifier , CPageAction >>();
116+ registeredeventswithmodifier = new HashMap <Object , HashMap <PageActionModifier , Pair < CPageAction , Boolean > >>();
116117 registeredinlineeventswithmodifier = new HashMap <Object , HashMap <PageActionModifier , CPageInlineAction >>();
117118 registeredinlineactions = new HashMap <Object , CPageInlineAction >();
118119 registeredcallbacks = new HashMap <Object , Callback >();
@@ -145,19 +146,39 @@ public void registerEvent(Object object, CPageAction action) {
145146 }
146147
147148 /**
149+ * Register an event with modifier for display of action result in the same tab
148150 * @param object the object (JAVAFX widget) that will fire an event
149151 * @param action the action to launch in that case
150152 * @param modifier relevant modifier (like Control, Shift pressed)
151153 */
152154 public void registerEventWithModifier (Object object , CPageAction action , PageActionModifier modifier ) {
153- HashMap <PageActionModifier , CPageAction > actions = registeredeventswithmodifier .get (object );
155+ registerEventWithModifier (object ,action ,modifier ,false );
156+ }
157+
158+ /**
159+ * Register an event with modifier for display of action result in the same tab
160+ *
161+ * @param object the object (JAVAFX widget) that will fire an event
162+ * @param action the action to launch in that case
163+ * @param modifier relevant modifier (like Control, Shift pressed)
164+ * @param openinnewtab if true, action result shown in new tab (keeping current
165+ * page in current tab), if false action result shown on
166+ * current tab (overwriting current page)
167+ * @since 1.1
168+ */
169+ public void registerEventWithModifier (
170+ Object object ,
171+ CPageAction action ,
172+ PageActionModifier modifier ,
173+ boolean openinnewtab ) {
174+ HashMap <PageActionModifier , Pair <CPageAction ,Boolean >> actions = registeredeventswithmodifier .get (object );
154175 if (actions == null ) {
155- actions = new HashMap <PageActionModifier , CPageAction >();
176+ actions = new HashMap <PageActionModifier , Pair < CPageAction , Boolean > >();
156177 registeredeventswithmodifier .put (object , actions );
157178 }
158- actions .put (modifier , action );
159- }
179+ actions .put (modifier , new Pair <CPageAction ,Boolean >(action ,new Boolean (openinnewtab )));
160180
181+ }
161182
162183 /**
163184 * @return the mouse handler from this page action manager
@@ -429,7 +450,7 @@ public void handle(MouseEvent event) {
429450 }
430451 // managing monoclick. Typically, this may have modifiers
431452
432- HashMap <PageActionModifier , CPageAction > actionswithmodifier = registeredeventswithmodifier
453+ HashMap <PageActionModifier , Pair < CPageAction , Boolean > > actionswithmodifier = registeredeventswithmodifier
433454 .get (finalobject );
434455 if (actionswithmodifier == null ) {
435456 CPageAction currentaction = registeredevents .get (finalobject );
@@ -450,9 +471,9 @@ public void handle(MouseEvent event) {
450471 while (modifierlist .hasNext ()) {
451472 PageActionModifier modifier = modifierlist .next ();
452473 if (modifier .isActionWithModifier (event )) {
453- CPageAction currentaction = actionswithmodifier .get (modifier );
474+ Pair < CPageAction , Boolean > currentaction = actionswithmodifier .get (modifier );
454475 if (currentaction !=null ) {
455- processAction (currentaction );
476+ processAction (currentaction . getFirstobject (), currentaction . getSecondobject (). booleanValue () );
456477 return ;
457478 }
458479 }
0 commit comments