IDEMPIERE-4084 - Improve toolbar customization

This commit is contained in:
Diego Ruiz 2020-01-30 17:17:40 +01:00 committed by Carlos Ruiz
parent 0b10b5ee1e
commit 33d2a4d0f7
12 changed files with 319 additions and 42 deletions

View File

@ -0,0 +1,47 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-4084 improve toolbar more configurable
-- Jan 24, 2020, 8:22:03 PM CET
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Help,PrintName,EntityType,AD_Element_UU) VALUES (203396,0,0,'Y',TO_DATE('2020-01-24 20:22:02','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-01-24 20:22:02','YYYY-MM-DD HH24:MI:SS'),100,'isShowMore','Group in show more',NULL,'Group in show more','D','ba2bc74f-3b73-48c0-b1fa-8182d5275c77')
;
-- Jan 24, 2020, 8:22:34 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (214166,0,'Group in show more',200003,'isShowMore','N',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_DATE('2020-01-24 20:22:34','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-01-24 20:22:34','YYYY-MM-DD HH24:MI:SS'),100,203396,'Y','N','D','N','N','N','Y','065f4119-dd27-42bf-997a-cfa9af541363','Y',0,'N','N','N')
;
-- Jan 24, 2020, 8:22:51 PM CET
ALTER TABLE AD_ToolBarButton ADD isShowMore CHAR(1) DEFAULT 'N' CHECK (isShowMore IN ('Y','N'))
;
-- Jan 24, 2020, 8:23:08 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (206377,'Group in show more',200002,214166,'Y',1,160,'N','N','N','N',0,0,'Y',TO_DATE('2020-01-24 20:23:07','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-01-24 20:23:07','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','df8fdfc2-139d-4246-95bb-89c62b72ab98','Y',160,2,2)
;
-- Jan 24, 2020, 8:23:47 PM CET
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_DATE('2020-01-24 20:23:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206377
;
-- Jan 24, 2020, 8:23:47 PM CET
UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-01-24 20:23:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200753
;
-- Jan 24, 2020, 8:23:47 PM CET
UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-01-24 20:23:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202546
;
-- Jan 24, 2020, 8:23:47 PM CET
UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-01-24 20:23:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202547
;
-- Jan 24, 2020, 8:33:05 PM CET
INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('M','More','',0,0,'Y',TO_DATE('2020-01-24 20:33:05','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-01-24 20:33:05','YYYY-MM-DD HH24:MI:SS'),100,200593,'ShowMore','D','a0b7f1d7-4bfd-4a5a-a86b-6e85aae57d17')
;
-- Jan 24, 2020, 8:33:46 PM CET
UPDATE AD_Field SET DisplayLogic='@Action@=W', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-01-24 20:33:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206377
;
SELECT register_migration_script('202001291950_IDEMPIERE-4084.sql') FROM dual
;

View File

@ -0,0 +1,44 @@
-- IDEMPIERE-4084 improve toolbar more configurable
-- Jan 24, 2020, 8:22:03 PM CET
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Help,PrintName,EntityType,AD_Element_UU) VALUES (203396,0,0,'Y',TO_TIMESTAMP('2020-01-24 20:22:02','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-01-24 20:22:02','YYYY-MM-DD HH24:MI:SS'),100,'isShowMore','Group in show more',NULL,'Group in show more','D','ba2bc74f-3b73-48c0-b1fa-8182d5275c77')
;
-- Jan 24, 2020, 8:22:34 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (214166,0,'Group in show more',200003,'isShowMore','N',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2020-01-24 20:22:34','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-01-24 20:22:34','YYYY-MM-DD HH24:MI:SS'),100,203396,'Y','N','D','N','N','N','Y','065f4119-dd27-42bf-997a-cfa9af541363','Y',0,'N','N','N')
;
-- Jan 24, 2020, 8:22:51 PM CET
ALTER TABLE AD_ToolBarButton ADD COLUMN isShowMore CHAR(1) DEFAULT 'N' CHECK (isShowMore IN ('Y','N'))
;
-- Jan 24, 2020, 8:23:08 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (206377,'Group in show more',200002,214166,'Y',1,160,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2020-01-24 20:23:07','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-01-24 20:23:07','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','df8fdfc2-139d-4246-95bb-89c62b72ab98','Y',160,2,2)
;
-- Jan 24, 2020, 8:23:47 PM CET
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-01-24 20:23:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206377
;
-- Jan 24, 2020, 8:23:47 PM CET
UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-01-24 20:23:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200753
;
-- Jan 24, 2020, 8:23:47 PM CET
UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-01-24 20:23:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202546
;
-- Jan 24, 2020, 8:23:47 PM CET
UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-01-24 20:23:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202547
;
-- Jan 24, 2020, 8:33:05 PM CET
INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('M','More','',0,0,'Y',TO_TIMESTAMP('2020-01-24 20:33:05','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-01-24 20:33:05','YYYY-MM-DD HH24:MI:SS'),100,200593,'ShowMore','D','a0b7f1d7-4bfd-4a5a-a86b-6e85aae57d17')
;
-- Jan 24, 2020, 8:33:46 PM CET
UPDATE AD_Field SET DisplayLogic='@Action@=W', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-01-24 20:33:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206377
;
SELECT register_migration_script('202001291950_IDEMPIERE-4084.sql') FROM dual
;

View File

@ -250,6 +250,15 @@ public interface I_AD_ToolBarButton
*/
public boolean isCustomization();
/** Column name isShowMore */
public static final String COLUMNNAME_isShowMore = "isShowMore";
/** Set Group in show more */
public void setisShowMore (boolean isShowMore);
/** Get Group in show more */
public boolean isShowMore();
/** Column name KeyStroke_KeyCode */
public static final String COLUMNNAME_KeyStroke_KeyCode = "KeyStroke_KeyCode";

View File

@ -30,7 +30,7 @@ public class X_AD_ToolBarButton extends PO implements I_AD_ToolBarButton, I_Pers
/**
*
*/
private static final long serialVersionUID = 20191121L;
private static final long serialVersionUID = 20200124L;
/** Standard Constructor */
public X_AD_ToolBarButton (Properties ctx, int AD_ToolBarButton_ID, String trxName)
@ -364,6 +364,27 @@ public class X_AD_ToolBarButton extends PO implements I_AD_ToolBarButton, I_Pers
return false;
}
/** Set Group in show more.
@param isShowMore Group in show more */
public void setisShowMore (boolean isShowMore)
{
set_Value (COLUMNNAME_isShowMore, Boolean.valueOf(isShowMore));
}
/** Get Group in show more.
@return Group in show more */
public boolean isShowMore ()
{
Object oo = get_Value(COLUMNNAME_isShowMore);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set KeyCode.
@param KeyStroke_KeyCode
KeyCode for shortcuts

View File

@ -143,7 +143,7 @@ public class WArchive implements EventListener<Event>
//
m_popup.setPage(invoker.getPage());
m_popup.open(invoker);
m_popup.open(invoker, "after_start");
} // getZoomTargets
/**

View File

@ -182,7 +182,7 @@ public class WRequest implements EventListener<Event>
}
m_popup.setPage(invoker.getPage());
m_popup.open(invoker);
m_popup.open(invoker, "after_start");
} // getZoomTargets
public void onEvent(final Event e) throws Exception

View File

@ -31,6 +31,7 @@ import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.action.Actions;
import org.adempiere.webui.action.IAction;
import org.adempiere.webui.component.FToolbar;
import org.adempiere.webui.component.Menupopup;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.event.ToolbarListener;
@ -61,10 +62,12 @@ import org.zkoss.zk.ui.event.KeyEvent;
import org.zkoss.zk.ui.event.OpenEvent;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.A;
import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Popup;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Space;
import org.zkoss.zul.Toolbarbutton;
import org.zkoss.zul.impl.LabelImageElement;
/**
*
@ -113,9 +116,14 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
private ToolBarButton btnCSVImport;
private ToolBarButton btnProcess;
private ToolBarButton btnShowMore;
private Menupopup menupopup;
private HashMap<String, ToolBarButton> buttons = new HashMap<String, ToolBarButton>();
private HashMap<ToolBarButton, Menuitem> menuItems = new HashMap<ToolBarButton, Menuitem>();
private ArrayList<ToolBarButton> mobileShowMoreButtons = new ArrayList<ToolBarButton>();
// private ToolBarButton btnExit;
private ArrayList<ToolbarListener> listeners = new ArrayList<ToolbarListener>();
@ -168,6 +176,10 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
{
LayoutUtils.addSclass("adwindow-toolbar", this);
//Show more menu pop up
menupopup = new Menupopup();
this.appendChild(menupopup);
btnIgnore = createButton("Ignore", "Ignore", "Ignore");
btnIgnore.setTooltiptext(btnIgnore.getTooltiptext()+ " Alt+Z");
btnHelp = createButton("Help", "Help","Help");
@ -236,6 +248,10 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
}
btnFileImport = createButton("FileImport", "FileImport", "FileImport");
btnCSVImport = createButton("CSVImport", "CSVImport", "CSVImport");
btnShowMore = createButton("ShowMore", "ShowMore", "ShowMore");
btnShowMore.setDisabled(true);
btnShowMore.setVisible(false);
MToolBarButton[] officialButtons = MToolBarButton.getToolbarButtons("W", null);
for (MToolBarButton button : officialButtons) {
@ -273,18 +289,35 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
ToolbarCustomButton toolbarCustomBtn = new ToolbarCustomButton(button, btn, actionId, windowNo);
toolbarCustomButtons.add(toolbarCustomBtn);
this.appendChild(btn);
action.decorate(btn);
if (ClientInfo.isMobile() && button.isShowMore())
mobileShowMoreButtons.add(btn);
else if (button.isShowMore())
createMenuitem(btn);
else {
this.appendChild(btn);
action.decorate(btn);
}
}
}
if (buttons.get(button.getComponentName()) != null) {
this.appendChild(buttons.get(button.getComponentName()));
if (button.isAddSeparator()) {
this.appendChild(new Separator("vertical"));
if (ClientInfo.isMobile() && button.isShowMore())
mobileShowMoreButtons.add(buttons.get(button.getComponentName()));
else if (button.isShowMore())
createMenuitem(buttons.get(button.getComponentName()));
else {
this.appendChild(buttons.get(button.getComponentName()));
if (button.isAddSeparator()) {
this.appendChild(new Separator("vertical"));
}
}
}
}
}
if (!ClientInfo.isMobile() && !menuItems.isEmpty()) {
this.appendChild(btnShowMore);
btnShowMore.setDisabled(false);
btnShowMore.setVisible(true);
}
configureKeyMap();
@ -328,11 +361,37 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
return btn;
}
/**
* Create Menu Item based on ToolBar button
* @param button
* @return
*/
private Menuitem createMenuitem(ToolBarButton button){
Menuitem item = new Menuitem(button.getTooltiptext());
if (button.getImage() != null)
item.setImage(button.getImage());
else if (ThemeManager.isUseFontIconForImage()) {
item.setIconSclass(button.getIconSclass());
LayoutUtils.addSclass("font-icon-toolbar-button", item);
}
item.setValue(button.getName());
item.addEventListener(Events.ON_CLICK, evt -> doOnClick(new Event(Events.ON_CLICK, button)));
menupopup.appendChild(item);
menuItems.put(button, item);
return item;
}
public ToolBarButton getButton(String name)
{
return buttons.get(name);
}
public LabelImageElement getToolbarItem(String name)
{
return menuItems.get(buttons.get(name)) != null ? buttons.get("ShowMore") :
buttons.get(name);
}
/** VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */
public static final int VK_A = 0x41;
@ -407,7 +466,10 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
{
if(event.getTarget() instanceof ToolBarButton)
{
doOnClick(event);
if (!event.getTarget().getId().contentEquals(BTNPREFIX+"ShowMore"))
doOnClick(event);
else
menupopup.open(btnShowMore, "after_start");
}
} else if (eventName.equals(Events.ON_CTRL_KEY))
{
@ -477,17 +539,22 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
{
this.btnParentRecord.setDisabled(!enableParent);
this.btnDetailRecord.setDisabled(!enableDetail);
enableMenuitem(btnParentRecord, enableParent);
enableMenuitem(btnDetailRecord, enableDetail);
}
public void enableRefresh(boolean enabled)
{
this.btnRefresh.setDisabled(!enabled);
enableMenuitem(btnRefresh, enabled);
}
public void enableSave(boolean enabled)
{
this.btnSave.setDisabled(!enabled);
this.btnSaveAndCreate.setDisabled(!enabled);
enableMenuitem(btnSave, enabled);
enableMenuitem(btnSaveAndCreate, enabled);
}
public boolean isSaveEnable() {
@ -502,6 +569,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
public void enableDelete(boolean enabled)
{
this.btnDelete.setDisabled(!enabled);
enableMenuitem(btnDelete, enabled);
}
public boolean isDeleteEnable()
@ -516,82 +584,105 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
public void enableIgnore(boolean enabled)
{
this.btnIgnore.setDisabled(!enabled);
enableMenuitem(btnIgnore, enabled);
}
public void enableNew(boolean enabled)
{
this.btnNew.setDisabled(!enabled);
enableMenuitem(btnNew, enabled);
}
public void enableCopy(boolean enabled)
{
this.btnCopy.setDisabled(!enabled);
enableMenuitem(btnCopy, enabled);
}
public void enableAttachment(boolean enabled)
{
this.btnAttachment.setDisabled(!enabled);
enableMenuitem(btnAttachment, enabled);
}
public void enableChat(boolean enabled)
{
this.btnChat.setDisabled(!enabled);
enableMenuitem(btnChat, enabled);
}
public void enablePrint(boolean enabled)
{
this.btnPrint.setDisabled(!enabled);
enableMenuitem(btnPrint, enabled);
}
public void enableReport(boolean enabled)
{
this.btnReport.setDisabled(!enabled);
enableMenuitem(btnReport, enabled);
}
public void enableFind(boolean enabled)
{
this.btnFind.setDisabled(!enabled);
enableMenuitem(btnFind, enabled);
}
public void enableGridToggle(boolean enabled)
{
btnGridToggle.setDisabled(!enabled);
enableMenuitem(btnGridToggle, enabled);
}
public void enableCustomize(boolean enabled)
{
btnCustomize.setDisabled(!enabled);
enableMenuitem(btnCustomize, enabled);
}
public void enableArchive(boolean enabled)
{
btnArchive.setDisabled(!enabled);
enableMenuitem(btnArchive, enabled);
}
public void enableZoomAcross(boolean enabled)
{
btnZoomAcross.setDisabled(!enabled);
enableMenuitem(btnZoomAcross, enabled);
}
public void enableActiveWorkflows(boolean enabled)
{
btnActiveWorkflows.setDisabled(!enabled);
enableMenuitem(btnActiveWorkflows, enabled);
}
public void enableRequests(boolean enabled)
{
btnRequests.setDisabled(!enabled);
enableMenuitem(btnRequests, enabled);
}
public void enableMenuitem(Toolbarbutton button, boolean enabled) {
if (menuItems.get(button) != null)
menuItems.get(button).setDisabled(!enabled);
}
public void lock(boolean locked)
{
this.btnLock.setPressed(locked);
setPressed("Lock", locked);
if (ThemeManager.isUseFontIconForImage())
{
String iconSclass = "z-icon-" + (this.btnLock.isPressed() ? "lock" : "unlock") ;
this.btnLock.setIconSclass(iconSclass);
LayoutUtils.addSclass("font-icon-toolbar-button", this.btnLock);
if (menuItems.get(btnLock) != null) {
menuItems.get(btnLock).setIconSclass(iconSclass);
LayoutUtils.addSclass("font-icon-toolbar-button", menuItems.get(btnLock));
}
}
else
{
@ -604,12 +695,16 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
String imgURL = "images/"+ (this.btnLock.isPressed() ? "LockX" : "Lock") + suffix;
imgURL = ThemeManager.getThemeResource(imgURL);
this.btnLock.setImage(imgURL);
if (menuItems.get(btnLock) != null) {
menuItems.get(btnLock).setImage(imgURL);
}
}
}
public void enablePostIt(boolean enabled)
{
this.btnPostIt.setDisabled(!enabled);
enableMenuitem(btnPostIt, enabled);
}
public Event getEvent()
@ -665,6 +760,10 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
{
btn.setVisible(visible);
}
for (Menuitem mn : menuItems.values())
{
mn.setVisible(visible);
}
}
/**
@ -679,6 +778,11 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
{
btn.setVisible(visible);
}
Menuitem mn = menuItems.get(btn);
if (mn != null)
{
mn.setVisible(visible);
}
}
/**
@ -696,6 +800,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
public void enableExport(boolean b) {
if (btnExport != null)
btnExport.setDisabled(!b);
enableMenuitem(btnExport, b);
}
/**
@ -705,6 +810,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
public void enableFileImport(boolean b) {
if (btnFileImport != null)
btnFileImport.setDisabled(!b);
enableMenuitem(btnFileImport, b);
}
/**
@ -714,6 +820,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
public void enableCSVImport(boolean b) {
if (btnCSVImport != null)
btnCSVImport.setDisabled(!b);
enableMenuitem(btnCSVImport, b);
}
private boolean ToolBarMenuRestictionLoaded = false;
@ -733,6 +840,13 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
this.removeChild(p);
break;
}
} else if (p instanceof Menupopup) {
for (Component p1 = p.getFirstChild(); p1 != null; p1 = p1.getNextSibling()) {
if ( p1 instanceof Menuitem && restrictName.equals((((Menuitem)p1).getValue())) ) {
p.removeChild(p1);
break;
}
}
}
}
@ -749,6 +863,13 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
this.removeChild(p);
break;
}
} else if (p instanceof Menupopup) {
for (Component p1 = p.getFirstChild(); p1 != null; p1 = p1.getNextSibling()) {
if ( p1 instanceof Menuitem && advancedName.equals((((Menuitem)p1).getValue())) ) {
p.removeChild(p1);
break;
}
}
}
}
@ -759,8 +880,10 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
// If no workflow set for the table => disable btnWorkflow
if (!btnActiveWorkflows.isDisabled()) {
GridTab gridTab = adwindow.getADWindowContent().getActiveGridTab();
if (gridTab != null)
if (gridTab != null) {
btnActiveWorkflows.setDisabled(!hasWorkflow(gridTab));
enableMenuitem(btnActiveWorkflows, !btnActiveWorkflows.isDisabled());
}
}
ToolBarMenuRestictionLoaded = true;
}
@ -775,6 +898,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
public void enableProcessButton(boolean b) {
if (btnProcess != null) {
btnProcess.setDisabled(!b);
enableMenuitem(btnProcess, b);
}
}
@ -806,6 +930,13 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
p.setVisible(false);
break;
}
} else if (p instanceof Menupopup) {
for (Component p1 = p.getFirstChild(); p1 != null; p1 = p1.getNextSibling()) {
if ( p1 instanceof Menuitem && restrictName.equals((((Menuitem)p1).getValue())) ) {
p.removeChild(p1);
break;
}
}
}
}
@ -835,6 +966,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
this.setWidgetOverride("toolbarScrollable", "function (wgt) {\n" +
" var total = jq(wgt.$n()).width();\n" +
" var w = wgt.firstChild;\n" +
" var a = " + !mobileShowMoreButtons.isEmpty() + ";\n" +
"\n" +
" // make sure all images are loaded.\n" +
" if (zUtl.isImageLoading()) {\n" +
@ -853,7 +985,11 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
" if (w) {\n" +
" var event = new zk.Event(wgt, 'onOverflowButton', w.uuid, {toServer: true}); \n" +
" zAu.send(event); \n" +
" }\n" +
" }\n" +
" else if (a) {\n" +
" var event = new zk.Event(wgt, 'onOverflowButton', null, {toServer: true}); \n" +
" zAu.send(event); \n" +
" }\n" +
"}");
addEventListener(Events.ON_AFTER_SIZE, (AfterSizeEvent evt) -> onAfterSize(evt));
@ -892,21 +1028,26 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
private void onOverflowButton(Event evt) {
overflows = new ArrayList<>();
String uuid = (String) evt.getData();
boolean overflowStarted = false;
for(Component comp : getChildren()) {
if (comp instanceof ToolBarButton) {
if (overflowStarted) {
overflows.add((ToolBarButton) comp);
} else if (comp.getUuid().equals(uuid)) {
overflows.add((ToolBarButton) comp);
overflowStarted = true;
if (uuid != null) {
boolean overflowStarted = false;
for(Component comp : getChildren()) {
if (comp instanceof ToolBarButton) {
if (overflowStarted) {
overflows.add((ToolBarButton) comp);
} else if (comp.getUuid().equals(uuid)) {
overflows.add((ToolBarButton) comp);
overflowStarted = true;
}
}
}
}
//Add at the end of the overflow those buttons marked as isShowMore
for (ToolBarButton toolbarButton : mobileShowMoreButtons)
overflows.add(toolbarButton);
if (overflows.size() > 0) {
overflowButton = new A();
overflowButton.setIconSclass("z-icon-angle-double-down");
overflowButton.setStyle("position: absolute; right: 2px; bottom: 6px; font-size: 12px; font-weight: 500;");
overflowButton.setIconSclass("z-icon-ShowMore");
overflowButton.setStyle("position: absolute; right: 4px; font-size: 18px; font-weight: 500; color: #333");
appendChild(overflowButton);
overflowPopup = new Popup();
overflowPopup.addEventListener(Events.ON_OPEN, (OpenEvent oe) -> {
@ -950,4 +1091,16 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
Clients.evalJavaScript(script);
}
}
public void setPressed(String buttonName, boolean pressed) {
getButton(buttonName).setPressed(pressed);
if (menuItems.get(getButton(buttonName)) != null) {
if (pressed)
menuItems.get(getButton(buttonName)).setSclass("z-toolbarbutton-checked");
else {
menuItems.get(getButton(buttonName)).setClass("");
menuItems.get(getButton(buttonName)).setClass("z-menu-item");
}
}
}
}

View File

@ -942,9 +942,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
});
m_popup.setPage(toolbar.getButton("Lock").getPage());
m_popup.setPage(toolbar.getToolbarItem("Lock").getPage());
}
m_popup.open(toolbar.getButton("Lock"));
m_popup.open(toolbar.getToolbarItem("Lock"), "after_start");
} // lock
//
@ -967,7 +967,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
@Override
public void onEvent(Event event) throws Exception {
toolbar.getButton("Attachment").setPressed(adTabbox.getSelectedGridTab().hasAttachment());
toolbar.setPressed("Attachment",adTabbox.getSelectedGridTab().hasAttachment());
focusToActivePanel();
}
};
@ -1020,7 +1020,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
@Override
public void onEvent(Event event) throws Exception {
hideBusyMask();
toolbar.getButton("Chat").setPressed(adTabbox.getSelectedGridTab().hasChat());
toolbar.setPressed("Chat",adTabbox.getSelectedGridTab().hasChat());
focusToActivePanel();
}
});
@ -1061,7 +1061,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
@Override
public void onEvent(Event event) throws Exception {
hideBusyMask();
toolbar.getButton("PostIt").setPressed(adTabbox.getSelectedGridTab().hasPostIt());
toolbar.setPressed("PostIt",adTabbox.getSelectedGridTab().hasPostIt());
focusToActivePanel();
}
});
@ -1339,9 +1339,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{
toolbar.enableTabNavigation(breadCrumb.hasParentLink(), adTabbox.getSelectedDetailADTabpanel() != null);
toolbar.getButton("Attachment").setPressed(adTabbox.getSelectedGridTab().hasAttachment());
toolbar.getButton("PostIt").setPressed(adTabbox.getSelectedGridTab().hasPostIt());
toolbar.getButton("Chat").setPressed(adTabbox.getSelectedGridTab().hasChat());
toolbar.setPressed("Attachment",adTabbox.getSelectedGridTab().hasAttachment());
toolbar.setPressed("PostIt",adTabbox.getSelectedGridTab().hasPostIt());
toolbar.setPressed("Chat",adTabbox.getSelectedGridTab().hasChat());
if (toolbar.isPersonalLock)
{
@ -1361,7 +1361,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
toolbar.enableCustomize(adtab.isGridView());
}
toolbar.getButton("Find").setPressed(adTabbox.getSelectedGridTab().isQueryActive() ||
toolbar.setPressed("Find",adTabbox.getSelectedGridTab().isQueryActive() ||
(!isNewRow && (m_onlyCurrentRows || m_onlyCurrentDays > 0)));
}
@ -1678,7 +1678,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (canHaveAttachment)
{
toolbar.enableAttachment(true);
toolbar.getButton("Attachment").setPressed(adTabbox.getSelectedGridTab().hasAttachment());
toolbar.setPressed("Attachment",adTabbox.getSelectedGridTab().hasAttachment());
}
else
{
@ -1699,9 +1699,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (canHaveChat)
{
toolbar.enableChat(true);
toolbar.getButton("Chat").setPressed(adTabbox.getSelectedGridTab().hasChat());
toolbar.setPressed("Chat",adTabbox.getSelectedGridTab().hasChat());
toolbar.enablePostIt(true);
toolbar.getButton("PostIt").setPressed(adTabbox.getSelectedGridTab().hasPostIt());
toolbar.setPressed("PostIt",adTabbox.getSelectedGridTab().hasPostIt());
}
else
{
@ -1727,7 +1727,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
toolbar.enableZoomAcross(!isNewRow);
toolbar.enableActiveWorkflows(!isNewRow);
toolbar.enableRequests(!isNewRow);
toolbar.getButton("Find").setPressed(adTabbox.getSelectedGridTab().isQueryActive() ||
toolbar.setPressed("Find", adTabbox.getSelectedGridTab().isQueryActive() ||
(!isNewRow && (m_onlyCurrentRows || m_onlyCurrentDays > 0)));
toolbar.enablePrint(adTabbox.getSelectedGridTab().isPrinted() && !isNewRow);
@ -2090,7 +2090,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
else
{
toolbar.getButton("Find").setPressed(adTabbox.getSelectedGridTab().isQueryActive());
toolbar.setPressed("Find",adTabbox.getSelectedGridTab().isQueryActive());
}
focusToActivePanel();
}
@ -2638,7 +2638,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
query.addRestriction(link, MQuery.EQUAL,
Env.getContext(ctx, curWindowNo, link));
}
new WZoomAcross(toolbar.getEvent().getTarget(), adTabbox.getSelectedGridTab()
new WZoomAcross(toolbar.getToolbarItem("ZoomAcross"), adTabbox.getSelectedGridTab()
.getTableName(), adTabbox.getSelectedGridTab().getAD_Window_ID(), query);
}
}
@ -2674,7 +2674,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if(bpartner != null)
C_BPartner_ID = Integer.valueOf(bpartner.toString());
new WRequest(toolbar.getEvent().getTarget(), adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getRecord_ID(), C_BPartner_ID);
new WRequest(toolbar.getToolbarItem("Requests"), adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getRecord_ID(), C_BPartner_ID);
}
}
//
@ -2701,7 +2701,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (adTabbox.getSelectedGridTab().getRecord_ID() <= 0)
return;
new WArchive(toolbar.getEvent().getTarget(), adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getRecord_ID());
new WArchive(toolbar.getToolbarItem("Archive"), adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getRecord_ID());
}
}
@ -3320,7 +3320,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
popup.render(adtab.getToolbarButtons());
if (popup.getChildren().size() > 0) {
popup.setPage(this.getComponent().getPage());
popup.open(getToolbar().getButton("Process"), "after_start");
popup.open(getToolbar().getToolbarItem("Process"), "after_start");
}
}

View File

@ -201,7 +201,7 @@ public class ReportAction implements EventListener<Event>
confirmPanel.addActionListener(this);
}
LayoutUtils.openPopupWindow(panel.getToolbar().getButton("Report"), winReport, "after_start");
LayoutUtils.openPopupWindow(panel.getToolbar().getToolbarItem("Report"), winReport, "after_start");
}
@Override

View File

@ -280,4 +280,7 @@
.z-icon-CSVImport:before {
content: "\f0f6";
}
.z-icon-ShowMore:before {
content: "\f142";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B