List of usage examples for com.google.gwt.user.client.ui HorizontalPanel add
@Override public void add(Widget w)
From source file:com.apress.progwt.client.calculator.Calculator.java
License:Apache License
public Calculator() { DockPanel dockPanel = new DockPanel(); Grid controls = new Grid(5, 2); Grid numbersP = new Grid(4, 3); // initialize the 1-9 buttons for (int row = 0; row < 3; row++) { for (int col = 0; col < 3; col++) { numbersP.setWidget(row, col, new NumberButton(this, row * 3 + col + 1)); }/*from www .j a v a2 s. co m*/ } numbersP.setWidget(3, 0, new NumberButton(this, 0)); numbersP.setWidget(3, 1, new NumberButton(this, ".")); numbersP.setWidget(3, 2, new ControlButton(this, new ControlAction(this, "+/-") { @Override public boolean isMultiArg() { return false; } @Override public double performAction(ControlAction lastAction, double previous, double current) { return -1 * current; } })); controls.setWidget(0, 0, new ControlButton(this, new ControlAction(this, "/") { @Override public double performAction(ControlAction lastAction, double previous, double current) { return previous / current; } })); controls.setWidget(0, 1, new ControlButton(this, new ControlAction(this, "sqrt") { @Override public boolean isMultiArg() { return false; } @Override public double performAction(ControlAction lastAction, double previous, double current) { return Math.sqrt(current); } })); controls.setWidget(1, 0, new ControlButton(this, new ControlAction(this, "*") { @Override public double performAction(ControlAction lastAction, double previous, double current) { return previous * current; } })); controls.setWidget(1, 1, new ControlButton(this, new ControlAction(this, "%") { @Override public double performAction(ControlAction lastAction, double previous, double current) { return previous % current; } })); controls.setWidget(2, 0, new ControlButton(this, new ControlAction(this, "-") { @Override public double performAction(ControlAction lastAction, double previous, double current) { return previous - current; } })); controls.setWidget(2, 1, new ControlButton(this, new ControlAction(this, "1/x") { @Override public boolean isMultiArg() { return false; } @Override public double performAction(ControlAction lastAction, double previous, double current) { return 1 / current; } })); controls.setWidget(3, 0, new ControlButton(this, new ControlAction(this, "+") { @Override public double performAction(ControlAction lastAction, double previous, double current) { return previous + current; } })); controls.setWidget(3, 1, new ControlButton(this, new ControlAction(this, "=") { @Override public boolean isMultiArg() { return false; } @Override public double performAction(ControlAction lastAction, double previous, double current) { if (lastAction == null) { return current; } return lastAction.performAction(null, previous, current); } })); controls.setWidget(4, 0, new ControlButton(this, new ControlAction(this, "bksp") { @Override public boolean isMultiArg() { return false; } @Override public double performAction(ControlAction lastAction, double previous, double current) { String cStr = current + ""; if (cStr.endsWith(".0")) { cStr = cStr.substring(0, cStr.length() - 3); } else { cStr = cStr.substring(0, cStr.length() - 1); } if (cStr.equals("")) { cStr = "0"; } return Double.parseDouble(cStr); } })); controls.setWidget(4, 1, new ControlButton(this, new ControlAction(this, "clear") { @Override public boolean isMultiArg() { return false; } @Override public double performAction(ControlAction lastAction, double previous, double current) { return 0; } })); dockPanel.add(numbersP, DockPanel.CENTER); dockPanel.add(controls, DockPanel.EAST); inputBox = new TextBox(); inputBox.addStyleName("ResultBox"); dockPanel.add(inputBox, DockPanel.NORTH); ticker = new TextArea(); ticker.setSize("7em", "140px"); MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(); oracle.add("Jill"); oracle.add("Jeff"); oracle.add("James"); oracle.add("Jennifer"); SuggestBox box = new SuggestBox(oracle); box.addEventHandler(new SuggestionHandler() { public void onSuggestionSelected(SuggestionEvent suggE) { String selected = suggE.getSelectedSuggestion().getReplacementString(); // do something with selected suggestion } }); dockPanel.add(box, DockPanel.SOUTH); HorizontalPanel mainP = new HorizontalPanel(); mainP.add(dockPanel); mainP.add(ticker); initWidget(mainP); setResult(0); }
From source file:com.apress.progwt.client.college.gui.ApplicationStatusChooserWidget.java
License:Apache License
public ApplicationStatusChooserWidget(Application application, ServiceCache serviceCache) { this.serviceCache = serviceCache; ProcessType currentStatus = application.getCurrentStatus(); lab = new Label(currentStatus.getName()); lab.addClickListener(new ClickListener() { public void onClick(Widget sender) { showOptions();//w w w. j a va 2s .c o m } }); VerticalPanel chooseP = new VerticalPanel(); for (ProcessType statusType : application.getUser().getStatusProcessTypes()) { HorizontalPanel hp = new HorizontalPanel(); hp.add(new PChooser(statusType)); chooseP.add(hp); } chooseP.add(new Label("Click Status To Choose")); popupP = new DecoratedPopupPanel(true); popupP.add(chooseP); popupP.addStyleName("TC-Popup"); popupP.addStyleName("TC-Popup-Status"); initWidget(lab); }
From source file:com.apress.progwt.client.college.gui.CollegeEntry.java
License:Apache License
public CollegeEntry(User user, Application application, ServiceCache serviceCache, MyRankings myRankings) { this.application = application; this.serviceCache = serviceCache; this.user = user; this.myRankings = myRankings; collegeNameLabel = new Label(application.getSchool().getName()); collegeNameLabel.setStylePrimaryName("TC-CollegeLabel"); rankLabel = new Label(); rankLabel.setStylePrimaryName("TC-CollegeEntry-RankLabel"); HorizontalPanel mainPanel = new HorizontalPanel(); mainPanel.add(rankLabel); mainPanel.add(collegeNameLabel);/* ww w . j a v a 2 s . c o m*/ mainPanel.setCellWidth(rankLabel, "30px"); DisclosurePanel disclosurePanel = new DisclosurePanel(" "); disclosurePanel.add(getInfoPanel()); mainPanel.add(disclosurePanel); mainPanel.setCellHorizontalAlignment(disclosurePanel, HorizontalPanel.ALIGN_RIGHT); mainPanel.setStylePrimaryName("TC-CollegeEntry"); initWidget(mainPanel); }
From source file:com.apress.progwt.client.college.gui.CollegeEntry.java
License:Apache License
/** * get buttons to show under all tabs/*from w w w . j a v a 2 s .c o m*/ */ private Widget getButtons() { HorizontalPanel buttonP = new HorizontalPanel(); Button deleteB = new Button("Remove " + application.getSchool().getName() + " from MyRankings"); deleteB.addClickListener(new ClickListener() { public void onClick(Widget sender) { myRankings.promptForDelete(CollegeEntry.this); } }); buttonP.add(deleteB); return buttonP; }
From source file:com.apress.progwt.client.college.gui.ext.AlertDialog.java
License:Apache License
public AlertDialog(String caption, String message) { super(false, true); setText(caption);/*ww w . j av a 2 s . c o m*/ VerticalPanel mainP = new VerticalPanel(); mainP.add(new Label(message)); HorizontalPanel buttonP = new HorizontalPanel(); Button okB = new Button("Ok"); okB.addClickListener(new ClickListener() { public void onClick(Widget sender) { hide(); } }); buttonP.add(okB); mainP.add(buttonP); setWidget(mainP); }
From source file:com.apress.progwt.client.college.gui.ext.YesNoDialog.java
License:Apache License
public YesNoDialog(String caption, String question, final Command onYes, final Command onNo, String noText, String yesText) {//from w w w. j av a 2 s .c o m super(false, true); setText(caption); VerticalPanel mainP = new VerticalPanel(); mainP.add(new Label(question)); HorizontalPanel buttonP = new HorizontalPanel(); Button yesB = new Button(yesText); yesB.addClickListener(new ClickListener() { public void onClick(Widget sender) { onYes.execute(); hide(); } }); Button noB = new Button(noText); noB.addClickListener(new ClickListener() { public void onClick(Widget sender) { onNo.execute(); hide(); } }); buttonP.add(noB); buttonP.add(yesB); mainP.add(buttonP); setWidget(mainP); }
From source file:com.apress.progwt.client.college.gui.LoginWindow.java
License:Apache License
private Widget getUPTab() { VerticalPanel uptab = new VerticalPanel(); username = new TextBox(); username.setName("j_username"); username.setText(lastNameEntered);/*from w ww .j a v a 2s . co m*/ KeyboardListener enterListener = new KeyboardListenerAdapter() { public void onKeyPress(Widget sender, char keyCode, int modifiers) { if (keyCode == KEY_ENTER) { form.submit(); } } }; final PasswordTextBox password = new PasswordTextBox(); password.setName("j_password"); password.addKeyboardListener(enterListener); username.setText("test"); password.setText("testaroo"); HorizontalPanel userP = new HorizontalPanel(); userP.add(new Label("Username")); userP.add(username); HorizontalPanel passPanel = new HorizontalPanel(); passPanel.add(new Label("Password")); passPanel.add(password); uptab.add(userP); uptab.add(passPanel); uptab.add(new Button("Login", new ClickListener() { public void onClick(Widget sender) { form.submit(); } })); return uptab; }
From source file:com.apress.progwt.client.college.gui.LoginWindow.java
License:Apache License
private Widget getOpenIDTab() { HorizontalPanel hP = new HorizontalPanel(); hP.add(new ExternalLink("Do OpenID login", secureTargetURL, true)); return hP;//from ww w . jav a 2s . c o m }
From source file:com.apress.progwt.client.college.gui.MyApplicationTimeline.java
License:Apache License
public MyApplicationTimeline(ServiceCache serviceCache) { this.serviceCache = serviceCache; HorizontalPanel mainP = new HorizontalPanel(); VerticalPanel chooserP = new VerticalPanel(); timeline = new ProcessTimeline(this); schoolPanel = new AppList(); processTypePanel = new ProcessTypePanel(); chooserP.add(schoolPanel);/*from w w w . ja v a2s . c o m*/ chooserP.add(processTypePanel); mainP.add(timeline); mainP.add(chooserP); initWidget(mainP); }
From source file:com.apress.progwt.client.college.gui.MyDecision.java
License:Apache License
public MyDecision(ServiceCache serviceCache) { this.serviceCache = serviceCache; HorizontalPanel mainPanel = new HorizontalPanel(); priorityPanel = new PriorityPanel(); schoolRanks = new SchoolRanks(); mainPanel.add(priorityPanel); mainPanel.add(schoolRanks);//from ww w.j a v a2 s . c o m initWidget(mainPanel); }