IDEMPIERE-3340 Adaxa's User Favorite which allow user to organize their menu, create folders (#569)

* Login Automatic Open Sequence -> buttons don't require names
* Login Automatic Open Sequence -> buttons look bad with non-font icons
* Clicking on + on an item of the favourites throws an NPE
* Implement same approach about checking for new button restricted on menu search, menu popup and quick entry popup
This commit is contained in:
Carlos Ruiz 2021-02-04 21:39:15 +01:00 committed by GitHub
parent 373225a62c
commit 0669760711
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 44 deletions

View File

@ -14,21 +14,5 @@ INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,
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','Expand/Collapse Tree',0,0,'Y',TO_DATE('2021-01-18 18:56:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-01-18 18:56:38','YYYY-MM-DD HH24:MI:SS'),100,200658,'Tooltip_ExpandCollapseTree','D','26463bcc-7a17-444c-aab4-51fda0fde442')
;
-- May 7, 2020 7:15:41 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','Move Down',0,0,'Y',TO_DATE('2020-05-07 19:15:40','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-05-07 19:15:40','YYYY-MM-DD HH24:MI:SS'),100,200608,'MoveDown','D','525bf4d4-5ce3-4a7d-9081-2e3b96708cf1')
;
-- May 7, 2020 7:16: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','Move Up',0,0,'Y',TO_DATE('2020-05-07 19:16:03','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-05-07 19:16:03','YYYY-MM-DD HH24:MI:SS'),100,200609,'MoveUp','D','bdf56785-ce50-49ce-a2c5-d20a1a08ec96')
;
-- May 7, 2020 7:16: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','Move Left',0,0,'Y',TO_DATE('2020-05-07 19:16:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-05-07 19:16:16','YYYY-MM-DD HH24:MI:SS'),100,200610,'MoveLeft','D','f0082f8f-7ecf-4682-9ee2-593b6b21fe41')
;
-- May 7, 2020 7:16: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','Move Right',0,0,'Y',TO_DATE('2020-05-07 19:16:30','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-05-07 19:16:30','YYYY-MM-DD HH24:MI:SS'),100,200611,'MoveRight','D','0d2f8a50-350d-43c5-9629-64c3a6ea88d1')
;
SELECT register_migration_script('202101181900_IDEMPIERE-3340.sql') FROM dual
;
;

View File

@ -11,21 +11,5 @@ INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,
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','Expand/Collapse Tree',0,0,'Y',TO_TIMESTAMP('2021-01-18 18:56:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-01-18 18:56:38','YYYY-MM-DD HH24:MI:SS'),100,200658,'Tooltip_ExpandCollapseTree','D','26463bcc-7a17-444c-aab4-51fda0fde442')
;
-- May 7, 2020 7:15:41 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','Move Down',0,0,'Y',TO_TIMESTAMP('2020-05-07 19:15:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-05-07 19:15:40','YYYY-MM-DD HH24:MI:SS'),100,200608,'MoveDown','D','525bf4d4-5ce3-4a7d-9081-2e3b96708cf1')
;
-- May 7, 2020 7:16: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','Move Up',0,0,'Y',TO_TIMESTAMP('2020-05-07 19:16:03','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-05-07 19:16:03','YYYY-MM-DD HH24:MI:SS'),100,200609,'MoveUp','D','bdf56785-ce50-49ce-a2c5-d20a1a08ec96')
;
-- May 7, 2020 7:16: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','Move Left',0,0,'Y',TO_TIMESTAMP('2020-05-07 19:16:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-05-07 19:16:16','YYYY-MM-DD HH24:MI:SS'),100,200610,'MoveLeft','D','f0082f8f-7ecf-4682-9ee2-593b6b21fe41')
;
-- May 7, 2020 7:16: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','Move Right',0,0,'Y',TO_TIMESTAMP('2020-05-07 19:16:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-05-07 19:16:30','YYYY-MM-DD HH24:MI:SS'),100,200611,'MoveRight','D','0d2f8a50-350d-43c5-9629-64c3a6ea88d1')
;
SELECT register_migration_script('202101181900_IDEMPIERE-3340.sql') FROM dual
;
;

View File

@ -27,6 +27,8 @@ import org.adempiere.webui.util.TreeItemAction;
import org.adempiere.webui.util.TreeNodeAction;
import org.adempiere.webui.util.TreeUtils;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.model.MMenu;
import org.compiere.model.MToolBarButtonRestrict;
import org.compiere.model.MTreeNode;
import org.compiere.util.Env;
import org.compiere.util.Msg;
@ -302,6 +304,12 @@ public class MenuSearchController implements EventListener<Event>{
Clients.showBusy(selected, null);
Events.echoEvent(ON_LOAD_MORE, layout, null);
} else {
if (newRecord) {
Treeitem ti = (Treeitem)item.getData();
MMenu menu = MMenu.get(Integer.parseInt(ti.getValue()));
if (MToolBarButtonRestrict.isNewButtonRestricted(menu.getAD_Window_ID()))
newRecord = false;
}
selectTreeitem(item.getData(), newRecord);
selected.setAttribute(ONSELECT_TIMESTAMP, System.currentTimeMillis());
}

