IDEMPIERE-4510 Add New to the toolbar search query combobox (#325)

* IDEMPIERE-4510 Add New to the toolbar search query combobox

* IDEMPIERE-4510 changed the if for a more defensive programming style

* IDEMPIERE-4510 Change placeholder text to Select Query to improve UX

* IDEMPIERE-4510 Modify migration scripts
This commit is contained in:
Diego Ruiz 2020-10-27 19:07:22 +01:00 committed by GitHub
parent 86732d69b7
commit 78393af99d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 3 deletions

View File

@ -0,0 +1,11 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-4510 Search in the toolbar improvement to work out of the box
-- Oct 27, 2020, 2:30:55 PM CET
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','Select Query',0,0,'Y',TO_DATE('2020-10-27 18:53:07','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-10-27 18:53:07','YYYY-MM-DD HH24:MI:SS'),100,200643,'SelectQuery','D','265f31ef-a92f-4898-bc38-5cbcd5d8523c')
;
SELECT register_migration_script('202010271430_IDEMPIERE-4510.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- IDEMPIERE-4510 Search in the toolbar improvement to work out of the box
-- Oct 27, 2020, 2:30:55 PM CET
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','Select Query',0,0,'Y',TO_TIMESTAMP('2020-10-27 18:53:07','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-10-27 18:53:07','YYYY-MM-DD HH24:MI:SS'),100,200643,'SelectQuery','D','265f31ef-a92f-4898-bc38-5cbcd5d8523c')
;
SELECT register_migration_script('202010271430_IDEMPIERE-4510.sql') FROM dual
;

View File

@ -95,6 +95,9 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
private static final CLogger log = CLogger.getCLogger(ADWindowToolbar.class); private static final CLogger log = CLogger.getCLogger(ADWindowToolbar.class);
/** Search messages using translation */
private String m_sNew;
private Combobox fQueryName; private Combobox fQueryName;
private MUserQuery[] userQueries; private MUserQuery[] userQueries;
private MUserQuery selectedUserQuery; private MUserQuery selectedUserQuery;
@ -200,9 +203,10 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
this.appendChild(menupopup); this.appendChild(menupopup);
//IDEMPIERE-4085 //IDEMPIERE-4085
m_sNew = "** ".concat(Msg.getMsg(Env.getCtx(), "New Query")).concat(" **");
fQueryName = new Combobox(); fQueryName = new Combobox();
fQueryName.setTooltiptext(Msg.getMsg(Env.getCtx(),"QueryName")); fQueryName.setTooltiptext(Msg.getMsg(Env.getCtx(),"SelectQuery"));
fQueryName.setPlaceholder(Msg.getMsg(Env.getCtx(),"QueryName")); fQueryName.setPlaceholder(Msg.getMsg(Env.getCtx(),"SelectQuery"));
fQueryName.setId(BTNPREFIX + "SearchQuery"); fQueryName.setId(BTNPREFIX + "SearchQuery");
fQueryName.addEventListener(Events.ON_SELECT, this); fQueryName.addEventListener(Events.ON_SELECT, this);
LayoutUtils.addSclass("toolbar-searchbox", fQueryName); LayoutUtils.addSclass("toolbar-searchbox", fQueryName);
@ -533,6 +537,10 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
if (index < 0) return; if (index < 0) return;
if (index == 0) // no query - refresh if (index == 0) // no query - refresh
setSelectedUserQuery(null); setSelectedUserQuery(null);
else if (m_sNew.equals(fQueryName.getValue())) { //On new send the Event to open the FindWindow
Events.sendEvent(Events.ON_CLICK, btnFind, null);
return;
}
else else
setSelectedUserQuery(userQueries[index-1]); setSelectedUserQuery(userQueries[index-1]);
@ -1226,6 +1234,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
setSelectedUserQuery(AD_UserQuery_ID); setSelectedUserQuery(AD_UserQuery_ID);
} }
} }
fQueryName.appendItem(m_sNew, 0);
if (AD_UserQuery_ID <= 0 || fQueryName.getItemCount() <= 1 if (AD_UserQuery_ID <= 0 || fQueryName.getItemCount() <= 1
|| fQueryName.getSelectedItem() == null) || fQueryName.getSelectedItem() == null)
fQueryName.setSelectedIndex(0); fQueryName.setSelectedIndex(0);