Minor clean up.
Home page - Make extend DashboardPanel optional. Home page - Fixed server push, run in background and refresh every 5 second. Toolbar - Wrong icon size for the ignore button.
This commit is contained in:
parent
1730ffe726
commit
0cd09ffbf9
|
@ -27,7 +27,8 @@ public abstract class DashboardPanel extends Window implements IDashboardPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Desktop.UpdateInfoRunnable will call this method at a certain interval
|
* Desktop.UpdateInfoRunnable will call this method at a certain interval.
|
||||||
|
* Subclass should overwrite this method to support server push.
|
||||||
*/
|
*/
|
||||||
public void updateInfo() {
|
public void updateInfo() {
|
||||||
|
|
||||||
|
|
|
@ -273,15 +273,8 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
|
||||||
{
|
{
|
||||||
int AD_Menu_ID = rs.getInt(X_AD_Menu.COLUMNNAME_AD_Menu_ID);
|
int AD_Menu_ID = rs.getInt(X_AD_Menu.COLUMNNAME_AD_Menu_ID);
|
||||||
ToolBarButton btn = new ToolBarButton(String.valueOf(AD_Menu_ID));
|
ToolBarButton btn = new ToolBarButton(String.valueOf(AD_Menu_ID));
|
||||||
// if(description == null)
|
MMenu menu = new MMenu(Env.getCtx(), AD_Menu_ID, null);
|
||||||
// {
|
btn.setLabel(menu.getName());
|
||||||
MMenu menu = new MMenu(Env.getCtx(), AD_Menu_ID, null);
|
|
||||||
btn.setLabel(menu.getName());
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// btn.setLabel(description);
|
|
||||||
// }
|
|
||||||
btn.addEventListener(Events.ON_CLICK, this);
|
btn.addEventListener(Events.ON_CLICK, this);
|
||||||
content.appendChild(btn);
|
content.appendChild(btn);
|
||||||
panelEmpty = false;
|
panelEmpty = false;
|
||||||
|
@ -322,17 +315,25 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Component component = Executions.createComponents(url, content, null);
|
Component component = Executions.createComponents(url, content, null);
|
||||||
if(component != null && component instanceof DashboardPanel)
|
if(component != null)
|
||||||
{
|
{
|
||||||
DashboardPanel dashboardPanel = (DashboardPanel) component;
|
if (component instanceof DashboardPanel)
|
||||||
if (!dashboardPanel.getChildren().isEmpty()) {
|
{
|
||||||
content.appendChild(dashboardPanel);
|
DashboardPanel dashboardPanel = (DashboardPanel) component;
|
||||||
dashboardPanels.add(dashboardPanel);
|
if (!dashboardPanel.getChildren().isEmpty()) {
|
||||||
|
content.appendChild(dashboardPanel);
|
||||||
|
dashboardPanels.add(dashboardPanel);
|
||||||
|
panelEmpty = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
content.appendChild(component);
|
||||||
panelEmpty = false;
|
panelEmpty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.log(Level.WARNING, "Failed to create components", e);
|
logger.log(Level.WARNING, "Failed to create components. zul="+url, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +355,9 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
|
||||||
|
|
||||||
updateInfo();
|
updateInfo();
|
||||||
|
|
||||||
new Thread(new UpdateInfoRunnable(layout.getDesktop())).start();
|
Thread infoThread = new Thread(new UpdateInfoRunnable(layout.getDesktop()), "UpdateInfo");
|
||||||
|
infoThread.setDaemon(true);
|
||||||
|
infoThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String goalsDetail(int AD_Table_ID, Panelchildren panel)
|
private String goalsDetail(int AD_Table_ID, Panelchildren panel)
|
||||||
|
@ -476,20 +479,22 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
|
||||||
}
|
}
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
try {
|
while(true) {
|
||||||
// get full control of desktop
|
|
||||||
Executions.activate(desktop);
|
|
||||||
try {
|
try {
|
||||||
updateInfo();
|
// get full control of desktop
|
||||||
Threads.sleep(500);// Update each 0.5 seconds
|
Executions.activate(desktop);
|
||||||
} catch (Error ex) {
|
try {
|
||||||
throw ex;
|
updateInfo();
|
||||||
} finally {
|
Threads.sleep(5000);// Update each 5 seconds
|
||||||
// release full control of desktop
|
} catch (Error ex) {
|
||||||
Executions.deactivate(desktop);
|
throw ex;
|
||||||
|
} finally {
|
||||||
|
// release full control of desktop
|
||||||
|
Executions.deactivate(desktop);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.log(Level.WARNING, "Failed to run UpdateInfo", e);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
logger.log(Level.WARNING, "Failed to run NRW", e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -935,7 +940,7 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
|
||||||
{
|
{
|
||||||
Tabbox tabbox = windowContainer.getComponent();
|
Tabbox tabbox = windowContainer.getComponent();
|
||||||
Tabpanels panels = tabbox.getTabpanels();
|
Tabpanels panels = tabbox.getTabpanels();
|
||||||
List childrens = panels.getChildren();
|
List<?> childrens = panels.getChildren();
|
||||||
for (Object child : childrens)
|
for (Object child : childrens)
|
||||||
{
|
{
|
||||||
Tabpanel panel = (Tabpanel) child;
|
Tabpanel panel = (Tabpanel) child;
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class CWindowToolbar extends FToolbar implements EventListener
|
||||||
{
|
{
|
||||||
LayoutUtils.addSclass("adwindow-toolbar", this);
|
LayoutUtils.addSclass("adwindow-toolbar", this);
|
||||||
|
|
||||||
btnIgnore = createButton("Ignore", "Ignore16.png", "Ignore");
|
btnIgnore = createButton("Ignore", "Ignore24.png", "Ignore");
|
||||||
addSeparator();
|
addSeparator();
|
||||||
btnHelp = createButton("Help", "Help24.png","Help");
|
btnHelp = createButton("Help", "Help24.png","Help");
|
||||||
btnNew = createButton("New", "New24.png", "New");
|
btnNew = createButton("New", "New24.png", "New");
|
||||||
|
|
Loading…
Reference in New Issue