[ adempiere-ZK Web Client-2787754 ] UserPreferemce should save with ad_org_id = 0
[ adempiere-ZK Web Client-2787755 ] Add WindowTabPlacement user preference
This commit is contained in:
parent
f009f414c6
commit
39e39490c0
|
|
@ -38,11 +38,27 @@ public class ADButtonTabList extends Panel implements IADTabList, EventListener
|
||||||
private List<EventListener> listeners = new ArrayList<EventListener>();
|
private List<EventListener> listeners = new ArrayList<EventListener>();
|
||||||
private IADTab tabbox;
|
private IADTab tabbox;
|
||||||
private int selectedIndex = 0;
|
private int selectedIndex = 0;
|
||||||
|
private int tabPlacement = IADTab.LEFT;
|
||||||
|
|
||||||
public ADButtonTabList() {
|
public ADButtonTabList() {
|
||||||
this.setStyle("margin:0;padding:0");
|
this.setStyle("margin:0;padding:0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set tab placement ( left or right )
|
||||||
|
* @param tabPlacement
|
||||||
|
*/
|
||||||
|
public void setTabplacement(int tabPlacement) {
|
||||||
|
if (tabPlacement != IADTab.LEFT && tabPlacement != IADTab.RIGHT)
|
||||||
|
return;
|
||||||
|
else if (tabPlacement == this.tabPlacement)
|
||||||
|
return;
|
||||||
|
else {
|
||||||
|
this.tabPlacement = tabPlacement;
|
||||||
|
this.invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized void refresh() {
|
public synchronized void refresh() {
|
||||||
List childs = getChildren();
|
List childs = getChildren();
|
||||||
int childCount = childs.size();
|
int childCount = childs.size();
|
||||||
|
|
@ -75,7 +91,7 @@ public class ADButtonTabList extends Panel implements IADTabList, EventListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String style = "margin-left:" + (tabLabel.tabLevel*15+5) + "px";
|
String style = (tabPlacement == IADTab.LEFT ? "margin-left:" : "margin-right:") + (tabLabel.tabLevel*15+5) + "px";
|
||||||
String width = (195 - tabLabel.tabLevel*15)+"px";
|
String width = (195 - tabLabel.tabLevel*15)+"px";
|
||||||
style = style + "; width:" + width;
|
style = style + "; width:" + width;
|
||||||
button.setStyle(style);
|
button.setStyle(style);
|
||||||
|
|
|
||||||
|
|
@ -140,4 +140,11 @@ public class CompositeADTab extends AbstractADTab
|
||||||
public Component getComponent() {
|
public Component getComponent() {
|
||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param tabPlacement
|
||||||
|
*/
|
||||||
|
public void setTabplacement(int tabPlacement) {
|
||||||
|
tabList.setTabplacement(tabPlacement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,4 +107,16 @@ public interface IADTab extends UIPart {
|
||||||
* @return IADTabpanel
|
* @return IADTabpanel
|
||||||
*/
|
*/
|
||||||
public IADTabpanel getADTabpanel(int index);
|
public IADTabpanel getADTabpanel(int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* constant for tab placement
|
||||||
|
*/
|
||||||
|
public final int LEFT = 0;
|
||||||
|
public final int RIGHT = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set tab placement ( left or right )
|
||||||
|
* @param tabPlacement
|
||||||
|
*/
|
||||||
|
public void setTabplacement(int tabPlacement);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import org.adempiere.webui.component.Tabbox;
|
||||||
import org.adempiere.webui.component.Tabpanel;
|
import org.adempiere.webui.component.Tabpanel;
|
||||||
import org.adempiere.webui.component.Tabs;
|
import org.adempiere.webui.component.Tabs;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
|
import org.adempiere.webui.util.UserPreference;
|
||||||
import org.compiere.model.GridWindow;
|
import org.compiere.model.GridWindow;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
|
@ -39,6 +40,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zk.ui.event.KeyEvent;
|
import org.zkoss.zk.ui.event.KeyEvent;
|
||||||
import org.zkoss.zkex.zul.Borderlayout;
|
import org.zkoss.zkex.zul.Borderlayout;
|
||||||
import org.zkoss.zkex.zul.Center;
|
import org.zkoss.zkex.zul.Center;
|
||||||
|
import org.zkoss.zkex.zul.East;
|
||||||
import org.zkoss.zkex.zul.North;
|
import org.zkoss.zkex.zul.North;
|
||||||
import org.zkoss.zkex.zul.South;
|
import org.zkoss.zkex.zul.South;
|
||||||
import org.zkoss.zkex.zul.West;
|
import org.zkoss.zkex.zul.West;
|
||||||
|
|
@ -69,6 +71,8 @@ public class ADWindowPanel extends AbstractADWindowPanel
|
||||||
|
|
||||||
private West west;
|
private West west;
|
||||||
|
|
||||||
|
private East east;
|
||||||
|
|
||||||
private Keylistener keyListener;
|
private Keylistener keyListener;
|
||||||
|
|
||||||
public ADWindowPanel(Properties ctx, int windowNo)
|
public ADWindowPanel(Properties ctx, int windowNo)
|
||||||
|
|
@ -114,12 +118,27 @@ public class ADWindowPanel extends AbstractADWindowPanel
|
||||||
|
|
||||||
if (!isEmbedded() && adTab.isUseExternalSelection())
|
if (!isEmbedded() && adTab.isUseExternalSelection())
|
||||||
{
|
{
|
||||||
west = new West();
|
String tabPlacement = SessionManager.getSessionApplication().getUserPreference().getProperty(UserPreference.P_WINDOW_TAB_PLACEMENT);
|
||||||
layout.appendChild(west);
|
if (tabPlacement == null || "left".equalsIgnoreCase(tabPlacement))
|
||||||
west.setSplittable(false);
|
{
|
||||||
west.setAutoscroll(true);
|
west = new West();
|
||||||
LayoutUtils.addSclass("adwindow-nav", west);
|
layout.appendChild(west);
|
||||||
adTab.getTabSelectionComponent().setParent(west);
|
west.setSplittable(false);
|
||||||
|
west.setAutoscroll(true);
|
||||||
|
LayoutUtils.addSclass("adwindow-nav", west);
|
||||||
|
adTab.setTabplacement(IADTab.LEFT);
|
||||||
|
adTab.getTabSelectionComponent().setParent(west);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
east = new East();
|
||||||
|
layout.appendChild(east);
|
||||||
|
east.setSplittable(false);
|
||||||
|
east.setAutoscroll(true);
|
||||||
|
LayoutUtils.addSclass("adwindow-nav", east);
|
||||||
|
adTab.setTabplacement(IADTab.RIGHT);
|
||||||
|
adTab.getTabSelectionComponent().setParent(east);
|
||||||
|
}
|
||||||
LayoutUtils.addSclass("adwindow-nav-content", (HtmlBasedComponent) adTab.getTabSelectionComponent());
|
LayoutUtils.addSclass("adwindow-nav-content", (HtmlBasedComponent) adTab.getTabSelectionComponent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,10 @@ public final class UserPreference implements Serializable {
|
||||||
/** Language Name Context **/
|
/** Language Name Context **/
|
||||||
public static final String LANGUAGE_NAME = "#LanguageName";
|
public static final String LANGUAGE_NAME = "#LanguageName";
|
||||||
|
|
||||||
|
/** window tab placement **/
|
||||||
|
public static final String P_WINDOW_TAB_PLACEMENT = "WindowTabPlacement";
|
||||||
|
public static final String DEFAULT_WINDOW_TAB_PLACEMENT = "Left";
|
||||||
|
|
||||||
/** Ini Properties */
|
/** Ini Properties */
|
||||||
private static final String[] PROPERTIES = new String[] {
|
private static final String[] PROPERTIES = new String[] {
|
||||||
P_LANGUAGE,
|
P_LANGUAGE,
|
||||||
|
|
@ -66,7 +70,8 @@ public final class UserPreference implements Serializable {
|
||||||
P_CLIENT,
|
P_CLIENT,
|
||||||
P_ORG,
|
P_ORG,
|
||||||
P_WAREHOUSE,
|
P_WAREHOUSE,
|
||||||
P_AUTO_COMMIT};
|
P_AUTO_COMMIT,
|
||||||
|
P_WINDOW_TAB_PLACEMENT};
|
||||||
/** Ini Property Values */
|
/** Ini Property Values */
|
||||||
private static final String[] VALUES = new String[] {
|
private static final String[] VALUES = new String[] {
|
||||||
DEFAULT_LANGUAGE,
|
DEFAULT_LANGUAGE,
|
||||||
|
|
@ -74,7 +79,8 @@ public final class UserPreference implements Serializable {
|
||||||
DEFAULT_CLIENT,
|
DEFAULT_CLIENT,
|
||||||
DEFAULT_ORG,
|
DEFAULT_ORG,
|
||||||
DEFAULT_WAREHOUSE,
|
DEFAULT_WAREHOUSE,
|
||||||
DEFAULT_AUTO_COMMIT};
|
DEFAULT_AUTO_COMMIT,
|
||||||
|
DEFAULT_WINDOW_TAB_PLACEMENT};
|
||||||
|
|
||||||
/** Container for Properties */
|
/** Container for Properties */
|
||||||
private Properties props = new Properties();
|
private Properties props = new Properties();
|
||||||
|
|
@ -99,8 +105,10 @@ public final class UserPreference implements Serializable {
|
||||||
if (preference == null) {
|
if (preference == null) {
|
||||||
preference = new MPreference(Env.getCtx(), 0, null);
|
preference = new MPreference(Env.getCtx(), 0, null);
|
||||||
preference.setAD_User_ID(m_AD_User_ID);
|
preference.setAD_User_ID(m_AD_User_ID);
|
||||||
|
preference.setAD_Org_ID(0);
|
||||||
preference.setAttribute(attribute);
|
preference.setAttribute(attribute);
|
||||||
}
|
}
|
||||||
|
preference.setAD_Org_ID(0);
|
||||||
preference.setValue(value);
|
preference.setValue(value);
|
||||||
preference.saveEx();
|
preference.saveEx();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue