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

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

Introduction

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

Prototype

public void insert(Widget w, int beforeIndex) 

Source Link

Usage

From source file:com.google.appinventor.client.DesignToolbar.java

License:Open Source License

/**
 * Initializes and assembles all commands into buttons in the toolbar.
 */// ww w. ja va2 s .c o m
public DesignToolbar() {
    super();

    isReadOnly = Ode.getInstance().isReadOnly();

    projectNameLabel = new Label();
    projectNameLabel.setStyleName("ya-ProjectName");
    HorizontalPanel toolbar = (HorizontalPanel) getWidget();
    toolbar.insert(projectNameLabel, 0);

    // width of palette minus cellspacing/border of buttons
    toolbar.setCellWidth(projectNameLabel, "222px");

    List<DropDownItem> screenItems = Lists.newArrayList();
    addDropDownButton(WIDGET_NAME_SCREENS_DROPDOWN, MESSAGES.screensButton(), screenItems);

    if (AppInventorFeatures.allowMultiScreenApplications() && !isReadOnly) {
        addButton(new ToolbarItem(WIDGET_NAME_ADDFORM, MESSAGES.addFormButton(), new AddFormAction()));
        addButton(new ToolbarItem(WIDGET_NAME_REMOVEFORM, MESSAGES.removeFormButton(), new RemoveFormAction()));
    }

    addButton(new ToolbarItem(WIDGET_NAME_SWITCH_TO_FORM_EDITOR, MESSAGES.switchToFormEditorButton(),
            new SwitchToFormEditorAction()), true);
    addButton(new ToolbarItem(WIDGET_NAME_SWITCH_TO_BLOCKS_EDITOR, MESSAGES.switchToBlocksEditorButton(),
            new SwitchToBlocksEditorAction()), true);

    // Gray out the Designer button and enable the blocks button
    toggleEditor(false);
    Ode.getInstance().getTopToolbar().updateFileMenuButtons(0);
}

From source file:org.jbpm.formbuilder.client.effect.view.ScriptHelperListPanel.java

License:Apache License

private void renumber() {
    for (Widget widget : this) {
        HorizontalPanel panel = (HorizontalPanel) widget;
        int index = getWidgetIndex(panel) + 1;
        String number = String.valueOf(index);
        panel.remove(0);//from   w  w w  .j a  v a 2s.com
        panel.insert(new Label(number), 0);
    }

}

From source file:org.openelis.modules.report.client.ReportScreen.java

License:Open Source License

/**
 * Places the specified widget after the label.
 *//*from w  w  w. ja v a 2  s. c o m*/
protected void addLabelAndWidget(Prompt p, FlexTable tp, Widget w) {
    int row;
    Label pr;
    HorizontalPanel hp;

    row = tp.getRowCount();
    //
    // add a label and widget if both are present
    //
    if (!DataBaseUtil.isEmpty(p.getPrompt())) {
        pr = new Label(p.getPrompt());
        pr.setStyleName("Prompt");
        pr.setWordWrap(false);
        hp = new HorizontalPanel();
        hp.add(w);
        if (!p.isHidden()) {
            tp.setWidget(row, 0, pr);
            tp.setWidget(row, 1, hp);
        }
    } else if (row > 0) {
        //
        // add the widget to the previous row's list of widgets
        //
        hp = (HorizontalPanel) tp.getWidget(row - 1, 1);
        hp.insert(w, hp.getWidgetCount());
    } else {
        //
        // special case; if first row doesn't have a label
        //
        tp.setWidget(row, 1, w);
    }
}

From source file:org.openelis.ui.screen.ReportScreen.java

License:Open Source License

/**
 * Places the specified widget after the label.
 *///  www  .  ja v a 2 s.co m
protected void addLabelAndWidget(Prompt p, FlexTable tp, Widget w) {
    int row;
    Label pr;
    HorizontalPanel hp;

    row = tp.getRowCount();
    //
    // add a label and widget if both are present
    //
    if (!DataBaseUtil.isEmpty(p.getPrompt())) {
        pr = new Label(p.getPrompt());
        pr.setStyleName(css.Prompt());
        tp.setWidget(row, 0, pr);
        hp = new HorizontalPanel();
        hp.add(w);
        tp.setWidget(row, 1, hp);
    } else if (row > 0) {
        //
        // add the widget to the previous row's list of widgets
        //
        hp = (HorizontalPanel) tp.getWidget(row - 1, 1);
        hp.insert(w, hp.getWidgetCount());
    } else {
        //
        // special case; if first row doesn't have a label
        //
        tp.setWidget(row, 1, w);
    }
}