View File

@ -257,6 +257,7 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
if (Events.ON_DROP.equals(eventName) || Events.ON_RIGHT_CLICK.equals(eventName)
|| (Events.ON_CLICK.equals(eventName) && comp instanceof Toolbarbutton
&& ((Toolbarbutton) event.getTarget()).getAttribute(FavoriteSimpleTreeModel.MOBILE_TOOLBAR_CTX_MENU) != null
&& (boolean) ((Toolbarbutton) event.getTarget()).getAttribute(FavoriteSimpleTreeModel.MOBILE_TOOLBAR_CTX_MENU)))
{
for (EventListener<Event> listener : onDropListners)

View File

@ -72,10 +72,10 @@ public class LoginOpenSequenceDialog extends Window
/** Logger */
protected static final CLogger log = CLogger.getCLogger(LoginOpenSequenceDialog.class);
private Button bAdd = ButtonFactory.createNamedButton("MoveRight", true, true);
private Button bRemove = ButtonFactory.createNamedButton("MoveLeft", true, true);
private Button bUp = ButtonFactory.createNamedButton("MoveUp", true, true);
private Button bDown = ButtonFactory.createNamedButton("MoveDown", true, true);
private Button bAdd = ButtonFactory.createNamedButton("Next", false, true);
private Button bRemove = ButtonFactory.createNamedButton("Previous", false, true);
private Button bUp = ButtonFactory.createNamedButton("Parent", false, true);
private Button bDown = ButtonFactory.createNamedButton("Detail", false, true);
private ConfirmPanel confirmPanel = new ConfirmPanel(true, false, true, false, false, false);

View File

@ -29,6 +29,7 @@ import org.compiere.model.Lookup;
import org.compiere.model.MFieldSuggestion;
import org.compiere.model.MRole;
import org.compiere.model.MTable;
import org.compiere.model.MToolBarButtonRestrict;
import org.compiere.model.MZoomCondition;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -141,18 +142,25 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
for (MZoomCondition zoomCondition : MZoomCondition.getConditions(table.getAD_Table_ID())) {
Boolean canAccessZoom = MRole.getDefault().getWindowAccess(zoomCondition.getAD_Window_ID());
if (canAccessZoom != null && canAccessZoom) {
this.zoomEnabled = true;
if (hasQuickEntryField(zoomCondition.getAD_Window_ID(), 0, tableName)) {
this.newEnabled = true;
this.updateEnabled = true;
}
this.zoomEnabled = true;
if (hasQuickEntryField(zoomCondition.getAD_Window_ID(), 0, tableName)) {
if (MToolBarButtonRestrict.isNewButtonRestricted(zoomCondition.getAD_Window_ID()))
this.newEnabled = false;
else
this.newEnabled = true;
this.updateEnabled = true;
}
break;
}
}
} else {
if (hasQuickEntryField(winID,winIDPO,tableName)) {
this.newEnabled = true;
if ( !MToolBarButtonRestrict.isNewButtonRestricted(winID)
|| (winIDPO > 0 && winIDPO != winID && !MToolBarButtonRestrict.isNewButtonRestricted(winIDPO)))
this.newEnabled = true;
else
this.newEnabled = false;
this.updateEnabled = true;
} else {
this.newEnabled = false;

View File

@ -30,6 +30,7 @@ import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.model.MMenu;
import org.compiere.model.MQuery;
import org.compiere.model.MToolBarButtonRestrict;
import org.compiere.model.MTree;
import org.compiere.model.MTreeNode;
import org.compiere.util.DB;
@ -264,6 +265,11 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
if (comp instanceof Treeitem)
{
Treeitem selectedItem = (Treeitem) comp;
if (newRecord) {
MMenu menu = MMenu.get(Integer.parseInt(selectedItem.getValue()));
if (MToolBarButtonRestrict.isNewButtonRestricted(menu.getAD_Window_ID()))
newRecord = false;
}
if(selectedItem.getValue() != null)
{
if (newRecord)
@ -279,6 +285,11 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
if (comp instanceof Treerow)
{
Treeitem selectedItem = (Treeitem) comp.getParent();
if (newRecord) {
MMenu menu = MMenu.get(Integer.parseInt(selectedItem.getValue()));
if (MToolBarButtonRestrict.isNewButtonRestricted(menu.getAD_Window_ID()))
newRecord = false;
}
if(selectedItem.getValue() != null)
{
if (newRecord)