List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setSpacing
public void setSpacing(int spacing)
From source file:com.google.livingstories.client.contentmanager.ContentItemManager.java
License:Apache License
/** * Create a panel for showing the text area to enter the HTML for a content piece; selectors * to enter its priority and type; and the timestamp. *//* w w w. j a v a 2s. c o m*/ private Widget createEditorPanel() { contentItemIdLabel = new Label(); HorizontalPanel contentItemIdPanel = new HorizontalPanel(); contentItemIdPanel.setSpacing(2); contentItemIdPanel.add(new Label("Id:")); contentItemIdPanel.add(contentItemIdLabel); contentEditor = new RichTextEditor(); timestamp = new Label(); HorizontalPanel timestampPanel = new HorizontalPanel(); timestampPanel.setSpacing(2); timestampPanel.add(new Label("Publish time:")); timestampPanel.add(timestamp); publishStateLabel = new Label(); contentTitle = new Label("Content"); contentTitle.setStylePrimaryName("header"); VerticalPanel editorPanel = new VerticalPanel(); editorPanel.add(contentItemIdPanel); editorPanel.add(createContentItemTypeSelectorPanel()); editorPanel.add(createSpecialAttributesPanel()); editorPanel.add(contentTitle); editorPanel.add(contentEditor); editorPanel.add(createImportanceSelectorPanel()); editorPanel.add(createContributorSelector()); editorPanel.add(createAdditionalPropertiesPanel()); editorPanel.add(createLinkedContentItemsPicker()); editorPanel.add(publishStateLabel); editorPanel.add(timestampPanel); return editorPanel; }
From source file:com.google.sampling.experiential.client.EsmPanel.java
License:Open Source License
public EsmPanel(final SignalScheduleDAO schedule) { MyConstants myConstants = GWT.create(MyConstants.class); this.schedule = schedule; VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setSpacing(2);/* ww w. j a va2 s. c o m*/ initWidget(verticalPanel); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setSpacing(2); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.setCellVerticalAlignment(horizontalPanel, HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setWidth(""); Label lblFrequency = new Label(myConstants.frequency() + ":"); lblFrequency.setStyleName("gwt-Label-Header"); horizontalPanel.add(lblFrequency); ValueSpinnerFixed frequencySpinner = new ValueSpinnerFixed(schedule.getEsmFrequency(), 0, 100); frequencySpinner.getTextBox().setWidth("18px"); frequencySpinner.setWidth("35px"); horizontalPanel.add(frequencySpinner); frequencySpinner.getSpinner().addSpinnerListener(new SpinnerListener() { public void onSpinning(long value) { schedule.setEsmFrequency((int) value); } }); Label lblPeriod = new Label(myConstants.period() + ": "); lblPeriod.setStyleName("gwt-Label-Header"); horizontalPanel.add(lblPeriod); final ListBox listBox = new ListBox(); for (int i = 0; i < SignalScheduleDAO.ESM_PERIODS.length; i++) { listBox.addItem(SignalScheduleDAO.ESM_PERIODS_NAMES[i]); } horizontalPanel.add(listBox); listBox.setVisibleItemCount(1); Integer period = schedule.getEsmPeriodInDays(); if (period == null) { period = SignalScheduleDAO.DEFAULT_ESM_PERIOD; schedule.setEsmPeriodInDays(SignalScheduleDAO.DEFAULT_ESM_PERIOD); } listBox.setSelectedIndex(period); listBox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { schedule.setEsmPeriodInDays(listBox.getSelectedIndex()); } }); verticalPanel.add(horizontalPanel); HorizontalPanel weekendsPanel = new HorizontalPanel(); weekendsPanel.setSpacing(2); weekendsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.add(weekendsPanel); weekendsPanel.setWidth(""); Label lblWeekends = new Label(myConstants.includeWeekends() + ": "); lblWeekends.setStyleName("gwt-Label-Header"); weekendsPanel.add(lblWeekends); final CheckBox weekendsBox = new CheckBox(""); weekendsPanel.add(weekendsBox); weekendsBox.setValue(schedule.getEsmWeekends()); weekendsBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { schedule.setEsmWeekends(weekendsBox.getValue()); } }); HorizontalPanel horizontalPanel_1 = new HorizontalPanel(); horizontalPanel_1.setSpacing(2); horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.add(horizontalPanel_1); horizontalPanel_1.setWidth(""); Label lblStartHour = new Label(myConstants.startTime() + ":"); lblStartHour.setStyleName("gwt-Label-Header"); horizontalPanel_1.add(lblStartHour); lblStartHour.setWidth("83px"); Date setTime = null; if (schedule.getEsmStartHour() != null) { setTime = new Date(); long offset = schedule.getEsmStartHour(); int hours = (int) (offset / (60 * 60 * 1000)); int minutes = (int) (offset - (hours * 60 * 60 * 1000)) / (60 * 1000); setTime.setHours(hours); setTime.setMinutes(minutes); setTime.setSeconds(0); } else { Date now = new Date(); now.setMinutes(0); now.setSeconds(0); setTime = now; } final TimePickerFixed startTimeBox = new TimePickerFixed(setTime, DateTimeFormat.getFormat("aa"), DateTimeFormat.getFormat("hh"), DateTimeFormat.getFormat("mm"), null); horizontalPanel_1.add(startTimeBox); HorizontalPanel horizontalPanel_2 = new HorizontalPanel(); horizontalPanel_2.setSpacing(2); horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.add(horizontalPanel_2); horizontalPanel_2.setWidth(""); startTimeBox.addValueChangeHandler(new ValueChangeHandler() { public void onValueChange(ValueChangeEvent event) { Date dateTime = startTimeBox.getDateTime(); long offset = (dateTime.getHours() * 60 * 60 * 1000) + (dateTime.getMinutes() * 60 * 1000); schedule.setEsmStartHour(offset); } }); Label lblEndTime = new Label(myConstants.endTime() + ": "); lblEndTime.setStyleName("gwt-Label-Header"); horizontalPanel_2.add(lblEndTime); lblEndTime.setWidth("83px"); setTime = null; if (schedule.getEsmEndHour() != null) { setTime = new Date(); long offset = schedule.getEsmEndHour(); int hours = (int) (offset / (60 * 60 * 1000)); int minutes = (int) (offset - (hours * 60 * 60 * 1000)) / (60 * 1000); setTime.setHours(hours); setTime.setMinutes(minutes); } else { Date now = new Date(); now.setMinutes(0); now.setSeconds(0); setTime = now; } final TimePickerFixed endTimePicker = new TimePickerFixed(setTime, DateTimeFormat.getFormat("aa"), DateTimeFormat.getFormat("hh"), DateTimeFormat.getFormat("mm"), null); horizontalPanel_2.add(endTimePicker); endTimePicker.addValueChangeHandler(new ValueChangeHandler() { public void onValueChange(ValueChangeEvent event) { Date dateTime = endTimePicker.getDateTime(); long offset = (dateTime.getHours() * 60 * 60 * 1000) + (dateTime.getMinutes() * 60 * 1000); schedule.setEsmEndHour(offset); } }); TimeoutPanel timeoutPanel = new TimeoutPanel(schedule); verticalPanel.add(timeoutPanel); timeoutPanel.setWidth("286px"); MinimumBufferPanel minimumBufferPanel = new MinimumBufferPanel(schedule); verticalPanel.add(minimumBufferPanel); minimumBufferPanel.setWidth("286px"); SnoozePanel snoozePanel = new SnoozePanel(schedule); verticalPanel.add(snoozePanel); snoozePanel.setWidth("286px"); }
From source file:com.google.sampling.experiential.client.ExperimentRow.java
License:Open Source License
public ExperimentRow(Images resources, ExperimentDAO experiment, ExperimentListener listener, boolean joined, boolean findView) { this.images = resources; this.myConstants = GWT.create(MyConstants.class); this.experiment = experiment; this.joined = joined; this.findView = findView; this.listeners = new ArrayList<ExperimentListener>(); if (listener != null) { listeners.add(listener);// w w w . j a v a 2 s . c om } HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setStyleName("paco-experimentRow"); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setSpacing(1); horizontalPanel.setHeight("42px"); initWidget(horizontalPanel); Image experimentIcon = new Image(resources.question()); experimentIcon.setAltText(myConstants.experimentIcon()); horizontalPanel.add(experimentIcon); horizontalPanel.setCellHeight(experimentIcon, "42"); horizontalPanel.setCellWidth(experimentIcon, "42"); horizontalPanel.setCellHorizontalAlignment(experimentIcon, HasHorizontalAlignment.ALIGN_CENTER); horizontalPanel.setCellVerticalAlignment(experimentIcon, HasVerticalAlignment.ALIGN_BOTTOM); experimentIcon.setSize("42px", "42px"); VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setHeight("39px"); horizontalPanel.add(verticalPanel); HorizontalPanel horizontalPanel_2 = new HorizontalPanel(); horizontalPanel_2.setHeight("19px"); verticalPanel.add(horizontalPanel_2); Label experimentTitleLabel = new Label(experiment.getTitle()); if (experiment.getDeleted() != null && experiment.getDeleted()) { experimentTitleLabel.setStyleName("gwt-Link-underline-strikethrough"); } else { experimentTitleLabel.setStyleName("gwt-Link-underline"); } horizontalPanel_2.add(experimentTitleLabel); horizontalPanel_2.setCellWidth(experimentTitleLabel, "22px"); horizontalPanel_2.setCellHeight(experimentTitleLabel, "18px"); experimentTitleLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); horizontalPanel.setCellVerticalAlignment(experimentTitleLabel, HasVerticalAlignment.ALIGN_MIDDLE); experimentTitleLabel.setWidth("180px"); ClickHandler titleHandler = new ClickHandler() { public void onClick(ClickEvent event) { showExperimentDetails(); } }; if (!isExperimentPurged()) { experimentTitleLabel.addClickHandler(titleHandler); experimentIcon.addClickHandler(titleHandler); } HorizontalPanel horizontalPanel_1 = new HorizontalPanel(); horizontalPanel_1.setSpacing(1); verticalPanel.add(horizontalPanel_1); createButtonPanel(experiment, joined, horizontalPanel, horizontalPanel_1, findView); }
From source file:com.google.sampling.experiential.client.Main.java
License:Open Source License
private void createHomePage() { RootPanel rootPanel = RootPanel.get(); mainPanel = new VerticalPanel(); mainPanel.setSpacing(2);/* w w w .j a v a 2 s .c o m*/ rootPanel.add(mainPanel); HorizontalPanel menuPanel = createMenuBar(); createStatusPanelOnMenubar(menuPanel); listTitle = new HTML(""); mainPanel.add(listTitle); listTitle.setStyleName("paco-HTML-Large"); listTitle.setWordWrap(false); listTitle.setSize("270px", "22"); mainPanel.setCellHorizontalAlignment(listTitle, HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setSpacing(2); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); mainPanel.add(horizontalPanel); experimentPanel = new VerticalPanel(); leftSidePanel = new ScrollPanel(experimentPanel); horizontalPanel.add(leftSidePanel); experimentPanel.setStyleName("paco-experimentPanel"); experimentPanel.setSpacing(2); experimentPanel.setVisible(false); experimentPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); flexTable = new FlexTable(); String height = (Window.getClientHeight() - 200) + "px"; ScrollPanel sp = new ScrollPanel(flexTable); //flexTable.setSize("400px", height); experimentPanel.add(flexTable); contentPanel = new VerticalPanel(); contentPanel.setSpacing(2); horizontalPanel.add(contentPanel); //contentPanel.setSize("550px", "325px"); rootPanel.add(new HTML( "<div style=\"text-align:center;\"><a href=\"/privacypolicy.html\">Privacy Policy</a></div>")); loadJoinedExperiments(); createCallbackForGviz(); }
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);//from w w w .j a va2 s . co m 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 HorizontalPanel createMainpanel() { HorizontalPanel mainPanel = new HorizontalPanel(); // mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); mainPanel.setSpacing(5); mainPanel.setWidth("100%"); return mainPanel; }
From source file:com.google.sampling.experiential.client.RepeatEveryNPanel.java
License:Open Source License
public RepeatEveryNPanel(String period, final SignalScheduleDAO schedule) { MyConstants myConstants = GWT.create(MyConstants.class); this.schedule = schedule; this.periodLabel = period; HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setSpacing(2); horizontalPanel.setSize("265px", "25px"); initWidget(horizontalPanel);/*from w w w . j a va2 s. c o m*/ Label lblRepeatEvery = new Label(myConstants.repeatEvery() + ":"); lblRepeatEvery.setStyleName("gwt-Label-Header"); horizontalPanel.add(lblRepeatEvery); horizontalPanel.setCellVerticalAlignment(lblRepeatEvery, HasVerticalAlignment.ALIGN_MIDDLE); lblRepeatEvery.setSize("93px", "16px"); final ListBox listBox = new ListBox(); listBox.addItem("1"); listBox.addItem("2"); listBox.addItem("3"); listBox.addItem("4"); listBox.addItem("5"); listBox.addItem("6"); listBox.addItem("7"); listBox.addItem("8"); listBox.addItem("9"); listBox.addItem("10"); listBox.addItem("11"); listBox.addItem("12"); listBox.addItem("13"); listBox.addItem("14"); listBox.addItem("15"); listBox.addItem("16"); listBox.addItem("17"); listBox.addItem("18"); listBox.addItem("19"); listBox.addItem("20"); listBox.addItem("21"); listBox.addItem("22"); listBox.addItem("23"); listBox.addItem("24"); listBox.addItem("25"); listBox.addItem("26"); listBox.addItem("27"); listBox.addItem("28"); listBox.addItem("29"); listBox.addItem("30"); horizontalPanel.add(listBox); listBox.setVisibleItemCount(1); listBox.setSelectedIndex(schedule.getRepeatRate() - 1); listBox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { schedule.setRepeatRate(listBox.getSelectedIndex() + 1); } }); if (periodLabel == null) { periodLabel = "Days"; } Label lblDays = new Label(periodLabel); lblDays.setStyleName("gwt-Label-Header"); horizontalPanel.add(lblDays); }
From source file:com.google.sampling.experiential.client.SchedulePanel.java
License:Open Source License
public SchedulePanel(SignalScheduleDAO schedule) { this.schedule = schedule; myConstants = GWT.create(MyConstants.class); VerticalPanel verticalPanel = new VerticalPanel(); initWidget(verticalPanel);/*from w w w . j a va2s . c o m*/ HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setSpacing(3); verticalPanel.add(horizontalPanel); Label lblSignalSchedule = new Label(myConstants.signalSchedule() + ":"); lblSignalSchedule.setStyleName("keyLabel"); horizontalPanel.add(lblSignalSchedule); horizontalPanel.setCellVerticalAlignment(lblSignalSchedule, HasVerticalAlignment.ALIGN_MIDDLE); lblSignalSchedule.setWidth("114px"); final ListBox listBox = createScheduleTypeListBox(); horizontalPanel.add(listBox); horizontalPanel.setCellVerticalAlignment(listBox, HasVerticalAlignment.ALIGN_MIDDLE); listBox.setVisibleItemCount(1); scheduleDetailsPanel = new VerticalPanel(); verticalPanel.add(scheduleDetailsPanel); setPanelForScheduleType(); addListSelectionListener(listBox); verticalPanel.add(createUserEditable(schedule)); verticalPanel.add(createUserEditableOnce(schedule)); }
From source file:com.google.sampling.experiential.client.SchedulePanel.java
License:Open Source License
private Widget createUserEditable(SignalScheduleDAO schedule2) { HorizontalPanel userEditablePanel = new HorizontalPanel(); userEditablePanel.setSpacing(2); userEditablePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); userEditablePanel.setWidth(""); Label lblUserEditable = new Label("User Editable: "); lblUserEditable.setStyleName("gwt-Label-Header"); userEditablePanel.add(lblUserEditable); final CheckBox userEditableCheckBox = new CheckBox(""); userEditablePanel.add(userEditableCheckBox); userEditableCheckBox/*ww w . j a v a2 s . c o m*/ .setValue(schedule.getUserEditable() != null ? schedule.getUserEditable() : Boolean.TRUE); userEditableCheckBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { schedule.setUserEditable(userEditableCheckBox.getValue()); } }); return userEditablePanel; }
From source file:com.google.sampling.experiential.client.SchedulePanel.java
License:Open Source License
private Widget createUserEditableOnce(SignalScheduleDAO schedule2) { HorizontalPanel userEditablePanel = new HorizontalPanel(); userEditablePanel.setSpacing(2); userEditablePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); userEditablePanel.setWidth(""); Label lblUserEditable = new Label("Only Editable on Join: "); lblUserEditable.setStyleName("gwt-Label-Header"); userEditablePanel.add(lblUserEditable); final CheckBox userEditableCheckBox = new CheckBox(""); userEditablePanel.add(userEditableCheckBox); userEditableCheckBox.setValue(/*from w ww . j a v a2s.c o m*/ schedule.getOnlyEditableOnJoin() != null ? schedule.getOnlyEditableOnJoin() : Boolean.FALSE); userEditableCheckBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { schedule.setOnlyEditableOnJoin(userEditableCheckBox.getValue()); } }); return userEditablePanel; }