List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment
public void setHorizontalAlignment(HorizontalAlignmentConstant align)
From source file:com.google.gwt.sample.dynatable.client.ui.DayFilterWidget.java
License:Apache License
@UiConstructor public DayFilterWidget(SchoolCalendarWidget calendar) { this.calendar = calendar; initWidget(outer);//from w w w . ja va2 s . co m setStyleName("DynaTable-DayFilterWidget"); outer.add(new DayCheckBox("Sunday", 0)); outer.add(new DayCheckBox("Monday", 1)); outer.add(new DayCheckBox("Tuesday", 2)); outer.add(new DayCheckBox("Wednesday", 3)); outer.add(new DayCheckBox("Thursday", 4)); outer.add(new DayCheckBox("Friday", 5)); outer.add(new DayCheckBox("Saturday", 6)); Button buttonAll = new Button("All", new ClickHandler() { public void onClick(ClickEvent event) { setAllCheckBoxes(true); } }); Button buttonNone = new Button("None", new ClickHandler() { public void onClick(ClickEvent event) { setAllCheckBoxes(false); } }); HorizontalPanel hp = new HorizontalPanel(); hp.setHorizontalAlignment(HasAlignment.ALIGN_CENTER); hp.add(buttonAll); hp.add(buttonNone); outer.add(hp); outer.setCellVerticalAlignment(hp, HasAlignment.ALIGN_BOTTOM); outer.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_CENTER); }
From source file:com.google.livingstories.client.start.StartPage.java
License:Apache License
private Widget createStoryWidget(LivingStory story, List<BaseContentItem> updates) { if (updates.isEmpty()) { return null; }//from w w w. jav a 2s. c o m VerticalPanel panel = new VerticalPanel(); panel.setWidth("100%"); DOM.setStyleAttribute(panel.getElement(), "marginBottom", "15px"); Anchor storyName = new Anchor(story.getTitle(), getStoryUrl(story)); storyName.addStyleName("startPageStoryName"); Label updateCount = getUpdateRecencyLabel( DateUtil.laterDate(updates.get(0).getTimestamp(), story.getLastChangeTimestamp())); updateCount.setWordWrap(false); HorizontalPanel header = new HorizontalPanel(); header.setWidth("100%"); header.addStyleName("sectionHeader"); DOM.setStyleAttribute(header.getElement(), "marginBottom", "10px"); header.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT); header.add(storyName); header.add(updateCount); header.setCellHorizontalAlignment(updateCount, HorizontalPanel.ALIGN_RIGHT); panel.add(header); for (BaseContentItem update : updates) { Anchor headline = null; if (update.getContentItemType() == ContentItemType.NARRATIVE) { NarrativeContentItem narrative = (NarrativeContentItem) update; headline = new Anchor( narrative.getHeadline() + "<span class=\"greyFont\"> - " + narrative.getNarrativeType().toString(), true, getStoryUrl(story) + getUpdateUrl(narrative)); } else { EventContentItem event = (EventContentItem) update; headline = new Anchor(event.getEventUpdate(), true, getStoryUrl(story) + getUpdateUrl(event)); } DOM.setStyleAttribute(headline.getElement(), "paddingLeft", "5px"); panel.add(headline); Label dateLabel = new Label(DateUtil.formatDate(update.getDateSortKey())); dateLabel.addStyleName("greyFont"); DOM.setStyleAttribute(dateLabel.getElement(), "padding", "0 0 13px 5px"); panel.add(dateLabel); } Anchor viewAll = new Anchor(ClientMessageHolder.consts.startPageViewAll(), true, getStoryUrl(story)); viewAll.setStylePrimaryName("startPageViewAll"); panel.add(viewAll); return panel; }
From source file:com.google.livingstories.client.ui.ContentItemSelector.java
License:Apache License
private Widget createHeader() { HorizontalPanel panel = new HorizontalPanel(); panel.setWidth("100%"); panel.add(new Label("Select Content Item(s)")); panel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); Image closeButton = new Image(Constants.CLOSE_IMAGE_URL); closeButton.addClickHandler(new ClickHandler() { @Override// w w w . j a v a 2s . c o m public void onClick(ClickEvent e) { hide(); } }); panel.add(closeButton); return panel; }
From source file:com.google.livingstories.client.ui.Lightbox.java
License:Apache License
private Widget createHeaderPanel(String title) { HorizontalPanel headerPanel = new HorizontalPanel(); headerPanel.setWidth("100%"); headerPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT); Label titleLabel = new Label(title); titleLabel.addStyleName("lightboxTitle"); headerPanel.add(titleLabel);//from w w w . j ava 2 s.co m headerPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); headerPanel.add(closeButton); return headerPanel; }
From source file:com.google.sampling.experiential.client.MonthlyPanel.java
License:Open Source License
public MonthlyPanel(final SignalScheduleDAO schedule) { myConstants = GWT.create(MyConstants.class); this.schedule = schedule; VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setSpacing(2);// w ww . ja v a 2 s. c om verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.setSize("290px", "43px"); initWidget(verticalPanel); RepeatEveryNPanel repeatPanel = new RepeatEveryNPanel(myConstants.repeatTypeMonths(), schedule); verticalPanel.add(repeatPanel); repeatPanel.setWidth("239px"); VerticalPanel byWhatPanel = new VerticalPanel(); byWhatPanel.setSpacing(2); verticalPanel.add(byWhatPanel); HorizontalPanel domPanel = new HorizontalPanel(); domPanel.setSpacing(2); domPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); byWhatPanel.add(domPanel); domPanel.setWidth("184px"); Label by = new Label("By: "); by.setStyleName("gwt-Label-Header"); domPanel.add(by); by.setWidth("30px"); RadioButton domRadio = new RadioButton(myConstants.byGroup(), myConstants.dayOfMonth()); domRadio.setHTML(myConstants.dayOfMonth()); domPanel.add(domRadio); final ListBox listBox = createDayOfMonthListBox(); listBox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { schedule.setDayOfMonth(listBox.getSelectedIndex()); } }); domPanel.add(listBox); if (Boolean.TRUE == schedule.getByDayOfMonth()) { listBox.setSelectedIndex(schedule.getDayOfMonth()); } HorizontalPanel dowPanel = new HorizontalPanel(); dowPanel.setSpacing(2); dowPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); byWhatPanel.add(dowPanel); Label label = new Label(myConstants.by() + ": "); label.setStyleName("gwt-Label-Header"); dowPanel.add(label); label.setWidth("30px"); RadioButton dowRadio = new RadioButton(myConstants.byGroup(), myConstants.dayOfWeek()); dowRadio.setHTML(myConstants.dayOfWeek()); dowPanel.add(dowRadio); HorizontalPanel weekdayPanel = new HorizontalPanel(); weekdayPanel.setSpacing(2); weekdayPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); weekdayPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); byWhatPanel.add(weekdayPanel); byWhatPanel.setCellHorizontalAlignment(weekdayPanel, HasHorizontalAlignment.ALIGN_RIGHT); final ListBox nth = createNthDayListBox(schedule, weekdayPanel); weekdayPanel.add(nth); nth.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { schedule.setNthOfMonth(nth.getSelectedIndex()); } }); final WeekDayPanel weekDayPanel = new WeekDayPanel(false, schedule); weekdayPanel.add(weekDayPanel); weekdayPanel.setCellHorizontalAlignment(weekDayPanel, HasHorizontalAlignment.ALIGN_RIGHT); dowRadio.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { toggleDayOfMonthDayOfWeekPanels(schedule, listBox, nth, weekDayPanel, true); } }); domRadio.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { toggleDayOfMonthDayOfWeekPanels(schedule, listBox, nth, weekDayPanel, false); } }); TimeListPanel timeListPanel = new TimeListPanel(schedule); verticalPanel.add(timeListPanel); timeListPanel.setWidth("286px"); if (schedule.getByDayOfMonth()) { domRadio.setValue(Boolean.TRUE); toggleDayOfMonthDayOfWeekPanels(schedule, listBox, nth, weekDayPanel, false); } else { dowRadio.setValue(Boolean.TRUE); toggleDayOfMonthDayOfWeekPanels(schedule, listBox, nth, weekDayPanel, true); } TimeoutPanel timeoutPanel = new TimeoutPanel(schedule); verticalPanel.add(timeoutPanel); timeoutPanel.setWidth("286px"); SnoozePanel snoozePanel = new SnoozePanel(schedule); verticalPanel.add(snoozePanel); snoozePanel.setWidth("286px"); }
From source file:com.google.sampling.experiential.client.PacoEventServer.java
License:Open Source License
private VerticalPanel createSearchPanel() { final VerticalPanel filterPanel = new VerticalPanel(); filterPanel.add(new HTMLPanel("<b>Events (empty for all):</b> ")); tagList = new TextBox(); tagList.setWidth("45em"); filterPanel.add(tagList);/*from w ww . j a v a2 s . c o m*/ filterPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); filterPanel.add(buttonPanel); Button cafeButton = new Button("Paco Search"); buttonPanel.add(cafeButton); InputHandler cafeHandler = new InputHandler(); cafeButton.addClickHandler(cafeHandler); tagList.addKeyUpHandler(cafeHandler); Button postButton = new Button("Store Data"); buttonPanel.add(postButton); postButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.Location.assign("/PostEvent.html"); } }); return filterPanel; }
From source file:com.gwtsite.gwittir.client.BookForm.java
License:Apache License
private void buildForm() { HorizontalPanel titlePanel = new HorizontalPanel(); titlePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); Label firstNameLabel = new Label("Book Title: "); titlePanel.add(firstNameLabel);//from w w w . jav a 2s .co m titleText = new TextBox(); titlePanel.add(titleText); HorizontalPanel publishedPanel = new HorizontalPanel(); publishedPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); Label publishedLabel = new Label("Year published: "); publishedLabel.addStyleName("bookFormLabel"); publishedPanel.add(publishedLabel); publishedText = new TextBox(); publishedPanel.add(publishedText); HorizontalPanel inStockPanel = new HorizontalPanel(); inStockPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); Label inStockLabel = new Label("In Stock? "); inStockPanel.add(inStockLabel); isInStockCheckbox = new Checkbox(); inStockPanel.add(isInStockCheckbox); VerticalPanel inputPanel = new VerticalPanel(); inputPanel.addStyleName("inputPanel"); inputPanel.add(titlePanel); inputPanel.add(publishedPanel); inputPanel.add(inStockPanel); addBookBtn = new Button(); addBookBtn.setText("Add book"); booksTable = createBooksTable(); mainPanel.add(inputPanel); mainPanel.add(addBookBtn); mainPanel.add(booksTable); }
From source file:com.LSH.client.LSH.java
License:Apache License
/** * ? UI//from ww w . j a v a 2 s . c o m */ public void onModuleLoad() { /* ? ? */ String linkWidth = String.valueOf(Window.getClientWidth() / 4); // HP = HorizontalPanel; VP = VerticalPanel final HorizontalPanel simpleDataHP = new HorizontalPanel(); // ? ?? final HorizontalPanel simpleAnswerHP = new HorizontalPanel(); // ? final VerticalPanel simpleVP = new VerticalPanel(); // ? ? , simpleShortButton.addClickHandler(new SimpleClickHandler()); // ?? simpleOriginalLink.addKeyDownHandler(new EnterKeyListener(simpleShortButton)); // ?? ? Enter simpleCopyButton.addClickHandler(new CopyClickHandler("simpleAnswer")); // ?? ? simpleOriginalLink.setWidth(linkWidth); // ? ? simpleDataHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // simpleDataHP.setSpacing(5); // ? // simpleDataHP.add(simpleOriginalLink); simpleDataHP.add(simpleShortButton); // ?, ? simpleAnswerHP.setSpacing(5); simpleAnswerHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // simpleAnswerHP.add(simpleShortText); simpleAnswerHP.add(simpleShortLink); simpleAnswerHP.add(simpleCopyButton); // simpleVP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); simpleVP.setSpacing(10); simpleVP.add(simpleDataHP); simpleVP.add(simpleAnswerHP); // ? ? simpleShortText.setVisible(false); simpleCopyButton.setVisible(false); /* ? ? */ // ? ? final HorizontalPanel complexLinkHP = new HorizontalPanel(); // ? ?? final HorizontalPanel complexDataHP = new HorizontalPanel(); // final HorizontalPanel complexOptionalData = new HorizontalPanel(); // final HorizontalPanel complexAnswerHP = new HorizontalPanel(); // final VerticalPanel complexVP = new VerticalPanel(); // , final VerticalPanel complexOptionalVP = new VerticalPanel(); // , EnterKeyListener complexKey = new EnterKeyListener(complexShortButton); // ? Enter complexCopyButton.addClickHandler(new CopyClickHandler("complexAnswer")); // ? ?? complexTime.addItem("1 hour"); complexTime.addItem("12 hours"); complexTime.addItem("1 day"); complexTime.addItem("1 week"); complexTime.addItem("1 month"); complexTime.addItem("Unlimited"); complexTime.setSelectedIndex(3); // ?? ? complexOriginalLink.setWidth(linkWidth); complexCount.setWidth("40px"); complexCount.setValue(10); complexShortButton.addClickHandler(new ComplexClickHandler()); // ? // ? ? Enter ? ? complexOriginalLink.addKeyDownHandler(complexKey); complexName.addKeyDownHandler(complexKey); complexCount.addKeyDownHandler(complexKey); complexTime.addKeyDownHandler(complexKey); complexPassword.addKeyDownHandler(complexKey); // ?? ? complexLinkHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); complexLinkHP.setSpacing(5); complexLinkHP.add(complexText); complexLinkHP.add(complexOriginalLink); complexDataHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); complexDataHP.setSpacing(5); complexDataHP.add(complexTimeText); complexDataHP.add(complexTime); complexDataHP.add(complexCountText); complexDataHP.add(complexCount); complexCount.setAlignment(ValueBoxBase.TextAlignment.CENTER); // ? ? complexCount.setMaxLength(5); // ?? - ? complexOptionalData.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); complexOptionalData.setSpacing(5); complexOptionalData.add(complexNameText); complexOptionalData.add(complexName); complexOptionalData.add(complexPasswordText); complexOptionalData.add(complexPassword); complexAnswerHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); complexAnswerHP.setSpacing(5); complexAnswerHP.add(complexShortText); complexAnswerHP.add(complexShortLink); complexAnswerHP.add(complexCopyButton); complexVP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); complexVP.setSpacing(5); complexVP.add(complexLinkHP); complexVP.add(complexDataHP); complexOptionalVP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); complexOptionalVP.setSpacing(5); complexOptionalVP.add(complexOptionalData); complexOptionalVP.add(complexShortButton); complexOptionalVP.add(complexAnswerHP); // complexShortText.setVisible(false); complexCopyButton.setVisible(false); /* ?? ? ? */ loginButton.addClickHandler(new ClickHandler() { // @Override public void onClick(ClickEvent event) { dialog.Login(); } }); logoutButton.addClickHandler(new ClickHandler() { // @Override public void onClick(ClickEvent event) { // Cookies.removeCookie(cookieName); // ? // ? ? ??? loginButton.setVisible(true); loginLabel.setHTML(""); loginLabel.setVisible(false); logoutButton.setVisible(false); } }); // ?? final HorizontalPanel loginHP = new HorizontalPanel(); loginHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); loginHP.setSpacing(5); loginHP.add(loginLabel); loginHP.add(logoutButton); loginHP.add(loginButton); logoutButton.setVisible(false); dialog.hide(); // ? // ? ? RootPanel.get("Login").add(loginHP); RootPanel.get("SimpleShort").add(simpleVP); RootPanel.get("ComplexShort").add(complexVP); RootPanel.get("ComplexShortOptional").add(complexOptionalVP); }
From source file:com.lushprojects.circuitjs1.client.ExportAsTextDialog.java
License:Open Source License
public ExportAsTextDialog(CirSim asim, String s) { super();/*from w w w. j av a 2 s .co m*/ sim = asim; // RichTextArea tb; TextArea ta; Button okButton, importButton; Label la2; SafeHtml html; vp = new VerticalPanel(); setWidget(vp); setText(sim.LS("Export as Text")); vp.add(new Label(sim.LS("Text file for this circuit is..."))); // vp.add(tb = new RichTextArea()); // html=SafeHtmlUtils.fromString(s); // html=SafeHtmlUtils.fromTrustedString(html.asString().replace("\n", "<BR>")); // tb.setHTML(html); vp.add(ta = new TextArea()); ta.setWidth("300px"); ta.setHeight("200px"); ta.setText(s); textArea = ta; vp.add(la2 = new Label(sim.LS( "To save this file select it all (eg click in text and type control-A) and copy to your clipboard (eg control-C) before pasting to an empty text file (eg on Windows Notepad) and saving as a new file."), true)); la2.setWidth("300px"); HorizontalPanel hp = new HorizontalPanel(); hp.setWidth("100%"); hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); hp.setStyleName("topSpace"); vp.add(hp); hp.add(okButton = new Button(sim.LS("OK"))); hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); hp.add(importButton = new Button(sim.LS("Re-Import"))); okButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { closeDialog(); } }); importButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { String s; sim.pushUndo(); closeDialog(); // s=textBox.getHTML(); // s=s.replace("<br>", "\r"); s = textArea.getText(); if (s != null) sim.readSetup(s, true); } }); this.center(); }
From source file:com.lushprojects.circuitjs1.client.ExportAsUrlDialog.java
License:Open Source License
public ExportAsUrlDialog(String dump) { super();// w ww. j a v a 2 s . com String start[] = Location.getHref().split("\\?"); dump = dump.replace(' ', '+'); String query = "?cct=" + URL.encode(dump); dump = start[0] + query; requrl = URL.encodeQueryString(query); Button okButton; Label la1, la2; vp = new VerticalPanel(); setWidget(vp); setText(CirSim.LS("Export as URL")); vp.add(new Label(CirSim.LS("URL for this circuit is..."))); if (dump.length() > 2000) { vp.add(la1 = new Label( CirSim.LS( "Warning: this URL is longer than 2000 characters and may not work in some browsers."), true)); la1.setWidth("300px"); } vp.add(tb = new RichTextArea()); tb.setText(dump); // tb.setMaxLength(s.length()); // tb.setVisibleLength(s.length()); vp.add(la2 = new Label(CirSim.LS( "To save this URL select it all (eg click in text and type control-A) and copy to your clipboard (eg control-C) before pasting to a suitable place."), true)); la2.setWidth("300px"); HorizontalPanel hp = new HorizontalPanel(); hp.setWidth("100%"); hp.setStyleName("topSpace"); hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); hp.add(okButton = new Button(CirSim.LS("OK"))); vp.add(hp); if (shortIsSupported()) { hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); hp.add(shortButton = new Button(CirSim.LS("Create short URL"))); shortButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { shortButton.setVisible(false); createShort(requrl); } }); } okButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { closeDialog(); } }); this.center(); }