Example usage for com.google.gwt.user.client.ui HorizontalPanel add

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel add

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HorizontalPanel add.

Prototype

@Override
    public void add(Widget w) 

Source Link

Usage

From source file:com.google.javascript.jscomp.debugger.DebuggerGwtMain.java

License:Apache License

@Override
public void onModuleLoad() {
    externs.setCharacterWidth(80);/*  ww w . ja  v a 2  s .  c o  m*/
    externs.setVisibleLines(5);
    externs.addKeyUpHandler(new KeyUpHandler() {
        public void onKeyUp(KeyUpEvent event) {
            doCompile();
        }
    });

    input0.setCharacterWidth(80);
    input0.setVisibleLines(25);
    input0.addKeyUpHandler(new KeyUpHandler() {
        public void onKeyUp(KeyUpEvent event) {
            doCompile();
        }
    });

    HorizontalPanel panel = new HorizontalPanel();
    VerticalPanel leftPane = new VerticalPanel();
    leftPane.add(new HTML("<h4>Externs</h4>"));
    leftPane.add(externs);
    leftPane.add(new HTML("<h4>Input</h4>"));
    leftPane.add(input0);
    leftPane.add(new HTML("<h4>Options</h4>"));
    createCheckboxes(leftPane);
    panel.add(leftPane);
    panel.add(rightPane);
    RootPanel.get().add(panel);
}

From source file:com.google.javascript.jscomp.debugger.gwt.DebuggerGwtMain.java

License:Apache License

@Override
public void onModuleLoad() {
    externs.setCharacterWidth(80);//from  ww w.  j a v a  2s  . c o m
    externs.setVisibleLines(5);
    externs.setText("function Symbol() {}\n");
    externs.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            doCompile();
        }
    });

    input0.setCharacterWidth(80);
    input0.setVisibleLines(25);
    input0.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            doCompile();
        }
    });

    HorizontalPanel panel = new HorizontalPanel();
    VerticalPanel leftPane = new VerticalPanel();
    leftPane.add(new HTML("<h4>Externs</h4>"));
    leftPane.add(externs);
    leftPane.add(new HTML("<h4>Input</h4>"));
    leftPane.add(input0);
    leftPane.add(new HTML("<h4>Options</h4>"));
    createCheckboxes(leftPane);
    panel.add(leftPane);
    panel.add(rightPane);
    RootPanel.get().add(panel);
}

From source file:com.google.livingstories.client.contentmanager.ContentItemManager.java

License:Apache License

public ContentItemManager() {
    mapsKey = LivingStoryData.getMapsKey();
    mapsKeyExists = mapsKey != null && !mapsKey.isEmpty();

    HorizontalPanel container = new HorizontalPanel();

    container.add(createControlsPanel());
    container.add(createContentPanel());

    // Event handlers
    createLivingStorySelectionHandler();
    createContentItemTypeSelectionHandler();
    createContentItemSelectionHandler();
    createSaveDeleteHandlers(topSaveControls);
    createSaveDeleteHandlers(bottomSaveControls);

    initWidget(container);/*from w w  w.ja v a2s .  c o m*/
}

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.
 *///  ww w  .  j a  va 2 s . 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.livingstories.client.contentmanager.ContentItemManager.java

License:Apache License

/**
 * Create a panel for the content priority/importance selector.
 *//*from ww  w  . ja v  a  2s  .co m*/
private Widget createImportanceSelectorPanel() {
    Label enterImportanceLabel = new Label("Select priority:");

    importanceSelector = EnumDropdown.newInstance(Importance.class);
    importanceSelector.selectConstant(Importance.MEDIUM);

    HorizontalPanel importanceSelectorPanel = new HorizontalPanel();
    importanceSelectorPanel.add(enterImportanceLabel);
    importanceSelectorPanel.add(importanceSelector);
    return importanceSelectorPanel;
}

From source file:com.google.livingstories.client.contentmanager.ContentItemManager.java

License:Apache License

/**
 * Create a selector for the content type.
 *///from w ww .j  a  va 2s  .c om
private Widget createContentItemTypeSelectorPanel() {
    Label enterTypeLabel = new Label("Select content type:");

    contentItemTypeSelector = EnumDropdown.newInstance(ContentItemType.class);

    HorizontalPanel typeSelectorPanel = new HorizontalPanel();
    DOM.setStyleAttribute(typeSelectorPanel.getElement(), "paddingBottom", "10px");
    typeSelectorPanel.add(enterTypeLabel);
    typeSelectorPanel.add(contentItemTypeSelector);
    return typeSelectorPanel;
}

From source file:com.google.livingstories.client.contentmanager.ContentItemManager.java

License:Apache License

private Widget createLocationPanel() {
    final VerticalPanel locationPanel = new VerticalPanel();

    // show a map based on geocoded or manually-inputted lat-long combination

    HorizontalPanel descriptionPanel = new HorizontalPanel();
    descriptionPanel.add(new HTML("Location name (displayed to readers):"));
    locationDescriptionTextArea = new TextArea();
    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);//from   ww w  . ja  v  a2  s .co m
    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:&nbsp;"));
    latitudeTextBox = new TextBox();
    latitudeTextBox.setEnabled(false);
    latLongPanel.add(latitudeTextBox);
    latLongPanel.add(new HTML("&nbsp;Longitude:&nbsp;"));
    longitudeTextBox = new TextBox();
    longitudeTextBox.setEnabled(false);
    latLongPanel.add(longitudeTextBox);

    HorizontalPanel buttonPanel = new HorizontalPanel();
    geocodeButton = new Button("Geocode location");
    geocodeButton.setEnabled(false);
    buttonPanel.add(geocodeButton);
    geocoderStatus = new Label("");
    buttonPanel.add(geocoderStatus);

    AjaxLoaderOptions options = AjaxLoaderOptions.newInstance();
    options.setOtherParms(mapsKey + "&sensor=false");
    AjaxLoader.loadApi("maps", "2", new Runnable() {
        @Override
        public void run() {
            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();
        }
    }, options);

    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"));

    DisclosurePanel locationZippy = new DisclosurePanel("Location");
    locationZippy.add(locationPanel);
    return locationZippy;
}

