IDEMPIERE-369 Master Detail layout improvements. First step - remove existing embedded tab implementation.
This commit is contained in:
parent
ca61e6d5ad
commit
f1860fa2ce
|
@ -135,7 +135,7 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab
|
||||||
|
|
||||||
private void prepareContext(int newIndex, IADTabpanel newTab) {
|
private void prepareContext(int newIndex, IADTabpanel newTab) {
|
||||||
//update context
|
//update context
|
||||||
if (newTab != null && (adWindowPanel == null || !adWindowPanel.isEmbedded()))
|
if (newTab != null)
|
||||||
{
|
{
|
||||||
List<Integer> parents = new ArrayList<Integer>();
|
List<Integer> parents = new ArrayList<Integer>();
|
||||||
//get parent list, always include first tab (0)
|
//get parent list, always include first tab (0)
|
||||||
|
|
|
@ -61,8 +61,6 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
|
|
||||||
private static final String BTNPREFIX = "Btn";
|
private static final String BTNPREFIX = "Btn";
|
||||||
|
|
||||||
private static final String EMBEDDED_TOOLBAR_BUTTON_STYLE = "background-color: transparent; display:inline-block; margin-left: 1px; margin-right: 1px; width: 20px; height: 18px;";
|
|
||||||
|
|
||||||
private static CLogger log = CLogger.getCLogger(CWindowToolbar.class);
|
private static CLogger log = CLogger.getCLogger(CWindowToolbar.class);
|
||||||
|
|
||||||
private ToolBarButton btnIgnore;
|
private ToolBarButton btnIgnore;
|
||||||
|
@ -101,8 +99,6 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
private Map<Integer, ToolBarButton> altKeyMap = new HashMap<Integer, ToolBarButton>();
|
private Map<Integer, ToolBarButton> altKeyMap = new HashMap<Integer, ToolBarButton>();
|
||||||
private Map<Integer, ToolBarButton> ctrlKeyMap = new HashMap<Integer, ToolBarButton>();
|
private Map<Integer, ToolBarButton> ctrlKeyMap = new HashMap<Integer, ToolBarButton>();
|
||||||
|
|
||||||
private boolean embedded;
|
|
||||||
|
|
||||||
// Elaine 2008/12/04
|
// Elaine 2008/12/04
|
||||||
/** Show Personal Lock */
|
/** Show Personal Lock */
|
||||||
public boolean isPersonalLock = MRole.getDefault().isPersonalLock();
|
public boolean isPersonalLock = MRole.getDefault().isPersonalLock();
|
||||||
|
@ -120,17 +116,10 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
|
|
||||||
public CWindowToolbar()
|
public CWindowToolbar()
|
||||||
{
|
{
|
||||||
this(false);
|
this(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CWindowToolbar(boolean embedded)
|
public CWindowToolbar(int windowNo) {
|
||||||
{
|
|
||||||
this.embedded = embedded;
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CWindowToolbar(boolean embedded, int windowNo) {
|
|
||||||
this.embedded = embedded;
|
|
||||||
setWindowNo(windowNo);
|
setWindowNo(windowNo);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -197,20 +186,7 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
|
|
||||||
configureKeyMap();
|
configureKeyMap();
|
||||||
|
|
||||||
if (embedded)
|
setWidth("100%");
|
||||||
{
|
|
||||||
btnParentRecord.setVisible(false);
|
|
||||||
btnDetailRecord.setVisible(false);
|
|
||||||
btnActiveWorkflows.setVisible(false);
|
|
||||||
btnProductInfo.setVisible(false);
|
|
||||||
setAlign("end");
|
|
||||||
setWidth("100%");
|
|
||||||
setStyle("background: transparent none; ");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setWidth("100%");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -219,20 +195,13 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
ToolBarButton btn = new ToolBarButton("");
|
ToolBarButton btn = new ToolBarButton("");
|
||||||
btn.setName(BTNPREFIX+name);
|
btn.setName(BTNPREFIX+name);
|
||||||
if (windowNo > 0)
|
if (windowNo > 0)
|
||||||
btn.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unq" + btn.getName() + "_" + windowNo + (embedded ? "E" : ""));
|
btn.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unq" + btn.getName() + "_" + windowNo);
|
||||||
else
|
else
|
||||||
btn.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, btn.getName());
|
btn.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, btn.getName());
|
||||||
btn.setImage("/images/"+image + (embedded ? "16.png" : "24.png"));
|
btn.setImage("/images/"+image + "24.png");
|
||||||
btn.setTooltiptext(Msg.getMsg(Env.getCtx(),tooltip));
|
btn.setTooltiptext(Msg.getMsg(Env.getCtx(),tooltip));
|
||||||
if (embedded)
|
btn.setSclass("toolbar-button");
|
||||||
{
|
|
||||||
btn.setStyle(EMBEDDED_TOOLBAR_BUTTON_STYLE);
|
|
||||||
btn.setSclass("embedded-toolbar-button");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
btn.setSclass("toolbar-button");
|
|
||||||
}
|
|
||||||
buttons.put(name, btn);
|
buttons.put(name, btn);
|
||||||
this.appendChild(btn);
|
this.appendChild(btn);
|
||||||
//make toolbar button last to receive focus
|
//make toolbar button last to receive focus
|
||||||
|
@ -310,10 +279,7 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
protected void addSeparator()
|
protected void addSeparator()
|
||||||
{
|
{
|
||||||
Space s = new Space();
|
Space s = new Space();
|
||||||
if (embedded)
|
s.setSpacing("6px");
|
||||||
s.setSpacing("3px");
|
|
||||||
else
|
|
||||||
s.setSpacing("6px");
|
|
||||||
s.setOrient("vertical");
|
s.setOrient("vertical");
|
||||||
this.appendChild(s);
|
this.appendChild(s);
|
||||||
}
|
}
|
||||||
|
@ -505,7 +471,7 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
{
|
{
|
||||||
this.btnLock.setPressed(locked);
|
this.btnLock.setPressed(locked);
|
||||||
|
|
||||||
String imgURL = "/images/"+ (this.btnLock.isPressed() ? "LockX" : "Lock") + (embedded ? "16.png" : "24.png");
|
String imgURL = "/images/"+ (this.btnLock.isPressed() ? "LockX" : "Lock") + "24.png";
|
||||||
this.btnLock.setImage(imgURL);
|
this.btnLock.setImage(imgURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.webui.LayoutUtils;
|
import org.adempiere.webui.LayoutUtils;
|
||||||
|
@ -146,8 +145,6 @@ DataStatusListener, IADTabpanel
|
||||||
private Map<Integer, Group> includedTab = new HashMap<Integer, Group>();
|
private Map<Integer, Group> includedTab = new HashMap<Integer, Group>();
|
||||||
private Map<Integer, Groupfoot> includedTabFooter = new HashMap<Integer, Groupfoot>();
|
private Map<Integer, Groupfoot> includedTabFooter = new HashMap<Integer, Groupfoot>();
|
||||||
|
|
||||||
private List<EmbeddedPanel> includedPanel = new ArrayList<EmbeddedPanel>();
|
|
||||||
|
|
||||||
private boolean active = false;
|
private boolean active = false;
|
||||||
|
|
||||||
private Group currentGroup;
|
private Group currentGroup;
|
||||||
|
@ -335,14 +332,6 @@ DataStatusListener, IADTabpanel
|
||||||
row.appendChild(new Separator());
|
row.appendChild(new Separator());
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
||||||
for (EmbeddedPanel ep : includedPanel) {
|
|
||||||
if (ep.adTabId == field.getIncluded_Tab_ID()) {
|
|
||||||
ep.group = includedTab.get(ep.adTabId);
|
|
||||||
createEmbeddedPanelUI(ep, field.getDisplayLength());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -759,27 +748,11 @@ DataStatusListener, IADTabpanel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//activate embedded panel
|
|
||||||
for(EmbeddedPanel ep : includedPanel)
|
|
||||||
{
|
|
||||||
activateChild(activate, ep);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gridTab.getRecord_ID() > 0 && gridTab.isTreeTab() && treePanel != null) {
|
if (gridTab.getRecord_ID() > 0 && gridTab.isTreeTab() && treePanel != null) {
|
||||||
setSelectedNode(gridTab.getRecord_ID());
|
setSelectedNode(gridTab.getRecord_ID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void activateChild(boolean activate, EmbeddedPanel panel) {
|
|
||||||
if (activate)
|
|
||||||
{
|
|
||||||
panel.windowPanel.getADTab().evaluate(null);
|
|
||||||
panel.windowPanel.getADTab().setSelectedIndex(0);
|
|
||||||
panel.tabPanel.query(false, 0, 0);
|
|
||||||
}
|
|
||||||
panel.tabPanel.activate(activate);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set focus to first active editor
|
* set focus to first active editor
|
||||||
*/
|
*/
|
||||||
|
@ -928,27 +901,6 @@ DataStatusListener, IADTabpanel
|
||||||
listPanel.updateListIndex();
|
listPanel.updateListIndex();
|
||||||
listPanel.dynamicDisplay(col);
|
listPanel.dynamicDisplay(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!includedPanel.isEmpty() && e.getChangedColumn() == -1) {
|
|
||||||
ArrayList<String> parentColumnNames = new ArrayList<String>();
|
|
||||||
GridField[] parentFields = gridTab.getFields();
|
|
||||||
for (GridField parentField : parentFields)
|
|
||||||
parentColumnNames.add(parentField.getColumnName());
|
|
||||||
|
|
||||||
for (EmbeddedPanel panel : includedPanel)
|
|
||||||
{
|
|
||||||
GridTab tab = panel.tabPanel.getGridTab();
|
|
||||||
GridField[] fields = tab.getFields();
|
|
||||||
for (GridField field : fields)
|
|
||||||
{
|
|
||||||
if (!parentColumnNames.contains(field.getColumnName()))
|
|
||||||
Env.setContext(Env.getCtx(), field.getWindowNo(), field.getColumnName(), "");
|
|
||||||
}
|
|
||||||
panel.tabPanel.query(false, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
parentColumnNames = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteNode(int recordId) {
|
private void deleteNode(int recordId) {
|
||||||
|
@ -1029,18 +981,8 @@ DataStatusListener, IADTabpanel
|
||||||
public void switchRowPresentation() {
|
public void switchRowPresentation() {
|
||||||
if (formComponent.isVisible()) {
|
if (formComponent.isVisible()) {
|
||||||
formComponent.setVisible(false);
|
formComponent.setVisible(false);
|
||||||
//de-activate embedded panel
|
|
||||||
for(EmbeddedPanel ep : includedPanel)
|
|
||||||
{
|
|
||||||
activateChild(false, ep);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
formComponent.setVisible(true);
|
formComponent.setVisible(true);
|
||||||
//activate embedded panel
|
|
||||||
for(EmbeddedPanel ep : includedPanel)
|
|
||||||
{
|
|
||||||
activateChild(true, ep);
|
|
||||||
}
|
|
||||||
formComponent.getParent().invalidate();
|
formComponent.getParent().invalidate();
|
||||||
}
|
}
|
||||||
listPanel.setVisible(!formComponent.isVisible());
|
listPanel.setVisible(!formComponent.isVisible());
|
||||||
|
@ -1069,89 +1011,10 @@ DataStatusListener, IADTabpanel
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Embed detail tab
|
|
||||||
* @param ctx
|
|
||||||
* @param windowNo
|
|
||||||
* @param gridWindow
|
|
||||||
* @param adTabId
|
|
||||||
* @param tabIndex
|
|
||||||
* @param tabPanel
|
|
||||||
*/
|
|
||||||
public void embed(Properties ctx, int windowNo, GridWindow gridWindow,
|
|
||||||
int adTabId, int tabIndex, IADTabpanel tabPanel) {
|
|
||||||
embed(ctx, windowNo, gridWindow, adTabId, tabIndex, tabPanel, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Embed detail tab
|
|
||||||
* @param ctx
|
|
||||||
* @param windowNo
|
|
||||||
* @param gridWindow
|
|
||||||
* @param adTabId
|
|
||||||
* @param tabIndex
|
|
||||||
* @param tabPanel
|
|
||||||
*/
|
|
||||||
public void embed(Properties ctx, int windowNo, GridWindow gridWindow,
|
|
||||||
int adTabId, int tabIndex, IADTabpanel tabPanel, int height) {
|
|
||||||
EmbeddedPanel ep = new EmbeddedPanel();
|
|
||||||
ep.tabPanel = tabPanel;
|
|
||||||
ep.adTabId = adTabId;
|
|
||||||
ep.tabIndex = tabIndex;
|
|
||||||
ep.gridWindow = gridWindow;
|
|
||||||
includedPanel.add(ep);
|
|
||||||
Group group = includedTab.get(adTabId);
|
|
||||||
ep.group = group;
|
|
||||||
if (tabPanel instanceof ADTabpanel) {
|
|
||||||
ADTabpanel atp = (ADTabpanel) tabPanel;
|
|
||||||
atp.listPanel.setPageSize(-1);
|
|
||||||
}
|
|
||||||
ADWindowPanel panel = new ADWindowPanel(ctx, windowNo, gridWindow, tabIndex, tabPanel);
|
|
||||||
ep.windowPanel = panel;
|
|
||||||
|
|
||||||
if (group != null) {
|
|
||||||
createEmbeddedPanelUI(ep, height);
|
|
||||||
if (active)
|
|
||||||
activateChild(true, ep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class EmbeddedPanel {
|
|
||||||
Group group;
|
|
||||||
GridWindow gridWindow;
|
|
||||||
int tabIndex;
|
|
||||||
ADWindowPanel windowPanel;
|
|
||||||
IADTabpanel tabPanel;
|
|
||||||
int adTabId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see IADTabpanel#afterSave(boolean)
|
* @see IADTabpanel#afterSave(boolean)
|
||||||
*/
|
*/
|
||||||
public void afterSave(boolean onSaveEvent) {
|
public void afterSave(boolean onSaveEvent) {
|
||||||
if (!includedPanel.isEmpty()) {
|
|
||||||
for (EmbeddedPanel panel : includedPanel)
|
|
||||||
panel.tabPanel.query(false, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createEmbeddedPanelUI(EmbeddedPanel ep, int height) {
|
|
||||||
Row row = new Row();
|
|
||||||
row.setSpans("5");
|
|
||||||
grid.getRows().insertBefore(row, includedTabFooter.get(ep.adTabId));
|
|
||||||
ep.windowPanel.createPart(row);
|
|
||||||
ep.windowPanel.getComponent().setWidth("100%");
|
|
||||||
ep.windowPanel.getComponent().setStyle("position: relative;");
|
|
||||||
//for backward compatibility, only treat display length > 50 as height for the embedded panel
|
|
||||||
if (height > 50)
|
|
||||||
ep.windowPanel.getComponent().setHeight(height + "px");
|
|
||||||
else
|
|
||||||
ep.windowPanel.getComponent().setHeight("400px");
|
|
||||||
|
|
||||||
Label title = new Label(ep.gridWindow.getTab(ep.tabIndex).getName());
|
|
||||||
ep.group.appendChild(title);
|
|
||||||
ep.group.appendChild(ep.windowPanel.getToolbar());
|
|
||||||
ep.windowPanel.initPanel(-1, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1196,20 +1059,6 @@ DataStatusListener, IADTabpanel
|
||||||
return listPanel.isVisible();
|
return listPanel.isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param gTab
|
|
||||||
* @return embedded panel or null if not found
|
|
||||||
*/
|
|
||||||
public IADTabpanel findEmbeddedPanel(GridTab gTab) {
|
|
||||||
IADTabpanel panel = null;
|
|
||||||
for(EmbeddedPanel ep : includedPanel) {
|
|
||||||
if (ep.tabPanel.getGridTab().equals(gTab)) {
|
|
||||||
return ep.tabPanel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return panel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return GridPanel
|
* @return GridPanel
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.adempiere.webui.component.Tabs;
|
||||||
import org.adempiere.webui.part.ITabOnSelectHandler;
|
import org.adempiere.webui.part.ITabOnSelectHandler;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.util.UserPreference;
|
import org.adempiere.webui.util.UserPreference;
|
||||||
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;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -86,12 +85,6 @@ public class ADWindowPanel extends AbstractADWindowPanel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ADWindowPanel(Properties ctx, int windowNo, GridWindow gridWindow,
|
|
||||||
int tabIndex, IADTabpanel tabPanel) {
|
|
||||||
super(ctx, windowNo, gridWindow, tabIndex, tabPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected Component doCreatePart(Component parent)
|
protected Component doCreatePart(Component parent)
|
||||||
{
|
{
|
||||||
layout = new Borderlayout();
|
layout = new Borderlayout();
|
||||||
|
@ -102,37 +95,24 @@ public class ADWindowPanel extends AbstractADWindowPanel
|
||||||
layout.setPage(page);
|
layout.setPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
//toolbar would be added to group for embedded tab
|
//toolbar
|
||||||
if (!isEmbedded())
|
North n = new North();
|
||||||
{
|
n.setParent(layout);
|
||||||
North n = new North();
|
n.setCollapsible(false);
|
||||||
n.setParent(layout);
|
n.setSclass("adwindow-north");
|
||||||
n.setCollapsible(false);
|
toolbar.setParent(n);
|
||||||
n.setSclass("adwindow-north");
|
toolbar.setWindowNo(getWindowNo());
|
||||||
toolbar.setParent(n);
|
|
||||||
toolbar.setWindowNo(getWindowNo());
|
|
||||||
}
|
|
||||||
|
|
||||||
//status bar on top for embedded tab
|
//status bar
|
||||||
if (!isEmbedded())
|
South s = new South();
|
||||||
{
|
layout.appendChild(s);
|
||||||
South s = new South();
|
s.setCollapsible(false);
|
||||||
layout.appendChild(s);
|
s.setSclass("adwindow-south");
|
||||||
s.setCollapsible(false);
|
statusBar.setParent(s);
|
||||||
s.setSclass("adwindow-south");
|
|
||||||
statusBar.setParent(s);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
North n = new North();
|
|
||||||
layout.appendChild(n);
|
|
||||||
n.setCollapsible(false);
|
|
||||||
statusBar.setParent(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
LayoutUtils.addSclass("adwindow-status", statusBar);
|
LayoutUtils.addSclass("adwindow-status", statusBar);
|
||||||
|
|
||||||
if (!isEmbedded() && adTab.isUseExternalSelection())
|
if (adTab.isUseExternalSelection())
|
||||||
{
|
{
|
||||||
String tabPlacement = SessionManager.getSessionApplication().getUserPreference().getProperty(UserPreference.P_WINDOW_TAB_PLACEMENT);
|
String tabPlacement = SessionManager.getSessionApplication().getUserPreference().getProperty(UserPreference.P_WINDOW_TAB_PLACEMENT);
|
||||||
if (tabPlacement == null || "left".equalsIgnoreCase(tabPlacement))
|
if (tabPlacement == null || "left".equalsIgnoreCase(tabPlacement))
|
||||||
|
@ -183,16 +163,14 @@ public class ADWindowPanel extends AbstractADWindowPanel
|
||||||
((Tabpanel)parent).setOnCloseHandler(handler);
|
((Tabpanel)parent).setOnCloseHandler(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isEmbedded()) {
|
if (keyListener != null)
|
||||||
if (keyListener != null)
|
keyListener.detach();
|
||||||
keyListener.detach();
|
keyListener = new Keylistener();
|
||||||
keyListener = new Keylistener();
|
statusBar.appendChild(keyListener);
|
||||||
statusBar.appendChild(keyListener);
|
keyListener.setCtrlKeys("#f1#f2#f3#f4#f5#f6#f7#f8#f9#f10#f11#f12^f^i^n^s^d@#left@#right@#up@#down@#pgup@#pgdn@p^p@z@x#enter");
|
||||||
keyListener.setCtrlKeys("#f1#f2#f3#f4#f5#f6#f7#f8#f9#f10#f11#f12^f^i^n^s^d@#left@#right@#up@#down@#pgup@#pgdn@p^p@z@x#enter");
|
keyListener.addEventListener(Events.ON_CTRL_KEY, toolbar);
|
||||||
keyListener.addEventListener(Events.ON_CTRL_KEY, toolbar);
|
keyListener.addEventListener(Events.ON_CTRL_KEY, this);
|
||||||
keyListener.addEventListener(Events.ON_CTRL_KEY, this);
|
keyListener.setAutoBlur(false);
|
||||||
keyListener.setAutoBlur(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
layout.setAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY, new ITabOnSelectHandler() {
|
layout.setAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY, new ITabOnSelectHandler() {
|
||||||
public void onSelect() {
|
public void onSelect() {
|
||||||
|
|
|
@ -168,46 +168,19 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
|
|
||||||
private boolean m_findCancelled;
|
private boolean m_findCancelled;
|
||||||
|
|
||||||
private int embeddedTabindex = -1;
|
|
||||||
|
|
||||||
protected Map<Integer, ADTabpanel> includedMap = new HashMap<Integer, ADTabpanel>();
|
|
||||||
|
|
||||||
protected Map<Integer, GridField> includedFieldMap = new HashMap<Integer, GridField>();
|
|
||||||
|
|
||||||
private IADTabpanel embeddedTabPanel;
|
|
||||||
|
|
||||||
private boolean m_findCreateNew;
|
private boolean m_findCreateNew;
|
||||||
|
|
||||||
private boolean m_queryInitiating;
|
private boolean m_queryInitiating;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for non-embedded mode
|
* Constructor
|
||||||
* @param ctx
|
* @param ctx
|
||||||
* @param windowNo
|
* @param windowNo
|
||||||
*/
|
*/
|
||||||
public AbstractADWindowPanel(Properties ctx, int windowNo)
|
public AbstractADWindowPanel(Properties ctx, int windowNo)
|
||||||
{
|
|
||||||
this(ctx, windowNo, null, -1, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for embedded mode
|
|
||||||
* @param ctx
|
|
||||||
* @param windowNo
|
|
||||||
* @param gridWindow
|
|
||||||
* @param tabIndex
|
|
||||||
* @param tabPanel
|
|
||||||
*/
|
|
||||||
public AbstractADWindowPanel(Properties ctx, int windowNo, GridWindow gridWindow, int tabIndex, IADTabpanel tabPanel)
|
|
||||||
{
|
{
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
this.curWindowNo = windowNo;
|
this.curWindowNo = windowNo;
|
||||||
this.gridWindow = gridWindow;
|
|
||||||
this.embeddedTabindex = tabIndex;
|
|
||||||
this.embeddedTabPanel = tabPanel;
|
|
||||||
curTabpanel = tabPanel;
|
|
||||||
if (gridWindow != null && tabIndex >= 0)
|
|
||||||
curTab = gridWindow.getTab(tabIndex);
|
|
||||||
|
|
||||||
initComponents();
|
initComponents();
|
||||||
}
|
}
|
||||||
|
@ -236,20 +209,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
return statusBar;
|
return statusBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public boolean isEmbedded() {
|
|
||||||
return embeddedTabindex >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initComponents()
|
private void initComponents()
|
||||||
{
|
{
|
||||||
/** Initalise toolbar */
|
/** Initalise toolbar */
|
||||||
toolbar = new CWindowToolbar(isEmbedded(), getWindowNo());
|
toolbar = new CWindowToolbar(getWindowNo());
|
||||||
toolbar.addListener(this);
|
toolbar.addListener(this);
|
||||||
|
|
||||||
statusBar = new StatusBarPanel(isEmbedded());
|
statusBar = new StatusBarPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -294,88 +260,69 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
// End of temporary code for [ adempiere-ZK Web Client-2832968 ] User context lost?
|
// End of temporary code for [ adempiere-ZK Web Client-2832968 ] User context lost?
|
||||||
|
|
||||||
// Set AutoCommit for this Window
|
// Set AutoCommit for this Window
|
||||||
if (embeddedTabindex < 0)
|
Env.setAutoCommit(ctx, curWindowNo, Env.isAutoCommit(ctx));
|
||||||
{
|
boolean autoNew = Env.isAutoNew(ctx);
|
||||||
Env.setAutoCommit(ctx, curWindowNo, Env.isAutoCommit(ctx));
|
Env.setAutoNew(ctx, curWindowNo, autoNew);
|
||||||
boolean autoNew = Env.isAutoNew(ctx);
|
|
||||||
Env.setAutoNew(ctx, curWindowNo, autoNew);
|
|
||||||
|
|
||||||
GridWindowVO gWindowVO = AEnv.getMWindowVO(curWindowNo, adWindowId, 0);
|
GridWindowVO gWindowVO = AEnv.getMWindowVO(curWindowNo, adWindowId, 0);
|
||||||
if (gWindowVO == null)
|
if (gWindowVO == null)
|
||||||
{
|
{
|
||||||
throw new ApplicationException(Msg.getMsg(ctx,
|
throw new ApplicationException(Msg.getMsg(ctx,
|
||||||
"AccessTableNoView")
|
"AccessTableNoView")
|
||||||
+ "(No Window Model Info)");
|
+ "(No Window Model Info)");
|
||||||
}
|
}
|
||||||
gridWindow = new GridWindow(gWindowVO, true);
|
gridWindow = new GridWindow(gWindowVO, true);
|
||||||
title = gridWindow.getName();
|
title = gridWindow.getName();
|
||||||
|
|
||||||
// Set AutoNew for Window
|
// Set AutoNew for Window
|
||||||
if (!autoNew && gridWindow.isTransaction())
|
if (!autoNew && gridWindow.isTransaction())
|
||||||
{
|
{
|
||||||
Env.setAutoNew(ctx, curWindowNo, true);
|
Env.setAutoNew(ctx, curWindowNo, true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
m_onlyCurrentRows = embeddedTabindex < 0 && gridWindow.isTransaction();
|
m_onlyCurrentRows = gridWindow.isTransaction();
|
||||||
|
|
||||||
MQuery detailQuery = null;
|
MQuery detailQuery = null;
|
||||||
/**
|
/**
|
||||||
* Window Tabs
|
* Window Tabs
|
||||||
*/
|
*/
|
||||||
if (embeddedTabindex < 0)
|
if (query != null && query.getZoomTableName() != null && query.getZoomColumnName() != null
|
||||||
|
&& query.getZoomValue() instanceof Integer && (Integer)query.getZoomValue() > 0)
|
||||||
|
{
|
||||||
|
if (!query.getZoomTableName().equalsIgnoreCase(gridWindow.getTab(0).getTableName()))
|
||||||
|
{
|
||||||
|
detailQuery = query;
|
||||||
|
query = new MQuery();
|
||||||
|
query.addRestriction("1=2");
|
||||||
|
query.setRecordCount(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int tabSize = gridWindow.getTabCount();
|
||||||
|
|
||||||
|
for (int tab = 0; tab < tabSize; tab++)
|
||||||
{
|
{
|
||||||
if (query != null && query.getZoomTableName() != null && query.getZoomColumnName() != null
|
initTab(query, tab);
|
||||||
&& query.getZoomValue() instanceof Integer && (Integer)query.getZoomValue() > 0)
|
if (tab == 0 && curTab == null && m_findCancelled)
|
||||||
{
|
return false;
|
||||||
if (!query.getZoomTableName().equalsIgnoreCase(gridWindow.getTab(0).getTableName()))
|
|
||||||
{
|
|
||||||
detailQuery = query;
|
|
||||||
query = new MQuery();
|
|
||||||
query.addRestriction("1=2");
|
|
||||||
query.setRecordCount(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int tabSize = gridWindow.getTabCount();
|
|
||||||
|
|
||||||
for (int tab = 0; tab < tabSize; tab++)
|
|
||||||
{
|
|
||||||
initTab(query, tab);
|
|
||||||
if (tab == 0 && curTab == null && m_findCancelled)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName());
|
|
||||||
}
|
}
|
||||||
else
|
Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName());
|
||||||
{
|
|
||||||
initEmbeddedTab(query, embeddedTabindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (curTab != null)
|
if (curTab != null)
|
||||||
curTab.getTableModel().setChanged(false);
|
curTab.getTableModel().setChanged(false);
|
||||||
|
|
||||||
if (embeddedTabindex < 0)
|
curTabIndex = 0;
|
||||||
{
|
|
||||||
curTabIndex = 0;
|
|
||||||
|
|
||||||
adTab.setSelectedIndex(0);
|
adTab.setSelectedIndex(0);
|
||||||
// all fields context for window is clear at AbstractADTab.prepareContext, set IsSOTrx for window
|
// all fields context for window is clear at AbstractADTab.prepareContext, set IsSOTrx for window
|
||||||
Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx());
|
Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx());
|
||||||
toolbar.enableTabNavigation(adTab.getTabCount() > 1);
|
toolbar.enableTabNavigation(adTab.getTabCount() > 1);
|
||||||
toolbar.enableFind(true);
|
toolbar.enableFind(true);
|
||||||
adTab.evaluate(null);
|
adTab.evaluate(null);
|
||||||
|
|
||||||
if (detailQuery != null && zoomToDetailTab(detailQuery))
|
if (detailQuery != null && zoomToDetailTab(detailQuery))
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
curTabIndex = embeddedTabindex;
|
return true;
|
||||||
toolbar.enableTabNavigation(false);
|
|
||||||
toolbar.enableFind(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateToolbar();
|
updateToolbar();
|
||||||
|
@ -471,15 +418,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
targetQuery.addRestriction(gTab.getLinkColumnName(), "=", parentId);
|
targetQuery.addRestriction(gTab.getLinkColumnName(), "=", parentId);
|
||||||
gTab.setQuery(targetQuery);
|
gTab.setQuery(targetQuery);
|
||||||
IADTabpanel gc = null;
|
IADTabpanel gc = null;
|
||||||
if (!includedMap.containsKey(gTab.getAD_Tab_ID()))
|
gc = adTab.findADTabpanel(gTab);
|
||||||
{
|
|
||||||
gc = adTab.findADTabpanel(gTab);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ADTabpanel parent = (ADTabpanel)includedMap.get(gTab.getAD_Tab_ID());
|
|
||||||
gc = parent.findEmbeddedPanel(gTab);
|
|
||||||
}
|
|
||||||
gc.createUI();
|
gc.createUI();
|
||||||
gc.query(false, 0, 0);
|
gc.query(false, 0, 0);
|
||||||
|
|
||||||
|
@ -490,17 +429,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
int id = table.getKeyID(i);
|
int id = table.getKeyID(i);
|
||||||
if (id == ((Integer)query.getZoomValue()).intValue())
|
if (id == ((Integer)query.getZoomValue()).intValue())
|
||||||
{
|
{
|
||||||
if (!includedMap.containsKey(gTab.getAD_Tab_ID()))
|
setActiveTab(gridWindow.getTabIndex(gTab), null);
|
||||||
{
|
|
||||||
setActiveTab(gridWindow.getTabIndex(gTab), null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IADTabpanel parent = includedMap.get(gTab.getAD_Tab_ID());
|
|
||||||
int pindex = gridWindow.getTabIndex(parent.getGridTab());
|
|
||||||
if (pindex >= 0)
|
|
||||||
setActiveTab(pindex, null);
|
|
||||||
}
|
|
||||||
gTab.navigate(i);
|
gTab.navigate(i);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -511,17 +440,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initEmbeddedTab(MQuery query, int tabIndex) {
|
|
||||||
GridTab gTab = gridWindow.getTab(tabIndex);
|
|
||||||
gTab.addDataStatusListener(this);
|
|
||||||
adTab.addTab(gTab, embeddedTabPanel);
|
|
||||||
if (gTab.isSortTab()) {
|
|
||||||
((ADSortTab)embeddedTabPanel).registerAPanel(this);
|
|
||||||
} else {
|
|
||||||
((ADTabpanel)embeddedTabPanel).init(this, curWindowNo, gTab, gridWindow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initQueryOnNew(MQuery result) {
|
private void initQueryOnNew(MQuery result) {
|
||||||
if (curTab.isHighVolume() && m_findCreateNew)
|
if (curTab.isHighVolume() && m_findCreateNew)
|
||||||
onNew();
|
onNew();
|
||||||
|
@ -583,57 +501,31 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
if (gTab.isSortTab())
|
if (gTab.isSortTab())
|
||||||
{
|
{
|
||||||
ADSortTab sortTab = new ADSortTab(curWindowNo, gTab);
|
ADSortTab sortTab = new ADSortTab(curWindowNo, gTab);
|
||||||
if (includedMap.containsKey(gTab.getAD_Tab_ID()))
|
adTab.addTab(gTab, sortTab);
|
||||||
{
|
sortTab.registerAPanel(this);
|
||||||
includedMap.get(gTab.getAD_Tab_ID()).embed(ctx, curWindowNo, gridWindow, gTab.getAD_Tab_ID(), tabIndex, sortTab);
|
if (tabIndex == 0) {
|
||||||
}
|
curTabpanel = sortTab;
|
||||||
else
|
curTabpanel.createUI();
|
||||||
{
|
if (!m_queryInitiating)
|
||||||
adTab.addTab(gTab, sortTab);
|
{
|
||||||
sortTab.registerAPanel(this);
|
initFirstTabpanel();
|
||||||
if (tabIndex == 0) {
|
|
||||||
curTabpanel = sortTab;
|
|
||||||
curTabpanel.createUI();
|
|
||||||
if (!m_queryInitiating)
|
|
||||||
{
|
|
||||||
initFirstTabpanel();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
gTab.addDataStatusListener(this);
|
|
||||||
}
|
}
|
||||||
|
gTab.addDataStatusListener(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//build embedded tab map
|
|
||||||
ADTabpanel fTabPanel = new ADTabpanel();
|
ADTabpanel fTabPanel = new ADTabpanel();
|
||||||
GridField[] fields = gTab.getTableModel().getFields();
|
gTab.addDataStatusListener(this);
|
||||||
for(int i = 0; i < fields.length; i++)
|
fTabPanel.init(this, curWindowNo, gTab, gridWindow);
|
||||||
{
|
adTab.addTab(gTab, fTabPanel);
|
||||||
if (fields[i].getIncluded_Tab_ID() > 0)
|
if (tabIndex == 0) {
|
||||||
{
|
fTabPanel.createUI();
|
||||||
includedMap.put(fields[i].getIncluded_Tab_ID(), fTabPanel);
|
curTabpanel = fTabPanel;
|
||||||
includedFieldMap.put(fields[i].getIncluded_Tab_ID(), fields[i]);
|
if (!m_queryInitiating)
|
||||||
}
|
{
|
||||||
}
|
initFirstTabpanel();
|
||||||
|
}
|
||||||
if (includedMap.containsKey(gTab.getAD_Tab_ID()))
|
|
||||||
{
|
|
||||||
includedMap.get(gTab.getAD_Tab_ID()).embed(ctx, curWindowNo, gridWindow, gTab.getAD_Tab_ID(), tabIndex, fTabPanel,
|
|
||||||
includedFieldMap.get(gTab.getAD_Tab_ID()).getDisplayLength());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gTab.addDataStatusListener(this);
|
|
||||||
fTabPanel.init(this, curWindowNo, gTab, gridWindow);
|
|
||||||
adTab.addTab(gTab, fTabPanel);
|
|
||||||
if (tabIndex == 0) {
|
|
||||||
fTabPanel.createUI();
|
|
||||||
curTabpanel = fTabPanel;
|
|
||||||
if (!m_queryInitiating)
|
|
||||||
{
|
|
||||||
initFirstTabpanel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_queryInitiating && tabIndex == 0)
|
if (!m_queryInitiating && tabIndex == 0)
|
||||||
|
|
|
@ -49,7 +49,7 @@ import org.zkoss.zul.Vbox;
|
||||||
* @date Mar 12, 2007
|
* @date Mar 12, 2007
|
||||||
* @version $Revision: 0.10 $
|
* @version $Revision: 0.10 $
|
||||||
*/
|
*/
|
||||||
public class StatusBarPanel extends Panel implements EventListener, IStatusBar
|
public class StatusBarPanel extends Panel implements EventListener<Event>, IStatusBar
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -79,20 +79,10 @@ public class StatusBarPanel extends Panel implements EventListener, IStatusBar
|
||||||
|
|
||||||
private Div popupContent;
|
private Div popupContent;
|
||||||
private String popupStyle;
|
private String popupStyle;
|
||||||
private boolean embedded;
|
|
||||||
|
|
||||||
public StatusBarPanel()
|
public StatusBarPanel()
|
||||||
{
|
{
|
||||||
this(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param embedded
|
|
||||||
*/
|
|
||||||
public StatusBarPanel(boolean embedded)
|
|
||||||
{
|
|
||||||
super();
|
super();
|
||||||
this.embedded = embedded;
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,16 +99,10 @@ public class StatusBarPanel extends Panel implements EventListener, IStatusBar
|
||||||
hbox.appendChild(leftCell);
|
hbox.appendChild(leftCell);
|
||||||
Cell rightCell = new Cell();
|
Cell rightCell = new Cell();
|
||||||
hbox.appendChild(rightCell);
|
hbox.appendChild(rightCell);
|
||||||
if (embedded)
|
|
||||||
{
|
leftCell.setWidth("50%");
|
||||||
leftCell.setWidth("90%");
|
rightCell.setWidth("50%");
|
||||||
rightCell.setWidth("10%");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
leftCell.setWidth("50%");
|
|
||||||
rightCell.setWidth("50%");
|
|
||||||
}
|
|
||||||
west = new Div();
|
west = new Div();
|
||||||
west.setStyle("text-align: left; ");
|
west.setStyle("text-align: left; ");
|
||||||
west.appendChild(statusLine);
|
west.appendChild(statusLine);
|
||||||
|
@ -131,17 +115,13 @@ public class StatusBarPanel extends Panel implements EventListener, IStatusBar
|
||||||
east = new Div();
|
east = new Div();
|
||||||
east.setWidth("100%");
|
east.setWidth("100%");
|
||||||
east.setStyle("text-align: right; ");
|
east.setStyle("text-align: right; ");
|
||||||
if (!embedded)
|
infoLine = new Label();
|
||||||
{
|
east.appendChild(infoLine);
|
||||||
infoLine = new Label();
|
infoLine.setVisible(false);
|
||||||
east.appendChild(infoLine);
|
|
||||||
infoLine.setVisible(false);
|
|
||||||
}
|
|
||||||
east.appendChild(statusDB);
|
east.appendChild(statusDB);
|
||||||
|
|
||||||
LayoutUtils.addSclass("status-db", statusDB);
|
LayoutUtils.addSclass("status-db", statusDB);
|
||||||
if (!embedded)
|
LayoutUtils.addSclass("status-info", infoLine);
|
||||||
LayoutUtils.addSclass("status-info", infoLine);
|
|
||||||
vbox = new Vbox();
|
vbox = new Vbox();
|
||||||
vbox.setAlign("stretch");
|
vbox.setAlign("stretch");
|
||||||
vbox.setPack("center");
|
vbox.setPack("center");
|
||||||
|
@ -306,15 +286,12 @@ public class StatusBarPanel extends Panel implements EventListener, IStatusBar
|
||||||
*/
|
*/
|
||||||
public void setInfo (String text)
|
public void setInfo (String text)
|
||||||
{
|
{
|
||||||
if (!embedded)
|
infoLine.setValue(text != null ? text : "");
|
||||||
{
|
infoLine.setTooltiptext(text);
|
||||||
infoLine.setValue(text != null ? text : "");
|
if (text == null || text.trim().length() == 0)
|
||||||
infoLine.setTooltiptext(text);
|
infoLine.setVisible(false);
|
||||||
if (text == null || text.trim().length() == 0)
|
else
|
||||||
infoLine.setVisible(false);
|
infoLine.setVisible(true);
|
||||||
else
|
|
||||||
infoLine.setVisible(true);
|
|
||||||
}
|
|
||||||
} // setInfo
|
} // setInfo
|
||||||
|
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue