📄 maincontrolpanel.java
字号:
package org.gjj.gwt.client;import java.util.LinkedList;import com.google.gwt.core.client.GWT;import com.google.gwt.user.client.Window;import com.google.gwt.user.client.rpc.AsyncCallback;import com.google.gwt.user.client.rpc.ServiceDefTarget;import com.google.gwt.user.client.ui.Button;import com.google.gwt.user.client.ui.CaptionPanel;import com.google.gwt.user.client.ui.CheckBox;import com.google.gwt.user.client.ui.ClickListener;import com.google.gwt.user.client.ui.DecoratedTabPanel;import com.google.gwt.user.client.ui.DecoratorPanel;import com.google.gwt.user.client.ui.DockPanel;import com.google.gwt.user.client.ui.FlexTable;import com.google.gwt.user.client.ui.HTML;import com.google.gwt.user.client.ui.HorizontalPanel;import com.google.gwt.user.client.ui.Label;import com.google.gwt.user.client.ui.ListBox;import com.google.gwt.user.client.ui.PushButton;import com.google.gwt.user.client.ui.RootPanel;import com.google.gwt.user.client.ui.ScrollPanel;import com.google.gwt.user.client.ui.SourcesTabEvents;import com.google.gwt.user.client.ui.TabListener;import com.google.gwt.user.client.ui.TabPanel;import com.google.gwt.user.client.ui.TextArea;import com.google.gwt.user.client.ui.TextBox;import com.google.gwt.user.client.ui.VerticalPanel;import com.google.gwt.user.client.ui.Widget;import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;public class MainControlPanel implements ClickListener { DockPanel mainControl = new DockPanel(); DockPanel mainEast = new DockPanel(); //LoginWidget login = new LoginWidget();//这么定义会出现莫名其妙的错误! LoginSystemAsync getOutput;//async RPC private ResultOfReturn resulted; Button jobControl = new Button("Job Control");//module of jobs control Button queueControl = new Button("Queue Control");//module of queue control Button submitJob = new Button("Submit Job");//module of submit job Button complexConfiguration = new Button("Complex Configuration");//module of complex configurate Button hostConfiguration = new Button("Host Configuration");//module of host configurate Button clusterConfiguration = new Button("Cluster Configuration");//module of cluster configurate Button schedulerConfiguration = new Button("Scheduler Configuration");//module of scheduler configurate Button calendarConfiguration = new Button("Calendar Configuration");//module of time configurate Button userConfiguration = new Button("User Configuration");//module of user configurate Button parallelEnvConfiguration = new Button("Parallel Configuration");//module of parallel environment configurate Button checkpointConfiguration = new Button("Checkpoint Configuration");//module of checkpoint configurate Button policyConfiguration = new Button("Policy Configuration");//module of run policy configurate Button projectConfiguration = new Button("Project Configuration");//module of project configurate Button resourceConfiguration = new Button("Resource Configuration");//module of resource configurate Button browser = new Button("Browser");//browser output of stderr, stdout Button exit = new Button("Exit");//exit /** * constructor- add clickListenner to Buttons. * * @author gaojinjun */ public MainControlPanel(){ //init RPC initRPC(); //init button clicklistener jobControl.addClickListener(this); queueControl.addClickListener(this); submitJob.addClickListener(this); complexConfiguration.addClickListener(this); hostConfiguration.addClickListener(this); clusterConfiguration.addClickListener(this); schedulerConfiguration.addClickListener(this); calendarConfiguration.addClickListener(this); userConfiguration.addClickListener(this); parallelEnvConfiguration.addClickListener(this); checkpointConfiguration.addClickListener(this); policyConfiguration.addClickListener(this); projectConfiguration.addClickListener(this); resourceConfiguration.addClickListener(this); browser.addClickListener(this); exit.addClickListener(this); } /** * Build main control panel, which include 16 buttons and a dockpanel. * * @author gaojinjun * @return */ public DockPanel buildMainControl(){ //build mainControl panel, just is 16 buttons of west of main panel String buttonWidth = "195px"; VerticalPanel buttonPanel = new VerticalPanel(); buttonPanel.setSpacing(5); buttonPanel.setStylePrimaryName("verticalPanel"); mainEast.setStylePrimaryName("mainEast-dock"); mainEast.setWidth("500px"); mainControl.setWidth("100%"); //set up width of buttons jobControl.setWidth(buttonWidth); queueControl.setWidth(buttonWidth); submitJob.setWidth(buttonWidth); complexConfiguration.setWidth(buttonWidth); hostConfiguration.setWidth(buttonWidth); clusterConfiguration.setWidth(buttonWidth); schedulerConfiguration.setWidth(buttonWidth); calendarConfiguration.setWidth(buttonWidth); userConfiguration.setWidth(buttonWidth); parallelEnvConfiguration.setWidth(buttonWidth); checkpointConfiguration.setWidth(buttonWidth); policyConfiguration.setWidth(buttonWidth); projectConfiguration.setWidth(buttonWidth); resourceConfiguration.setWidth(buttonWidth); browser.setWidth(buttonWidth); exit.setWidth(buttonWidth); //add buttons to main panel buttonPanel.add(jobControl); buttonPanel.add(queueControl); buttonPanel.add(submitJob); buttonPanel.add(complexConfiguration); buttonPanel.add(hostConfiguration); buttonPanel.add(clusterConfiguration); buttonPanel.add(schedulerConfiguration); buttonPanel.add(calendarConfiguration); buttonPanel.add(userConfiguration); buttonPanel.add(parallelEnvConfiguration); buttonPanel.add(checkpointConfiguration); buttonPanel.add(policyConfiguration); buttonPanel.add(projectConfiguration); buttonPanel.add(resourceConfiguration); buttonPanel.add(browser); buttonPanel.add(exit); mainControl.clear(); mainControl.add(buttonPanel, DockPanel.WEST); mainEast.add(jobControl(),DockPanel.CENTER); mainControl.add(mainEast,DockPanel.EAST); return mainControl; } /** * override onClick, we can call different modthod */ public void onClick(Widget sender){ if(sender == jobControl){ mainEast.clear(); mainEast.add(this.jobControl(),DockPanel.CENTER); mainControl.add(mainEast, DockPanel.EAST); } else if(sender == queueControl){ this.queueControl(); } else if(sender == submitJob){ this.submitJob(); } else if(sender == complexConfiguration){ this.complexConfiguration(); } else if(sender == hostConfiguration){ this.hostConfiguration(); } else if(sender == clusterConfiguration){ this.clusterConfiguration(); } else if(sender == schedulerConfiguration){ this.schedulerConfiguration(); } else if(sender == calendarConfiguration){ this.calendarConfiguration(); } else if(sender == userConfiguration){ this.userConfiguration(); } else if(sender == parallelEnvConfiguration){ this.parallelEnvConfiguration(); } else if(sender == checkpointConfiguration){ this.checkpointConfiguration(); } else if(sender == policyConfiguration){ this.policyConfiguration(); } else if(sender == projectConfiguration){ this.projectConfiguration(); } else if(sender == resourceConfiguration){ this.resourceConfiguration(); } else if(sender == browser){ this.browser(); } else if(sender == exit){ this.exit(); } } /** * @author gaojinjun */ public DockPanel jobControl(){ //mainEast.clear(); String buttonWidth = "100px"; DockPanel jobCon = new DockPanel(); DecoratedTabPanel jobContent = new DecoratedTabPanel(); VerticalPanel buttons = new VerticalPanel(); VerticalPanel buttonIn = new VerticalPanel(); DockPanel jobStat = new DockPanel(); jobCon.setStylePrimaryName("white"); jobContent.setStylePrimaryName("white"); buttons.setSpacing(4); buttons.setStylePrimaryName("white"); buttonIn.setSpacing(3); Button refresh = new Button("Refresh"); Button submit = new Button("Submit"); Button ticket = new Button("Tickets"); refresh.setWidth(buttonWidth); submit.setWidth(buttonWidth); ticket.setWidth(buttonWidth); buttons.add(refresh); buttons.add(submit); buttons.add(ticket); buttons.add(buttonIn); CheckBox force = new CheckBox("force",false); Button suspend = new Button("Suspend"); Button resume = new Button("Resume"); Button delete = new Button("Delete"); Button reschedule = new Button("Reschedule"); Button selectall = new Button("Select All"); Button why = new Button("Why?"); Button hold = new Button("Hold"); Button priority = new Button("Priority"); Button qalter = new Button("Qalter"); Button clearerror = new Button("Clear Error"); Button customize = new Button("Customize"); Button done = new Button("Done"); Button help = new Button("Help"); suspend.setWidth(buttonWidth); resume.setWidth(buttonWidth); delete.setWidth(buttonWidth); reschedule.setWidth(buttonWidth); selectall.setWidth(buttonWidth); why.setWidth(buttonWidth); hold.setWidth(buttonWidth); priority.setWidth(buttonWidth); qalter.setWidth(buttonWidth); clearerror.setWidth(buttonWidth); customize.setWidth(buttonWidth); done.setWidth(buttonWidth); help.setWidth(buttonWidth); buttonIn.add(force); buttonIn.add(suspend); buttonIn.add(resume); buttonIn.add(delete); buttonIn.add(reschedule); buttonIn.add(selectall); buttonIn.add(why); buttonIn.add(hold); buttonIn.add(priority); buttonIn.add(qalter); buttonIn.add(clearerror); buttonIn.add(customize); buttonIn.add(done); buttonIn.add(help); //jobContent north String width = "140px"; jobStat.add(display(), DockPanel.CENTER); jobStat.add(scrollListJob(20, 6, ""),DockPanel.SOUTH); DockPanel jobStat1 = new DockPanel(); jobStat1.add(display(), DockPanel.CENTER); jobStat1.add(scrollListJob(20, 6, ""), DockPanel.SOUTH); DockPanel jobStat2 = new DockPanel(); jobStat2.add(display(), DockPanel.CENTER); jobStat2.add(scrollListJob(40, 6, ""), DockPanel.SOUTH); HTML pending = new HTML("Pending Jobs"); pending.setWidth(width); HTML running = new HTML("Running Jobs"); running.setWidth(width); HTML finished = new HTML("Finished Jobs"); finished.setWidth(width); jobContent.add(jobStat, pending); jobContent.add(jobStat1, running); jobContent.add(jobStat2, finished); jobContent.selectTab(0); jobContent.getDeckPanel().setAnimationEnabled(true); //add to jobCon jobCon.add(jobContent, DockPanel.WEST); jobCon.add(buttons,DockPanel.EAST); return jobCon; } /** * @author gaojinjun */ public void queueControl(){ DockPanel jobCon = new DockPanel(); DockPanel inJobContent = new DockPanel(); DecoratedTabPanel jobContent = new DecoratedTabPanel(); inJobContent.setStylePrimaryName("white"); jobCon.setStylePrimaryName("white"); jobContent.setStylePrimaryName("white"); //east of panel, some buttons VerticalPanel eastOfJobCon = new VerticalPanel(); String buttonWidth = "120px"; eastOfJobCon.setStylePrimaryName("verticalPanel"); //build buttons of east of content panel Button refresh = new Button("Refresh"); Button ticket = new Button("Tickets"); Button customize = new Button("Customize"); Button done = new Button("Done"); Button help = new Button("Help"); Button add = new Button("Add"); Button clone = new Button("Clone"); Button modify = new Button("Modify"); Button delete = new Button("Delete"); Button showSetting = new Button("Show Setting"); CheckBox force = new CheckBox("Force",true); Button suspend = new Button("Suspend"); Button resume = new Button("Resume"); Button disable = new Button("Disable"); Button enable = new Button("Enable"); Button reschedule = new Button("Reschedule"); Button clearerror = new Button("Clear Error"); Button load = new Button("Load"); CheckBox c = new CheckBox("c",false); CheckBox a = new CheckBox("a",false); CheckBox A = new CheckBox("A",false); CheckBox E = new CheckBox("E",false); HorizontalPanel checkBox = new HorizontalPanel(); checkBox.add(c); checkBox.add(a); checkBox.add(A); checkBox.add(E); Button explain = new Button("Explain"); //set up width of buttons refresh.setWidth(buttonWidth); ticket.setWidth(buttonWidth); customize.setWidth(buttonWidth); done.setWidth(buttonWidth); help.setWidth(buttonWidth); add.setWidth(buttonWidth); clone.setWidth(buttonWidth); modify.setWidth(buttonWidth); delete.setWidth(buttonWidth); showSetting.setWidth(buttonWidth); suspend.setWidth(buttonWidth); resume.setWidth(buttonWidth); disable.setWidth(buttonWidth); enable.setWidth(buttonWidth); reschedule.setWidth(buttonWidth); clearerror.setWidth(buttonWidth); load.setWidth(buttonWidth); explain.setWidth(buttonWidth); //add buttons to eastOfJobCon eastOfJobCon.add(refresh); eastOfJobCon.add(ticket); eastOfJobCon.add(customize); eastOfJobCon.add(done); eastOfJobCon.add(help); eastOfJobCon.add(add); eastOfJobCon.add(clone); eastOfJobCon.add(modify); eastOfJobCon.add(delete); eastOfJobCon.add(showSetting); eastOfJobCon.add(force); eastOfJobCon.add(suspend); eastOfJobCon.add(resume); eastOfJobCon.add(disable); eastOfJobCon.add(enable); eastOfJobCon.add(reschedule); eastOfJobCon.add(clearerror); eastOfJobCon.add(load); eastOfJobCon.add(checkBox); eastOfJobCon.add(explain); //west of panel, three tab:clusterQueue,queueInstance and host. String width = "140px"; HTML clusterQueue = new HTML("Cluster Queues"); clusterQueue.setWidth(width); HTML queueInstance = new HTML("Queue Instances"); queueInstance.setWidth(width); HTML host = new HTML("Hosts"); host.setWidth(width);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -