📄 maincontrolpanel.java
字号:
eastMain.add(add); eastMain.add(modify); eastMain.add(delete); eastMain.add(done); eastMain.add(help); mainPanel.add(eastMain, DockPanel.EAST); //build westMain int i; VerticalPanel leftWest = new VerticalPanel(); VerticalPanel rightWest = new VerticalPanel(); Label checkPoint = new Label("Checkpoint Objects"); ListBox checkListBox = new ListBox(); checkListBox.setSize("200px", "430px"); for(i = 0; i < 20; i++){ checkListBox.addItem(""); } checkListBox.setVisibleItemCount(18); Label config = new Label("Confiuration"); ListBox configList = new ListBox(); configList.setSize("400px", "430px"); for(i = 0; i < 20; i++){ configList.addItem(""); } configList.setVisibleItemCount(18); leftWest.add(checkPoint); leftWest.add(checkListBox); rightWest.add(config); rightWest.add(configList); westMain.setSpacing(5); westMain.add(leftWest); westMain.add(rightWest); deckPanel.add(westMain); mainPanel.add(deckPanel, DockPanel.WEST); mainEast.clear(); mainEast.add(mainPanel, DockPanel.CENTER); mainControl.add(mainEast, DockPanel.EAST); } /** * build every policy of configuration * @author gaojinjun */ public void policyConfiguration(){ DecoratorPanel deckPanel = new DecoratorPanel(); DockPanel mainPanel = new DockPanel(); VerticalPanel eastMain = new VerticalPanel(); VerticalPanel westMain = new VerticalPanel(); //build east of main panel String buttonWidth = "100px"; Button refresh = new Button("Refresh"); Button apply = new Button("Apply"); Button done = new Button("Done"); Button help = new Button("Help"); refresh.setWidth(buttonWidth); apply.setWidth(buttonWidth); done.setWidth(buttonWidth); help.setWidth(buttonWidth); eastMain.setSpacing(30); eastMain.add(refresh); eastMain.add(apply); eastMain.add(done); eastMain.add(help); mainPanel.add(eastMain, DockPanel.EAST); //build west of main panel String boxWidth = "140px"; Label policyFactor = new Label("Policy Importance Factor"); policyFactor.setStylePrimaryName("gwt-Label-Blue"); HorizontalPanel policyFactorHor = new HorizontalPanel(); policyFactorHor.setSpacing(5); VerticalPanel priority = new VerticalPanel(); VerticalPanel urgency = new VerticalPanel(); VerticalPanel ticket = new VerticalPanel(); Label priorityLabel = new Label("Priority"); TextBox priorityBox = new TextBox(); priorityBox.setWidth(boxWidth); priorityBox.setText("1"); priority.add(priorityLabel); priority.add(priorityBox); Label urgencyLabel = new Label("Urgency"); TextBox urgencyBox = new TextBox(); urgencyBox.setWidth(boxWidth); urgencyBox.setText("0.1"); urgency.add(urgencyLabel); urgency.add(urgencyBox); Label ticketLabel = new Label("Ticket"); TextBox ticketBox = new TextBox(); ticketBox.setWidth(boxWidth); ticketBox.setText("0.01"); ticket.add(ticketLabel); ticket.add(ticketBox); policyFactorHor.add(priority); policyFactorHor.add(urgency); policyFactorHor.add(ticket); } /** * @author gaojinjun */ public void projectConfiguration(){ DecoratorPanel deckPanel = new DecoratorPanel(); DockPanel mainPanel = new DockPanel(); HorizontalPanel westMain = new HorizontalPanel(); VerticalPanel eastMain = new VerticalPanel(); //build eastMain; just create some buttons String buttonWidth = "100px"; Button add = new Button("Add"); Button modify = new Button("Modify"); Button delete = new Button("Delete"); Button done = new Button("Done"); Button help = new Button("Help"); add.setWidth(buttonWidth); modify.setWidth(buttonWidth); delete.setWidth(buttonWidth); done.setWidth(buttonWidth); help.setWidth(buttonWidth); //add buttons to eastMain eastMain.setSpacing(30); eastMain.add(add); eastMain.add(modify); eastMain.add(delete); eastMain.add(done); eastMain.add(help); mainPanel.add(eastMain, DockPanel.EAST); //build westMain int i; VerticalPanel leftWest = new VerticalPanel(); VerticalPanel rightWest = new VerticalPanel(); Label project = new Label("Projects"); ListBox projectListBox = new ListBox(); projectListBox.setSize("200px", "430px"); for(i = 0; i < 20; i++){ projectListBox.addItem(""); } projectListBox.setVisibleItemCount(18); Label config = new Label("Confiuration"); ListBox configList = new ListBox(); configList.setSize("400px", "430px"); for(i = 0; i < 20; i++){ configList.addItem(""); } configList.setVisibleItemCount(18); leftWest.add(project); leftWest.add(projectListBox); rightWest.add(config); rightWest.add(configList); westMain.setSpacing(5); westMain.add(leftWest); westMain.add(rightWest); deckPanel.add(westMain); mainPanel.add(deckPanel, DockPanel.WEST); mainEast.clear(); mainEast.add(mainPanel, DockPanel.CENTER); mainControl.add(mainEast, DockPanel.EAST); } /** * @author gaojinjun */ public void resourceConfiguration(){ DecoratorPanel deckPanel = new DecoratorPanel(); DockPanel mainPanel = new DockPanel(); VerticalPanel eastMain = new VerticalPanel(); VerticalPanel westMain = new VerticalPanel(); //build east panel String buttonWidth = "100px"; Button ok = new Button("Ok"); Button cancel = new Button("Cancel"); Button help = new Button("Help"); ok.setWidth(buttonWidth); cancel.setWidth(buttonWidth); help.setWidth(buttonWidth); eastMain.setSpacing(30); eastMain.add(ok); eastMain.add(cancel); eastMain.add(help); mainPanel.add(eastMain, DockPanel.EAST); //build west panel Label resource = new Label("Resource Quotas"); ScrollPanel resourceScroll = new ScrollPanel(); TextArea resourceArea = new TextArea(); resourceArea.setSize("600px", "430px"); resourceScroll.setWidget(resourceArea); westMain.add(resource); westMain.add(resourceScroll); deckPanel.add(westMain); mainPanel.add(deckPanel, DockPanel.WEST); mainEast.clear(); mainEast.add(mainPanel, DockPanel.CENTER); mainControl.add(mainEast, DockPanel.EAST); } /** * @author gaojinjun */ public void browser(){ DecoratorPanel deckPanel = new DecoratorPanel(); DockPanel mainPanel = new DockPanel(); VerticalPanel eastMain = new VerticalPanel(); //build east panel String buttonWidth = "100px"; CaptionPanel objects = new CaptionPanel("Objects"); VerticalPanel objVer = new VerticalPanel(); objVer.setSpacing(20); Button stdout = new Button("stdout"); Button stderr = new Button("stderr"); Button queue = new Button("Queue"); Button job = new Button("Job"); Button message = new Button("Messages"); stdout.setWidth(buttonWidth); stderr.setWidth(buttonWidth); queue.setWidth(buttonWidth); job.setWidth(buttonWidth); message.setWidth(buttonWidth); objVer.add(stdout); objVer.add(stderr); objVer.add(queue); objVer.add(job); objVer.add(message); objects.add(objVer); Button clear = new Button("Clear"); Button done = new Button("Done"); Button help = new Button("Help"); String tmpwidth = "180px"; clear.setWidth(tmpwidth); done.setWidth(tmpwidth); help.setWidth(tmpwidth); eastMain.setSpacing(20); eastMain.add(objects); eastMain.add(clear); eastMain.add(done); eastMain.add(help); mainPanel.add(eastMain, DockPanel.EAST); //Build west panel ScrollPanel westContent = new ScrollPanel(); TextArea contentArea = new TextArea(); contentArea.setSize("600px", "460px"); contentArea.setReadOnly(true); westContent.setWidget(contentArea); deckPanel.add(westContent); mainPanel.add(deckPanel, DockPanel.WEST); mainEast.clear(); mainEast.add(mainPanel, DockPanel.CENTER); mainControl.add(mainEast, DockPanel.EAST); } /** * @author gaojinjun */ public void exit(){ mainControl.removeFromParent(); RootPanel.get("main-panel").add(new LoginWidget());// mainControl.clear();// mainControl.setStyleName("mainEast-dock");// mainControl.setBorderWidth(0);// mainControl.add(new LoginWidget(), DockPanel.CENTER); } /** * @author gaojinjun * return horizontalpanel which include 6 buttons in controljob panel,them * are center place of panel */ private HorizontalPanel display(){ String buttonwidth = "81px"; HorizontalPanel jobDisplay = new HorizontalPanel(); Button jobID = new Button("JobId"); Button priorityStat = new Button("Priority"); Button jobName = new Button("JobName"); Button owner = new Button("Owner"); Button status = new Button("Status"); Button queue = new Button("Queue"); jobID.setWidth(buttonwidth); priorityStat.setWidth(buttonwidth); jobName.setWidth(buttonwidth); owner.setWidth(buttonwidth); status.setWidth(buttonwidth); queue.setWidth(buttonwidth); jobDisplay.add(jobID); jobDisplay.add(priorityStat); jobDisplay.add(jobName); jobDisplay.add(owner); jobDisplay.add(status); jobDisplay.add(queue); return jobDisplay; } /** * @author gaojinjun * build a FlexTable.Jobcontrol and Queuecontrol will use it */ private ScrollPanel scrollListJob(int row, int col, String content){ FlexTable listJobs = new FlexTable(); //FlexCellFormatter cellFormatter = listJobs.getFlexCellFormatter(); listJobs.setCellSpacing(0); for(int i = 0; i < row; i ++){ for(int j = 0; j < col; j ++){ TextBox readOL = new TextBox(); readOL.setWidth("69.5px"); readOL.setText(""+i+","+j); readOL.setReadOnly(true); listJobs.setWidget(i, j, readOL); } } ScrollPanel scrollList = new ScrollPanel(); scrollList.setWidth("500px"); scrollList.setHeight("430px"); scrollList.setWidget(listJobs); return scrollList; } /** * @author gaojinjun */ private ScrollPanel jobQueue(int row, int col, Widget flextab){ int num = ((FlexTable)flextab).getRowCount(); int i, j; ScrollPanel hostsScroll = new ScrollPanel(); //FlexCellFormatter cellFormatter = ((FlexTable)flextab).getFlexCellFormatter(); String cellWidth = "80px"; String[] temp = resulted.getResult(); for(i = num; i < temp.length; i ++){ String tmp = temp[i]; for(j = 0; j < col; j ++){ TextBox readOL = new TextBox(); readOL.setWidth(cellWidth); readOL.setText(tmp); readOL.setReadOnly(true); ((FlexTable)flextab).setWidget(i, j, readOL); } } if(col * 80 < 740) hostsScroll.setWidth(col * 80 + "px"); else hostsScroll.setWidth("740px"); hostsScroll.setHeight("500px"); hostsScroll.setWidget(((FlexTable)flextab)); return hostsScroll; } /** * async RPC * @author gaojinjun */ public void getOutputLinked(String post){ // create the response handler final AsyncCallback callback = new AsyncCallback(){ public void onFailure(Throwable caught) { GWT.log("RPC error!", caught); Window.alert("Sorry there was an error while get output"); } public void onSuccess(Object result) { resulted = (ResultOfReturn)result; } }; getOutput.getOutput(post, callback); } public void initRPC(){ // get a handle on the async version of our service getOutput = (LoginSystemAsync)GWT.create(LoginSystem.class); ServiceDefTarget endpoint = (ServiceDefTarget)getOutput; String moduleRelativeURL = GWT.getModuleBaseURL() + "LoginSystem"; endpoint.setServiceEntryPoint(moduleRelativeURL); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -