IDEMPIERE-4157: Removing open quick form tracking from sessionManager, Adding support for tool tip translation (#36)

This commit is contained in:
Deepak Pansheriya 2020-05-08 16:55:06 +05:30 committed by GitHub
parent 912767b4ec
commit df6b9c8c22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 175 additions and 103 deletions

View File

@ -0,0 +1,42 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Quick Form button tooltip message
-- Apr 14, 2020, 6:00:58 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','UnSort',0,0,'Y',TO_DATE('2020-04-14 18:00:57','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-04-14 18:00:57','YYYY-MM-DD HH24:MI:SS'),100,200594,'UnSort','D','59bd510b-a62a-44f3-8c5b-4d341ddfdb64')
;
-- Apr 14, 2020, 6:01:25 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Save and Close ( Alt+K )',0,0,'Y',TO_DATE('2020-04-14 18:01:24','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-04-14 18:01:24','YYYY-MM-DD HH24:MI:SS'),100,200595,'QuickFormOk','D','58187f07-3e1c-4e3f-9a5c-dfb3f0376dff')
;
-- Apr 14, 2020, 6:02:16 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Save changes ( Alt+S )',0,0,'Y',TO_DATE('2020-04-14 18:02:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-04-14 18:02:16','YYYY-MM-DD HH24:MI:SS'),100,200596,'QuickFormSave','D','af523275-d6a2-4844-8e0d-b54c10cda673')
;
-- Apr 14, 2020, 6:02:39 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Close quick form ( Alt+X )',0,0,'Y',TO_DATE('2020-04-14 18:02:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-04-14 18:02:38','YYYY-MM-DD HH24:MI:SS'),100,200597,'QuickFormCancel','D','4e7a74e2-145e-4db6-9caf-6eb86e6644d1')
;
-- Apr 14, 2020, 6:03:05 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Ignore changes ( Alt+Z )',0,0,'Y',TO_DATE('2020-04-14 18:03:04','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-04-14 18:03:04','YYYY-MM-DD HH24:MI:SS'),100,200598,'QuickFormIgnore','D','df828ee6-f7e8-4e1a-a7fe-4a8b73eacfc5')
;
-- Apr 14, 2020, 6:03:31 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Delete selected or current record ( Alt+D )',0,0,'Y',TO_DATE('2020-04-14 18:03:30','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-04-14 18:03:30','YYYY-MM-DD HH24:MI:SS'),100,200599,'QuickFormDelete','D','bffa36a5-4351-4057-993c-2026032eda9b')
;
-- Apr 14, 2020, 6:04:04 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Restore sorting to natural order ( Alt+R )',0,0,'Y',TO_DATE('2020-04-14 18:04:03','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-04-14 18:04:03','YYYY-MM-DD HH24:MI:SS'),100,200600,'QuickFormUnSort','D','4f50ef68-ea76-401a-90c2-21bf09ca9673')
;
-- Apr 14, 2020, 6:04:49 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','ReQuery all record ( Alt+E )',0,0,'Y',TO_DATE('2020-04-14 18:04:49','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-04-14 18:04:49','YYYY-MM-DD HH24:MI:SS'),100,200601,'QuickFormRefresh','D','2a89576d-a216-43d2-97ae-64221701ad99')
;
-- Apr 14, 2020, 6:05:11 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Customize grid ( Alt+L )',0,0,'Y',TO_DATE('2020-04-14 18:05:10','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-04-14 18:05:10','YYYY-MM-DD HH24:MI:SS'),100,200602,'QuickFormCustomize','D','52801c89-07fc-4a9b-a84a-7d752feb8d63')
;
SELECT register_migration_script('202005061900_IDEMPIERE-4157.sql') FROM dual
;

View File

@ -0,0 +1,39 @@
-- Quick Form button tooltip message
-- Apr 14, 2020, 6:00:58 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','UnSort',0,0,'Y',TO_TIMESTAMP('2020-04-14 18:00:57','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-04-14 18:00:57','YYYY-MM-DD HH24:MI:SS'),100,200594,'UnSort','D','59bd510b-a62a-44f3-8c5b-4d341ddfdb64')
;
-- Apr 14, 2020, 6:01:25 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Save and Close ( Alt+K )',0,0,'Y',TO_TIMESTAMP('2020-04-14 18:01:24','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-04-14 18:01:24','YYYY-MM-DD HH24:MI:SS'),100,200595,'QuickFormOk','D','58187f07-3e1c-4e3f-9a5c-dfb3f0376dff')
;
-- Apr 14, 2020, 6:02:17 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Save changes ( Alt+S )',0,0,'Y',TO_TIMESTAMP('2020-04-14 18:02:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-04-14 18:02:16','YYYY-MM-DD HH24:MI:SS'),100,200596,'QuickFormSave','D','af523275-d6a2-4844-8e0d-b54c10cda673')
;
-- Apr 14, 2020, 6:02:39 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Close quick form ( Alt+X )',0,0,'Y',TO_TIMESTAMP('2020-04-14 18:02:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-04-14 18:02:38','YYYY-MM-DD HH24:MI:SS'),100,200597,'QuickFormCancel','D','4e7a74e2-145e-4db6-9caf-6eb86e6644d1')
;
-- Apr 14, 2020, 6:03:05 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Ignore changes ( Alt+Z )',0,0,'Y',TO_TIMESTAMP('2020-04-14 18:03:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-04-14 18:03:04','YYYY-MM-DD HH24:MI:SS'),100,200598,'QuickFormIgnore','D','df828ee6-f7e8-4e1a-a7fe-4a8b73eacfc5')
;
-- Apr 14, 2020, 6:03:31 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Delete selected or current record ( Alt+D )',0,0,'Y',TO_TIMESTAMP('2020-04-14 18:03:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-04-14 18:03:30','YYYY-MM-DD HH24:MI:SS'),100,200599,'QuickFormDelete','D','bffa36a5-4351-4057-993c-2026032eda9b')
;
-- Apr 14, 2020, 6:04:04 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Restore sorting to natural order ( Alt+R )',0,0,'Y',TO_TIMESTAMP('2020-04-14 18:04:03','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-04-14 18:04:03','YYYY-MM-DD HH24:MI:SS'),100,200600,'QuickFormUnSort','D','4f50ef68-ea76-401a-90c2-21bf09ca9673')
;
-- Apr 14, 2020, 6:04:49 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','ReQuery all record ( Alt+E )',0,0,'Y',TO_TIMESTAMP('2020-04-14 18:04:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-04-14 18:04:49','YYYY-MM-DD HH24:MI:SS'),100,200601,'QuickFormRefresh','D','2a89576d-a216-43d2-97ae-64221701ad99')
;
-- Apr 14, 2020, 6:05:11 PM IST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Customize grid ( Alt+L )',0,0,'Y',TO_TIMESTAMP('2020-04-14 18:05:10','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-04-14 18:05:10','YYYY-MM-DD HH24:MI:SS'),100,200602,'QuickFormCustomize','D','52801c89-07fc-4a9b-a84a-7d752feb8d63')
;
SELECT register_migration_script('202005061900_IDEMPIERE-4157.sql') FROM dual
;

View File

@ -94,7 +94,7 @@ public class ADWindowContent extends AbstractADWindowContent
ZKUpdateUtil.setVflex(north, "0"); ZKUpdateUtil.setVflex(north, "0");
toolbar.setParent(div); toolbar.setParent(div);
toolbar.setWindowNo(getWindowNo()); toolbar.setWindowNo(getWindowNo());
breadCrumb = new BreadCrumb(getWindowNo()); breadCrumb = new BreadCrumb(this, getWindowNo());
breadCrumb.setToolbarListener(this); breadCrumb.setToolbarListener(this);
breadCrumb.setId("breadCrumb"); breadCrumb.setId("breadCrumb");
div.appendChild(breadCrumb); div.appendChild(breadCrumb);

View File

@ -171,16 +171,19 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
private int prevWidth; private int prevWidth;
private AbstractADWindowContent windowContent;
/** Last Modifier of Action Event */ /** Last Modifier of Action Event */
// public int lastModifiers; // public int lastModifiers;
// //
public ADWindowToolbar() public ADWindowToolbar()
{ {
this(0); this(null, 0);
} }
public ADWindowToolbar(int windowNo) { public ADWindowToolbar(AbstractADWindowContent windowContent, int windowNo) {
this.windowContent = windowContent;
setWindowNo(windowNo); setWindowNo(windowNo);
init(); init();
if (ClientInfo.isMobile()) { if (ClientInfo.isMobile()) {
@ -502,9 +505,12 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
} }
} else if (eventName.equals(Events.ON_CTRL_KEY)) } else if (eventName.equals(Events.ON_CTRL_KEY))
{ {
KeyEvent keyEvent = (KeyEvent) event; KeyEvent keyEvent = (KeyEvent) event;
if (SessionManager.getOpenQuickFormTabs().size() > 0 && !(keyEvent.getKeyCode() == KeyEvent.F2))
return; // If Quick form is opened then prevent toolbar shortcut key events.
if (!(keyEvent.getKeyCode() == KeyEvent.F2) && windowContent != null && windowContent.getOpenQuickFormTabs().size() > 0)
return;
if (LayoutUtils.isReallyVisible(this)) { if (LayoutUtils.isReallyVisible(this)) {
//filter same key event that is too close //filter same key event that is too close
//firefox fire key event twice when grid is visible //firefox fire key event twice when grid is visible

View File

@ -204,6 +204,11 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
*/ */
protected StatusBar statusBarQF; protected StatusBar statusBarQF;
/**
* Maintain no of quick form tabs open
*/
ArrayList <Integer> quickFormOpenTabs = new ArrayList <Integer>();
/** /**
* Constructor * Constructor
* @param ctx * @param ctx
@ -256,7 +261,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
private void initComponents() private void initComponents()
{ {
/** Initalise toolbar */ /** Initalise toolbar */
toolbar = new ADWindowToolbar(getWindowNo()); toolbar = new ADWindowToolbar(this, getWindowNo());
toolbar.setId("windowToolbar"); toolbar.setId("windowToolbar");
toolbar.addListener(this); toolbar.addListener(this);
@ -1113,7 +1118,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{ {
logger.log(Level.FINE, "Invoke Quick Form"); logger.log(Level.FINE, "Invoke Quick Form");
// Prevent to open Quick Form if already opened. // Prevent to open Quick Form if already opened.
if (!SessionManager.registerQuickFormTab(getADTab().getSelectedGridTab().getAD_Tab_ID())) if (!this.registerQuickFormTab(getADTab().getSelectedGridTab().getAD_Tab_ID()))
{ {
logger.fine("TabID=" + getActiveGridTab().getAD_Tab_ID() + " is already open."); logger.fine("TabID=" + getActiveGridTab().getAD_Tab_ID() + " is already open.");
return; return;
@ -3681,5 +3686,42 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{ {
this.currQGV = currQGV; this.currQGV = currQGV;
} }
/**
* Close Quick form to remove tabID from the list
*
* @param AD_Tab_ID
*/
public void closeQuickFormTab(Integer AD_Tab_ID)
{
quickFormOpenTabs.remove(AD_Tab_ID);
} // closeQuickFormTab
/**
* Get list of open quick form tabs
*
* @return list of tabIDs
*/
public ArrayList <Integer> getOpenQuickFormTabs( )
{
return quickFormOpenTabs;
} // getOpenQuickFormTabs
/**
* Register Quick form against tabID
*
* @param AD_Tab_ID
* @return False when already quick form opens for same tab
*/
public boolean registerQuickFormTab(Integer AD_Tab_ID)
{
if (quickFormOpenTabs.contains(AD_Tab_ID))
{
return false;
}
quickFormOpenTabs.add(AD_Tab_ID);
return true;
} // registerQuickFormTab
} }

View File

@ -92,10 +92,14 @@ public class BreadCrumb extends Div implements EventListener<Event> {
private GridTab m_gridTab; private GridTab m_gridTab;
private AbstractADWindowContent windowContent;
/** /**
* * @param windowContent
* @param windowNo
*/ */
public BreadCrumb(int windowNo) { public BreadCrumb(AbstractADWindowContent windowContent, int windowNo) {
this.windowContent = windowContent;
this.windowNo = windowNo; this.windowNo = windowNo;
layout = new Hbox(); layout = new Hbox();
layout.setPack("start"); layout.setPack("start");
@ -325,7 +329,11 @@ public class BreadCrumb extends Div implements EventListener<Event> {
} }
} else if (event.getName().equals(Events.ON_CTRL_KEY)) { } else if (event.getName().equals(Events.ON_CTRL_KEY)) {
if (!LayoutUtils.isReallyVisible(this)) return; if (!LayoutUtils.isReallyVisible(this)) return;
// If Quick form is opened then prevent navigation keyEvent
if (windowContent != null && windowContent.getOpenQuickFormTabs().size() > 0)
return;
KeyEvent keyEvent = (KeyEvent) event; KeyEvent keyEvent = (KeyEvent) event;
if (keyEvent.isAltKey()) { if (keyEvent.isAltKey()) {
if (keyEvent.getKeyCode() == KeyEvent.LEFT) { if (keyEvent.getKeyCode() == KeyEvent.LEFT) {

View File

@ -105,8 +105,11 @@ public class QuickGridView extends Vbox
private static final String ATTR_ON_POST_SELECTED_ROW_CHANGED = "org.adempiere.webui.adwindow.GridView.onPostSelectedRowChanged"; private static final String ATTR_ON_POST_SELECTED_ROW_CHANGED = "org.adempiere.webui.adwindow.GridView.onPostSelectedRowChanged";
public static final String CNTRL_KEYS = "#left#right#up#down#home@k@r"; public static final String CNTRL_KEYS = "#left#right#up#down#home@k@r";
// 'Enter' Work as Down key
private static final int KEYBOARD_KEY_ENTER = 13;
// Event Listeners // Event Listeners
public static final String EVENT_ON_SELECT_ROW = "onSelectRow"; public static final String EVENT_ON_SELECT_ROW = "onSelectRow";
public static final String EVENT_ON_CUSTOMIZE_GRID = "onCustomizeGrid"; public static final String EVENT_ON_CUSTOMIZE_GRID = "onCustomizeGrid";
@ -168,25 +171,6 @@ public class QuickGridView extends Vbox
// To prevent 'onFocus' event fire twice on same component. // To prevent 'onFocus' event fire twice on same component.
private Component preEventComponent; private Component preEventComponent;
// 'Alt + K' for Save and Close
private static final int KEYBOARD_KEY_K = 75;
// 'Alt + S' for Save
private static final int KEYBOARD_KEY_S = 83;
// 'Alt + Z' for Ignore
private static final int KEYBOARD_KEY_Z = 90;
// 'Alt + E' for Refresh
private static final int KEYBOARD_KEY_E = 69;
// 'Enter' Work as Down key
private static final int KEYBOARD_KEY_ENTER = 13;
// 'Alt + D' for Delete
private static final int KEYBOARD_KEY_D = 68;
// 'Alt + X' for Close
private static final int KEYBOARD_KEY_X = 88;
// 'Alt + L' for opening Customize grid panel
private static final int KEYBOARD_KEY_L = 76;
// 'Alt + R' for UnSort
private static final int KEYBOARD_KEY_R = 82;
public WQuickForm quickForm; public WQuickForm quickForm;
public GridField[] getGridField() { public GridField[] getGridField() {
@ -950,36 +934,36 @@ public class QuickGridView extends Vbox
} }
else if (!isCtrl && isAlt && !isShift) else if (!isCtrl && isAlt && !isShift)
{ {
if (code == KEYBOARD_KEY_K) if (code == ADWindowToolbar.VK_K)
{ {
quickForm.onSave(); quickForm.onSave();
quickForm.dispose(); quickForm.dispose();
} }
else if (code == KEYBOARD_KEY_S) else if (code == ADWindowToolbar.VK_S)
{ {
quickForm.onSave(); quickForm.onSave();
} }
else if (code == KEYBOARD_KEY_D) else if (code == ADWindowToolbar.VK_D)
{ {
quickForm.onDelete(); quickForm.onDelete();
} }
else if (code == KEYBOARD_KEY_Z) else if (code == ADWindowToolbar.VK_Z)
{ {
quickForm.onIgnore(); quickForm.onIgnore();
} }
else if (code == KEYBOARD_KEY_E) else if (code == ADWindowToolbar.VK_E)
{ {
quickForm.onRefresh(); quickForm.onRefresh();
} }
else if (code == KEYBOARD_KEY_X) else if (code == ADWindowToolbar.VK_X)
{ {
quickForm.onCancel(); quickForm.onCancel();
} }
else if (code == KEYBOARD_KEY_L) else if (code == ADWindowToolbar.VK_L)
{ {
quickForm.onCustomize(); quickForm.onCustomize();
} }
else if (code == KEYBOARD_KEY_R) else if (code == ADWindowToolbar.VK_R)
{ {
quickForm.onUnSort(); quickForm.onUnSort();
} }

View File

@ -141,24 +141,19 @@ public class WQuickForm extends Window implements EventListener <Event>, DataSta
bCustomize.addEventListener(Events.ON_CLICK, this); bCustomize.addEventListener(Events.ON_CLICK, this);
bUnSort.addEventListener(Events.ON_CLICK, this); bUnSort.addEventListener(Events.ON_CLICK, this);
// @TODO: translate extra quickform tooltips
// Add Shortcut Key info in tool-tip
bSave.setTooltiptext(bSave.getTooltiptext() + " (Alt+S) Save current record if modified");
bIgnore.setTooltiptext(bIgnore.getTooltiptext() + " (Alt+Z) Ignore un-save changes of current record");
bDelete.setTooltiptext(bDelete.getTooltiptext() + " (Alt+D) Delete selected or current record");
bCustomize.setTooltiptext(bCustomize.getTooltiptext() + " (Alt+L) Customize panel as per user");
Button bRefresh = confirmPanel.getButton(ConfirmPanel.A_REFRESH); Button bRefresh = confirmPanel.getButton(ConfirmPanel.A_REFRESH);
bRefresh.setTooltiptext(bRefresh.getTooltiptext() + " (Alt+E) ReQuery all record"); Button bCancel = confirmPanel.getButton(ConfirmPanel.A_CANCEL);
Button bOk = confirmPanel.getButton(ConfirmPanel.A_OK);
Button bCancle = confirmPanel.getButton(ConfirmPanel.A_CANCEL); // Set tool-tip information
bCancle.setTooltiptext(bCancle.getTooltiptext() + " (Alt+X) Close quick form"); bSave.setTooltiptext(Msg.translate(Env.getCtx(), "QuickFormSave")); // 'Alt + S'
bDelete.setTooltiptext(Msg.translate(Env.getCtx(), "QuickFormDelete")); // 'Alt + D'
Button bok = confirmPanel.getButton(ConfirmPanel.A_OK); bIgnore.setTooltiptext(Msg.translate(Env.getCtx(), "QuickFormIgnore")); // 'Alt + Z'
bok.setTooltiptext(bok.getTooltiptext() + " (Alt+K) Save and Close quick form"); bUnSort.setTooltiptext(Msg.translate(Env.getCtx(), "QuickFormUnSort")); // 'Alt + R'
bCustomize.setTooltiptext(Msg.translate(Env.getCtx(), "QuickFormCustomize")); // 'Alt + L'
Button bunSort = confirmPanel.getButton("UnSort"); bOk.setTooltiptext(Msg.translate(Env.getCtx(), "QuickFormOk")); // 'Alt + K' - Save_Close
bunSort.setTooltiptext(bunSort.getTooltiptext() + " (Alt + R) Restore sorting to natural if column sorted"); bCancel.setTooltiptext(Msg.translate(Env.getCtx(), "QuickFormCancel")); // 'Alt + X'
bRefresh.setTooltiptext(Msg.translate(Env.getCtx(), "QuickFormRefresh")); // 'Alt + E'
confirmPanel.addComponentsLeft(bSave); confirmPanel.addComponentsLeft(bSave);
confirmPanel.addComponentsLeft(bDelete); confirmPanel.addComponentsLeft(bDelete);
@ -386,7 +381,7 @@ public class WQuickForm extends Window implements EventListener <Event>, DataSta
gridTab.setQuickForm(false); gridTab.setQuickForm(false);
onIgnore(); onIgnore();
gridTab.removeDataStatusListener(this); gridTab.removeDataStatusListener(this);
SessionManager.closeQuickFormTab(gridTab.getAD_Tab_ID()); adWinContent.closeQuickFormTab(gridTab.getAD_Tab_ID());
quickGridView.getRenderer().clearMaps(); quickGridView.getRenderer().clearMaps();
int tabLevel = adWinContent.getToolbar().getQuickFormTabHrchyLevel(); int tabLevel = adWinContent.getToolbar().getQuickFormTabHrchyLevel();
if (tabLevel > 0) if (tabLevel > 0)
@ -400,7 +395,7 @@ public class WQuickForm extends Window implements EventListener <Event>, DataSta
{ {
adWinContent.onParentRecord(); adWinContent.onParentRecord();
SessionManager.getSessionApplication().getKeylistener().addEventListener(Events.ON_CTRL_KEY, prevQGV); SessionManager.getSessionApplication().getKeylistener().addEventListener(Events.ON_CTRL_KEY, prevQGV);
// TODO need to set focus on last focused row of parent Form. // need to set focus on last focused row of parent Form.
Events.echoEvent(QuickGridView.EVENT_ON_PAGE_NAVIGATE, prevQGV, null); Events.echoEvent(QuickGridView.EVENT_ON_PAGE_NAVIGATE, prevQGV, null);
} }
adWinContent.setCurrQGV(prevQGV); adWinContent.setCurrQGV(prevQGV);

View File

@ -18,7 +18,6 @@
package org.adempiere.webui.session; package org.adempiere.webui.session;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.LinkedList;
import java.util.Properties; import java.util.Properties;
import org.adempiere.webui.IWebClient; import org.adempiere.webui.IWebClient;
@ -27,8 +26,6 @@ import org.adempiere.webui.desktop.IDesktop;
import org.compiere.model.MUser; import org.compiere.model.MUser;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.zkoss.zk.ui.Desktop; import org.zkoss.zk.ui.Desktop;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Session;
/** /**
* *
@ -39,8 +36,6 @@ import org.zkoss.zk.ui.Session;
public class SessionManager public class SessionManager
{ {
public static final String SESSION_APPLICATION = "SessionApplication"; public static final String SESSION_APPLICATION = "SessionApplication";
// Keep track of open Quick Form
public static final String SESSION_QUICKFORM = "SessionQuickForm";
public static boolean isUserLoggedIn(Properties ctx) public static boolean isUserLoggedIn(Properties ctx)
{ {
@ -98,43 +93,4 @@ public class SessionManager
if (app != null) if (app != null)
app.changeRole(user); app.changeRole(user);
} }
public static boolean registerQuickFormTab(Integer AD_Tab_ID)
{
LinkedList<Integer> openTabs = getOpenQuickFormTabs();
if (openTabs.contains(AD_Tab_ID))
{
return false;
}
openTabs.add(AD_Tab_ID);
getSession().setAttribute(SESSION_QUICKFORM, openTabs);
return true;
}
@SuppressWarnings("unchecked")
public static LinkedList<Integer> getOpenQuickFormTabs()
{
LinkedList<Integer> tabs = (LinkedList<Integer>) getSession().getAttribute(SESSION_QUICKFORM);
if (tabs == null)
{
tabs = new LinkedList<Integer>();
}
return tabs;
}
public static void closeQuickFormTab(Integer AD_Tab_ID)
{
LinkedList<Integer> openTabs = getOpenQuickFormTabs();
openTabs.remove(AD_Tab_ID);
getSession().setAttribute(SESSION_QUICKFORM, openTabs);
}
private static Session getSession()
{
return Executions.getCurrent().getDesktop().getSession();
}
} }