IDEMPIERE-4915 Improvements to Preference Popup (#835)
* IDEMPIERE-4915 Improvements to Preference Popup * IDEMPIERE-4915 Improvements to Preference Popup - Move MY_PROFILE_MENU_ID to SystemIDs
This commit is contained in:
parent
c20e76bc13
commit
8cc3a2a33f
|
@ -63,11 +63,13 @@ public class SystemIDs
|
|||
public final static int FORM_MFA_REGISTER = 200017;
|
||||
|
||||
public final static int MENU_NOTICE = 233;
|
||||
|
||||
|
||||
public final static int MESSAGE_REQUESTUPDATE = 834;
|
||||
public final static int MESSAGE_WORKFLOWRESULT = 753;
|
||||
public final static int MESSAGE_NOTES = 52244;
|
||||
|
||||
public static final int MY_PROFILE_MENU_ID = 53246;
|
||||
|
||||
public final static int PRINTFORMAT_STATEMENTOFACCOUNT = 134;
|
||||
public final static int PRINTFORMAT_ORDER_HEADER_TEMPLATE = 100;
|
||||
public final static int PRINTFORMAT_ORDER_LINETAX_TEMPLATE = 101;
|
||||
|
|
|
@ -18,17 +18,22 @@ import java.util.logging.Level;
|
|||
import org.adempiere.webui.ClientInfo;
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.ToolBar;
|
||||
import org.adempiere.webui.component.ToolBarButton;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.editor.WYesNoEditor;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
import org.adempiere.webui.grid.WQuickEntry;
|
||||
import org.adempiere.webui.theme.ThemeManager;
|
||||
import org.adempiere.webui.util.ZKUpdateUtil;
|
||||
import org.compiere.model.I_AD_UserPreference;
|
||||
import org.compiere.model.MMenu;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MUserPreference;
|
||||
import org.compiere.model.SystemIDs;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
|
@ -38,23 +43,27 @@ import org.zkoss.zk.ui.event.EventListener;
|
|||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.A;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Space;
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class WPreference extends WQuickEntry implements EventListener<Event>, ValueChangeListener {
|
||||
public class WPreference extends WQuickEntry implements EventListener<Event>, ValueChangeListener {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8223456746437563389L;
|
||||
private static final long serialVersionUID = 3259434079666571595L;
|
||||
private static final CLogger log = CLogger.getCLogger(WPreference.class);
|
||||
|
||||
private static final String LINE_DIV_STYLE = "background-color: transparent !important; border: none; margin: 5px;";
|
||||
|
||||
private WYesNoEditor adempiereSys;
|
||||
private WYesNoEditor logMigrationScript;
|
||||
private WGadgets gadgets;
|
||||
private A addgadgets;
|
||||
private A morePreferences;
|
||||
private A myProfile;
|
||||
private MUserPreference preferences = null;
|
||||
private int recordId = 0;
|
||||
|
||||
|
@ -75,6 +84,7 @@ public class WPreference extends WQuickEntry implements EventListener<Event>, Va
|
|||
if (canAccessPreference != null && canAccessPreference) {
|
||||
initPOs();
|
||||
loadPreferences();
|
||||
moveMigrationScriptComment();
|
||||
}
|
||||
|
||||
this.setTitle("");
|
||||
|
@ -100,19 +110,37 @@ public class WPreference extends WQuickEntry implements EventListener<Event>, Va
|
|||
private void init() {
|
||||
|
||||
Div div = new Div();
|
||||
div.setStyle("background-color: transparent !important; border: none; margin: 5px;");
|
||||
div.setStyle(LINE_DIV_STYLE);
|
||||
morePreferences= new A();
|
||||
morePreferences.setLabel(Msg.translate(Env.getCtx(), "MorePreferences"));
|
||||
morePreferences.addEventListener(Events.ON_CLICK, this);
|
||||
div.appendChild(morePreferences);
|
||||
this.appendChild(div);
|
||||
|
||||
MMenu myProfileMenu = MMenu.get(SystemIDs.MY_PROFILE_MENU_ID);
|
||||
div = new Div();
|
||||
div.setStyle(LINE_DIV_STYLE);
|
||||
myProfile= new A();
|
||||
myProfile.setLabel(myProfileMenu.get_Translation("Name"));
|
||||
myProfile.addEventListener(Events.ON_CLICK, this);
|
||||
div.appendChild(myProfile);
|
||||
this.appendChild(div);
|
||||
|
||||
div = new Div();
|
||||
div.setStyle(LINE_DIV_STYLE);
|
||||
addgadgets= new A();
|
||||
addgadgets.setLabel( Msg.translate(Env.getCtx(), "ManageGadgets"));
|
||||
addgadgets.addEventListener(Events.ON_CLICK, this);
|
||||
div.appendChild(addgadgets);
|
||||
this.appendChild(div);
|
||||
|
||||
if (Env.getAD_Client_ID(Env.getCtx()) <= 20 && Env.getAD_User_ID(Env.getCtx()) <= 102) {
|
||||
this.appendChild(new Space());
|
||||
adempiereSys = new WYesNoEditor("AdempiereSys", Msg.getMsg(Env.getCtx(), "AdempiereSys", true),
|
||||
null, false, false, true);
|
||||
adempiereSys.getComponent().setTooltiptext(Msg.getMsg(Env.getCtx(), "AdempiereSys", false));
|
||||
div = new Div();
|
||||
div.setStyle("background-color: transparent !important; border: none; margin: 5px;");
|
||||
div.setStyle(LINE_DIV_STYLE);
|
||||
div.appendChild(adempiereSys.getComponent());
|
||||
this.appendChild(div);
|
||||
adempiereSys.setValue(Env.getCtx().getProperty("AdempiereSys"));
|
||||
|
@ -122,11 +150,11 @@ public class WPreference extends WQuickEntry implements EventListener<Event>, Va
|
|||
null, false, false, true);
|
||||
logMigrationScript.getComponent().setTooltiptext(Msg.getMsg(Env.getCtx(), "LogMigrationScript", false));
|
||||
div = new Div();
|
||||
div.setStyle("background-color: transparent !important; border: none; margin: 5px;");
|
||||
div.setStyle(LINE_DIV_STYLE);
|
||||
div.appendChild(logMigrationScript.getComponent());
|
||||
this.appendChild(div);
|
||||
logMigrationScript.setValue(Env.getCtx().getProperty("LogMigrationScript"));
|
||||
logMigrationScript.addValueChangeListener(this);
|
||||
logMigrationScript.addValueChangeListener(this);
|
||||
}
|
||||
|
||||
ToolBar toolbar = new ToolBar();
|
||||
|
@ -145,16 +173,38 @@ public class WPreference extends WQuickEntry implements EventListener<Event>, Va
|
|||
if (ThemeManager.isUseFontIconForImage())
|
||||
LayoutUtils.addSclass("large-toolbarbutton", btn);
|
||||
|
||||
div = new Div();
|
||||
div.setStyle("background-color: transparent !important; border: none; margin: 5px;");
|
||||
addgadgets= new A();
|
||||
addgadgets.setLabel( Msg.translate(Env.getCtx(), "ManageGadgets"));
|
||||
addgadgets.addEventListener(Events.ON_CLICK, this);
|
||||
div.appendChild(addgadgets);
|
||||
this.appendChild(div);
|
||||
|
||||
} //init
|
||||
|
||||
private void moveMigrationScriptComment() {
|
||||
WEditor commentEditor = null;
|
||||
for (WEditor editor : quickEditors) {
|
||||
if (I_AD_UserPreference.COLUMNNAME_MigrationScriptComment.equals(editor.getColumnName())) {
|
||||
commentEditor = editor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (commentEditor != null) {
|
||||
Component field = commentEditor.getComponent();
|
||||
Component parent = field.getParent();
|
||||
if (parent != null) {
|
||||
parent.detach();
|
||||
Div div = new Div();
|
||||
div.setStyle(LINE_DIV_STYLE);
|
||||
Label label = commentEditor.getLabel();
|
||||
LayoutUtils.removeSclass("field-label", label);
|
||||
if (!label.getValue().endsWith(":"))
|
||||
label.setValue(label.getValue()+":");
|
||||
div.appendChild(label);
|
||||
this.insertBefore(div, logMigrationScript.getComponent().getParent().getNextSibling());
|
||||
Component ref = div.getNextSibling();
|
||||
div = new Div();
|
||||
div.setStyle(LINE_DIV_STYLE);
|
||||
div.appendChild(field);
|
||||
this.insertBefore(div, ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onEvent(Event event) throws Exception {
|
||||
String nameEvent=event.getName();
|
||||
Component com =event.getTarget();
|
||||
|
@ -182,10 +232,13 @@ public class WPreference extends WQuickEntry implements EventListener<Event>, Va
|
|||
gadgets.setAttribute(Window.MODE_KEY, Mode.HIGHLIGHTED);
|
||||
AEnv.showWindow(gadgets);
|
||||
gadgets.focus();
|
||||
}
|
||||
|
||||
if (com == morePreferences) {
|
||||
} else if (com == morePreferences) {
|
||||
AEnv.zoom(MUserPreference.Table_ID, recordId);
|
||||
this.detach();
|
||||
} else if (com == myProfile) {
|
||||
MMenu myProfileMenu = MMenu.get(SystemIDs.MY_PROFILE_MENU_ID);
|
||||
AEnv.zoom(myProfileMenu.getAD_Window_ID(), null);
|
||||
this.detach();
|
||||
}
|
||||
}
|
||||
} //onEvent
|
||||
|
|
Loading…
Reference in New Issue