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>();
public CWindowToolbar()
private boolean embedded;
public CWindowToolbar()
{
this(false);
}
public CWindowToolbar(boolean embedded)
{
this.embedded = embedded;
init();
}
@ -89,36 +97,36 @@ public class CWindowToolbar extends FToolbar implements EventListener
{
LayoutUtils.addSclass("adwindow-toolbar", this);
btnIgnore = createButton("Ignore", "Ignore24.png", "Ignore");
btnIgnore = createButton("Ignore", "Ignore", "Ignore");
addSeparator();
btnHelp = createButton("Help", "Help24.png","Help");
btnNew = createButton("New", "New24.png", "New");
btnCopy = createButton("Copy", "Copy24.png", "Copy");
btnDelete = createButton("Delete", "Delete24.png", "Delete");
btnSave = createButton("Save", "Save24.png", "Save");
btnHelp = createButton("Help", "Help","Help");
btnNew = createButton("New", "New", "New");
btnCopy = createButton("Copy", "Copy", "Copy");
btnDelete = createButton("Delete", "Delete", "Delete");
btnSave = createButton("Save", "Save", "Save");
addSeparator();
btnRefresh = createButton("Refresh", "Refresh24.png", "Refresh");
btnFind = createButton("Find", "Find24.png", "Find");
btnAttachment = createButton("Attachment", "Attachment24.png", "Attachment");
btnGridToggle = createButton("Toggle", "Multi24.png", "Multi");
btnRefresh = createButton("Refresh", "Refresh", "Refresh");
btnFind = createButton("Find", "Find", "Find");
btnAttachment = createButton("Attachment", "Attachment", "Attachment");
btnGridToggle = createButton("Toggle", "Multi", "Multi");
addSeparator();
btnHistoryRecords = createButton("HistoryRecords", "HistoryX24.png", "History");
btnParentRecord = createButton("ParentRecord", "Parent24.png", "Parent");
btnDetailRecord = createButton("DetailRecord", "Detail24.png", "Detail");
btnHistoryRecords = createButton("HistoryRecords", "HistoryX", "History");
btnParentRecord = createButton("ParentRecord", "Parent", "Parent");
btnDetailRecord = createButton("DetailRecord", "Detail", "Detail");
addSeparator();
btnFirst = createButton("First", "First24.png", "First");
btnPrevious = createButton("Previous", "Previous24.png", "Previous");
btnNext = createButton("Next", "Next24.png", "Next");
btnLast = createButton("Last", "Last24.png", "Last");
btnFirst = createButton("First", "First", "First");
btnPrevious = createButton("Previous", "Previous", "Previous");
btnNext = createButton("Next", "Next", "Next");
btnLast = createButton("Last", "Last", "Last");
addSeparator();
btnReport = createButton("Report", "Report24.png", "Report");
btnArchive = createButton("Archive", "Archive24.png", "Archive");
btnPrint = createButton("Print", "Print24.png", "Print");
btnReport = createButton("Report", "Report", "Report");
btnArchive = createButton("Archive", "Archive", "Archive");
btnPrint = createButton("Print", "Print", "Print");
addSeparator();
btnZoomAcross = createButton("ZoomAcross", "ZoomAcross24.png", "ZoomAcross");
btnActiveWorkflows = createButton("ActiveWorkflows", "WorkFlow24.png", "WorkFlow");
btnRequests = createButton("Requests", "Request24.png", "Request");
btnProductInfo = createButton("ProductInfo", "Product24.png", "InfoProduct");
btnZoomAcross = createButton("ZoomAcross", "ZoomAcross", "ZoomAcross");
btnActiveWorkflows = createButton("ActiveWorkflows", "WorkFlow", "WorkFlow");
btnRequests = createButton("Requests", "Request", "Request");
btnProductInfo = createButton("ProductInfo", "Product", "InfoProduct");
for (Object obj : this.getChildren())
{
@ -146,27 +154,33 @@ public class CWindowToolbar extends FToolbar implements EventListener
btnArchive.setDisabled(false); // Elaine 2008/07/28
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)
{
ToolBarButton btn = new ToolBarButton("");
btn.setName("btn"+name);
btn.setImage("/images/"+image);
btn.setImage("/images/"+image + (embedded ? "16.png" : "24.png"));
btn.setTooltiptext(Msg.getMsg(Env.getCtx(),tooltip));
if (embedded)
btn.setStyle("background: transparent none");
buttons.put(name, btn);
this.appendChild(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
*/
public void updateListIndex() {
int rowIndex = gridTab.getCurrentRow();
int rowIndex = gridTab.isOpen() ? gridTab.getCurrentRow() : -1;
if (pageSize > 0) {
if (paging.getTotalSize() != 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.Group;
import org.zkoss.zul.Groupfoot;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator;
import org.zkoss.zul.SimpleTreeNode;
import org.zkoss.zul.Space;
@ -276,6 +277,7 @@ DataStatusListener, IADTabpanel
rows.appendChild(row);
row = new Group();
row.setSpans("2,3");
rows.appendChild(row);
includedTab .put(field.getIncluded_Tab_ID(), (Group)row);
row = new Row();
@ -927,7 +929,15 @@ DataStatusListener, IADTabpanel
grid.getRows().insertBefore(row, next);
panel.createPart(row);
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);
if (active)
activateChild(true, ep);

View File

@ -92,17 +92,20 @@ public class ADWindowPanel extends AbstractADWindowPanel
layout.setPage(page);
}
North n = new North();
n.setParent(layout);
n.setCollapsible(false);
n.setHeight("30px");
toolbar.setHeight("30px");
toolbar.setParent(n);
if (!isEmbedded())
{
North n = new North();
n.setParent(layout);
n.setCollapsible(false);
n.setHeight("30px");
toolbar.setHeight("30px");
toolbar.setParent(n);
}
South s = new South();
layout.appendChild(s);
s.setCollapsible(false);
statusBar.setParent(s);
statusBar.setParent(s);
LayoutUtils.addSclass("adwindow-status", statusBar);
if (!isEmbedded() && adTab.isUseExternalSelection())

View File

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