Enhance included tab appearance.

This commit is contained in:
Heng Sin Low 2008-11-25 08:13:53 +00:00
parent 0cd09ffbf9
commit 90376b1dd3
5 changed files with 75 additions and 50 deletions

View File

@ -80,8 +80,16 @@ public class CWindowToolbar extends FToolbar implements EventListener
private Map<Integer, ToolBarButton> keyMap = new HashMap<Integer, ToolBarButton>(); private Map<Integer, ToolBarButton> keyMap = new HashMap<Integer, ToolBarButton>();
private boolean embedded;
public CWindowToolbar() public CWindowToolbar()
{ {
this(false);
}
public CWindowToolbar(boolean embedded)
{
this.embedded = embedded;
init(); init();
} }
@ -89,36 +97,36 @@ public class CWindowToolbar extends FToolbar implements EventListener
{ {
LayoutUtils.addSclass("adwindow-toolbar", this); LayoutUtils.addSclass("adwindow-toolbar", this);
btnIgnore = createButton("Ignore", "Ignore24.png", "Ignore"); btnIgnore = createButton("Ignore", "Ignore", "Ignore");
addSeparator(); addSeparator();
btnHelp = createButton("Help", "Help24.png","Help"); btnHelp = createButton("Help", "Help","Help");
btnNew = createButton("New", "New24.png", "New"); btnNew = createButton("New", "New", "New");
btnCopy = createButton("Copy", "Copy24.png", "Copy"); btnCopy = createButton("Copy", "Copy", "Copy");
btnDelete = createButton("Delete", "Delete24.png", "Delete"); btnDelete = createButton("Delete", "Delete", "Delete");
btnSave = createButton("Save", "Save24.png", "Save"); btnSave = createButton("Save", "Save", "Save");
addSeparator(); addSeparator();
btnRefresh = createButton("Refresh", "Refresh24.png", "Refresh"); btnRefresh = createButton("Refresh", "Refresh", "Refresh");
btnFind = createButton("Find", "Find24.png", "Find"); btnFind = createButton("Find", "Find", "Find");
btnAttachment = createButton("Attachment", "Attachment24.png", "Attachment"); btnAttachment = createButton("Attachment", "Attachment", "Attachment");
btnGridToggle = createButton("Toggle", "Multi24.png", "Multi"); btnGridToggle = createButton("Toggle", "Multi", "Multi");
addSeparator(); addSeparator();
btnHistoryRecords = createButton("HistoryRecords", "HistoryX24.png", "History"); btnHistoryRecords = createButton("HistoryRecords", "HistoryX", "History");
btnParentRecord = createButton("ParentRecord", "Parent24.png", "Parent"); btnParentRecord = createButton("ParentRecord", "Parent", "Parent");
btnDetailRecord = createButton("DetailRecord", "Detail24.png", "Detail"); btnDetailRecord = createButton("DetailRecord", "Detail", "Detail");
addSeparator(); addSeparator();
btnFirst = createButton("First", "First24.png", "First"); btnFirst = createButton("First", "First", "First");
btnPrevious = createButton("Previous", "Previous24.png", "Previous"); btnPrevious = createButton("Previous", "Previous", "Previous");
btnNext = createButton("Next", "Next24.png", "Next"); btnNext = createButton("Next", "Next", "Next");
btnLast = createButton("Last", "Last24.png", "Last"); btnLast = createButton("Last", "Last", "Last");
addSeparator(); addSeparator();
btnReport = createButton("Report", "Report24.png", "Report"); btnReport = createButton("Report", "Report", "Report");
btnArchive = createButton("Archive", "Archive24.png", "Archive"); btnArchive = createButton("Archive", "Archive", "Archive");
btnPrint = createButton("Print", "Print24.png", "Print"); btnPrint = createButton("Print", "Print", "Print");
addSeparator(); addSeparator();
btnZoomAcross = createButton("ZoomAcross", "ZoomAcross24.png", "ZoomAcross"); btnZoomAcross = createButton("ZoomAcross", "ZoomAcross", "ZoomAcross");
btnActiveWorkflows = createButton("ActiveWorkflows", "WorkFlow24.png", "WorkFlow"); btnActiveWorkflows = createButton("ActiveWorkflows", "WorkFlow", "WorkFlow");
btnRequests = createButton("Requests", "Request24.png", "Request"); btnRequests = createButton("Requests", "Request", "Request");
btnProductInfo = createButton("ProductInfo", "Product24.png", "InfoProduct"); btnProductInfo = createButton("ProductInfo", "Product", "InfoProduct");
for (Object obj : this.getChildren()) for (Object obj : this.getChildren())
{ {
@ -146,27 +154,33 @@ public class CWindowToolbar extends FToolbar implements EventListener
btnArchive.setDisabled(false); // Elaine 2008/07/28 btnArchive.setDisabled(false); // Elaine 2008/07/28
configureKeyMap(); configureKeyMap();
if (embedded)
{
btnParentRecord.setVisible(false);
btnDetailRecord.setVisible(false);
btnActiveWorkflows.setVisible(false);
btnHistoryRecords.setVisible(false);
btnProductInfo.setVisible(false);
setAlign("end");
setWidth("100%");
setStyle("background: transparent none");
}
else
{
setWidth("100%");
}
} }
/**
* 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("");
btn.setName("btn"+name); btn.setName("btn"+name);
btn.setImage("/images/"+image); btn.setImage("/images/"+image + (embedded ? "16.png" : "24.png"));
btn.setTooltiptext(Msg.getMsg(Env.getCtx(),tooltip)); btn.setTooltiptext(Msg.getMsg(Env.getCtx(),tooltip));
if (embedded)
btn.setStyle("background: transparent none");
buttons.put(name, btn); buttons.put(name, btn);
this.appendChild(btn); this.appendChild(btn);
return btn; return btn;

View File

@ -125,7 +125,7 @@ public class GridPanel extends Borderlayout implements EventListener
* Update listbox index to sync with grid current row pointer changes * Update listbox index to sync with grid current row pointer changes
*/ */
public void updateListIndex() { public void updateListIndex() {
int rowIndex = gridTab.getCurrentRow(); int rowIndex = gridTab.isOpen() ? gridTab.getCurrentRow() : -1;
if (pageSize > 0) { if (pageSize > 0) {
if (paging.getTotalSize() != gridTab.getRowCount()) if (paging.getTotalSize() != gridTab.getRowCount())
paging.setTotalSize(gridTab.getRowCount()); paging.setTotalSize(gridTab.getRowCount());

View File

@ -73,6 +73,7 @@ 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.Group;
import org.zkoss.zul.Groupfoot; import org.zkoss.zul.Groupfoot;
import org.zkoss.zul.Hbox;
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;
@ -276,6 +277,7 @@ DataStatusListener, IADTabpanel
rows.appendChild(row); rows.appendChild(row);
row = new Group(); row = new Group();
row.setSpans("2,3");
rows.appendChild(row); rows.appendChild(row);
includedTab .put(field.getIncluded_Tab_ID(), (Group)row); includedTab .put(field.getIncluded_Tab_ID(), (Group)row);
row = new Row(); row = new Row();
@ -927,7 +929,15 @@ DataStatusListener, IADTabpanel
grid.getRows().insertBefore(row, next); grid.getRows().insertBefore(row, next);
panel.createPart(row); panel.createPart(row);
panel.getComponent().setWidth("99%"); panel.getComponent().setWidth("99%");
group.setLabel(gridWindow.getTab(tabIndex).getName());
Label title = new Label(gridWindow.getTab(tabIndex).getName());
group.appendChild(title);
group.appendChild(panel.getToolbar());
panel.getStatusBar().setZclass("z-group-foot");
if (!group.isOpen()) {
panel.getToolbar().setVisible(false);
}
panel.initPanel(-1, null); panel.initPanel(-1, null);
if (active) if (active)
activateChild(true, ep); activateChild(true, ep);

View File

@ -92,12 +92,15 @@ public class ADWindowPanel extends AbstractADWindowPanel
layout.setPage(page); layout.setPage(page);
} }
if (!isEmbedded())
{
North n = new North(); North n = new North();
n.setParent(layout); n.setParent(layout);
n.setCollapsible(false); n.setCollapsible(false);
n.setHeight("30px"); n.setHeight("30px");
toolbar.setHeight("30px"); toolbar.setHeight("30px");
toolbar.setParent(n); toolbar.setParent(n);
}
South s = new South(); South s = new South();
layout.appendChild(s); layout.appendChild(s);

View File

@ -183,10 +183,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
private void initComponents() private void initComponents()
{ {
/** Initalise toolbar */ /** Initalise toolbar */
toolbar = new CWindowToolbar(); toolbar = new CWindowToolbar(isEmbedded());
toolbar.addListener(this); toolbar.addListener(this);
toolbar.setWidth("100%");
toolbar.setEmbedded(isEmbedded());
statusBar = new StatusBarPanel(); statusBar = new StatusBarPanel();
} }