use of org.zkoss.zul.Panelchildren in project adempiere by adempiere.
the class MenuPanel method initComponents.
private void initComponents() {
this.setWidth("100%");
this.setHeight("100%");
this.setStyle("position: relative");
menuTree = new Tree();
menuTree.setMultiple(false);
menuTree.setId("mnuMain");
menuTree.setWidth("100%");
menuTree.setVflex(true);
menuTree.setSizedByContent(false);
// Due to bug in the new paging functionality
menuTree.setPageSize(-1);
menuTree.setStyle("border: none");
pnlSearch = new TreeSearchPanel(menuTree);
Toolbar toolbar = new Toolbar();
toolbar.setMold("panel");
toolbar.appendChild(pnlSearch);
this.appendChild(toolbar);
Panelchildren pc = new Panelchildren();
this.appendChild(pc);
pc.appendChild(menuTree);
// Elaine 2009/02/27 - expand tree
toolbar = new Toolbar();
toolbar.setStyle("verticle-align: middle; padding: 2px");
chkExpand = new Checkbox();
chkExpand.setText(Msg.getMsg(Env.getCtx(), "ExpandTree"));
chkExpand.addEventListener(Events.ON_CHECK, this);
toolbar.appendChild(chkExpand);
toolbar.setMold("panel");
this.appendChild(toolbar);
}
use of org.zkoss.zul.Panelchildren in project adempiere by adempiere.
the class WGraph method render.
// loadData
private void render(JFreeChart chart) {
ChartRenderingInfo info = new ChartRenderingInfo();
int width = 560;
int height = 400;
if (zoomFactor > 0) {
width = width * zoomFactor / 100;
height = height * zoomFactor / 100;
}
if (m_hideTitle) {
chart.setTitle("");
}
BufferedImage bi = chart.createBufferedImage(width, height, BufferedImage.TRANSLUCENT, info);
try {
byte[] bytes = EncoderUtil.encode(bi, ImageFormat.PNG, true);
AImage image = new AImage("", bytes);
Imagemap myImage = new Imagemap();
myImage.setContent(image);
if (panel.getPanelchildren() != null) {
panel.getPanelchildren().getChildren().clear();
panel.getPanelchildren().appendChild(myImage);
} else {
Panelchildren pc = new Panelchildren();
panel.appendChild(pc);
pc.appendChild(myImage);
}
int count = 0;
for (Iterator<?> it = info.getEntityCollection().getEntities().iterator(); it.hasNext(); ) {
ChartEntity entity = (ChartEntity) it.next();
String key = null;
if (entity instanceof CategoryItemEntity) {
Comparable<?> colKey = ((CategoryItemEntity) entity).getColumnKey();
if (colKey != null) {
key = colKey.toString();
}
} else if (entity instanceof PieSectionEntity) {
Comparable<?> sectionKey = ((PieSectionEntity) entity).getSectionKey();
if (sectionKey != null) {
key = sectionKey.toString();
}
}
if (key == null) {
continue;
}
Area area = new Area();
myImage.appendChild(area);
area.setCoords(entity.getShapeCoords());
area.setShape(entity.getShapeType());
area.setTooltiptext(entity.getToolTipText());
area.setId(count + "_WG_" + key);
count++;
}
myImage.addEventListener(Events.ON_CLICK, new EventListener() {
public void onEvent(Event event) throws Exception {
MouseEvent me = (MouseEvent) event;
String areaId = me.getArea();
if (areaId != null) {
for (int i = 0; i < list.size(); i++) {
String s = "_WG_" + list.get(i).getLabel();
if (areaId.endsWith(s)) {
chartMouseClicked(i);
return;
}
}
}
}
});
} catch (Exception e) {
log.log(Level.SEVERE, "", e);
}
}
use of org.zkoss.zul.Panelchildren in project adempiere by adempiere.
the class DefaultDesktop method createHomeTab.
private void createHomeTab() {
Tabpanel homeTab = new Tabpanel();
windowContainer.addWindow(homeTab, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", ""), false);
Portallayout portalLayout = new Portallayout();
portalLayout.setWidth("100%");
portalLayout.setHeight("100%");
portalLayout.setStyle("position: absolute; overflow: auto");
homeTab.appendChild(portalLayout);
// Dashboard content
Portalchildren portalchildren = null;
int currentColumnNo = 0;
String sql = "SELECT COUNT(DISTINCT COLUMNNO) " + "FROM PA_DASHBOARDCONTENT " + "WHERE (AD_CLIENT_ID=0 OR AD_CLIENT_ID=?) AND ISACTIVE='Y'";
int noOfCols = DB.getSQLValue(null, sql, Env.getAD_Client_ID(Env.getCtx()));
int width = noOfCols <= 0 ? 100 : 100 / noOfCols;
/* sql = "SELECT x.* "
+ "FROM PA_DASHBOARDCONTENT x "
+ "WHERE (x.AD_CLIENT_ID=0 OR x.AD_CLIENT_ID=?) AND x.ISACTIVE='Y' "
+ "ORDER BY x.COLUMNNO, x.AD_CLIENT_ID, x.LINE ";*/
StringBuffer sqlContent = new StringBuffer();
sqlContent.append("SELECT x.PA_DASHBOARDCONTENT_ID, x.AD_CLIENT_ID, x.AD_ORG_ID, x.ISACTIVE ,");
sqlContent.append(" COALESCE(XTRL.NAME,x.NAME) AS NAME ,");
sqlContent.append(" x.AD_WINDOW_ID ,");
sqlContent.append(" x.DESCRIPTION ,");
sqlContent.append(" x.HTML ,");
sqlContent.append(" x.LINE ,");
sqlContent.append(" x.PA_GOAL_ID ,");
sqlContent.append(" x.COLUMNNO ,");
sqlContent.append(" x.ZULFILEPATH ,");
sqlContent.append(" x.ISCOLLAPSIBLE ,");
sqlContent.append(" x.GOALDISPLAY ,");
sqlContent.append(" x.ISOPENBYDEFAULT ,");
sqlContent.append(" x.ISEVENTREQUIRED ,");
sqlContent.append(" x.ZOOM_WINDOW_ID ,");
sqlContent.append(" x.ZOOM_TAB_ID ,");
sqlContent.append(" x.PAGESIZE ,");
sqlContent.append(" x.ONEVENT ,");
sqlContent.append(" x.AD_BROWSE_ID ,");
sqlContent.append(" x.ZOOM_FIELD_ID ");
sqlContent.append(" FROM PA_DASHBOARDCONTENT x ");
sqlContent.append(" LEFT JOIN PA_DASHBOARDCONTENT_TRL xtrl on x.PA_DASHBOARDCONTENT_ID = xtrl.PA_DASHBOARDCONTENT_ID " + "AND xtrl.AD_LANGUAGE = ?");
sqlContent.append(" WHERE (x.AD_CLIENT_ID=0 OR x.AD_CLIENT_ID=?) AND x.ISACTIVE='Y' ");
sqlContent.append(" ORDER BY x.COLUMNNO, x.AD_CLIENT_ID, x.LINE ");
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = DB.prepareStatement(sqlContent.toString(), null);
pstmt.setString(1, Env.getAD_Language(Env.getCtx()));
pstmt.setInt(2, Env.getAD_Client_ID(Env.getCtx()));
rs = pstmt.executeQuery();
while (rs.next()) {
int columnNo = rs.getInt(X_PA_DashboardContent.COLUMNNAME_ColumnNo);
if (portalchildren == null || currentColumnNo != columnNo) {
portalchildren = new Portalchildren();
portalLayout.appendChild(portalchildren);
portalchildren.setWidth(width + "%");
portalchildren.setStyle("padding: 5px");
currentColumnNo = columnNo;
}
Panel panel = new Panel();
panel.setStyle("margin-bottom:10px");
panel.setTitle(rs.getString(X_PA_DashboardContent.COLUMNNAME_Name));
String description = rs.getString(X_PA_DashboardContent.COLUMNNAME_Description);
if (description != null)
panel.setTooltiptext(description);
String collapsible = rs.getString(X_PA_DashboardContent.COLUMNNAME_IsCollapsible);
panel.setCollapsible(collapsible.equals("Y"));
String isOpenByDefault = rs.getString(X_PA_DashboardContent.COLUMNNAME_IsOpenByDefault);
panel.setOpen(isOpenByDefault.equals("Y"));
panel.setBorder("normal");
portalchildren.appendChild(panel);
Panelchildren content = new Panelchildren();
panel.appendChild(content);
boolean panelEmpty = true;
// HTML content
String htmlContent = rs.getString(X_PA_DashboardContent.COLUMNNAME_HTML);
if (htmlContent != null) {
StringBuffer result = new StringBuffer("<html><head>");
URL url = getClass().getClassLoader().getResource("org/compiere/images/PAPanel.css");
InputStreamReader ins;
try {
ins = new InputStreamReader(url.openStream());
BufferedReader bufferedReader = new BufferedReader(ins);
String cssLine;
while ((cssLine = bufferedReader.readLine()) != null) result.append(cssLine + "\n");
} catch (IOException e1) {
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
}
result.append("</head><body><div class=\"content\">\n");
result.append(stripHtml(htmlContent, false) + "<br>\n");
result.append("</div>\n</body>\n</html>\n</html>");
Html html = new Html();
html.setContent(result.toString());
content.appendChild(html);
panelEmpty = false;
}
// Window
int AD_Window_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Window_ID);
if (AD_Window_ID > 0) {
MDashboardContent dashboardContent = new MDashboardContent(Env.getCtx(), rs.getInt(X_PA_DashboardContent.COLUMNNAME_PA_DashboardContent_ID), null);
int AD_Menu_ID = dashboardContent.getAD_Menu_ID();
ToolBarButton btn = new ToolBarButton(String.valueOf(AD_Menu_ID));
I_AD_Menu menu = dashboardContent.getAD_Menu();
btn.setLabel(menu.getName());
btn.addEventListener(Events.ON_CLICK, this);
content.appendChild(btn);
panelEmpty = false;
}
//SmartBrowse
int AD_Browse_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Browse_ID);
if (AD_Browse_ID > 0) {
try {
//setting Tab ID to context
Env.setContext(Env.getCtx(), "#AD_Browse_ID", rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Browse_ID));
Env.setContext(Env.getCtx(), "#PageSize", rs.getInt(X_PA_DashboardContent.COLUMNNAME_PageSize));
Env.setContext(Env.getCtx(), "#Zoom_Tab_ID", rs.getInt(X_PA_DashboardContent.COLUMNNAME_Zoom_Tab_ID));
Env.setContext(Env.getCtx(), "#Zoom_Window_ID", rs.getInt(X_PA_DashboardContent.COLUMNNAME_Zoom_Window_ID));
Env.setContext(Env.getCtx(), "#Zoom_Field_ID", rs.getInt(X_PA_DashboardContent.COLUMNNAME_Zoom_Field_ID));
Env.setContext(Env.getCtx(), "#OnEvent", rs.getString(X_PA_DashboardContent.COLUMNNAME_onevent));
Component component = Executions.createComponents(dynamic_Dashboard_zulFilepath, content, null);
if (component != null) {
if (component instanceof DashboardPanel) {
DashboardPanel dashboardPanel = (DashboardPanel) component;
if (!dashboardPanel.getChildren().isEmpty()) {
content.appendChild(dashboardPanel);
dashboardRunnable.add(dashboardPanel);
panelEmpty = false;
}
} else {
content.appendChild(component);
panelEmpty = false;
}
}
} catch (Exception e) {
logger.log(Level.WARNING, "Failed to create components. zul=" + dynamic_Dashboard_zulFilepath, e);
}
}
// Goal
int PA_Goal_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_PA_Goal_ID);
if (PA_Goal_ID > 0) {
//link to open performance detail
Toolbarbutton link = new Toolbarbutton();
link.setImage("/images/Zoom16.png");
link.setAttribute("PA_Goal_ID", PA_Goal_ID);
link.addEventListener(Events.ON_CLICK, new EventListener() {
public void onEvent(Event event) throws Exception {
int PA_Goal_ID = (Integer) event.getTarget().getAttribute("PA_Goal_ID");
MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null);
new WPerformanceDetail(goal);
}
});
content.appendChild(link);
String goalDisplay = rs.getString(X_PA_DashboardContent.COLUMNNAME_GoalDisplay);
MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null);
WGraph graph = new WGraph(goal, 55, false, true, !(X_PA_DashboardContent.GOALDISPLAY_Chart.equals(goalDisplay)), X_PA_DashboardContent.GOALDISPLAY_Chart.equals(goalDisplay));
content.appendChild(graph);
panelEmpty = false;
}
// ZUL file url
String url = rs.getString(X_PA_DashboardContent.COLUMNNAME_ZulFilePath);
if (url != null) {
try {
Component component = Executions.createComponents(url, content, null);
if (component != null) {
if (component instanceof DashboardPanel) {
DashboardPanel dashboardPanel = (DashboardPanel) component;
if (!dashboardPanel.getChildren().isEmpty()) {
content.appendChild(dashboardPanel);
dashboardRunnable.add(dashboardPanel);
panelEmpty = false;
}
} else {
content.appendChild(component);
panelEmpty = false;
}
}
} catch (Exception e) {
logger.log(Level.WARNING, "Failed to create components. zul=" + url, e);
}
}
if (panelEmpty)
panel.detach();
}
} catch (Exception e) {
logger.log(Level.WARNING, "Failed to create dashboard content", e);
} finally {
}
//
//register as 0
registerWindow(homeTab);
if (!portalLayout.getDesktop().isServerPushEnabled())
portalLayout.getDesktop().enableServerPush(true);
dashboardRunnable.refreshDashboard();
dashboardThread = new Thread(dashboardRunnable, "UpdateInfo");
dashboardThread.setDaemon(true);
dashboardThread.start();
}
use of org.zkoss.zul.Panelchildren in project adempiere by adempiere.
the class WCollectDetail method init.
/**
* Init Main Panel
* @author Yamel Senih, ysenih@erpcya.com, ERPCyA http://www.erpcya.com
* @return void
*/
private void init() {
v_MainPanel = new Panel();
v_PanelChildren = new Panelchildren();
groupPanel = new Groupbox();
v_PanelChildren.appendChild(groupPanel);
v_TitleBorder = new Caption("Credit Card");
Style style = new Style();
style.setContent(".z-fieldset legend {font-size: medium; font-weight:bold;}");
style.setParent(v_TitleBorder);
groupPanel.appendChild(v_TitleBorder);
v_MainPanel.appendChild(v_PanelChildren);
// Load Standard Panel
loadStandardPanel();
// Load Check Panel
loadCheckPanel();
// Load Credit Panel
loadCreditPanel();
// Load Debit Panel
loadDebitPanel();
// Load Credit Note Panel
loadCreditMemoPanel();
// Add to Main Panel
groupPanel.appendChild(v_StandarPanel);
groupPanel.appendChild(v_CheckPanel);
groupPanel.appendChild(v_CreditPanel);
groupPanel.appendChild(v_DebitPanel);
groupPanel.appendChild(v_CreditMemoPanel);
// Change View
changeViewPanel();
fPayAmt.setValue(getPayAmt());
}
use of org.zkoss.zul.Panelchildren in project adempiere by adempiere.
the class WGraph method render.
/**
* render chart and/or table
*/
public void render() {
Borderlayout layout = null;
this.getChildren().clear();
if (m_renderTable && m_renderChart) {
layout = new Borderlayout();
appendChild(layout);
layout.setStyle("height: 100%; width: 100%; position: absolute;");
Center center = new Center();
layout.appendChild(center);
center.appendChild(panel);
} else {
appendChild(panel);
}
if (m_renderChart) {
JFreeChart chart = builder.createChart(builder.getMGoal().getChartType());
render(chart);
}
if (m_renderTable) {
if (m_renderChart) {
East east = new East();
layout.appendChild(east);
renderTable(east);
} else {
Panelchildren pc = panel.getPanelchildren();
if (pc == null) {
pc = new Panelchildren();
panel.appendChild(pc);
} else {
pc.getChildren().clear();
}
renderTable(pc);
}
}
}
Aggregations