From source file:com.google.livingstories.client.contentmanager.ContentItemManager.java

License:Apache License

private Widget createStoryPlayerAttributesPanel() {
    Label title = new Label("Parent player entity");
    title.setStylePrimaryName("header");

    parentPlayerDisplayPanel = new FlowPanel();
    parentPlayerDisplayPanel.setWidth("450px");
    changeParentLink = new Label("Change parent");
    changeParentLink.setStylePrimaryName("primaryLink");

    HorizontalPanel parentPlayerDisplayAndChangeLinkPanel = new HorizontalPanel();
    parentPlayerDisplayAndChangeLinkPanel.add(parentPlayerDisplayPanel);
    parentPlayerDisplayAndChangeLinkPanel.add(changeParentLink);

    parentSelectionInstructions = new Label("Type a player name into the box below. Select from the"
            + " list to add an existing player to the story. To add a new player to the story that"
            + " doesn't exist yet, type their name into the box and click on the button.");
    parentSelectionInstructions.setWidth("450px");

    generalPlayerSuggestPanel = new PlayerSuggestAndAddPanel(contentRpcService, false,
            new AsyncCallback<BaseContentItem>() {
                @Override/*from  w  w w . j  av a2  s.c o  m*/
                public void onFailure(Throwable caught) {
                    parentPlayer = null;
                    formatParentPlayerDisplay();
                }

                @Override
                public void onSuccess(BaseContentItem result) {
                    parentPlayer = (PlayerContentItem) result;
                    addUnassignedPlayer(parentPlayer);
                    formatParentPlayerDisplay();
                }
            });

    changeParentLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            parentPlayer = null;
            formatParentPlayerDisplay();
        }
    });

    if (unassignedPlayersIdToContentItemMap == null) {
        // Asynchronously query for the contributor names:
        contentRpcService.getUnassignedPlayers(new AsyncCallback<List<PlayerContentItem>>() {
            @Override
            public void onFailure(Throwable caught) {
            }

            @Override
            public void onSuccess(List<PlayerContentItem> results) {
                unassignedPlayersIdToContentItemMap = new HashMap<Long, PlayerContentItem>();
                populateUnassignedPlayersMap(results);
                populatePlayerSuggestPanel(generalPlayerSuggestPanel);
            }
        });
    } else {
        populatePlayerSuggestPanel(generalPlayerSuggestPanel);
    }

    Label contentInstructions = new Label("Please enter the role of the selected player in this "
            + "particular story in the 'Content' box below.");
    DOM.setStyleAttribute(contentInstructions.getElement(), "marginTop", "3em");

    formatParentPlayerDisplay();

    FlowPanel storyPlayerAttributesPanel = new FlowPanel();
    storyPlayerAttributesPanel.add(title);
    storyPlayerAttributesPanel.add(parentPlayerDisplayAndChangeLinkPanel);
    storyPlayerAttributesPanel.add(parentSelectionInstructions);
    storyPlayerAttributesPanel.add(generalPlayerSuggestPanel);
    storyPlayerAttributesPanel.add(contentInstructions);
    return storyPlayerAttributesPanel;
}

From source file:com.google.livingstories.client.contentmanager.ContentItemManager.java

License:Apache License

/**
 * Create buttons to save and delete content pieces. And a label for error messages if the
 * updates don't work.//from  w  ww. j ava 2  s  . c o m
 */
private Widget createSaveDeletePanel(SaveControlsWidgetGroup widgets) {
    widgets.saveDraftButton = new Button("Save as draft");
    widgets.publishButton = new Button("Publish");
    widgets.republishButton = new Button("Republish, without updating time");
    widgets.republishButton.setEnabled(false);
    widgets.deleteButton = new Button("Delete");
    widgets.deleteButton.setEnabled(false);

    widgets.statusLabel = new Label();

    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.add(widgets.saveDraftButton);
    buttonPanel.add(widgets.publishButton);
    buttonPanel.add(widgets.republishButton);
    buttonPanel.add(widgets.deleteButton);
    buttonPanel.add(widgets.statusLabel);
    return buttonPanel;
}

From source file:com.google.livingstories.client.contentmanager.LivingStoryManager.java

License:Apache License

private DialogBox getCreateDialog() {
    if (createDialog == null) {
        // creates the dialog box on first demand, but reuses it for subsequent
        // appearances
        createDialog = new DialogBox();
        createDialog.setText("Enter story url");
        createDialog.setAnimationEnabled(true);

        VerticalPanel dialogVPanel = new VerticalPanel();
        dialogVPanel.add(new HTML("Enter the desired story url name"));
        createDialogTextBox = new TextBox();
        // dialog text is set below
        dialogVPanel.add(createDialogTextBox);

        HorizontalPanel buttonPanel = new HorizontalPanel();
        createDialogSaveButton = new Button("Save");
        createDialogSaveButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                closeCreateDialog(false);
            }/*from w  w  w .jav a  2s .c  o m*/
        });
        buttonPanel.add(createDialogSaveButton);
        Button cancelButton = new Button("Cancel");
        cancelButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                closeCreateDialog(true);
            }
        });
        buttonPanel.add(cancelButton);
        dialogVPanel.add(buttonPanel);
        createDialog.setWidget(dialogVPanel);
    }

    createDialogTextBox.setText("");

    return createDialog;
}