Reimplemented collapsible field group using the native zk group component
hide tab when there is only one tab [ 2192992 ] ZKWebui not support grid include (tab include ) as swing ui
This commit is contained in:
parent
fd70983c8c
commit
1437b52f11
|
@ -148,6 +148,19 @@ public class CWindowToolbar extends FToolbar implements EventListener
|
||||||
configureKeyMap();
|
configureKeyMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set embedded mode on/off, embedded panel toolbar should show less button
|
||||||
|
* @param embedded
|
||||||
|
*/
|
||||||
|
public void setEmbedded(boolean embedded)
|
||||||
|
{
|
||||||
|
btnParentRecord.setVisible(!embedded);
|
||||||
|
btnDetailRecord.setVisible(!embedded);
|
||||||
|
btnActiveWorkflows.setVisible(!embedded);
|
||||||
|
btnHistoryRecords.setVisible(!embedded);
|
||||||
|
btnProductInfo.setVisible(!embedded);
|
||||||
|
}
|
||||||
|
|
||||||
private ToolBarButton createButton(String name, String image, String tooltip)
|
private ToolBarButton createButton(String name, String image, String tooltip)
|
||||||
{
|
{
|
||||||
ToolBarButton btn = new ToolBarButton("");
|
ToolBarButton btn = new ToolBarButton("");
|
||||||
|
@ -158,6 +171,11 @@ public class CWindowToolbar extends FToolbar implements EventListener
|
||||||
this.appendChild(btn);
|
this.appendChild(btn);
|
||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ToolBarButton getButton(String name)
|
||||||
|
{
|
||||||
|
return buttons.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
private void configureKeyMap() {
|
private void configureKeyMap() {
|
||||||
keyMap.put(KeyEvent.F1, btnHelp);
|
keyMap.put(KeyEvent.F1, btnHelp);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Posterita Ajax UI *
|
* Copyright (C) 2008 Low Heng Sin *
|
||||||
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
|
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
* by the Free Software Foundation. This program is distributed in the hope *
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
|
@ -10,11 +9,7 @@
|
||||||
* You should have received a copy of the GNU General Public License along *
|
* You should have received a copy of the GNU General Public License along *
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
|
||||||
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
|
|
||||||
* or via info@posterita.org or http://www.posterita.org/ *
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
package org.adempiere.webui.component;
|
package org.adempiere.webui.component;
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,11 +22,9 @@ import org.adempiere.webui.LayoutUtils;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
import org.compiere.model.GridTable;
|
import org.compiere.model.GridTable;
|
||||||
import org.zkoss.zk.au.out.AuEcho;
|
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zk.ui.util.Clients;
|
|
||||||
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.South;
|
import org.zkoss.zkex.zul.South;
|
||||||
|
@ -231,7 +224,11 @@ public class GridPanel extends Borderlayout implements EventListener
|
||||||
south.appendChild(paging);
|
south.appendChild(paging);
|
||||||
paging.addEventListener(ZulEvents.ON_PAGING, this);
|
paging.addEventListener(ZulEvents.ON_PAGING, this);
|
||||||
this.getParent().invalidate();
|
this.getParent().invalidate();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
south.setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateModel() {
|
private void updateModel() {
|
||||||
|
|
|
@ -36,9 +36,21 @@ public class ToolBarButton extends org.zkoss.zul.Toolbarbutton
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
this.setSclass("disableFilter");
|
this.setSclass("disableFilter");
|
||||||
} else {
|
} else {
|
||||||
this.setSclass("");
|
if (this.getSclass() != null && this.getSclass().indexOf("disableFilter") >= 0)
|
||||||
|
this.setSclass(this.getSclass().replace("disableFilter", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPressed(boolean pressed) {
|
||||||
|
if (!isDisabled()) {
|
||||||
|
if (pressed)
|
||||||
|
setSclass("depressed");
|
||||||
|
else {
|
||||||
|
if (this.getSclass() != null && this.getSclass().indexOf("depressed") >= 0)
|
||||||
|
this.setSclass(this.getSclass().replace("depressed", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ToolBarButton(String name) {
|
public ToolBarButton(String name) {
|
||||||
super();
|
super();
|
||||||
|
|
|
@ -35,11 +35,6 @@ public interface ToolbarListener
|
||||||
*/
|
*/
|
||||||
public void onNew();
|
public void onNew();
|
||||||
|
|
||||||
/**
|
|
||||||
* Edit current record
|
|
||||||
*/
|
|
||||||
public void onEdit();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigate to first record
|
* Navigate to first record
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -847,10 +847,6 @@ public class ADSortTab extends Panel implements IADTabpanel
|
||||||
return gridTab != null ? gridTab.isCurrent() : false;
|
return gridTab != null ? gridTab.isCurrent() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEditing() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void query() {
|
public void query() {
|
||||||
loadData();
|
loadData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
@ -38,7 +39,6 @@ import org.adempiere.webui.component.Listbox;
|
||||||
import org.adempiere.webui.component.Row;
|
import org.adempiere.webui.component.Row;
|
||||||
import org.adempiere.webui.component.Rows;
|
import org.adempiere.webui.component.Rows;
|
||||||
import org.adempiere.webui.component.SimpleTreeModel;
|
import org.adempiere.webui.component.SimpleTreeModel;
|
||||||
import org.adempiere.webui.component.ToolBar;
|
|
||||||
import org.adempiere.webui.editor.IZoomableEditor;
|
import org.adempiere.webui.editor.IZoomableEditor;
|
||||||
import org.adempiere.webui.editor.WButtonEditor;
|
import org.adempiere.webui.editor.WButtonEditor;
|
||||||
import org.adempiere.webui.editor.WEditor;
|
import org.adempiere.webui.editor.WEditor;
|
||||||
|
@ -71,10 +71,11 @@ import org.zkoss.zkex.zul.Borderlayout;
|
||||||
import org.zkoss.zkex.zul.Center;
|
import org.zkoss.zkex.zul.Center;
|
||||||
import org.zkoss.zkex.zul.West;
|
import org.zkoss.zkex.zul.West;
|
||||||
import org.zkoss.zul.Div;
|
import org.zkoss.zul.Div;
|
||||||
|
import org.zkoss.zul.Group;
|
||||||
|
import org.zkoss.zul.Groupfoot;
|
||||||
import org.zkoss.zul.Separator;
|
import org.zkoss.zul.Separator;
|
||||||
import org.zkoss.zul.SimpleTreeNode;
|
import org.zkoss.zul.SimpleTreeNode;
|
||||||
import org.zkoss.zul.Space;
|
import org.zkoss.zul.Space;
|
||||||
import org.zkoss.zul.Toolbarbutton;
|
|
||||||
import org.zkoss.zul.Tree;
|
import org.zkoss.zul.Tree;
|
||||||
import org.zkoss.zul.Treeitem;
|
import org.zkoss.zul.Treeitem;
|
||||||
|
|
||||||
|
@ -104,7 +105,8 @@ DataStatusListener, IADTabpanel
|
||||||
|
|
||||||
private GridTab gridTab;
|
private GridTab gridTab;
|
||||||
|
|
||||||
private GridWindow gridWindow;
|
@SuppressWarnings("unused")
|
||||||
|
private GridWindow gridWindow;
|
||||||
|
|
||||||
private AbstractADWindowPanel windowPanel;
|
private AbstractADWindowPanel windowPanel;
|
||||||
|
|
||||||
|
@ -116,17 +118,15 @@ DataStatusListener, IADTabpanel
|
||||||
|
|
||||||
private ArrayList<String> editorIds = new ArrayList<String>();
|
private ArrayList<String> editorIds = new ArrayList<String>();
|
||||||
|
|
||||||
private boolean editing;
|
|
||||||
|
|
||||||
private boolean uiCreated = false;
|
private boolean uiCreated = false;
|
||||||
|
|
||||||
private GridPanel listPanel;
|
private GridPanel listPanel;
|
||||||
|
|
||||||
private Map<String, List<Row>> fieldGroupContents = new HashMap<String, List<Row>>();
|
private Map<String, List<org.zkoss.zul.Row>> fieldGroupContents = new HashMap<String, List<org.zkoss.zul.Row>>();
|
||||||
|
|
||||||
private Map<String, List<Row>> fieldGroupHeaders = new HashMap<String, List<Row>>();
|
private Map<String, List<org.zkoss.zul.Row>> fieldGroupHeaders = new HashMap<String, List<org.zkoss.zul.Row>>();
|
||||||
|
|
||||||
private ArrayList<Row> rowList;
|
private ArrayList<org.zkoss.zul.Row> rowList;
|
||||||
|
|
||||||
private Component formComponent = null;
|
private Component formComponent = null;
|
||||||
|
|
||||||
|
@ -134,6 +134,12 @@ DataStatusListener, IADTabpanel
|
||||||
|
|
||||||
private GridTabDataBinder dataBinder;
|
private GridTabDataBinder dataBinder;
|
||||||
|
|
||||||
|
private Map<Integer, Group> includedTab = new HashMap<Integer, Group>();
|
||||||
|
|
||||||
|
private List<EmbeddedPanel> includedPanel = new ArrayList<EmbeddedPanel>();
|
||||||
|
|
||||||
|
private boolean active = false;
|
||||||
|
|
||||||
public ADTabpanel()
|
public ADTabpanel()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
@ -237,7 +243,7 @@ DataStatusListener, IADTabpanel
|
||||||
|
|
||||||
Rows rows = new Rows();
|
Rows rows = new Rows();
|
||||||
GridField fields[] = gridTab.getFields();
|
GridField fields[] = gridTab.getFields();
|
||||||
Row row = new Row();
|
org.zkoss.zul.Row row = new Row();
|
||||||
|
|
||||||
String currentFieldGroup = null;
|
String currentFieldGroup = null;
|
||||||
for (int i = 0; i < fields.length; i++)
|
for (int i = 0; i < fields.length; i++)
|
||||||
|
@ -245,6 +251,38 @@ DataStatusListener, IADTabpanel
|
||||||
GridField field = fields[i];
|
GridField field = fields[i];
|
||||||
if (field.isDisplayed())
|
if (field.isDisplayed())
|
||||||
{
|
{
|
||||||
|
//included tab
|
||||||
|
if (field.getIncluded_Tab_ID() > 0)
|
||||||
|
{
|
||||||
|
if (row.getChildren().size() == 2)
|
||||||
|
{
|
||||||
|
row.appendChild(createSpacer());
|
||||||
|
row.appendChild(createSpacer());
|
||||||
|
row.appendChild(createSpacer());
|
||||||
|
rows.appendChild(row);
|
||||||
|
if (rowList != null)
|
||||||
|
rowList.add(row);
|
||||||
|
row = new Row();
|
||||||
|
} else if (row.getChildren().size() > 0)
|
||||||
|
{
|
||||||
|
rows.appendChild(row);
|
||||||
|
if (rowList != null)
|
||||||
|
rowList.add(row);
|
||||||
|
row = new Row();
|
||||||
|
}
|
||||||
|
|
||||||
|
row.setSpans("5");
|
||||||
|
row.appendChild(new Separator());
|
||||||
|
rows.appendChild(row);
|
||||||
|
|
||||||
|
row = new Group();
|
||||||
|
rows.appendChild(row);
|
||||||
|
includedTab .put(field.getIncluded_Tab_ID(), (Group)row);
|
||||||
|
row = new Row();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//normal field
|
||||||
String fieldGroup = field.getFieldGroup();
|
String fieldGroup = field.getFieldGroup();
|
||||||
if (fieldGroup != null && fieldGroup.trim().length() > 0)
|
if (fieldGroup != null && fieldGroup.trim().length() > 0)
|
||||||
{
|
{
|
||||||
|
@ -268,7 +306,7 @@ DataStatusListener, IADTabpanel
|
||||||
row = new Row();
|
row = new Row();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Row> headerRows = new ArrayList<Row>();
|
List<org.zkoss.zul.Row> headerRows = new ArrayList<org.zkoss.zul.Row>();
|
||||||
fieldGroupHeaders.put(fieldGroup, headerRows);
|
fieldGroupHeaders.put(fieldGroup, headerRows);
|
||||||
|
|
||||||
row.setSpans("5");
|
row.setSpans("5");
|
||||||
|
@ -276,13 +314,13 @@ DataStatusListener, IADTabpanel
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
headerRows.add(row);
|
headerRows.add(row);
|
||||||
|
|
||||||
rowList = new ArrayList<Row>();
|
rowList = new ArrayList<org.zkoss.zul.Row>();
|
||||||
fieldGroupContents.put(fieldGroup, rowList);
|
fieldGroupContents.put(fieldGroup, rowList);
|
||||||
|
|
||||||
row = new Row();
|
|
||||||
row.setSpans("4");
|
|
||||||
if (X_AD_FieldGroup.FIELDGROUPTYPE_Label.equals(field.getFieldGroupType()))
|
if (X_AD_FieldGroup.FIELDGROUPTYPE_Label.equals(field.getFieldGroupType()))
|
||||||
{
|
{
|
||||||
|
row = new Row();
|
||||||
|
row.setSpans("4");
|
||||||
Label groupLabel = new Label(fieldGroup);
|
Label groupLabel = new Label(fieldGroup);
|
||||||
row.appendChild(groupLabel);
|
row.appendChild(groupLabel);
|
||||||
row.appendChild(createSpacer());
|
row.appendChild(createSpacer());
|
||||||
|
@ -300,12 +338,11 @@ DataStatusListener, IADTabpanel
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ToolBar toolbar = new ToolBar();
|
row = new Group(fieldGroup);
|
||||||
Toolbarbutton button = new Toolbarbutton(fieldGroup, "images/ns-collapse.png");
|
if (X_AD_FieldGroup.FIELDGROUPTYPE_Tab.equals(field.getFieldGroupType()) || field.getIsCollapsedByDefault())
|
||||||
button.addEventListener(Events.ON_CLICK, this);
|
{
|
||||||
button.setParent(toolbar);
|
((Group)row).setOpen(false);
|
||||||
row.appendChild(toolbar);
|
}
|
||||||
row.appendChild(createSpacer());
|
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
headerRows.add(row);
|
headerRows.add(row);
|
||||||
}
|
}
|
||||||
|
@ -316,6 +353,7 @@ DataStatusListener, IADTabpanel
|
||||||
|
|
||||||
if (!field.isSameLine())
|
if (!field.isSameLine())
|
||||||
{
|
{
|
||||||
|
//next line
|
||||||
if(row.getChildren().size() > 0)
|
if(row.getChildren().size() > 0)
|
||||||
{
|
{
|
||||||
if (row.getChildren().size() == 2)
|
if (row.getChildren().size() == 2)
|
||||||
|
@ -335,6 +373,7 @@ DataStatusListener, IADTabpanel
|
||||||
}
|
}
|
||||||
else if (row.getChildren().size() == 4)
|
else if (row.getChildren().size() == 4)
|
||||||
{
|
{
|
||||||
|
//next line if reach max column ( 4 )
|
||||||
row.appendChild(createSpacer());
|
row.appendChild(createSpacer());
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
if (rowList != null)
|
if (rowList != null)
|
||||||
|
@ -377,6 +416,7 @@ DataStatusListener, IADTabpanel
|
||||||
editor.addValueChangeListener(dataBinder);
|
editor.addValueChangeListener(dataBinder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//streach component to fill grid cell
|
||||||
if (editor.getComponent() instanceof HtmlBasedComponent) {
|
if (editor.getComponent() instanceof HtmlBasedComponent) {
|
||||||
//can't stretch bandbox & datebox
|
//can't stretch bandbox & datebox
|
||||||
if (!(editor.getComponent() instanceof Bandbox) &&
|
if (!(editor.getComponent() instanceof Bandbox) &&
|
||||||
|
@ -394,8 +434,8 @@ DataStatusListener, IADTabpanel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WEditorPopupMenu popupMenu = editor.getPopupMenu();
|
//setup editor context menu
|
||||||
|
WEditorPopupMenu popupMenu = editor.getPopupMenu();
|
||||||
if (popupMenu != null)
|
if (popupMenu != null)
|
||||||
{
|
{
|
||||||
popupMenu.addMenuListener((ContextMenuListener)editor);
|
popupMenu.addMenuListener((ContextMenuListener)editor);
|
||||||
|
@ -411,6 +451,8 @@ DataStatusListener, IADTabpanel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//last row
|
||||||
if (row.getChildren().size() > 0)
|
if (row.getChildren().size() > 0)
|
||||||
{
|
{
|
||||||
if (row.getChildren().size() == 2)
|
if (row.getChildren().size() == 2)
|
||||||
|
@ -425,11 +467,15 @@ DataStatusListener, IADTabpanel
|
||||||
}
|
}
|
||||||
grid.appendChild(rows);
|
grid.appendChild(rows);
|
||||||
|
|
||||||
|
//create tree
|
||||||
if (gridTab.isTreeTab() && tree != null) {
|
if (gridTab.isTreeTab() && tree != null) {
|
||||||
int AD_Tree_ID = MTree.getDefaultAD_Tree_ID (
|
int AD_Tree_ID = MTree.getDefaultAD_Tree_ID (
|
||||||
Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName());
|
Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName());
|
||||||
SimpleTreeModel.initADTree(tree, AD_Tree_ID, windowNo);
|
SimpleTreeModel.initADTree(tree, AD_Tree_ID, windowNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!gridTab.isSingleRow())
|
||||||
|
switchRowPresentation();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Component createSpacer() {
|
private Component createSpacer() {
|
||||||
|
@ -476,7 +522,7 @@ DataStatusListener, IADTabpanel
|
||||||
for (WEditor comp : editors)
|
for (WEditor comp : editors)
|
||||||
{
|
{
|
||||||
GridField mField = comp.getGridField();
|
GridField mField = comp.getGridField();
|
||||||
if (mField != null)
|
if (mField != null && mField.getIncluded_Tab_ID() <= 0)
|
||||||
{
|
{
|
||||||
if (mField.isDisplayed(true)) // check context
|
if (mField.isDisplayed(true)) // check context
|
||||||
{
|
{
|
||||||
|
@ -497,13 +543,6 @@ DataStatusListener, IADTabpanel
|
||||||
{
|
{
|
||||||
comp.setMandatory(mField.isMandatory(true)); // check context
|
comp.setMandatory(mField.isMandatory(true)); // check context
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
boolean manMissing = false;
|
|
||||||
if (rw && mField.getValue() == null && mField.isMandatory(true)) // check context
|
|
||||||
{
|
|
||||||
manMissing = true;
|
|
||||||
}
|
|
||||||
comp.setBackground(manMissing || mField.isError());*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (comp.isVisible())
|
else if (comp.isVisible())
|
||||||
|
@ -514,11 +553,11 @@ DataStatusListener, IADTabpanel
|
||||||
} // all components
|
} // all components
|
||||||
|
|
||||||
//hide row if all editor within the row is invisible
|
//hide row if all editor within the row is invisible
|
||||||
List rows = grid.getRows().getChildren();
|
List<?> rows = grid.getRows().getChildren();
|
||||||
for(int i = 0; i < rows.size(); i++)
|
for(int i = 0; i < rows.size(); i++)
|
||||||
{
|
{
|
||||||
Row row = (Row) rows.get(i);
|
org.zkoss.zul.Row row = (org.zkoss.zul.Row) rows.get(i);
|
||||||
List components = row.getChildren();
|
List<?> components = row.getChildren();
|
||||||
boolean visible = false;
|
boolean visible = false;
|
||||||
boolean editorRow = false;
|
boolean editorRow = false;
|
||||||
for (int j = 0; j < components.size(); j++)
|
for (int j = 0; j < components.size(); j++)
|
||||||
|
@ -538,13 +577,13 @@ DataStatusListener, IADTabpanel
|
||||||
row.setVisible(visible);
|
row.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
//hide fieldgroup is all editor row within the fieldgroup is invisible
|
//hide fieldgroup if all editor row within the fieldgroup is invisible
|
||||||
for(Iterator<Entry<String, List<Row>>> i = fieldGroupHeaders.entrySet().iterator(); i.hasNext();)
|
for(Iterator<Entry<String, List<org.zkoss.zul.Row>>> i = fieldGroupHeaders.entrySet().iterator(); i.hasNext();)
|
||||||
{
|
{
|
||||||
Map.Entry<String, List<Row>> entry = i.next();
|
Map.Entry<String, List<org.zkoss.zul.Row>> entry = i.next();
|
||||||
List<Row> contents = fieldGroupContents.get(entry.getKey());
|
List<org.zkoss.zul.Row> contents = fieldGroupContents.get(entry.getKey());
|
||||||
boolean visible = false;
|
boolean visible = false;
|
||||||
for (Row row : contents)
|
for (org.zkoss.zul.Row row : contents)
|
||||||
{
|
{
|
||||||
if (row.isVisible())
|
if (row.isVisible())
|
||||||
{
|
{
|
||||||
|
@ -552,8 +591,8 @@ DataStatusListener, IADTabpanel
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<Row> headers = entry.getValue();
|
List<org.zkoss.zul.Row> headers = entry.getValue();
|
||||||
for(Row row : headers)
|
for(org.zkoss.zul.Row row : headers)
|
||||||
{
|
{
|
||||||
if (row.isVisible() != visible)
|
if (row.isVisible() != visible)
|
||||||
row.setVisible(visible);
|
row.setVisible(visible);
|
||||||
|
@ -621,6 +660,7 @@ DataStatusListener, IADTabpanel
|
||||||
|
|
||||||
public void activate(boolean activate)
|
public void activate(boolean activate)
|
||||||
{
|
{
|
||||||
|
active = activate;
|
||||||
if (listPanel.isVisible()) {
|
if (listPanel.isVisible()) {
|
||||||
if (activate)
|
if (activate)
|
||||||
listPanel.activate(gridTab);
|
listPanel.activate(gridTab);
|
||||||
|
@ -632,7 +672,23 @@ DataStatusListener, IADTabpanel
|
||||||
setInitialFocus();
|
setInitialFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//activate embedded panel
|
||||||
|
for(EmbeddedPanel ep : includedPanel)
|
||||||
|
{
|
||||||
|
activateChild(activate, ep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
private void setInitialFocus() {
|
private void setInitialFocus() {
|
||||||
for (WEditor editor : editors) {
|
for (WEditor editor : editors) {
|
||||||
|
@ -644,38 +700,9 @@ DataStatusListener, IADTabpanel
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEditing()
|
|
||||||
{
|
|
||||||
return this.editing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void editRecord(boolean edit)
|
|
||||||
{
|
|
||||||
/* this.editing = edit;
|
|
||||||
for (Editor editor : editors)
|
|
||||||
{
|
|
||||||
editor.setEditing(edit);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onEvent(Event event)
|
public void onEvent(Event event)
|
||||||
{
|
{
|
||||||
if (event.getTarget() instanceof Toolbarbutton)
|
if (event.getTarget() instanceof Listbox)
|
||||||
{
|
|
||||||
Toolbarbutton button = (Toolbarbutton) event.getTarget();
|
|
||||||
List<Row> list = fieldGroupContents.get(button.getLabel());
|
|
||||||
if (list.get(0).isVisible()) {
|
|
||||||
for (Row row : list) {
|
|
||||||
row.setVisible(false);
|
|
||||||
}
|
|
||||||
button.setImage("images/ns-expand.png");
|
|
||||||
} else {
|
|
||||||
for (Row row : list) {
|
|
||||||
row.setVisible(true);
|
|
||||||
}
|
|
||||||
button.setImage("images/ns-collapse.png");
|
|
||||||
}
|
|
||||||
} else if (event.getTarget() instanceof Listbox)
|
|
||||||
{
|
{
|
||||||
this.switchRowPresentation();
|
this.switchRowPresentation();
|
||||||
}
|
}
|
||||||
|
@ -774,6 +801,12 @@ DataStatusListener, IADTabpanel
|
||||||
if (listPanel.isVisible()) {
|
if (listPanel.isVisible()) {
|
||||||
listPanel.updateListIndex();
|
listPanel.updateListIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!includedPanel.isEmpty()) {
|
||||||
|
for (EmbeddedPanel panel : includedPanel)
|
||||||
|
panel.tabPanel.query(false, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteNode(int recordId) {
|
private void deleteNode(int recordId) {
|
||||||
|
@ -808,7 +841,7 @@ DataStatusListener, IADTabpanel
|
||||||
MTreeNode root = (MTreeNode) treeNode.getData();
|
MTreeNode root = (MTreeNode) treeNode.getData();
|
||||||
MTreeNode node = new MTreeNode (gridTab.getRecord_ID(), 0, name, description,
|
MTreeNode node = new MTreeNode (gridTab.getRecord_ID(), 0, name, description,
|
||||||
root.getNode_ID(), summary, imageIndicator, false, null);
|
root.getNode_ID(), summary, imageIndicator, false, null);
|
||||||
SimpleTreeNode newNode = new SimpleTreeNode(node, new ArrayList());
|
SimpleTreeNode newNode = new SimpleTreeNode(node, new ArrayList<Object>());
|
||||||
model.addNode(newNode);
|
model.addNode(newNode);
|
||||||
int[] path = model.getPath(model.getRoot(), newNode);
|
int[] path = model.getPath(model.getRoot(), newNode);
|
||||||
Treeitem ti = tree.renderItemByPath(path);
|
Treeitem ti = tree.renderItemByPath(path);
|
||||||
|
@ -864,5 +897,47 @@ 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) {
|
||||||
|
EmbeddedPanel ep = new EmbeddedPanel();
|
||||||
|
ep.tabPanel = tabPanel;
|
||||||
|
ep.adTabId = adTabId;
|
||||||
|
includedPanel.add(ep);
|
||||||
|
Group group = includedTab.get(adTabId);
|
||||||
|
if (tabPanel instanceof ADTabpanel) {
|
||||||
|
ADTabpanel atp = (ADTabpanel) tabPanel;
|
||||||
|
atp.listPanel.setPageSize(-1);
|
||||||
|
}
|
||||||
|
if (group != null) {
|
||||||
|
ADWindowPanel panel = new ADWindowPanel(ctx, windowNo, gridWindow, tabIndex, tabPanel);
|
||||||
|
ep.windowPanel = panel;
|
||||||
|
org.zkoss.zul.Row row = new Row();
|
||||||
|
row.setSpans("5");
|
||||||
|
Component next = group.getNextSibling();
|
||||||
|
grid.getRows().insertBefore(row, next);
|
||||||
|
panel.createPart(row);
|
||||||
|
panel.getComponent().setWidth("99%");
|
||||||
|
group.setLabel(gridWindow.getTab(tabIndex).getName());
|
||||||
|
panel.initPanel(-1, null);
|
||||||
|
if (active)
|
||||||
|
activateChild(true, ep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class EmbeddedPanel {
|
||||||
|
ADWindowPanel windowPanel;
|
||||||
|
IADTabpanel tabPanel;
|
||||||
|
int adTabId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ 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.compiere.model.GridWindow;
|
||||||
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.HtmlBasedComponent;
|
import org.zkoss.zk.ui.HtmlBasedComponent;
|
||||||
|
@ -63,12 +65,21 @@ public class ADWindowPanel extends AbstractADWindowPanel
|
||||||
private Borderlayout layout;
|
private Borderlayout layout;
|
||||||
|
|
||||||
private Center contentArea;
|
private Center contentArea;
|
||||||
|
|
||||||
|
private West west;
|
||||||
|
|
||||||
public ADWindowPanel(Properties ctx, int windowNo)
|
public ADWindowPanel(Properties ctx, int windowNo)
|
||||||
{
|
{
|
||||||
super(ctx, windowNo);
|
super(ctx, windowNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
@ -94,14 +105,14 @@ public class ADWindowPanel extends AbstractADWindowPanel
|
||||||
statusBar.setParent(s);
|
statusBar.setParent(s);
|
||||||
LayoutUtils.addSclass("adwindow-status", statusBar);
|
LayoutUtils.addSclass("adwindow-status", statusBar);
|
||||||
|
|
||||||
if (adTab.isUseExternalSelection())
|
if (!isEmbedded() && adTab.isUseExternalSelection())
|
||||||
{
|
{
|
||||||
West w = new West();
|
west = new West();
|
||||||
layout.appendChild(w);
|
layout.appendChild(west);
|
||||||
w.setSplittable(false);
|
west.setSplittable(false);
|
||||||
w.setAutoscroll(true);
|
west.setAutoscroll(true);
|
||||||
LayoutUtils.addSclass("adwindow-nav", w);
|
LayoutUtils.addSclass("adwindow-nav", west);
|
||||||
adTab.getTabSelectionComponent().setParent(w);
|
adTab.getTabSelectionComponent().setParent(west);
|
||||||
LayoutUtils.addSclass("adwindow-nav-content", (HtmlBasedComponent) adTab.getTabSelectionComponent());
|
LayoutUtils.addSclass("adwindow-nav-content", (HtmlBasedComponent) adTab.getTabSelectionComponent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +127,7 @@ public class ADWindowPanel extends AbstractADWindowPanel
|
||||||
((Tabpanel)parent).setOnCloseHandler(handler);
|
((Tabpanel)parent).setOnCloseHandler(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adTab.getComponent() instanceof Window) {
|
if (!isEmbedded() && adTab.getComponent() instanceof Window) {
|
||||||
Window w = (Window) adTab.getComponent();
|
Window w = (Window) adTab.getComponent();
|
||||||
w.addEventListener(Events.ON_CTRL_KEY, toolbar);
|
w.addEventListener(Events.ON_CTRL_KEY, toolbar);
|
||||||
}
|
}
|
||||||
|
@ -134,6 +145,18 @@ public class ADWindowPanel extends AbstractADWindowPanel
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean initPanel(int adWindowId, MQuery query) {
|
||||||
|
boolean retValue = super.initPanel(adWindowId, query);
|
||||||
|
if (adTab.getTabCount() == 1 && west != null)
|
||||||
|
west.setVisible(false);
|
||||||
|
return retValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TabOnCloseHanlder implements ITabOnCloseHandler {
|
class TabOnCloseHanlder implements ITabOnCloseHandler {
|
||||||
|
|
||||||
public void onClose(Tabpanel tabPanel) {
|
public void onClose(Tabpanel tabPanel) {
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
package org.adempiere.webui.panel;
|
package org.adempiere.webui.panel;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
@ -120,10 +122,40 @@ 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>();
|
||||||
|
|
||||||
|
private IADTabpanel embeddedTabPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for non-embedded mode
|
||||||
|
* @param ctx
|
||||||
|
* @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();
|
||||||
}
|
}
|
||||||
|
@ -134,7 +166,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
this.parent = (Component) parent;
|
this.parent = (Component) parent;
|
||||||
|
|
||||||
adTab = createADTab();
|
adTab = createADTab();
|
||||||
adTab.addSelectionEventListener(this);
|
adTab.addSelectionEventListener(this);
|
||||||
|
|
||||||
return super.createPart(parent);
|
return super.createPart(parent);
|
||||||
}
|
}
|
||||||
|
@ -143,6 +175,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
{
|
{
|
||||||
return statusBar;
|
return statusBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEmbedded() {
|
||||||
|
return embeddedTabindex >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
private void initComponents()
|
private void initComponents()
|
||||||
{
|
{
|
||||||
|
@ -150,6 +186,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
toolbar = new CWindowToolbar();
|
toolbar = new CWindowToolbar();
|
||||||
toolbar.addListener(this);
|
toolbar.addListener(this);
|
||||||
toolbar.setWidth("100%");
|
toolbar.setWidth("100%");
|
||||||
|
toolbar.setEmbedded(isEmbedded());
|
||||||
|
|
||||||
statusBar = new StatusBarPanel();
|
statusBar = new StatusBarPanel();
|
||||||
}
|
}
|
||||||
|
@ -159,106 +196,71 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
public boolean initPanel(int adWindowId, MQuery query)
|
public boolean initPanel(int adWindowId, MQuery query)
|
||||||
{
|
{
|
||||||
// Set AutoCommit for this Window
|
// Set AutoCommit for this Window
|
||||||
Env.setAutoCommit(ctx, curWindowNo, Env.isAutoCommit(ctx));
|
if (embeddedTabindex < 0)
|
||||||
boolean autoNew = Env.isAutoNew(ctx);
|
{
|
||||||
Env.setAutoNew(ctx, curWindowNo, autoNew);
|
Env.setAutoCommit(ctx, curWindowNo, Env.isAutoCommit(ctx));
|
||||||
|
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);
|
gridWindow = new GridWindow(gWindowVO);
|
||||||
title = gridWindow.getName();
|
title = gridWindow.getName();
|
||||||
|
|
||||||
// Set SO/AutoNew for Window
|
// Set SO/AutoNew for Window
|
||||||
Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx());
|
Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx());
|
||||||
if (!autoNew && gridWindow.isTransaction())
|
if (!autoNew && gridWindow.isTransaction())
|
||||||
{
|
{
|
||||||
Env.setAutoNew(ctx, curWindowNo, true);
|
Env.setAutoNew(ctx, curWindowNo, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_onlyCurrentRows = gridWindow.isTransaction();
|
m_onlyCurrentRows = embeddedTabindex < 0 && gridWindow.isTransaction();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Window Tabs
|
* Window Tabs
|
||||||
*/
|
*/
|
||||||
int tabSize = gridWindow.getTabCount();
|
if (embeddedTabindex < 0)
|
||||||
|
|
||||||
for (int tab = 0; tab < tabSize; tab++)
|
|
||||||
{
|
{
|
||||||
gridWindow.initTab(tab);
|
int tabSize = gridWindow.getTabCount();
|
||||||
|
|
||||||
GridTab gTab = gridWindow.getTab(tab);
|
for (int tab = 0; tab < tabSize; tab++)
|
||||||
Env.setContext(ctx, curWindowNo, tab, "TabLevel", Integer
|
{
|
||||||
.toString(gTab.getTabLevel()));
|
initTab(query, tab);
|
||||||
|
}
|
||||||
|
Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName());
|
||||||
|
|
||||||
gTab.addDataStatusListener(this);
|
|
||||||
|
|
||||||
// Query first tab
|
|
||||||
if (tab == 0)
|
|
||||||
{
|
|
||||||
query = initialQuery(query, gTab);
|
|
||||||
if (gTab.isHighVolume() && m_findCancelled)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (query != null && query.getRecordCount() <= 1)
|
|
||||||
{
|
|
||||||
// goSingleRow = true;
|
|
||||||
}
|
|
||||||
// Set initial Query on first tab
|
|
||||||
if (query != null)
|
|
||||||
{
|
|
||||||
m_onlyCurrentRows = false;
|
|
||||||
gTab.setQuery(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
curTab = gTab;
|
|
||||||
curTabIndex = tab;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gTab.isSortTab())
|
|
||||||
{
|
|
||||||
ADSortTab sortTab = new ADSortTab(curWindowNo, gTab);
|
|
||||||
adTab.addTab(gTab, sortTab);
|
|
||||||
sortTab.registerAPanel(this);
|
|
||||||
if (tab == 0) {
|
|
||||||
curTabpanel = sortTab;
|
|
||||||
curTabpanel.createUI();
|
|
||||||
curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, 0);
|
|
||||||
curTabpanel.activate(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ADTabpanel fTabPanel = new ADTabpanel();
|
|
||||||
fTabPanel.init(this, curWindowNo, gTab, gridWindow);
|
|
||||||
adTab.addTab(gTab, fTabPanel);
|
|
||||||
if (tab == 0) {
|
|
||||||
fTabPanel.createUI();
|
|
||||||
curTabpanel = fTabPanel;
|
|
||||||
curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, 0);
|
|
||||||
curTabpanel.activate(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName());
|
|
||||||
curTab.getTableModel().setChanged(false);
|
|
||||||
curTabIndex = 0;
|
|
||||||
|
|
||||||
adTab.setSelectedIndex(0);
|
|
||||||
toolbar.enableTabNavigation(adTab.getTabCount() > 1);
|
|
||||||
toolbar.enableFind(true);
|
|
||||||
adTab.evaluate(null);
|
|
||||||
|
|
||||||
if (gridWindow.isTransaction())
|
|
||||||
{
|
{
|
||||||
toolbar.enableHistoryRecords(true);
|
initEmbeddedTab(query, embeddedTabindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
curTab.getTableModel().setChanged(false);
|
||||||
|
if (embeddedTabindex < 0)
|
||||||
|
{
|
||||||
|
curTabIndex = 0;
|
||||||
|
|
||||||
|
adTab.setSelectedIndex(0);
|
||||||
|
toolbar.enableTabNavigation(adTab.getTabCount() > 1);
|
||||||
|
toolbar.enableFind(true);
|
||||||
|
adTab.evaluate(null);
|
||||||
|
|
||||||
|
if (gridWindow.isTransaction())
|
||||||
|
{
|
||||||
|
toolbar.enableHistoryRecords(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curTabIndex = embeddedTabindex;
|
||||||
|
toolbar.enableTabNavigation(false);
|
||||||
|
toolbar.enableFind(true);
|
||||||
|
toolbar.enableHistoryRecords(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateToolbar();
|
updateToolbar();
|
||||||
|
@ -266,6 +268,98 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initTab(MQuery query, int tabIndex) {
|
||||||
|
gridWindow.initTab(tabIndex);
|
||||||
|
|
||||||
|
GridTab gTab = gridWindow.getTab(tabIndex);
|
||||||
|
Env.setContext(ctx, curWindowNo, tabIndex, "TabLevel", Integer
|
||||||
|
.toString(gTab.getTabLevel()));
|
||||||
|
|
||||||
|
// Query first tab
|
||||||
|
if (tabIndex == 0)
|
||||||
|
{
|
||||||
|
query = initialQuery(query, gTab);
|
||||||
|
if (gTab.isHighVolume() && m_findCancelled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (query != null && query.getRecordCount() <= 1)
|
||||||
|
{
|
||||||
|
// goSingleRow = true;
|
||||||
|
}
|
||||||
|
// Set initial Query on first tab
|
||||||
|
if (query != null)
|
||||||
|
{
|
||||||
|
m_onlyCurrentRows = false;
|
||||||
|
gTab.setQuery(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
curTab = gTab;
|
||||||
|
curTabIndex = tabIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gTab.isSortTab())
|
||||||
|
{
|
||||||
|
ADSortTab sortTab = new ADSortTab(curWindowNo, gTab);
|
||||||
|
if (includedMap.containsKey(gTab.getAD_Tab_ID()))
|
||||||
|
{
|
||||||
|
includedMap.get(gTab.getAD_Tab_ID()).embed(ctx, curWindowNo, gridWindow, gTab.getAD_Tab_ID(), tabIndex, sortTab);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
adTab.addTab(gTab, sortTab);
|
||||||
|
sortTab.registerAPanel(this);
|
||||||
|
if (tabIndex == 0) {
|
||||||
|
curTabpanel = sortTab;
|
||||||
|
curTabpanel.createUI();
|
||||||
|
curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, 0);
|
||||||
|
curTabpanel.activate(true);
|
||||||
|
}
|
||||||
|
gTab.addDataStatusListener(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//build embedded tab map
|
||||||
|
ADTabpanel fTabPanel = new ADTabpanel();
|
||||||
|
GridField[] fields = gTab.getTableModel().getFields();
|
||||||
|
for(int i = 0; i < fields.length; i++)
|
||||||
|
{
|
||||||
|
if (fields[i].getIncluded_Tab_ID() > 0)
|
||||||
|
{
|
||||||
|
includedMap.put(fields[i].getIncluded_Tab_ID(), fTabPanel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (includedMap.containsKey(gTab.getAD_Tab_ID()))
|
||||||
|
{
|
||||||
|
includedMap.get(gTab.getAD_Tab_ID()).embed(ctx, curWindowNo, gridWindow, gTab.getAD_Tab_ID(), tabIndex, fTabPanel);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gTab.addDataStatusListener(this);
|
||||||
|
fTabPanel.init(this, curWindowNo, gTab, gridWindow);
|
||||||
|
adTab.addTab(gTab, fTabPanel);
|
||||||
|
if (tabIndex == 0) {
|
||||||
|
fTabPanel.createUI();
|
||||||
|
curTabpanel = fTabPanel;
|
||||||
|
curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, 0);
|
||||||
|
curTabpanel.activate(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initial Query
|
* Initial Query
|
||||||
*
|
*
|
||||||
|
@ -623,37 +717,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
|
|
||||||
public void dataStatusChanged(DataStatusEvent e)
|
public void dataStatusChanged(DataStatusEvent e)
|
||||||
{
|
{
|
||||||
//TODO: ignore non-ui thread event for now.
|
//ignore non-ui thread event for now.
|
||||||
if (Executions.getCurrent() == null)
|
if (Executions.getCurrent() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* // update Navigation
|
|
||||||
boolean firstRow = e.isFirstRow();
|
|
||||||
boolean lastRow = e.isLastRow();
|
|
||||||
toolbar.enableFirstNavigation(!firstRow);
|
|
||||||
toolbar.enableLastNavigation(!lastRow);
|
|
||||||
|
|
||||||
// update Change
|
|
||||||
boolean changed = e.isChanged() || e.isInserting();
|
|
||||||
boolean readOnly = curTab.isReadOnly();
|
|
||||||
boolean insertRecord = !readOnly;
|
|
||||||
if (insertRecord)
|
|
||||||
{
|
|
||||||
insertRecord = curTab.isInsertRecord();
|
|
||||||
}
|
|
||||||
|
|
||||||
toolbar.enabledNew(!changed && insertRecord);
|
|
||||||
toolbar.enableRefresh(!changed);
|
|
||||||
toolbar.enableDelete(!changed && !readOnly);
|
|
||||||
|
|
||||||
if (readOnly && curTab.isAlwaysUpdateField())
|
|
||||||
{
|
|
||||||
readOnly = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
lblRecords.setValue(e.getMessage());
|
|
||||||
tabbox.evaluate(e);*/
|
|
||||||
|
|
||||||
logger.info(e.getMessage());
|
logger.info(e.getMessage());
|
||||||
String dbInfo = e.getMessage();
|
String dbInfo = e.getMessage();
|
||||||
if (curTab != null && curTab.isQueryActive())
|
if (curTab != null && curTab.isQueryActive())
|
||||||
|
@ -739,13 +806,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
toolbar.enableDeleteSelection(true);
|
toolbar.enableDeleteSelection(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Single-Multi
|
|
||||||
// aMulti.setPressed(!m_curGC.isSingleRow());
|
|
||||||
|
|
||||||
// History (on first Tab only)
|
// History (on first Tab only)
|
||||||
if (isFirstTab())
|
if (isFirstTab())
|
||||||
{
|
{
|
||||||
// aHistory.setPressed(!curTab.isOnlyCurrentRows());
|
toolbar.getButton("HistoryRecords").setPressed(!curTab.isOnlyCurrentRows());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction info
|
// Transaction info
|
||||||
|
@ -770,15 +834,14 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
if (canHaveAttachment)
|
if (canHaveAttachment)
|
||||||
{
|
{
|
||||||
toolbar.enableAttachment(true);
|
toolbar.enableAttachment(true);
|
||||||
/*aAttachment.setPressed(m_curTab.hasAttachment());
|
toolbar.getButton("Attachment").setPressed(curTab.hasAttachment());
|
||||||
aChat.setEnabled(true);
|
|
||||||
aChat.setPressed(m_curTab.hasChat());*/
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
toolbar.enableAttachment(false);
|
toolbar.enableAttachment(false);
|
||||||
// aChat.setEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toolbar.getButton("Find").setPressed(curTab.isQueryActive());
|
||||||
// Lock Indicator
|
// Lock Indicator
|
||||||
/* if (m_isPersonalLock)
|
/* if (m_isPersonalLock)
|
||||||
{
|
{
|
||||||
|
@ -829,7 +892,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
newRecord = curTab.dataNew(false);
|
newRecord = curTab.dataNew(false);
|
||||||
if (newRecord)
|
if (newRecord)
|
||||||
{
|
{
|
||||||
curTabpanel.editRecord(true);
|
|
||||||
curTabpanel.dynamicDisplay(0);
|
curTabpanel.dynamicDisplay(0);
|
||||||
toolbar.enableChanges(false);
|
toolbar.enableChanges(false);
|
||||||
toolbar.enableDelete(false);
|
toolbar.enableDelete(false);
|
||||||
|
@ -860,7 +922,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
newRecord = curTab.dataNew(true);
|
newRecord = curTab.dataNew(true);
|
||||||
if (newRecord)
|
if (newRecord)
|
||||||
{
|
{
|
||||||
curTabpanel.editRecord(true);
|
|
||||||
curTabpanel.dynamicDisplay(0);
|
curTabpanel.dynamicDisplay(0);
|
||||||
toolbar.enableChanges(false);
|
toolbar.enableChanges(false);
|
||||||
toolbar.enableDelete(false);
|
toolbar.enableDelete(false);
|
||||||
|
@ -921,27 +982,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
curTab.dataIgnore();
|
curTab.dataIgnore();
|
||||||
curTab.dataRefresh();
|
curTab.dataRefresh();
|
||||||
curTabpanel.dynamicDisplay(0);
|
curTabpanel.dynamicDisplay(0);
|
||||||
curTabpanel.editRecord(false);
|
|
||||||
toolbar.enableIgnore(false);
|
toolbar.enableIgnore(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ToolbarListener#onEdit()
|
|
||||||
*/
|
|
||||||
public void onEdit()
|
|
||||||
{
|
|
||||||
curTabpanel.editRecord(true);
|
|
||||||
toolbar.enableIgnore(true);
|
|
||||||
toolbar.enabledNew(false);
|
|
||||||
toolbar.enableCopy(false);
|
|
||||||
toolbar.enableDelete(false);
|
|
||||||
toolbar.enableNavigation(false);
|
|
||||||
toolbar.enableTabNavigation(false);
|
|
||||||
toolbar.enablePrint(true);
|
|
||||||
toolbar.enableReport(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ToolbarListener#onSave()
|
* @see ToolbarListener#onSave()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -45,10 +45,5 @@ public interface IADTabpanel extends Component, Evaluatee {
|
||||||
|
|
||||||
public void switchRowPresentation();
|
public void switchRowPresentation();
|
||||||
|
|
||||||
public boolean isEditing();
|
|
||||||
|
|
||||||
public void dynamicDisplay(int i);
|
public void dynamicDisplay(int i);
|
||||||
|
|
||||||
public void editRecord(boolean b);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue