List of usage examples for com.google.gwt.user.client.ui HorizontalPanel add
@Override public void add(Widget w)
From source file:com.google.livingstories.client.contentmanager.ThemeManager.java
License:Apache License
public ThemeManager() { final VerticalPanel contentPanel = new VerticalPanel(); contentPanel.add(createLivingStorySelectorPanel()); // Add the radio buttons to create or edit themes contentPanel.add(createModeSelector()); // Add the editor and the content listbox in a horizontal panel at the center HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.add(createEditorPanel()); horizontalPanel.add(createThemeListBox()); contentPanel.add(horizontalPanel);/*from w ww . j a va 2s . c o m*/ // Add buttons to save and delete at the bottom contentPanel.add(createSaveDeletePanel()); // Event handlers createLivingStorySelectionHandler(); createThemeSelectionHandler(); createSaveButtonHandler(); createDeleteButtonHandler(); initWidget(contentPanel); }
From source file:com.google.livingstories.client.contentmanager.ThemeManager.java
License:Apache License
/** * Create a panel for showing the text box to name or rename an theme. *//*w ww . j a v a 2 s .co m*/ private Widget createEditorPanel() { nameBox = new TextBox(); HorizontalPanel nameBoxPanel = new HorizontalPanel(); nameBoxPanel.add(new Label("Enter theme name:")); nameBoxPanel.add(nameBox); return nameBoxPanel; }
From source file:com.google.livingstories.client.contentmanager.ThemeManager.java
License:Apache License
/** * Create buttons to save and delete themes. And a label for error messages if the * updates don't work./*from w w w .j a va 2 s . com*/ */ private Widget createSaveDeletePanel() { saveButton = new Button("Save"); deleteButton = new Button("Delete"); deleteButton.setEnabled(false); statusLabel = new Label(); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.add(saveButton); buttonPanel.add(deleteButton); buttonPanel.add(statusLabel); return buttonPanel; }
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; }/* ww w.j av a2 s . 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.ContentItemListBox.java
License:Apache License
public ContentItemListBox(final boolean multiSelect) { filter = EnumDropdown.newInstance(ContentItemType.class, "All"); filter.addChangeHandler(new ChangeHandler() { @Override/*w ww . j a v a 2 s . co m*/ public void onChange(ChangeEvent event) { refresh(); } }); HorizontalPanel filterPanel = new HorizontalPanel(); filterPanel.add(new Label("Filter:")); filterPanel.add(filter); itemList = new ItemList<BaseContentItem>(multiSelect) { @Override public void loadItems() { if (!loadedContentItemsMap.isEmpty()) { // loads the items in reverse order from how they're stored. List<BaseContentItem> contentItems = new ArrayList<BaseContentItem>( loadedContentItemsMap.values()); Collections.reverse(contentItems); for (BaseContentItem contentItem : contentItems) { if (testContentItem(contentItem)) { String content = contentItem.getDisplayString(); if (content.length() > Constants.CONTENT_SNIPPET_LENGTH) { content = content.substring(0, Constants.CONTENT_SNIPPET_LENGTH).concat("..."); } addItem(content, String.valueOf(contentItem.getId())); } } } } }; VerticalPanel contentPanel = new VerticalPanel(); contentPanel.add(filterPanel); contentPanel.add(itemList); initWidget(contentPanel); }
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/*from ww w . j a v a 2 s . 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); headerPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); headerPanel.add(closeButton);// w ww . jav a 2s .c om return headerPanel; }
From source file:com.google.livingstories.client.ui.richtexttoolbar.RichTextToolbar.java
License:Apache License
private void addControlToToolbar(HorizontalPanel toolbar, Widget w, String styleName) { w.addStyleName(styleName); toolbar.add(w); }
From source file:com.google.livingstories.client.ui.Slideshow.java
License:Apache License
public Slideshow(List<AssetContentItem> images) { allImages = images;/*from ww w .jav a 2 s .co m*/ Image closeButton = new Image(Constants.CLOSE_IMAGE_URL); closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent e) { hide(); } }); HorizontalPanel controlsPanel = new HorizontalPanel(); controlsPanel.setWidth("100%"); controlsPanel.add(closeButton); controlsPanel.setCellHorizontalAlignment(closeButton, HorizontalPanel.ALIGN_RIGHT); imagePanel = new SimplePanel(); // Note that this needs to be a VerticalPanel, which is backed by a table, // rather than a flow panel, which is backed by a div. Otherwise, the // width is unconstrained in chrome and the popup takes up the whole // width of the screen. contentPanel = new VerticalPanel(); contentPanel.add(controlsPanel); contentPanel.add(imagePanel); popup = new AutoHidePopupPanel(true); popup.add(contentPanel); popup.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { hide(); } }); filmstrip = new Filmstrip() { @Override public void onNavigate(int newIndex) { displayImage(newIndex); } }; filmstrip.loadImages(allImages); filmstripPopup = new AutoHidePopupPanel(true); filmstripPopup.add(filmstrip); popup.addAutoHidePartner(filmstripPopup.getElement()); filmstripPopup.addAutoHidePartner(popup.getElement()); }
From source file:com.google.livingstories.plugins.wordpress.livingstorypropertymanager.client.ui.LocationInput.java
License:Apache License
private Widget createLocationPanel(final Location location) { final VerticalPanel locationPanel = new VerticalPanel(); if (mapsKeyExists) { HorizontalPanel descriptionPanel = new HorizontalPanel(); descriptionPanel.add(new HTML("Location name (displayed to readers):")); locationDescriptionTextArea = new TextArea(); locationDescriptionTextArea.setName("lsp_location_description"); locationDescriptionTextArea.setCharacterWidth(50); locationDescriptionTextArea.setHeight("60px"); descriptionPanel.add(locationDescriptionTextArea); Label geocodingOptions = new Label("Geocode based on:"); useDisplayedLocation = new RadioButton("geoGroup", "The displayed location name"); useDisplayedLocation.setValue(true); useAlternateLocation = new RadioButton("geoGroup", "An alternate location that geocodes better: "); alternateTextBox = new TextBox(); alternateTextBox.setEnabled(false); HorizontalPanel alternatePanel = new HorizontalPanel(); alternatePanel.add(useAlternateLocation); alternatePanel.add(alternateTextBox); useManualLatLong = new RadioButton("geoGroup", "Manually entered latitude and longitude numbers (enter these below)"); HorizontalPanel latLongPanel = new HorizontalPanel(); latLongPanel.add(new HTML("Latitude: ")); latitudeTextBox = new TextBox(); latitudeTextBox.setEnabled(false); latLongPanel.add(latitudeTextBox); latLongPanel.add(new HTML(" Longitude: ")); longitudeTextBox = new TextBox(); longitudeTextBox.setName("lsp_longitude"); longitudeTextBox.setEnabled(false); latLongPanel.add(longitudeTextBox); // Hidden fields are needed to pass the value of the latitude and longitude text boxes to // the PHP code because the text boxes can be disabled. And if they are disabled, their // values can't be accessed. latitudeValue = new Hidden(); latitudeValue.setName("lsp_latitude"); longitudeValue = new Hidden(); longitudeValue.setName("lsp_longitude"); HorizontalPanel buttonPanel = new HorizontalPanel(); geocodeButton = new Button("Geocode location"); geocodeButton.setEnabled(false); buttonPanel.add(geocodeButton);// w w w. j a va2 s. co m geocoderStatus = new Label(""); buttonPanel.add(geocoderStatus); locationPanel.add(descriptionPanel); locationPanel.add(geocodingOptions); locationPanel.add(useDisplayedLocation); locationPanel.add(alternatePanel); locationPanel.add(useManualLatLong); locationPanel.add(latLongPanel); locationPanel.add(buttonPanel); locationPanel.add(new Label("Tip: once the map is visible, right-click a point on the map to" + " indicate that this is the precise location you want")); locationPanel.add(latitudeValue); locationPanel.add(longitudeValue); locationZippy = new DisclosurePanel("Location"); locationZippy.add(locationPanel); // show a map based on geocoded or manually-inputted lat-long combination AjaxLoaderOptions options = AjaxLoaderOptions.newInstance(); options.setOtherParms(mapsKey + "&sensor=false"); AjaxLoader.loadApi("maps", "2", new Runnable() { @Override public void run() { mapsApiReady = true; map = new MapWidget(); map.setSize(MAP_WIDTH + "px", MAP_HEIGHT + "px"); map.addControl(new SmallMapControl()); map.setDoubleClickZoom(true); map.setDraggable(true); map.setScrollWheelZoomEnabled(true); map.setZoomLevel(MAP_ZOOM); map.setVisible(false); locationPanel.add(map); createLocationHandlers(); // Set the provided location on the map, if there is any setLocation(location); // Add handlers to re-center the map when the disclosure panel is toggled, because the // map has trouble centering if it's visibility is changed via the map. The handlers need // to be added here because we want to make sure that the map has been created before // adding the handlers. addDisclosurePanelHandlers(); } }, options); } else { Label noKeyLabel = new Label("Google Maps API key not available. Please specify in" + " the ClientConstants.properties file."); noKeyLabel.setStyleName(Resources.INSTANCE.css().error()); locationPanel.add(noKeyLabel); } return locationZippy; }