List of usage examples for com.google.gwt.user.client.ui HorizontalPanel HorizontalPanel
public HorizontalPanel()
From source file:com.appspot.codsallarts.client.Application.java
License:Apache License
/** * Create the panel at the top of the page that contains the title and links. *//*from www . j ava2s.c om*/ private void createTopPanel() { boolean isRTL = LocaleInfo.getCurrentLocale().isRTL(); topPanel = new FlexTable(); topPanel.setCellPadding(0); topPanel.setCellSpacing(0); topPanel.setStyleName(DEFAULT_STYLE_NAME + "-top"); FlexCellFormatter formatter = topPanel.getFlexCellFormatter(); // Setup the links cell linksPanel = new HorizontalPanel(); topPanel.setWidget(0, 0, linksPanel); formatter.setStyleName(0, 0, DEFAULT_STYLE_NAME + "-links"); if (isRTL) { formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT); } else { formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); } formatter.setColSpan(0, 0, 2); // Setup the title cell setTitleWidget(null); formatter.setStyleName(1, 0, DEFAULT_STYLE_NAME + "-title"); // Setup the options cell setOptionsWidget(null); formatter.setStyleName(1, 1, DEFAULT_STYLE_NAME + "-options"); if (isRTL) { formatter.setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT); } else { formatter.setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_RIGHT); } // Align the content to the top topPanel.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP); topPanel.getRowFormatter().setVerticalAlign(1, HasVerticalAlignment.ALIGN_TOP); }
From source file:com.appspot.hommkmessage.client.view.Hommk_message.java
License:Open Source License
private SearchHandler initSearch(final ListView listView) { final Button searchButton = new Button("Suche"); final TextBox searchTextField = new TextBox(); searchTextField.setText(""); searchTextField.setFocus(true);/*from w ww. ja va2 s .c o m*/ searchButton.addStyleName("sendButton"); HorizontalPanel searchPanel = new HorizontalPanel(); searchPanel.add(searchTextField); searchPanel.add(searchButton); RootPanel.get("searchLineContainer").add(searchPanel); SearchHandler handler = new SearchHandler(listView, searchTextField); searchButton.addClickHandler(handler); searchTextField.addKeyUpHandler(handler); return handler; }
From source file:com.appspot.hommkmessage.client.view.ListView.java
License:Open Source License
private void createListEntry(final int index, final MessageMetadata messageMetadata) { final HorizontalPanel entryLinePanel = new HorizontalPanel(); final DisclosurePanel entryPanel = new DisclosurePanel(); entryPanel.addStyleName("messageListEntryPanel"); setEntryHeader(messageMetadata, entryPanel, true); entryLinePanel.add(entryPanel);/*w w w. j ava 2s .co m*/ addDeleteLink(messageMetadata, entryLinePanel); add(entryLinePanel); entryPanel.addOpenHandler(new OpenHandler<DisclosurePanel>() { @Override public void onOpen(OpenEvent<DisclosurePanel> event) { entryPanel.clear(); final MessageFrame messageFrame = new MessageFrame("messageFrame" + index); messageFrame.addStyleName("messageInListView"); entryPanel.add(messageFrame); messageFrame.showMessage(messageMetadata.getId()); localStorage.markAsRead(messageMetadata.getId()); setEntryHeader(messageMetadata, entryPanel, false); } }); entryPanel.addCloseHandler(new CloseHandler<DisclosurePanel>() { @Override public void onClose(CloseEvent<DisclosurePanel> event) { setEntryHeader(messageMetadata, entryPanel, true); } }); }
From source file:com.appspot.hommkmessage.client.view.ListView.java
License:Open Source License
private void setEntryHeader(final MessageMetadata messageMetadata, final DisclosurePanel entryPanel, boolean entryClosed) { HTML header = messageMetadata.getInfoLine(dateFormatter, localStorage); Panel entryHeaderPanel = new HorizontalPanel(); AbstractImagePrototype imagePrototype = entryClosed ? images.disclosurePanelClosed() : images.disclosurePanelOpen(); Image image = imagePrototype.createImage(); entryHeaderPanel.add(image);/*from ww w.ja v a 2 s . com*/ entryHeaderPanel.add(header); entryPanel.setHeader(entryHeaderPanel); }
From source file:com.appspot.sendmail.client.RichTextToolbar.java
License:Open Source License
/** Constructor of the Toolbar **/ public RichTextToolbar(RichTextArea richtext) { //Initialize the main-panel outer = new VerticalPanel(); //Initialize the two inner panels topPanel = new HorizontalPanel(); bottomPanel = new HorizontalPanel(); topPanel.setStyleName(CSS_ROOT_NAME); bottomPanel.setStyleName(CSS_ROOT_NAME); //Save the reference to the RichText area we refer to and get the interfaces to the stylings styleText = richtext;/* w w w .j av a 2s . co m*/ styleTextFormatter = styleText.getFormatter(); //Set some graphical options, so this toolbar looks how we like it. topPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT); bottomPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT); //Add the two inner panels to the main panel outer.add(topPanel); outer.add(bottomPanel); //Some graphical stuff to the main panel and the initialisation of the new widget outer.setWidth("100%"); outer.setStyleName(CSS_ROOT_NAME); initWidget(outer); // evHandler = new EventHandler(); //Add KeyUp and Click-Handler to the RichText, so that we can actualize the toolbar if neccessary styleText.addKeyUpHandler(evHandler); styleText.addClickHandler(evHandler); //Now lets fill the new toolbar with life buildTools(); }
From source file:com.appstore.yorknodelays.client.FlightChecklist.java
License:sencha.com license
public Widget asWidget() { FlowPanel container = new FlowPanel(); container.setTitle("Flight Check List"); FramedPanel panel = new FramedPanel(); panel.setHeadingText("Before-Takeoff Checklist"); panel.setWidth(350);//from w w w . ja v a 2 s . c o m panel.setBodyStyle("background: none; padding: 5px"); VerticalLayoutContainer p = new VerticalLayoutContainer(); panel.add(p); CheckBox check1 = new CheckBox(); check1.setBoxLabel("Auxiliary fuel pump Off:"); p.add(check1); CheckBox check2 = new CheckBox(); check1.setBoxLabel("Flight controls Free and correct:"); p.add(check2); CheckBox check3 = new CheckBox(); check3.setBoxLabel("Instruments and radios:"); p.add(check3); CheckBox check4 = new CheckBox(); check4.setBoxLabel("Landing gear position lights :"); p.add(check4); CheckBox check5 = new CheckBox(); check5.setBoxLabel("Altimeter :"); p.add(check5); CheckBox check6 = new CheckBox(); check6.setBoxLabel("Directional gyro :"); p.add(check6); CheckBox check7 = new CheckBox(); check7.setBoxLabel("Fuel gauges :"); p.add(check7); CheckBox check8 = new CheckBox(); check8.setBoxLabel("Trim :"); p.add(check8); CheckBox check9 = new CheckBox(); check9.setBoxLabel(" Propeller Exercise:"); p.add(check9); CheckBox check10 = new CheckBox(); check10.setBoxLabel(" Engine idle :"); p.add(check10); CheckBox check11 = new CheckBox(); check11.setBoxLabel("Magnetos:"); p.add(check11); CheckBox check12 = new CheckBox(); check12.setBoxLabel("Flaps:"); p.add(check12); CheckBox check13 = new CheckBox(); check13.setBoxLabel("Seat belts/shoulder harnesses Fastened:"); p.add(check13); container.add(panel); //Panel 2 Parking Brake FramedPanel panel2 = new FramedPanel(); panel2.setHeadingText("Parking Brake"); panel2.setWidth(350); panel2.setBodyStyle("background: none; padding: 5px"); VerticalLayoutContainer p2 = new VerticalLayoutContainer(); panel2.add(p2); CheckBox check14 = new CheckBox(); check14.setBoxLabel("Lights Landing, taxi, strobes on:"); p2.add(check14); CheckBox check15 = new CheckBox(); check15.setBoxLabel("Doors and windows Locked:"); p2.add(check15); CheckBox check16 = new CheckBox(); check16.setBoxLabel("Mixture Full rich :"); p2.add(check16); CheckBox check17 = new CheckBox(); check17.setBoxLabel("Lights Landing :"); p2.add(check17); CheckBox check18 = new CheckBox(); check18.setBoxLabel("Lights Landing :"); p2.add(check18); CheckBox check19 = new CheckBox(); check19.setBoxLabel("Camera Transponder on :"); HorizontalPanel hp = new HorizontalPanel(); p2.add(check19); CheckBox check20 = new CheckBox(); check20.setBoxLabel("Action Engine instruments checked"); p2.add(check20); container.add(panel2); //Panel 3 Before Flight Landing FramedPanel panel3 = new FramedPanel(); panel3.setHeadingText("Before Flight Landing"); panel3.setWidth(350); panel3.setBodyStyle("background: none; padding: 5px"); VerticalLayoutContainer p3 = new VerticalLayoutContainer(); panel3.add(p3); CheckBox check21 = new CheckBox(); check21.setBoxLabel("Fuel selector Fullest tank:"); p3.add(check21); CheckBox check22 = new CheckBox(); check22.setBoxLabel("Directional gyro Aligned with magnetic compass:"); p3.add(check22); CheckBox check23 = new CheckBox(); check23.setBoxLabel("Seat belts/shoulder harnesses secure:"); p3.add(check23); CheckBox check24 = new CheckBox(); check24.setBoxLabel("Mixture Full rich :"); p3.add(check24); CheckBox check25 = new CheckBox(); check25.setBoxLabel("Cowl flaps As requiredh :"); p3.add(check25); CheckBox check26 = new CheckBox(); check26.setBoxLabel("Final items:"); p3.add(check26); CheckBox check27 = new CheckBox(); check27.setBoxLabel("Landing gear Down:"); p3.add(check27); CheckBox check28 = new CheckBox(); check28.setBoxLabel("Propeller High rpm:"); p3.add(check28); CheckBox check29 = new CheckBox(); check29.setBoxLabel("Flaps As required"); p3.add(check29); container.add(panel3); return container; }
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)); }// w ww. j av 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();/*from ww w .j a va2 s. 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);/* w w w . j a v a 2s . c om*/ mainPanel.add(collegeNameLabel); 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 ww . j a v a2 s . co 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; }