Java Examples for com.google.gwt.user.client.ui.HorizontalPanel

The following java examples will help you to understand the usage of com.google.gwt.user.client.ui.HorizontalPanel. These source code samples are taken from different open source projects.

Example 1
Project: kunagi-master  File: BlockHeaderWidget.java View source code
@Override
protected Widget onInitialization() {
    dragHandleWrapper = new FocusPanel();
    dragHandleWrapper.setStyleName("BlockHeaderWidget-dragHandle");
    // dragHandleWrapper.setHeight("100%");
    centerText = Gwt.createInline(null);
    centerText.setStyleName("BlockHeaderWidget-center-text");
    centerWrapper = new FlowPanel();
    centerWrapper.setStyleName("BlockHeaderWidget-center");
    centerWrapper.setWidth("100%");
    centerWrapper.add(centerText);
    centerFocusPanel = new FocusPanel(centerWrapper);
    centerFocusPanel.setHeight("100%");
    table = new HorizontalPanel();
    table.setStyleName("BlockHeaderWidget");
    table.setWidth("100%");
    table.add(dragHandleWrapper);
    table.setCellWidth(dragHandleWrapper, "50px");
    table.add(centerFocusPanel);
    return table;
}
Example 2
Project: xapi-master  File: GwtcTest.java View source code
@Override
public void onModuleLoad() {
    DEFAULT.css().ensureInjected();
    GwtCompilerView view = new GwtCompilerView(DEFAULT);
    view.setWidth("350px");
    view.getElement().getStyle().setProperty("margin", "auto");
    HorizontalPanel wrapper = new HorizontalPanel();
    wrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    wrapper.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    wrapper.add(view);
    wrapper.setSize("100%", "100%");
    RootPanel.get().add(wrapper);
    ResizeHandler handler = new ResizeHandler() {

        @Override
        public void onResize(ResizeEvent event) {
            RootPanel.get().setSize(Window.getClientWidth() + "px", Window.getClientHeight() + "px");
        }
    };
    handler.onResize(null);
    Window.addResizeHandler(handler);
}
Example 3
Project: gwt4nb-master  File: MainEntryPoint.java View source code
/** 
     * The entry point method, called automatically by loading a module
     * that declares an implementing class as an entry-point
     */
public void onModuleLoad() {
    final TextBox text = new TextBox();
    final VerticalPanel messages = new VerticalPanel();
    final Button button = new Button("Add Message");
    final GWTServiceAsync s = GWT.create(GWTService.class);
    button.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            messages.add(new Label(text.getText()));
            s.addMessage(text.getText(), new AsyncCallback<Void>() {

                public void onFailure(Throwable caught) {
                    Window.alert("GWT service call error");
                }

                public void onSuccess(Void result) {
                }
            });
        }
    });
    HorizontalPanel hp = new HorizontalPanel();
    hp.add(new Label("Message:"));
    hp.add(text);
    hp.add(button);
    RootPanel.get().add(hp);
    RootPanel.get().add(messages);
    s.getMessages(new AsyncCallback<String[]>() {

        public void onFailure(Throwable caught) {
            Window.alert("GWT service call error");
        }

        public void onSuccess(String[] result) {
            messages.clear();
            for (String s : result) messages.add(new Label(s));
        }
    });
}
Example 4
Project: hexa.tools-master  File: BootstrapShowcase.java View source code
private void addButton(HorizontalPanel panel, String text, String style) {
    Button button = new Button(text);
    button.setStylePrimaryName(BootstrapHexaCss.CSS.btn());
    button.addStyleName(style);
    panel.add(button);
    button.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            Window.alert("I am a normal GWT Button !");
        }
    });
}
Example 5
Project: jcommerce-master  File: ValueSelector.java View source code
private DialogBox createDialogBox() {
    // Create a dialog box and set the caption text
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText(caption);
    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);
    dialogBox.setWidget(dialogContents);
    // Add some text to the top of the dialog
    HTML details = new HTML(message);
    dialogContents.add(details);
    final ListBox listAll = new ListBox();
    listAll.setWidth("15em");
    listAll.setVisibleItemCount(20);
    dialogContents.add(listAll);
    if (bean == null) {
        throw new RuntimeException("bean == null");
    }
    new ListService().listBeans(bean, new ListService.Listener() {

        public void onSuccess(List<BeanObject> beans) {
            for (Iterator it = beans.iterator(); it.hasNext(); ) {
                BeanObject data = (BeanObject) it.next();
                listAll.addItem((String) data.get("name"), data.get("id") + "");
            }
        }
    });
    HorizontalPanel holder = new HorizontalPanel();
    holder.setSpacing(20);
    // Add a close button at the bottom of the dialog
    Button btnOK = new Button("OK", new ClickListener() {

        public void onClick(Widget sender) {
            id = Long.valueOf(Utils.getSelectedValue(listAll));
            text.setText(Utils.getSelectedText(listAll));
            dialogBox.hide();
        }
    });
    holder.add(btnOK);
    Button btnCancel = new Button("Cancel", new ClickListener() {

        public void onClick(Widget sender) {
            dialogBox.hide();
        }
    });
    holder.add(btnCancel);
    dialogContents.add(holder);
    return dialogBox;
}
Example 6
Project: MVPGettingStarted-master  File: EditContactView.java View source code
private void initUi() {
    dialogEditBox = new DialogBox();
    saveButton = new Button("Save");
    cancelButton = new Button("Cancel");
    firstNameTextBox = new TextBox();
    lastNameTextBox = new TextBox();
    emailTextBox = new TextBox();
    mainPanel = new VerticalPanel();
    ;
    buttonsPanel = new HorizontalPanel();
    dialogEditBox.setText("Edit Contact");
    mainPanel.add(firstNameTextBox);
    mainPanel.add(lastNameTextBox);
    mainPanel.add(emailTextBox);
    buttonsPanel.add(saveButton);
    buttonsPanel.add(cancelButton);
    buttonsPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    mainPanel.add(buttonsPanel);
    dialogEditBox.add(mainPanel);
}
Example 7
Project: neighborhoodPSS-master  File: AddNetworkDlg.java View source code
public void draw() {
    VerticalPanel vp = new VerticalPanel();
    vp.add(new Label("network name"));
    vp.add(networkName_tb);
    HorizontalPanel checkBoxPanel = new HorizontalPanel();
    checkBoxPanel.add(new Label("building network"));
    checkBoxPanel.add(isBuilding_cb);
    vp.add(checkBoxPanel);
    vp.add(new Label("Choose color:"));
    vp.add(picker);
    HorizontalPanel buttonPanel = new HorizontalPanel();
    addNetworkBtn.addClickHandler(this);
    buttonPanel.add(addNetworkBtn);
    cancelBtn.addClickHandler(this);
    buttonPanel.add(cancelBtn);
    vp.add(buttonPanel);
    this.add(vp);
}
Example 8
Project: ovirt-engine-master  File: StoragesTree.java View source code
@Override
protected TreeItem getRootItem(StorageDomainModel storageDomainModel) {
    HorizontalPanel panel = new HorizontalPanel();
    panel.setSpacing(1);
    //$NON-NLS-1$
    panel.setWidth("100%");
    StorageDomain storage = storageDomainModel.getStorageDomain();
    //$NON-NLS-1$
    addItemToPanel(panel, new Image(resources.storageImage()), "25px");
    //$NON-NLS-1$
    addTextBoxToPanel(panel, new StringValueLabel(), storage.getStorageName(), "");
    //$NON-NLS-1$
    addValueLabelToPanel(panel, new EnumLabel<StorageDomainType>(), storage.getStorageDomainType(), "120px");
    //$NON-NLS-1$
    addValueLabelToPanel(panel, new EnumLabel<StorageDomainSharedStatus>(), storage.getStorageDomainSharedStatus(), "120px");
    //$NON-NLS-1$
    addValueLabelToPanel(panel, new DiskSizeLabel<Integer>(), storage.getAvailableDiskSize(), "120px");
    //$NON-NLS-1$
    addValueLabelToPanel(panel, new DiskSizeLabel<Integer>(), storage.getUsedDiskSize(), "120px");
    //$NON-NLS-1$
    addValueLabelToPanel(panel, new DiskSizeLabel<Integer>(), storage.getTotalDiskSize(), "90px");
    TreeItem treeItem = new TreeItem(panel);
    treeItem.setUserObject(storage.getId());
    return treeItem;
}
Example 9
Project: sonar-plugins-master  File: PageTab.java View source code
private FlowPanel createHeader(String url) {
    FlowPanel header = new FlowPanel();
    header.setStyleName("gwt-ViewerHeader");
    HorizontalPanel horizPanel = new HorizontalPanel();
    HTML html = new HTML("URL: ");
    html.setStyleName("metric");
    horizPanel.add(html);
    if (url != null) {
        FlowPanel cell = new FlowPanel();
        cell.setStyleName("value");
        Anchor anchor = new Anchor(url, url);
        cell.add(anchor);
        horizPanel.add(cell);
    }
    header.add(horizPanel);
    return header;
}
Example 10
Project: uberfire-master  File: DefaultScreenActivity.java View source code
private <A> Panel makeLinksInColumns(Collection<IOCBeanDef<A>> activityBeans) {
    List<IOCBeanDef<A>> sortedBeans = new ArrayList<IOCBeanDef<A>>(activityBeans);
    Collections.sort(sortedBeans, new Comparator<IOCBeanDef<A>>() {

        @Override
        public int compare(IOCBeanDef<A> o1, IOCBeanDef<A> o2) {
            return shortName(o1.getBeanClass()).compareTo(shortName(o2.getBeanClass()));
        }
    });
    final int colCount = 3;
    final int rowCount = (int) Math.ceil((double) sortedBeans.size() / (double) colCount);
    HorizontalPanel columns = new HorizontalPanel();
    columns.setSpacing(20);
    for (int c = 0; c < colCount; c++) {
        VerticalPanel col = new VerticalPanel();
        columns.add(col);
        for (int r = 0; r < rowCount; r++) {
            int index = r + (rowCount * c);
            if (index >= sortedBeans.size()) {
                break;
            }
            final IOCBeanDef<A> activityBean = sortedBeans.get(index);
            Anchor a = new Anchor(shortName(activityBean.getBeanClass()));
            a.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    placeManager.goTo(new DefaultPlaceRequest(activityBean.getBeanClass().getName()));
                }
            });
            col.add(a);
        }
    }
    return columns;
}
Example 11
Project: Bam-master  File: GoogleTableDisplayerView.java View source code
protected HorizontalPanel createTablePager() {
    HorizontalPanel pagerPanel = new HorizontalPanel();
    pagerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    pagerPanel.getElement().setAttribute("cellpadding", "5");
    Pagination pagination = new Pagination();
    pagination.setPaginationSize(PaginationSize.NONE);
    for (int i = leftMostPageNumber; i <= rightMostPageNumber; i++) {
        AnchorListItem pageLink = new AnchorListItem(Integer.toString(i));
        final Integer _currentPage = i;
        if (currentPage != i) {
            pageLink.setActive(false);
            pageLink.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {
                    getPresenter().gotoPage(_currentPage.intValue());
                }
            });
        } else {
            pageLink.setActive(true);
        }
        pagination.add(pageLink);
    }
    Icon leftPageIcon = new Icon(IconType.ANGLE_LEFT);
    leftPageIcon.setSize(IconSize.LARGE);
    leftPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    leftPageIcon.sinkEvents(Event.ONCLICK);
    leftPageIcon.addHandler(createGotoPageHandler(currentPage - 1), ClickEvent.getType());
    Tooltip leftPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoPreviousPage());
    leftPageTooltip.add(leftPageIcon);
    Icon rightPageIcon = new Icon(IconType.ANGLE_RIGHT);
    rightPageIcon.setSize(IconSize.LARGE);
    rightPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    rightPageIcon.sinkEvents(Event.ONCLICK);
    rightPageIcon.addHandler(createGotoPageHandler(currentPage + 1), ClickEvent.getType());
    Tooltip rightPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoNextPage());
    rightPageTooltip.add(rightPageIcon);
    Icon firstPageIcon = new Icon(IconType.ANGLE_DOUBLE_LEFT);
    firstPageIcon.setSize(IconSize.LARGE);
    firstPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    firstPageIcon.sinkEvents(Event.ONCLICK);
    firstPageIcon.addHandler(createGotoPageHandler(1), ClickEvent.getType());
    Tooltip firstPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoFirstPage());
    firstPageTooltip.add(firstPageIcon);
    Icon lastPageIcon = new Icon(IconType.ANGLE_DOUBLE_RIGHT);
    lastPageIcon.setSize(IconSize.LARGE);
    lastPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    lastPageIcon.sinkEvents(Event.ONCLICK);
    lastPageIcon.addHandler(createGotoPageHandler(totalPages), ClickEvent.getType());
    Tooltip lastPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoLastPage());
    lastPageTooltip.add(lastPageIcon);
    pagerPanel.add(firstPageTooltip);
    pagerPanel.add(leftPageTooltip);
    pagerPanel.add(pagination);
    pagerPanel.add(rightPageTooltip);
    pagerPanel.add(lastPageTooltip);
    if (totalPagesHintEnabled) {
        pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_pages(Integer.toString(leftMostPageNumber), Integer.toString(rightMostPageNumber), Integer.toString(totalPages))));
    }
    if (totalRowsHintEnabled) {
        int currentRowsShown = currentPage * pageSize > totalRows ? totalRows : currentPage * pageSize;
        pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_rows(Integer.toString(((currentPage - 1) * pageSize) + 1), Integer.toString(currentRowsShown), Integer.toString(totalRows))));
    }
    return pagerPanel;
}
Example 12
Project: cmestemp22-master  File: TabDragHandler.java View source code
/**
     * What happens when we're done drag and dropping.
     * 
     * @param event
     *            the event to fire on drag end.
     */
public void onDragEnd(final DragEndEvent event) {
    StartPageTab tab = (StartPageTab) event.getContext().draggable;
    HorizontalPanel dropPanel = (HorizontalPanel) event.getContext().finalDropController.getDropTarget();
    StartTabsModel.getInstance().reorder(new SetTabOrderRequest(TabGroupType.START, tab.getTab().getId(), new Integer(dropPanel.getWidgetIndex(tab))));
}
Example 13
Project: dashbuilder-master  File: GoogleTableDisplayerView.java View source code
protected HorizontalPanel createTablePager() {
    HorizontalPanel pagerPanel = new HorizontalPanel();
    pagerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    pagerPanel.getElement().setAttribute("cellpadding", "5");
    Pagination pagination = new Pagination();
    pagination.setPaginationSize(PaginationSize.NONE);
    for (int i = leftMostPageNumber; i <= rightMostPageNumber; i++) {
        AnchorListItem pageLink = new AnchorListItem(Integer.toString(i));
        final Integer _currentPage = i;
        if (currentPage != i) {
            pageLink.setActive(false);
            pageLink.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {
                    getPresenter().gotoPage(_currentPage.intValue());
                }
            });
        } else {
            pageLink.setActive(true);
        }
        pagination.add(pageLink);
    }
    Icon leftPageIcon = new Icon(IconType.ANGLE_LEFT);
    leftPageIcon.setSize(IconSize.LARGE);
    leftPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    leftPageIcon.sinkEvents(Event.ONCLICK);
    leftPageIcon.addHandler(createGotoPageHandler(currentPage - 1), ClickEvent.getType());
    Tooltip leftPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoPreviousPage());
    leftPageTooltip.add(leftPageIcon);
    Icon rightPageIcon = new Icon(IconType.ANGLE_RIGHT);
    rightPageIcon.setSize(IconSize.LARGE);
    rightPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    rightPageIcon.sinkEvents(Event.ONCLICK);
    rightPageIcon.addHandler(createGotoPageHandler(currentPage + 1), ClickEvent.getType());
    Tooltip rightPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoNextPage());
    rightPageTooltip.add(rightPageIcon);
    Icon firstPageIcon = new Icon(IconType.ANGLE_DOUBLE_LEFT);
    firstPageIcon.setSize(IconSize.LARGE);
    firstPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    firstPageIcon.sinkEvents(Event.ONCLICK);
    firstPageIcon.addHandler(createGotoPageHandler(1), ClickEvent.getType());
    Tooltip firstPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoFirstPage());
    firstPageTooltip.add(firstPageIcon);
    Icon lastPageIcon = new Icon(IconType.ANGLE_DOUBLE_RIGHT);
    lastPageIcon.setSize(IconSize.LARGE);
    lastPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    lastPageIcon.sinkEvents(Event.ONCLICK);
    lastPageIcon.addHandler(createGotoPageHandler(totalPages), ClickEvent.getType());
    Tooltip lastPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoLastPage());
    lastPageTooltip.add(lastPageIcon);
    pagerPanel.add(firstPageTooltip);
    pagerPanel.add(leftPageTooltip);
    pagerPanel.add(pagination);
    pagerPanel.add(rightPageTooltip);
    pagerPanel.add(lastPageTooltip);
    if (totalPagesHintEnabled) {
        pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_pages(Integer.toString(leftMostPageNumber), Integer.toString(rightMostPageNumber), Integer.toString(totalPages))));
    }
    if (totalRowsHintEnabled) {
        int currentRowsShown = currentPage * pageSize > totalRows ? totalRows : currentPage * pageSize;
        pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_rows(Integer.toString(((currentPage - 1) * pageSize) + 1), Integer.toString(currentRowsShown), Integer.toString(totalRows))));
    }
    return pagerPanel;
}
Example 14
Project: eurekastreams-master  File: TabDragHandler.java View source code
/**
     * What happens when we're done drag and dropping.
     * 
     * @param event
     *            the event to fire on drag end.
     */
public void onDragEnd(final DragEndEvent event) {
    StartPageTab tab = (StartPageTab) event.getContext().draggable;
    HorizontalPanel dropPanel = (HorizontalPanel) event.getContext().finalDropController.getDropTarget();
    StartTabsModel.getInstance().reorder(new SetTabOrderRequest(TabGroupType.START, tab.getTab().getId(), new Integer(dropPanel.getWidgetIndex(tab))));
}
Example 15
Project: example-projects-master  File: App.java View source code
@PostConstruct
public void buildUI() {
    button.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            // In GWT Dev Mode, Text written to System.out shows up in the
            // console where you launched Dev Mode (eg. in your terminal
            // window or in the Eclipse Console tab).
            // In Production Mode, System.out is a black hole.
            System.out.println("Handling click event!");
            fireMessage();
        }
    });
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.add(message);
    horizontalPanel.add(button);
    horizontalPanel.add(responseLabel);
    RootPanel.get().add(horizontalPanel);
    System.out.println("UI Constructed!");
}
Example 16
Project: exo-training-master  File: AdvancedFormsExample.java View source code
private void createColumnForm() {
    FramedPanel panel = new FramedPanel();
    panel.setHeadingText("Form Example");
    panel.setWidth(COLUMN_FORM_WIDTH);
    HtmlLayoutContainer con = new HtmlLayoutContainer(getTableMarkup());
    panel.setWidget(con);
    int cw = (COLUMN_FORM_WIDTH / 2) - 12;
    TextField firstName = new TextField();
    firstName.setAllowBlank(false);
    firstName.setWidth(cw);
    con.add(new FieldLabel(firstName, "First Name"), new HtmlData(".fn"));
    TextField lastName = new TextField();
    lastName.setAllowBlank(false);
    lastName.setWidth(cw);
    con.add(new FieldLabel(lastName, "Last Name"), new HtmlData(".ln"));
    TextField company = new TextField();
    company.setWidth(cw);
    con.add(new FieldLabel(company, "Company"), new HtmlData(".company"));
    TextField email = new TextField();
    email.setWidth(cw);
    con.add(new FieldLabel(email, "Email"), new HtmlData(".email"));
    DateField birthday = new DateField();
    birthday.setWidth(cw);
    con.add(new FieldLabel(birthday, "Birthday"), new HtmlData(".birthday"));
    Radio radio1 = new Radio();
    radio1.setBoxLabel("Yes");
    Radio radio2 = new Radio();
    radio2.setBoxLabel("No");
    HorizontalPanel hp = new HorizontalPanel();
    hp.add(radio1);
    hp.add(radio2);
    con.add(new FieldLabel(hp, "GXT User"), new HtmlData(".user"));
    ToggleGroup group = new ToggleGroup();
    group.add(radio1);
    group.add(radio2);
    HtmlEditor a = new HtmlEditor();
    a.setWidth(COLUMN_FORM_WIDTH - 25);
    con.add(new FieldLabel(a, "Comment"), new HtmlData(".editor"));
    panel.addButton(new TextButton("Cancel"));
    panel.addButton(new TextButton("Submit"));
    // need to call after everything is constructed
    List<FieldLabel> labels = FormPanelHelper.getFieldLabels(panel);
    for (FieldLabel lbl : labels) {
        lbl.setLabelAlign(LabelAlign.TOP);
    }
    vp.add(panel);
}
Example 17
Project: google-gin-master  File: DefaultGameDialogs.java View source code
public void show(String title) {
    final DialogBox box = new DialogBox();
    box.setAnimationEnabled(true);
    box.setText(title);
    // It's an higherlower, folks!
    box.setWidth("200px");
    VerticalPanel verticalPanel = new VerticalPanel();
    Button higher = new Button("Higher, higher!");
    higher.addStyleName("centered");
    higher.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            box.hide();
            gameHost.get().playerGuess(RelationshipToPreviousCard.HIGHER);
        }
    });
    verticalPanel.add(higher);
    Button lower = new Button("Down, boy!");
    lower.addStyleName("centered");
    lower.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            box.hide();
            gameHost.get().playerGuess(RelationshipToPreviousCard.LOWER);
        }
    });
    verticalPanel.add(lower);
    HorizontalPanel hp = new HorizontalPanel();
    hp.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    hp.add(verticalPanel);
    box.setWidget(hp);
    box.center();
    box.show();
}
Example 18
Project: google-web-toolkit-svnmirror-master  File: CwBasicText.java View source code
/**
   * Create a TextBox example that includes the text box and an optional handler
   * that updates a Label with the currently selected text.
   *
   * @param textBox the text box to handle
   * @param addSelection add handlers to update label
   * @return the Label that will be updated
   */
@ShowcaseSource
private HorizontalPanel createTextExample(final TextBoxBase textBox, boolean addSelection) {
    // Add the text box and label to a panel
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(4);
    hPanel.add(textBox);
    // Add handlers
    if (addSelection) {
        // Create the new label
        final Label label = new Label(constants.cwBasicTextSelected() + ": 0, 0");
        // Add a KeyUpHandler
        textBox.addKeyUpHandler(new KeyUpHandler() {

            public void onKeyUp(KeyUpEvent event) {
                updateSelectionLabel(textBox, label);
            }
        });
        // Add a ClickHandler
        textBox.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                updateSelectionLabel(textBox, label);
            }
        });
        // Add the label to the box
        hPanel.add(label);
    }
    // Return the panel
    return hPanel;
}
Example 19
Project: guvnor-master  File: GAVEditor.java View source code
public void onClick(ClickEvent event) {
    form.reset();
    HorizontalPanel fields = new HorizontalPanel();
    fields.add(getHiddenField(HTMLFileManagerFields.GROUP_ID, ""));
    fields.add(getHiddenField(HTMLFileManagerFields.ARTIFACT_ID, ""));
    fields.add(getHiddenField(HTMLFileManagerFields.VERSION_ID, ""));
    form.add(fields);
    form.submit();
}
Example 20
Project: GWT-Maps-V3-Api-master  File: TransitDirectionsServiceMapWidget.java View source code
private void draw() {
    pWidget.clear();
    pWidget.add(new HTML("<br/>"));
    HorizontalPanel hp = new HorizontalPanel();
    pWidget.add(hp);
    hp.add(new HTML("Transit Directions Service    "));
    hp.add(htmlStatus);
    drawMap();
    htmlSummary = new HTML();
    pWidget.add(htmlSummary);
    nRequests = 0;
    Timer directionsTimer = new Timer() {

        @Override
        public void run() {
            drawRandomDirections();
            /*
         * We do not want to make the client to be blacklisted by Google if its browser window is left open for too
         * long... :)
         */
            if (nRequests++ > 10)
                cancel();
        }
    };
    directionsTimer.scheduleRepeating(10000);
    drawRandomDirections();
}
Example 21
Project: gwt-master  File: CwCustomButton.java View source code
/**
   * Initialize this example.
   */
@ShowcaseSource
@Override
public Widget onInitialize() {
    // Create a panel to layout the widgets
    VerticalPanel vpanel = new VerticalPanel();
    HorizontalPanel pushPanel = new HorizontalPanel();
    pushPanel.setSpacing(10);
    HorizontalPanel togglePanel = new HorizontalPanel();
    togglePanel.setSpacing(10);
    // Combine all the panels
    vpanel.add(new HTML(constants.cwCustomButtonPush()));
    vpanel.add(pushPanel);
    vpanel.add(new HTML("<br><br>" + constants.cwCustomButtonToggle()));
    vpanel.add(togglePanel);
    // Add a normal PushButton
    PushButton normalPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    normalPushButton.ensureDebugId("cwCustomButton-push-normal");
    pushPanel.add(normalPushButton);
    // Add a disabled PushButton
    PushButton disabledPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    disabledPushButton.ensureDebugId("cwCustomButton-push-disabled");
    disabledPushButton.setEnabled(false);
    pushPanel.add(disabledPushButton);
    // Add a normal ToggleButton
    ToggleButton normalToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    normalToggleButton.ensureDebugId("cwCustomButton-toggle-normal");
    togglePanel.add(normalToggleButton);
    // Add a disabled ToggleButton
    ToggleButton disabledToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    disabledToggleButton.ensureDebugId("cwCustomButton-toggle-disabled");
    disabledToggleButton.setEnabled(false);
    togglePanel.add(disabledToggleButton);
    // Return the panel
    return vpanel;
}
Example 22
Project: gwt-sandbox-master  File: CwCustomButton.java View source code
/**
   * Initialize this example.
   */
@ShowcaseSource
@Override
public Widget onInitialize() {
    // Create a panel to layout the widgets
    VerticalPanel vpanel = new VerticalPanel();
    HorizontalPanel pushPanel = new HorizontalPanel();
    pushPanel.setSpacing(10);
    HorizontalPanel togglePanel = new HorizontalPanel();
    togglePanel.setSpacing(10);
    // Combine all the panels
    vpanel.add(new HTML(constants.cwCustomButtonPush()));
    vpanel.add(pushPanel);
    vpanel.add(new HTML("<br><br>" + constants.cwCustomButtonToggle()));
    vpanel.add(togglePanel);
    // Add a normal PushButton
    PushButton normalPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    normalPushButton.ensureDebugId("cwCustomButton-push-normal");
    pushPanel.add(normalPushButton);
    // Add a disabled PushButton
    PushButton disabledPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    disabledPushButton.ensureDebugId("cwCustomButton-push-disabled");
    disabledPushButton.setEnabled(false);
    pushPanel.add(disabledPushButton);
    // Add a normal ToggleButton
    ToggleButton normalToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    normalToggleButton.ensureDebugId("cwCustomButton-toggle-normal");
    togglePanel.add(normalToggleButton);
    // Add a disabled ToggleButton
    ToggleButton disabledToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    disabledToggleButton.ensureDebugId("cwCustomButton-toggle-disabled");
    disabledToggleButton.setEnabled(false);
    togglePanel.add(disabledToggleButton);
    // Return the panel
    return vpanel;
}
Example 23
Project: gwt-tictactoe-master  File: BrandingPage.java View source code
public void setCountry(String country) {
    String filteredName = country.replace(" ", "_");
    HTML smallTxt = new HTML("All text is available under the terms of the GNU Free Documentation License. " + "<p class='small'>Original content available at <u>en.wikipedia.org/wiki/" + filteredName + "</u></p>");
    smallTxt.setStyleName("ySmallTxt");
    ImageButton wikiBtn = new ImageButton(RES.wikiTxt());
    HorizontalPanel hp = new HorizontalPanel();
    hp.add(wikiBtn);
    hp.add(smallTxt);
    hp.setCellVerticalAlignment(smallTxt, HasVerticalAlignment.ALIGN_MIDDLE);
    hp.setCellVerticalAlignment(wikiBtn, HasVerticalAlignment.ALIGN_MIDDLE);
    setWidget(hp);
}
Example 24
Project: gwt.create2015-master  File: CwCustomButton.java View source code
/**
   * Initialize this example.
   */
@ShowcaseSource
@Override
public Widget onInitialize() {
    // Create a panel to layout the widgets
    VerticalPanel vpanel = new VerticalPanel();
    HorizontalPanel pushPanel = new HorizontalPanel();
    pushPanel.setSpacing(10);
    HorizontalPanel togglePanel = new HorizontalPanel();
    togglePanel.setSpacing(10);
    // Combine all the panels
    vpanel.add(new HTML(constants.cwCustomButtonPush()));
    vpanel.add(pushPanel);
    vpanel.add(new HTML("<br><br>" + constants.cwCustomButtonToggle()));
    vpanel.add(togglePanel);
    // Add a normal PushButton
    PushButton normalPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    normalPushButton.ensureDebugId("cwCustomButton-push-normal");
    pushPanel.add(normalPushButton);
    // Add a disabled PushButton
    PushButton disabledPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    disabledPushButton.ensureDebugId("cwCustomButton-push-disabled");
    disabledPushButton.setEnabled(false);
    pushPanel.add(disabledPushButton);
    // Add a normal ToggleButton
    ToggleButton normalToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    normalToggleButton.ensureDebugId("cwCustomButton-toggle-normal");
    togglePanel.add(normalToggleButton);
    // Add a disabled ToggleButton
    ToggleButton disabledToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    disabledToggleButton.ensureDebugId("cwCustomButton-toggle-disabled");
    disabledToggleButton.setEnabled(false);
    togglePanel.add(disabledToggleButton);
    // Return the panel
    return vpanel;
}
Example 25
Project: gwt.svn-master  File: CwCustomButton.java View source code
/**
   * Initialize this example.
   */
@ShowcaseSource
@Override
public Widget onInitialize() {
    // Create a panel to layout the widgets
    VerticalPanel vpanel = new VerticalPanel();
    HorizontalPanel pushPanel = new HorizontalPanel();
    pushPanel.setSpacing(10);
    HorizontalPanel togglePanel = new HorizontalPanel();
    togglePanel.setSpacing(10);
    // Combine all the panels
    vpanel.add(new HTML(constants.cwCustomButtonPush()));
    vpanel.add(pushPanel);
    vpanel.add(new HTML("<br><br>" + constants.cwCustomButtonToggle()));
    vpanel.add(togglePanel);
    // Add a normal PushButton
    PushButton normalPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    normalPushButton.ensureDebugId("cwCustomButton-push-normal");
    pushPanel.add(normalPushButton);
    // Add a disabled PushButton
    PushButton disabledPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    disabledPushButton.ensureDebugId("cwCustomButton-push-disabled");
    disabledPushButton.setEnabled(false);
    pushPanel.add(disabledPushButton);
    // Add a normal ToggleButton
    ToggleButton normalToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    normalToggleButton.ensureDebugId("cwCustomButton-toggle-normal");
    togglePanel.add(normalToggleButton);
    // Add a disabled ToggleButton
    ToggleButton disabledToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    disabledToggleButton.ensureDebugId("cwCustomButton-toggle-disabled");
    disabledToggleButton.setEnabled(false);
    togglePanel.add(disabledToggleButton);
    // Return the panel
    return vpanel;
}
Example 26
Project: iambookmaster-master  File: QuickAlchemyEditor.java View source code
@Override
public Widget getTail() {
    ChangeHandler changeHandler = new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            if (event.getSource() == from) {
                alchemy.setFrom(from.getSelectedParameter());
            } else if (event.getSource() == to) {
                alchemy.setTo(to.getSelectedParameter());
            } else if (event.getSource() == toValue) {
                alchemy.setToValue(toValue.getDiceValue());
            } else if (event.getSource() == fromValue) {
                alchemy.setFromValue(fromValue.getIntegerValue());
            } else if (event.getSource() == battleLimit) {
                alchemy.setBattleLimit(battleLimit.getSelectedParameter());
            }
            updateParameter(event.getSource());
        }
    };
    ClickHandler clickHandler = new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (event.getSource() == weapon) {
                alchemy.setWeapon(weapon.getValue());
            } else if (event.getSource() == onDemand) {
                alchemy.setOnDemand(onDemand.getValue());
            } else if (event.getSource() == battle) {
                alchemy.setPlace(battle.getSelectedIndex());
            } else if (event.getSource() == oneTimePerRound) {
                alchemy.setOneTimePerRound(oneTimePerRound.getValue());
            } else if (event.getSource() == overflowControl) {
                alchemy.setOverflowControl(overflowControl.getValue());
            }
            updateParameter(event.getSource());
        }
    };
    //from
    from = new SimpleAbstractParameterListBox<Parameter>(Parameter.class, model, false);
    from.addChangeHandler(changeHandler);
    from.setTitle(appConstants.alchemyFromTitle());
    addWidgetToGrid(from, appConstants.quickAlchemyFrom());
    //from Value
    fromValue = new NumberTextBox();
    fromValue.addChangeHandler(changeHandler);
    fromValue.setMaxLength(2);
    fromValue.setVisibleLength(3);
    fromValue.setRange(0, 99);
    addWidgetToGrid(fromValue, appConstants.quickAlchemyFromValue());
    //to
    to = new SimpleAbstractParameterListBox<Parameter>(Parameter.class, model, false);
    to.addChangeHandler(changeHandler);
    to.setTitle(appConstants.alchemyToTitle());
    addWidgetToGrid(to, appConstants.quickAlchemyTo());
    //to Value
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    toValue = new DiceValueWidget(horizontalPanel);
    addWidgetToGrid(horizontalPanel, appConstants.quickAlchemyToValue());
    //limit control
    overflowControl = new CheckBox();
    overflowControl.addClickHandler(clickHandler);
    if (model.getSettings().isOverflowControl()) {
        overflowControl.setTitle(appConstants.quickAlchemyNoOverflowControlTitle());
        addWidgetToGrid(overflowControl, appConstants.calculationNoOverflowControl());
    } else {
        overflowControl.setTitle(appConstants.quickAlchemyOverflowControlTitle());
        addWidgetToGrid(overflowControl, appConstants.calculationOverflowControl());
    }
    //battle
    battle = new ListBox();
    battle.addItem(appConstants.quickAlchemyPeace(), String.valueOf(Alchemy.PLACE_PEACE));
    battle.addItem(appConstants.quickAlchemyBattle(), String.valueOf(Alchemy.PLACE_BATTLE));
    battle.addItem(appConstants.quickAlchemyBoth(), String.valueOf(Alchemy.PLACE_BOTH));
    battle.addClickHandler(clickHandler);
    battle.setTitle(appConstants.quickAlchemyBattleTitle());
    addWidgetToGrid(battle, appConstants.quickAlchemyPlace());
    //on-demand
    onDemand = new CheckBox();
    onDemand.addClickHandler(clickHandler);
    onDemand.setTitle(appConstants.quickAlchemyOnDemandTitle());
    addWidgetToGrid(onDemand, appConstants.quickAlchemyOnDemand());
    //on-demand
    weapon = new CheckBox();
    weapon.addClickHandler(clickHandler);
    weapon.setTitle(appConstants.quickAlchemyWeapondTitle());
    addWidgetToGrid(weapon, appConstants.quickAlchemyWeapond());
    //limit in battle
    battleLimit = new SimpleAbstractParameterListBox<Parameter>(Parameter.class, model, true);
    battleLimit.addChangeHandler(changeHandler);
    battleLimit.setTitle(appConstants.alchemyBattleLimitTitle());
    addWidgetToGrid(battleLimit, appConstants.alchemyBattleLimit());
    //one time per round
    oneTimePerRound = new CheckBox();
    oneTimePerRound.addClickHandler(clickHandler);
    oneTimePerRound.setTitle(appConstants.quickAlchemyOneTimePerRoundTitle());
    addWidgetToGrid(oneTimePerRound, appConstants.quickAlchemyOneTimePerRound());
    return null;
}
Example 27
Project: kevoree-library-master  File: latexEditor.java View source code
/**
     * This is the entry point method.
     */
public void onModuleLoad() {
    fileExplorer = new latexEditorFileExplorer();
    VerticalPanel leftBar = new VerticalPanel();
    Button btCompile = new Button();
    btCompile.setText("Generate PDF");
    btCompile.setStyleName("btn");
    btCompile.addStyleName("primary");
    btCompile.addStyleName("small");
    btCompile.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            latexEditorRPC.callForCompile(fileExplorer);
        }
    });
    /*
        Button btSave = new Button();
        btSave.setText("Save");
        btSave.setStyleName("btn");
        btSave.addStyleName("primary");
        btSave.addStyleName("small");
        btSave.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                latexEditorRPC.callForSave(fileExplorer);
            }
        });*/
    Button btDefault = new Button();
    btDefault.setText("Set main file");
    btDefault.setStyleName("btn");
    btDefault.addStyleName("primary");
    btDefault.addStyleName("small");
    btDefault.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            fileExplorer.setSelectAsDefault();
        //latexEditorRPC.callForSave(fileExplorer);
        }
    });
    /*
        Button tooglePDF = new Button();
        tooglePDF.setText("PDF");
        tooglePDF.setStyleName("btn");
        tooglePDF.addStyleName("primary");
        final Frame pdfframe = new Frame("");
        final RootPanel pdfroot = RootPanel.get("pdfview");
        pdfroot.add(pdfframe);
        pdfroot.setVisible(false);

        tooglePDF.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                if (pdfroot.isVisible()) {
                    pdfroot.setVisible(false);
                } else {
                    pdfroot.setVisible(true);
                    pdfframe.setUrl("https://docs.google.com/gview?url=http://www.google.com/google-d-s/docsQuickstartGuide.pdf&chrome=true");
                    pdfframe.setSize("400px","100%");
                }
            }
        });
*/
    HorizontalPanel bts = new HorizontalPanel();
    bts.setBorderWidth(0);
    bts.add(btCompile);
    bts.add(btDefault);
    // bts.add(btSave);
    leftBar.add(bts);
    ScrollPanelWrapper scrollP = new ScrollPanelWrapper(fileExplorer);
    leftBar.add(scrollP);
    RootPanel.get("files").add(leftBar);
}
Example 28
Project: MavenOneCMDB-master  File: SelectCIPopup.java View source code
/*
	public SelectCIPopup(String header, String type) {
		this(header, new SelectInheritanceDataSourceControl(type));
	}
	*/
protected void load() {
    VerticalPanel panel = new VerticalPanel();
    HorizontalPanel header = new HorizontalPanel();
    header.setStyleName("one-select-popup-header");
    header.setWidth("100%");
    Label headerLabel = new Label(headerText);
    Image close = new Image("images/eclipse/close.gif");
    header.add(headerLabel);
    if (control instanceof SelectMultipleDataSourceControl) {
        HTML submit = new HTML("[<a href='javascript:;'>save</a>]");
        submit.setStyleName("one-submit-label");
        submit.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                control.getSelectListener().onSelect(((SelectMultipleDataSourceControl) control).getSelection());
            }
        });
        header.add(submit);
        header.setCellHorizontalAlignment(submit, HorizontalPanel.ALIGN_RIGHT);
    }
    header.add(close);
    header.setCellHorizontalAlignment(headerLabel, HorizontalPanel.ALIGN_LEFT);
    header.setCellHorizontalAlignment(close, HorizontalPanel.ALIGN_RIGHT);
    header.setCellVerticalAlignment(close, HorizontalPanel.ALIGN_MIDDLE);
    // Add drag control.
    new DragControl(this, headerLabel);
    close.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            hide();
        }
    });
    setStyleName("one-select-popup");
    control.setRootState(true);
    CITreeWidget templateTreeWidget = new CITreeWidget(control);
    templateTreeWidget.setSize("100%", "100%");
    ScrollPanel content = new ScrollPanel(templateTreeWidget);
    content.setHeight("300px");
    panel.add(header);
    panel.add(content);
    //panel.setCellVerticalAlignment(header, VerticalPanel.ALIGN_TOP);
    panel.setCellHeight(content, "100%");
    panel.setCellWidth(content, "100%");
    panel.setCellVerticalAlignment(content, VerticalPanel.ALIGN_TOP);
    setWidget(panel);
}
Example 29
Project: motiver_fi-master  File: PermissionsSelectView.java View source code
@Override
public Widget asWidget() {
    Text textDesc = new Text(AppController.Lang.PermissionsDesc());
    textDesc.setStyleName("label-form-desc");
    this.add(textDesc, new RowData(-1, -1, new Margins(10, 10, 0, 10)));
    //search widget
    final TextField<String> tfSearch = new TextField<String>();
    tfSearch.setAllowBlank(true);
    tfSearch.setAutoValidate(true);
    tfSearch.setMinLength(Constants.LIMIT_MIN_QUERY_WORD);
    CommonUtils.setWarningMessages(tfSearch);
    tfSearch.setWidth("775px");
    tfSearch.setEmptyText(AppController.Lang.SearchUsers());
    tfSearch.addListener(Events.Valid, new Listener<BaseEvent>() {

        @Override
        public void handleEvent(BaseEvent be) {
            if (!queryLast.equals(tfSearch.getValue())) {
                handler.onUserSearch(tfSearch.getValue());
            }
        }
    });
    this.add(tfSearch, new RowData(-1, -1, new Margins(10)));
    //search results
    panelUsers.setStyleAttribute("min-height", "100px");
    TableLayout tl = new TableLayout(4);
    tl.setCellPadding(5);
    tl.setCellHorizontalAlign(HorizontalAlignment.CENTER);
    panelUsers.setLayout(tl);
    this.add(panelUsers, new RowData(-1, -1, new Margins(10)));
    //permission boxes
    HorizontalPanel p1 = new HorizontalPanel();
    p1.setSpacing(10);
    p1.add(panelPermissionTraining);
    p1.add(panelPermissionNutrition);
    p1.add(panelPermissionNutritionFoods);
    p1.setCellWidth(panelPermissionTraining, "33%");
    p1.setCellWidth(panelPermissionNutrition, "33%");
    p1.setCellWidth(panelPermissionNutritionFoods, "33%");
    this.add(p1);
    HorizontalPanel p2 = new HorizontalPanel();
    p2.setSpacing(10);
    p2.add(panelPermissionCardio);
    p2.add(panelPermissionMeasurements);
    p2.add(panelPermissionCoach);
    p2.setCellWidth(panelPermissionCardio, "33%");
    p2.setCellWidth(panelPermissionMeasurements, "33%");
    p2.setCellWidth(panelPermissionCoach, "33%");
    this.add(p2);
    return this;
}
Example 30
Project: OneSwarm-master  File: FileBrowser.java View source code
private void createPopup() {
    openItems = new LinkedList<FileTreeItem>();
    final Tree fileTree = new Tree();
    growTree(fileTree, "");
    fileTree.addOpenHandler(new OpenHandler<TreeItem>() {

        public void onOpen(OpenEvent<TreeItem> event) {
            FileTreeItem item = (FileTreeItem) event.getTarget();
            if (item.isDirectory()) {
                if (!item.hasBeenExpanded) {
                    growTree(item);
                }
            }
            closeItems(item.filePath());
            openItems.add(item);
        }
    });
    Button selectButton = new Button(msg.file_browser_button_select());
    selectButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            FileTreeItem item = (FileTreeItem) fileTree.getSelectedItem();
            if (item.fileStatus() == FileInfo.FileStatusFlag.NO_READ_PERMISSION)
                new ReportableErrorDialogBox(msg.file_browser_error_permission_denied(), false).show();
            else if (!directoryOk && item.isDirectory())
                new ReportableErrorDialogBox(msg.file_browser_error_directory_selected(), false).show();
            else {
                callback.onSuccess(item.filePath());
                popup.hide();
            }
        }
    });
    Button closeButton = new Button(msg.file_browser_button_cancel());
    closeButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            callback.onFailure(new Exception("No file Selected"));
            popup.hide();
        }
    });
    HorizontalPanel footer = new HorizontalPanel();
    footer.add(closeButton);
    footer.add(selectButton);
    ScrollPanel scrollArea = new ScrollPanel(fileTree);
    scrollArea.setHeight("400px");
    scrollArea.setWidth("450px");
    VerticalPanel contents = new VerticalPanel();
    contents.add(scrollArea);
    contents.add(footer);
    popup = new PopupPanel(false);
    popup.setStylePrimaryName("fileBrowserPopup");
    popup.setStyleName("gwt-DialogBox", true);
    popup.setStyleName("Top", true);
    popup.setGlassEnabled(true);
    popup.setTitle(msg.file_browser_title());
    popup.setWidget(contents);
}
Example 31
Project: Peergos-master  File: CwCustomButton.java View source code
/**
   * Initialize this example.
   */
@ShowcaseSource
@Override
public Widget onInitialize() {
    // Create a panel to layout the widgets
    VerticalPanel vpanel = new VerticalPanel();
    HorizontalPanel pushPanel = new HorizontalPanel();
    pushPanel.setSpacing(10);
    HorizontalPanel togglePanel = new HorizontalPanel();
    togglePanel.setSpacing(10);
    // Combine all the panels
    vpanel.add(new HTML(constants.cwCustomButtonPush()));
    vpanel.add(pushPanel);
    vpanel.add(new HTML("<br><br>" + constants.cwCustomButtonToggle()));
    vpanel.add(togglePanel);
    // Add a normal PushButton
    PushButton normalPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    normalPushButton.ensureDebugId("cwCustomButton-push-normal");
    pushPanel.add(normalPushButton);
    // Add a disabled PushButton
    PushButton disabledPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    disabledPushButton.ensureDebugId("cwCustomButton-push-disabled");
    disabledPushButton.setEnabled(false);
    pushPanel.add(disabledPushButton);
    // Add a normal ToggleButton
    ToggleButton normalToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    normalToggleButton.ensureDebugId("cwCustomButton-toggle-normal");
    togglePanel.add(normalToggleButton);
    // Add a disabled ToggleButton
    ToggleButton disabledToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    disabledToggleButton.ensureDebugId("cwCustomButton-toggle-disabled");
    disabledToggleButton.setEnabled(false);
    togglePanel.add(disabledToggleButton);
    // Return the panel
    return vpanel;
}
Example 32
Project: QMAClone-master  File: PanelMatching.java View source code
public void setPlayerList(List<PacketMatchingPlayer> players) {
    final VerticalPanel verticalPanel = new VerticalPanel();
    for (PacketMatchingPlayer player : players) {
        final HorizontalPanel horizontalPanel = new HorizontalPanel();
        horizontalPanel.setVerticalAlignment(ALIGN_MIDDLE);
        final Image image = new Image(Constant.ICON_URL_PREFIX + player.imageFileName);
        image.setPixelSize(Constant.ICON_SIZE, Constant.ICON_SIZE);
        horizontalPanel.add(image);
        final HTML html = new HTML(player.playerSummary.asSafeHtml());
        if (player.isRequestSkip) {
            html.addStyleDependentName("matchingSkip");
        }
        horizontalPanel.add(html);
        verticalPanel.add(horizontalPanel);
    }
    gridPanel.setWidget(verticalPanel);
}
Example 33
Project: rstudio-master  File: NewDirectoryPage.java View source code
@Override
protected void onAddWidgets() {
    NewProjectResources.Styles styles = NewProjectResources.INSTANCE.styles();
    HorizontalPanel panel = new HorizontalPanel();
    panel.addStyleName(styles.wizardMainColumn());
    // create the dir name label
    dirNameLabel_ = new Label("Directory name:");
    dirNameLabel_.addStyleName(styles.wizardTextEntryLabel());
    // top panel widgets
    onAddTopPanelWidgets(panel);
    // dir name
    VerticalPanel namePanel = new VerticalPanel();
    namePanel.addStyleName(styles.newProjectDirectoryName());
    namePanel.add(dirNameLabel_);
    txtProjectName_ = new TextBox();
    txtProjectName_.setWidth("100%");
    txtProjectName_.getElement().setAttribute("spellcheck", "false");
    namePanel.add(txtProjectName_);
    panel.add(namePanel);
    addWidget(panel);
    onAddBodyWidgets();
    addSpacer();
    // project dir
    newProjectParent_ = new DirectoryChooserTextBox("Create project as subdirectory of:", txtProjectName_);
    addWidget(newProjectParent_);
    // if git is available then add git init
    UIPrefs uiPrefs = RStudioGinjector.INSTANCE.getUIPrefs();
    SessionInfo sessionInfo = RStudioGinjector.INSTANCE.getSession().getSessionInfo();
    HorizontalPanel optionsPanel = null;
    if (getOptionsSideBySide())
        optionsPanel = new HorizontalPanel();
    chkGitInit_ = new CheckBox("Create a git repository");
    chkGitInit_.addStyleName(styles.wizardCheckbox());
    if (sessionInfo.isVcsAvailable(VCSConstants.GIT_ID)) {
        chkGitInit_.setValue(uiPrefs.newProjGitInit().getValue());
        chkGitInit_.getElement().getStyle().setMarginRight(7, Unit.PX);
        if (optionsPanel != null) {
            optionsPanel.add(chkGitInit_);
        } else {
            addSpacer();
            addWidget(chkGitInit_);
        }
    }
    // Initialize project with packrat
    chkPackratInit_ = new CheckBox("Use packrat with this project");
    chkPackratInit_.setValue(uiPrefs.newProjUsePackrat().getValue());
    if (!sessionInfo.getPackratAvailable()) {
        chkPackratInit_.setValue(false);
        chkPackratInit_.setVisible(false);
    }
    if (optionsPanel != null) {
        optionsPanel.add(chkPackratInit_);
    } else {
        addSpacer();
        addWidget(chkPackratInit_);
    }
    if (optionsPanel != null) {
        addSpacer();
        addWidget(optionsPanel);
    }
}
Example 34
Project: scalagwt-gwt-master  File: CwCustomButton.java View source code
/**
   * Initialize this example.
   */
@ShowcaseSource
@Override
public Widget onInitialize() {
    // Create a panel to layout the widgets
    VerticalPanel vpanel = new VerticalPanel();
    HorizontalPanel pushPanel = new HorizontalPanel();
    pushPanel.setSpacing(10);
    HorizontalPanel togglePanel = new HorizontalPanel();
    togglePanel.setSpacing(10);
    // Combine all the panels
    vpanel.add(new HTML(constants.cwCustomButtonPush()));
    vpanel.add(pushPanel);
    vpanel.add(new HTML("<br><br>" + constants.cwCustomButtonToggle()));
    vpanel.add(togglePanel);
    // Add a normal PushButton
    PushButton normalPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    normalPushButton.ensureDebugId("cwCustomButton-push-normal");
    pushPanel.add(normalPushButton);
    // Add a disabled PushButton
    PushButton disabledPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    disabledPushButton.ensureDebugId("cwCustomButton-push-disabled");
    disabledPushButton.setEnabled(false);
    pushPanel.add(disabledPushButton);
    // Add a normal ToggleButton
    ToggleButton normalToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    normalToggleButton.ensureDebugId("cwCustomButton-toggle-normal");
    togglePanel.add(normalToggleButton);
    // Add a disabled ToggleButton
    ToggleButton disabledToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    disabledToggleButton.ensureDebugId("cwCustomButton-toggle-disabled");
    disabledToggleButton.setEnabled(false);
    togglePanel.add(disabledToggleButton);
    // Return the panel
    return vpanel;
}
Example 35
Project: sim-visualization-liferay-portlets-master  File: Vis_toolbar.java View source code
/**
	 * The message displayed to the user when the server cannot be reached or
	 * returns an error.
	 */
/**
	 * This is the entry point method.
	 */
public void onModuleLoad() {
    HorizontalPanel datePanel = new HorizontalPanel();
    HorizontalPanel ledsPanel = new HorizontalPanel();
    HorizontalPanel mainPanel = new HorizontalPanel();
    LarkcLeds leds = new LarkcLeds(ledsPanel);
    leds.getPlatformRunning();
    final LarkcDatePicker ldp = new LarkcDatePicker(datePanel);
    final Button refresh = new Button("refresh");
    final JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
    refresh.setStyleName("display:block; font-size: 16px;");
    refresh.setLayoutData("http://users.utcluj.ro/~negrum/images/gray_led.png");
    refresh.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            /*Date startDate = ldp.getStartDate();
				Date endDate = ldp.getEndDate();
				String lBoxText =ldp.getListBoxText(); 
				*/
            ldp.checkDataErrorsAndUpdate();
            String url = URL.encode("http://localhost:8080/vis-toolbar-portlet/ToolbarServlet");
            url += "?StartDate=" + ldp.getStartDate();
            url += "&EndDate=" + ldp.getEndDate();
            //System.out.println(url);
            jsonp.requestObject(url, new AsyncCallback<MetricEntries>() {

                public void onFailure(Throwable caught) {
                    GWT.log("Error: " + caught);
                    Window.Location.reload();
                }

                public void onSuccess(MetricEntries result) {
                    Window.Location.reload();
                }
            });
        }
    });
    mainPanel.setSpacing(5);
    mainPanel.setStyleName("padding:5px;");
    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
    mainPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setStyleName("background-color:#FFFFFF;");
    mainPanel.add(ledsPanel);
    mainPanel.add(datePanel);
    mainPanel.add(refresh);
    RootPanel.get("vis-toolbar").add(mainPanel);
}
Example 36
Project: socom-master  File: LoginPanel.java View source code
private void buildLoginArea() {
    HorizontalPanel manualLoginUid = new HorizontalPanel();
    add(manualLoginUid);
    Label lblUserId = new Label("User ID");
    manualLoginUid.add(lblUserId);
    uidBox = new LongBox();
    manualLoginUid.add(uidBox);
    HorizontalPanel manualLoginPassword = new HorizontalPanel();
    add(manualLoginPassword);
    Label lblSecret = new Label("Password");
    manualLoginPassword.add(lblSecret);
    passwordBox = new TextBox();
    manualLoginPassword.add(passwordBox);
    loginButton = new Button("Login");
    add(loginButton);
    loginFBButton = new Button("Login with Facebook");
    add(loginFBButton);
    initLoginListeners();
}
Example 37
Project: test-analytics-master  File: ProjectDataViewImpl.java View source code
public void displayData(List<UploadedDatum> data) {
    if (data.size() == 0) {
        dataSummary.setText("No items have been uploaded.");
        return;
    }
    UploadedDatum firstItem = data.get(0);
    dataSummary.setText("Showing " + Integer.toString(data.size()) + " " + firstItem.getDatumType().getPlural());
    dataGrid.clear();
    // Header row + one for each bug x datum, Attribute, Component, Capability
    dataGrid.resize(data.size() + 1, 4);
    // Set grid headers.
    dataGrid.setWidget(0, 0, new Label(firstItem.getDatumType().getPlural()));
    dataGrid.setWidget(0, 1, new Label("Attribute"));
    dataGrid.setWidget(0, 2, new Label("Component"));
    dataGrid.setWidget(0, 3, new Label("Capability"));
    dataGrid.getWidget(0, 0).addStyleName(GRID_HEADER_CSS_STYLE);
    dataGrid.getWidget(0, 1).addStyleName(GRID_HEADER_CSS_STYLE);
    dataGrid.getWidget(0, 2).addStyleName(GRID_HEADER_CSS_STYLE);
    dataGrid.getWidget(0, 3).addStyleName(GRID_HEADER_CSS_STYLE);
    // Fill with data.
    for (int i = 0; i < data.size(); i++) {
        UploadedDatum datum = data.get(i);
        String host = LinkUtil.getLinkHost(datum.getLinkUrl());
        Widget description;
        if (host != null) {
            HorizontalPanel panel = new HorizontalPanel();
            Anchor anchor = new Anchor(datum.getLinkText(), datum.getLinkUrl());
            anchor.setTarget("_blank");
            Label hostLabel = new Label(host);
            panel.add(anchor);
            panel.add(hostLabel);
            description = panel;
        } else {
            description = new Label(datum.getLinkText() + " [" + datum.getLinkUrl() + "]");
        }
        description.addStyleName(GRID_CELL_CSS_STYLE);
        description.setTitle(datum.getToolTip());
        dataGrid.setWidget(i + 1, 0, description);
        // Display images indicating whether or not the datum is associated with project artifacts.
        // For example, a Bug may be associated with a Component or a Testcase might validate scenarios
        // for a given Attribute. The user can associate data with project artifacts using SuperLabels.
        dataGrid.setWidget(i + 1, 1, (datum.isAttachedToAttribute()) ? getX() : getCheckmark());
        dataGrid.setWidget(i + 1, 2, (datum.isAttachedToComponent()) ? getX() : getCheckmark());
        dataGrid.setWidget(i + 1, 3, (datum.isAttachedToCapability()) ? getX() : getCheckmark());
    }
}
Example 38
Project: test-analytics-ng-master  File: ProjectDataViewImpl.java View source code
public void displayData(List<UploadedDatum> data) {
    if (data.size() == 0) {
        dataSummary.setText("No items have been uploaded.");
        return;
    }
    UploadedDatum firstItem = data.get(0);
    dataSummary.setText("Showing " + Integer.toString(data.size()) + " " + firstItem.getDatumType().getPlural());
    dataGrid.clear();
    // Header row + one for each bug x datum, Attribute, Component, Capability
    dataGrid.resize(data.size() + 1, 4);
    // Set grid headers.
    dataGrid.setWidget(0, 0, new Label(firstItem.getDatumType().getPlural()));
    dataGrid.setWidget(0, 1, new Label("Attribute"));
    dataGrid.setWidget(0, 2, new Label("Component"));
    dataGrid.setWidget(0, 3, new Label("Capability"));
    dataGrid.getWidget(0, 0).addStyleName(GRID_HEADER_CSS_STYLE);
    dataGrid.getWidget(0, 1).addStyleName(GRID_HEADER_CSS_STYLE);
    dataGrid.getWidget(0, 2).addStyleName(GRID_HEADER_CSS_STYLE);
    dataGrid.getWidget(0, 3).addStyleName(GRID_HEADER_CSS_STYLE);
    // Fill with data.
    for (int i = 0; i < data.size(); i++) {
        UploadedDatum datum = data.get(i);
        String host = LinkUtil.getLinkHost(datum.getLinkUrl());
        Widget description;
        if (host != null) {
            HorizontalPanel panel = new HorizontalPanel();
            Anchor anchor = new Anchor(datum.getLinkText(), datum.getLinkUrl());
            anchor.setTarget("_blank");
            Label hostLabel = new Label(host);
            panel.add(anchor);
            panel.add(hostLabel);
            description = panel;
        } else {
            description = new Label(datum.getLinkText() + " [" + datum.getLinkUrl() + "]");
        }
        description.addStyleName(GRID_CELL_CSS_STYLE);
        description.setTitle(datum.getToolTip());
        dataGrid.setWidget(i + 1, 0, description);
        // Display images indicating whether or not the datum is associated with project artifacts.
        // For example, a Bug may be associated with a Component or a Testcase might validate scenarios
        // for a given Attribute. The user can associate data with project artifacts using SuperLabels.
        dataGrid.setWidget(i + 1, 1, (datum.isAttachedToAttribute()) ? getX() : getCheckmark());
        dataGrid.setWidget(i + 1, 2, (datum.isAttachedToComponent()) ? getX() : getCheckmark());
        dataGrid.setWidget(i + 1, 3, (datum.isAttachedToCapability()) ? getX() : getCheckmark());
    }
}
Example 39
Project: tocollege.net-master  File: HDatePicker.java View source code
// @Override
protected void showCalendar() {
    calendarPopup.show();
    if (align == HorizontalPanel.ALIGN_RIGHT) {
        // getAbsoluteLeft() is broken in FF for things in our
        // gadgetDisplayer
        // seems to be a known problem, but no good fix. Even FireBug
        // says that the
        // left position is 450px, which is totally wrong.
        //
        // found native method below on forum, but it returns the same
        // thing
        //
        // int left = this.getAbsoluteLeft() - WIDTH;
        int left = Window.getClientWidth() - WIDTH;
        // make sure it doesn't go too low
        int top = this.getAbsoluteTop() + this.getOffsetHeight() + 4;
        top = (Window.getClientHeight() - top > 400) ? top : Window.getClientHeight() - 400;
        calendarPopup.setPopupPosition(left, top);
        Log.debug("SHOW RIGHT " + (this.getAbsoluteLeft() - WIDTH) + " " + (this.getAbsoluteTop() + this.getOffsetHeight() + 4));
        // Logger.log("SHOW RIGHT "+getAbsoluteLeft(getElement())+"
        // FIX "+getAbsoluteLeftFix(getElement()));
        calendarPopup.setHeight(120 + "px");
        calendarPopup.setWidth(165 + "px");
        calendarPopup.setStyleName("date_popupPanel");
    } else {
        calendarPopup.setPopupPosition(this.getAbsoluteLeft(), this.getAbsoluteTop() + this.getOffsetHeight() + 4);
        calendarPopup.setHeight(120 + "px");
        calendarPopup.setWidth(165 + "px");
        calendarPopup.setStyleName("date_popupPanel");
    }
}
Example 40
Project: XACML-Policy-Analysis-Tool-master  File: CwBasicText.java View source code
/**
   * Create a TextBox example that includes the text box and an optional
   * listener that updates a Label with the currently selected text.
   * 
   * @param textBox the text box to listen to
   * @param addSelection add listeners to update label
   * @return the Label that will be updated
   */
@ShowcaseSource
private HorizontalPanel createTextExample(final TextBoxBase textBox, boolean addSelection) {
    // Add the text box and label to a panel
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(4);
    hPanel.add(textBox);
    // Add listeners
    if (addSelection) {
        // Create the new label
        final Label label = new Label(constants.cwBasicTextSelected() + ": 0, 0");
        // Add a KeyboardListener
        textBox.addKeyboardListener(new KeyboardListenerAdapter() {

            @Override
            public void onKeyUp(Widget sender, char keyCode, int modifiers) {
                updateSelectionLabel(textBox, label);
            }
        });
        // Add a ClickListener
        textBox.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                updateSelectionLabel(textBox, label);
            }
        });
        // Add the label to the box
        hPanel.add(label);
    }
    // Return the panel
    return hPanel;
}
Example 41
Project: balas-master  File: EditUserDialog.java View source code
/**
	 * Creates the gui.
	 * 
	 */
private void createGUI() {
    if (editlogin == null) {
        setText(M.users.menuAddUser());
    } else {
        setText(M.users.titleEditUser());
    }
    setAnimationEnabled(true);
    setGlassEnabled(true);
    String addText = M.users.btnAdd();
    if (editlogin != null) {
        addText = M.users.btnUpdate();
    }
    Button btnAdd = new Button(addText);
    btnAdd.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (editlogin == null) {
                createUser();
            } else {
                updateUser();
            }
        }
    });
    Button btnCancel = new Button(M.users.btnCancel());
    btnCancel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            EditUserDialog.this.hide();
        }
    });
    VerticalPanel vpanel = new VerticalPanel();
    // vpanel.setWidth("400px");
    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);
    layout.setHTML(0, 0, M.users.fullName());
    name = new TextBox();
    name.setText(user.getUsername());
    layout.setWidget(0, 1, name);
    layout.setHTML(1, 0, M.users.login());
    login = new TextBox();
    login.setText(user.getLogin());
    if (editlogin != null) {
        login.setReadOnly(true);
    }
    layout.setWidget(1, 1, login);
    layout.setHTML(2, 0, M.users.password());
    password = new TextBox();
    password.setText("");
    layout.setWidget(2, 1, password);
    layout.setHTML(3, 0, M.users.isactive());
    isactive = new CheckBox();
    isactive.setValue(user.isActive());
    layout.setWidget(3, 1, isactive);
    layout.setHTML(4, 0, M.users.access());
    UserRole role = user.getUserrole();
    FlexTable access = new FlexTable();
    access.setCellSpacing(6);
    access.setHTML(0, 0, M.users.isadmin());
    isadmin = new CheckBox();
    isadmin.setValue(role.isAdmin());
    access.setWidget(0, 1, isadmin);
    access.setHTML(1, 0, M.users.isdocuments());
    isdocuments = new CheckBox();
    isdocuments.setValue(role.isDocuments());
    access.setWidget(1, 1, isdocuments);
    access.setHTML(2, 0, M.users.isfinances());
    isfinances = new CheckBox();
    isfinances.setValue(role.isFinances());
    access.setWidget(2, 1, isfinances);
    access.setHTML(3, 0, M.users.ismanager());
    ismanager = new CheckBox();
    ismanager.setValue(role.isManager());
    access.setWidget(3, 1, ismanager);
    layout.setWidget(4, 1, access);
    vpanel.add(layout);
    HorizontalPanel buttons = new HorizontalPanel();
    buttons.setWidth("100%");
    buttons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    HorizontalPanel bcontainer = new HorizontalPanel();
    bcontainer.add(btnAdd);
    bcontainer.add(btnCancel);
    bcontainer.setSpacing(5);
    buttons.add(bcontainer);
    vpanel.add(buttons);
    setWidget(vpanel);
    /*
		 * setPopupPosition( (Ballance_autosauler_net.mainpanel.getOffsetWidth()
		 * / 2 - 200), 100);
		 */
    show();
}
Example 42
Project: ballroom-master  File: ListBoxItemTest.java View source code
@Test
public void testListBoxItem() {
    ListBoxItem lbi = new ListBoxItem("listbox", "List Box");
    assertEquals("listbox", lbi.getName());
    assertEquals("List Box", lbi.getTitle());
    HorizontalPanel panel = (HorizontalPanel) lbi.asWidget();
    ListBox listBox = findListBox(panel);
    assertEquals(0, listBox.getItemCount());
    lbi.setChoices(Arrays.asList("b", "a"), null);
    assertEquals(2, listBox.getItemCount());
    assertEquals("a", listBox.getItemText(0));
    assertEquals("b", listBox.getItemText(1));
    assertNull(lbi.getValue());
    try {
        lbi.setValue("c");
        fail("Should have thrown an exception as 'c' is not one of the listbox values");
    } catch (IllegalStateException ise) {
    }
    assertNull(lbi.getValue());
    lbi.setValue("b");
    assertEquals("b", lbi.getValue());
    listBox.setSelectedIndex(0);
    assertEquals("a", lbi.getValue());
    lbi.setChoices(Collections.singleton("d"), "d");
    assertEquals(1, listBox.getItemCount());
    assertEquals("d", listBox.getItemText(0));
    assertEquals("d", lbi.getValue());
}
Example 43
Project: bi-platform-v2-master  File: UserPreferencesDialog.java View source code
public void init() {
    //$NON-NLS-1$
    preferencesPanelMap.put(Messages.getString("repository"), new RepositoryPanel());
    HorizontalPanel content = (HorizontalPanel) getContent();
    content.setSpacing(10);
    content.add(preferencesList);
    content.add(preferencesContent);
    preferencesList.setVisibleItemCount(10);
    //$NON-NLS-1$
    preferencesList.setWidth("120px");
    for (String key : preferencesPanelMap.keySet()) {
        preferencesList.addItem(key);
    }
    // preferencesList.addItem("Favorites");
    preferencesList.addChangeHandler(this);
    for (int i = 0; i < preferencesList.getItemCount(); i++) {
        String item = preferencesList.getItemText(i);
        if (initialSelectedPreference.equals(PREFERENCE.STYLES) && item.equalsIgnoreCase(Messages.getString("styles"))) {
            //$NON-NLS-1$
            preferencesList.setSelectedIndex(i);
        } else if (initialSelectedPreference.equals(PREFERENCE.REPOSITORY) && item.equalsIgnoreCase(Messages.getString("repository"))) {
            //$NON-NLS-1$
            preferencesList.setSelectedIndex(i);
        } else if (initialSelectedPreference.equals(PREFERENCE.FAVORITES) && item.equalsIgnoreCase(Messages.getString("favorites"))) {
            //$NON-NLS-1$
            preferencesList.setSelectedIndex(i);
        }
    }
    onChange(null);
}
Example 44
Project: drools-wb-master  File: VerifyRulesFiredWidget.java View source code
private FlexTable render(final FixtureList rfl, final Scenario sc) {
    FlexTable data = new FlexTable();
    for (int i = 0; i < rfl.size(); i++) {
        final VerifyRuleFired v = (VerifyRuleFired) rfl.get(i);
        if (showResults && v.getSuccessResult() != null) {
            if (!v.getSuccessResult().booleanValue()) {
                data.setWidget(i, 0, new Image(CommonImages.INSTANCE.warning()));
                data.setWidget(i, 4, new HTML(TestScenarioConstants.INSTANCE.ActualResult(v.getActualResult().toString())));
                data.getCellFormatter().addStyleName(i, 4, //NON-NLS
                "testErrorValue");
            } else {
                data.setWidget(i, 0, new Image(TestScenarioImages.INSTANCE.testPassed()));
            }
        }
        data.setWidget(i, 1, new SmallLabel(v.getRuleName() + ":"));
        data.getFlexCellFormatter().setAlignment(i, 1, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE);
        final ListBox b = new ListBox();
        b.addItem(TestScenarioConstants.INSTANCE.firedAtLeastOnce(), "y");
        b.addItem(TestScenarioConstants.INSTANCE.didNotFire(), "n");
        b.addItem(TestScenarioConstants.INSTANCE.firedThisManyTimes(), "e");
        final TextBox num = new TextBox();
        ((InputElement) num.getElement().cast()).setSize(5);
        if (v.getExpectedFire() != null) {
            b.setSelectedIndex((v.getExpectedFire().booleanValue()) ? 0 : 1);
            num.setVisible(false);
        } else {
            b.setSelectedIndex(2);
            String xc = (v.getExpectedCount() != null) ? "" + v.getExpectedCount().intValue() : "0";
            num.setText(xc);
        }
        b.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                String s = b.getValue(b.getSelectedIndex());
                if (s.equals("y") || s.equals("n")) {
                    num.setVisible(false);
                    v.setExpectedFire((s.equals("y")) ? Boolean.TRUE : Boolean.FALSE);
                    v.setExpectedCount(null);
                } else {
                    num.setVisible(true);
                    v.setExpectedFire(null);
                    num.setText("1");
                    v.setExpectedCount(Integer.valueOf(1));
                }
            }
        });
        b.addItem(TestScenarioConstants.INSTANCE.ChooseDotDotDot());
        num.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                v.setExpectedCount(Integer.valueOf(num.getText()));
            }
        });
        HorizontalPanel h = new HorizontalPanel();
        h.add(b);
        h.add(num);
        data.setWidget(i, 2, h);
        Image del = CommonAltedImages.INSTANCE.DeleteItemSmall();
        del.setAltText(TestScenarioConstants.INSTANCE.RemoveThisRuleExpectation());
        del.setTitle(TestScenarioConstants.INSTANCE.RemoveThisRuleExpectation());
        del.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent w) {
                if (Window.confirm(TestScenarioConstants.INSTANCE.AreYouSureYouWantToRemoveThisRuleExpectation())) {
                    rfl.remove(v);
                    sc.removeFixture(v);
                    outer.setWidget(1, 0, render(rfl, sc));
                }
            }
        });
        data.setWidget(i, 3, del);
        //we only want numbers here...
        num.addKeyPressHandler(new KeyPressHandler() {

            public void onKeyPress(KeyPressEvent event) {
                if (Character.isLetter(event.getCharCode())) {
                    ((TextBox) event.getSource()).cancelKey();
                }
            }
        });
    }
    return data;
}
Example 45
Project: droolsjbpm-master  File: QueryWidget.java View source code
private void doMetaSearch() {
    DecoratedDisclosurePanel advancedDisclosure = new DecoratedDisclosurePanel(constants.AttributeSearch());
    advancedDisclosure.setWidth("100%");
    advancedDisclosure.setOpen(true);
    final Map<String, MetaDataQuery> atts = new HashMap<String, MetaDataQuery>() {

        private static final long serialVersionUID = 510l;

        {
            put(constants.CreatedBy(), //NON-NLS
            new MetaDataQuery("drools:creator"));
            put(constants.Format1(), //NON-NLS
            new MetaDataQuery("drools:format"));
            put(constants.Subject(), //NON-NLS
            new MetaDataQuery("drools:subject"));
            put(constants.Type1(), //NON-NLS
            new MetaDataQuery("drools:type"));
            put(constants.ExternalLink(), //NON-NLS
            new MetaDataQuery("drools:relation"));
            put(constants.Source(), //NON-NLS
            new MetaDataQuery("drools:source"));
            put(constants.Description1(), //NON-NLS
            new MetaDataQuery("drools:description"));
            put(constants.LastModifiedBy(), //NON-NLS
            new MetaDataQuery("drools:lastContributor"));
            put(constants.CheckinComment(), //NON-NLS
            new MetaDataQuery("drools:checkinComment"));
        }
    };
    FormStyleLayout fm = new FormStyleLayout();
    for (Iterator<String> iterator = atts.keySet().iterator(); iterator.hasNext(); ) {
        String fieldName = (String) iterator.next();
        final MetaDataQuery q = (MetaDataQuery) atts.get(fieldName);
        final TextBox box = new TextBox();
        box.setTitle(constants.WildCardsSearchTip());
        fm.addAttribute(fieldName + ":", box);
        box.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent arg0) {
                q.valueList = box.getText();
            }
        });
    }
    HorizontalPanel created = new HorizontalPanel();
    created.add(new SmallLabel(constants.AfterColon()));
    final DatePickerTextBox createdAfter = new DatePickerTextBox("");
    created.add(createdAfter);
    //NON-NLS
    created.add(new SmallLabel(" "));
    created.add(new SmallLabel(constants.BeforeColon()));
    final DatePickerTextBox createdBefore = new DatePickerTextBox("");
    created.add(createdBefore);
    fm.addAttribute(constants.DateCreated1(), created);
    HorizontalPanel lastMod = new HorizontalPanel();
    lastMod.add(new SmallLabel(constants.AfterColon()));
    final DatePickerTextBox lastModAfter = new DatePickerTextBox("");
    lastMod.add(lastModAfter);
    //NON-NLS
    lastMod.add(new SmallLabel(" "));
    lastMod.add(new SmallLabel(constants.BeforeColon()));
    final DatePickerTextBox lastModBefore = new DatePickerTextBox("");
    lastMod.add(lastModBefore);
    fm.addAttribute(constants.LastModified1(), lastMod);
    final SimplePanel resultsP = new SimplePanel();
    Button search = new Button(constants.Search());
    fm.addAttribute("", search);
    search.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {
            resultsP.clear();
            AssetItemGrid grid = new AssetItemGrid(editEvent, "searchresults", new //NON-NLS
            AssetItemGridDataLoader() {

                public void loadData(int startRow, int numberOfRows, GenericCallback cb) {
                    MetaDataQuery[] mdq = new MetaDataQuery[atts.size()];
                    int i = 0;
                    for (Iterator<String> iterator = atts.keySet().iterator(); iterator.hasNext(); ) {
                        String name = (String) iterator.next();
                        mdq[i] = (MetaDataQuery) atts.get(name);
                        i++;
                    }
                    try {
                        RepositoryServiceFactory.getService().queryMetaData(mdq, getDate(createdAfter), getDate(createdBefore), getDate(lastModAfter), getDate(lastModBefore), false, startRow, numberOfRows, cb);
                    } catch (IllegalArgumentException e) {
                        ErrorPopup.showMessage(Format.format(constants.BadDateFormatPleaseTryAgainTryTheFormatOf0(), Preferences.getStringPref("drools.dateformat")));
                    }
                }

                private Date getDate(final DatePickerTextBox datePicker) {
                    try {
                        return datePicker.getDate();
                    } catch (IllegalArgumentException e) {
                        datePicker.clear();
                        throw e;
                    }
                }
            });
            resultsP.add(grid);
        }
    });
    fm.addRow(resultsP);
    advancedDisclosure.setContent(fm);
    layout.add(advancedDisclosure);
}
Example 46
Project: Flax-HTML5-Game-Engine-master  File: PreferencesViewImpl.java View source code
@UiHandler("clearMaps")
void onClearMapsClick(ClickEvent event) {
    //TODO Carl: this needs to actually clear _all_ maps from local storage - that means
    //that local storage needs to contain more than one map too ;) -Carl
    final FWindow w = new FWindow("Confirm");
    w.add(new HTML("<p>Are you sure you want to clear all your maps from local storage?</p>"));
    HorizontalPanel hp = new HorizontalPanel();
    Button cnf = new Button("Confirm");
    cnf.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            presenter.removeMaps();
            w.close();
        }
    });
    Button ccl = new Button("Cancel");
    ccl.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            w.close();
        }
    });
    hp.setSpacing(5);
    hp.add(ccl);
    hp.add(cnf);
    w.add(hp);
    w.show();
}
Example 47
Project: FormDesigner-master  File: FieldWidget.java View source code
private void setupWidgets() {
    //Field 1
    fieldHyperlink = new Hyperlink("_", "");
    horizontalPanel = new HorizontalPanel();
    horizontalPanel.add(fieldHyperlink);
    fieldHyperlink.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            itemSelectionListener.onStartItemSelection(this);
            horizontalPanel.remove(fieldHyperlink);
            horizontalPanel.add(sgstField);
            sgstField.setText(fieldHyperlink.getText());
            sgstField.setFocus(true);
            txtField.selectAll();
        }
    });
    /*txtField.addFocusListener(new FocusListenerAdapter(){
			public void onLostFocus(Widget sender){
				stopSelection();
			}
		});

		/*sgstField.addFocusListener(new FocusListenerAdapter(){
			public void onLostFocus(Widget sender){
				stopSelection();
			}
		});*/
    sgstField.addSelectionHandler(new SelectionHandler() {

        public void onSelection(SelectionEvent event) {
            stopSelection();
        }
    });
    initWidget(horizontalPanel);
}
Example 48
Project: geogebra-master  File: PerspectivesPopup.java View source code
private void setLabels() {
    PerspectiveResources pr = ((ImageFactory) GWT.create(ImageFactory.class)).getPerspectiveResources();
    contentPanel.clear();
    addPerspective(0, pr.menu_icon_algebra24());
    if (app.supportsView(App.VIEW_CAS)) {
        addPerspective(3, pr.menu_icon_cas24());
    }
    addPerspective(1, pr.menu_icon_geometry24());
    if (app.supportsView(App.VIEW_EUCLIDIAN3D)) {
        addPerspective(4, pr.menu_icon_graphics3D24());
    }
    addPerspective(2, pr.menu_icon_spreadsheet24());
    addPerspective(5, pr.menu_icon_probability24());
    if (app.has(Feature.WHITEBOARD_APP)) {
        addPerspective(6, pr.menu_icon_whiteboard24());
    }
    // add exam mode
    HorizontalPanel examRow = addPerspectiveRow(pr.menu_icon_exam24(), "exam_menu_entry", -1, 7);
    contentPanel.add(examRow);
    // add link to tutorials
    if (app.has(Feature.STORE_IMAGES_ON_APPS_PICKER)) {
        if (!app.getLAF().isSmart() && !app.getLAF().isTablet()) {
            SimplePanel holderPanel = new SimplePanel();
            holderPanel.addStyleName("appstoreholder");
            NoDragImage appStoreIcon = new NoDragImage(ImgResourceHelper.safeURI(GuiResources.INSTANCE.app_store()), 135);
            Anchor link = new Anchor(appStoreIcon.toString(), true, "http://www.geogebra.org/download");
            holderPanel.add(link);
            contentPanel.add(holderPanel);
        }
    } else {
        HorizontalPanel tutorialsRow = addPerspectiveRow(GuiResources.INSTANCE.icon_help(), "Tutorials", -2, 8);
        tutorialsRow.addStyleName("upperBorder");
        contentPanel.add(tutorialsRow);
    }
    box.getCaption().setText(app.getLocalization().getMenu("CreateYourOwn"));
}
Example 49
Project: geomajas-project-client-gwt2-master  File: CloseableDialogExample.java View source code
@Override
public void onMouseDown(MouseDownEvent mouseDownEvent) {
    final CloseableDialogBoxWidget widget = new CloseableDialogBoxWidget();
    VerticalPanel panel = new VerticalPanel();
    panel.setWidth("100%");
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    HorizontalPanel top = new HorizontalPanel();
    top.setSpacing(10);
    InlineLabel labelTop = new InlineLabel(msg.closeableDialogBoxExampleLabel());
    top.add(labelTop);
    HorizontalPanel middle = new HorizontalPanel();
    middle.setSpacing(10);
    final Button middleButton = new Button(msg.closeableDialogBoxExampleButton());
    middle.add(middleButton);
    HorizontalPanel bottom = new HorizontalPanel();
    bottom.setSpacing(10);
    final InlineLabel bottomlabel = new InlineLabel(msg.loremIpsum());
    bottom.add(bottomlabel);
    middleButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (clicked < 3) {
                bottomlabel.setText(bottomlabel.getText() + bottomlabel.getText());
                layerEventLayout.add(new Label(msg.closeableDialogBoxExampleButtonMessage()));
                scrollPanel.scrollToBottom();
                clicked++;
                if (clicked == 3) {
                    middleButton.setText(msg.closeableDialogBoxExampleButtonClear());
                }
            } else {
                layerEventLayout.add(new Label(msg.closeableDialogBoxExampleButtonClearMessage()));
                scrollPanel.scrollToBottom();
                middleButton.setText(msg.closeableDialogBoxExampleButton());
                bottomlabel.setText(msg.loremIpsum());
                clicked = 0;
            }
        }
    });
    panel.add(top);
    panel.add(middle);
    panel.add(bottom);
    widget.addContent(panel);
    widget.setGlassEnabled(true);
    widget.setModal(true);
    widget.setTitle(msg.closeableDialogTitle());
    widget.setSize(380, 150);
    widget.center();
    widget.show();
    widget.setOnCloseHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            layerEventLayout.add(new Label(msg.closeableDialogBoxHandlerMessage()));
            scrollPanel.scrollToBottom();
        }
    });
}
Example 50
Project: gerrit-master  File: ProjectListPopup.java View source code
private void createWidgets(final String popupText, final String currentPageLink) {
    filterPanel = new HorizontalPanel();
    filterPanel.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
    final Label filterLabel = new Label(com.google.gerrit.client.admin.AdminConstants.I.projectFilter());
    filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
    filterPanel.add(filterLabel);
    filterTxt = new NpTextBox();
    filterTxt.addKeyUpHandler(new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            Query q = new Query(filterTxt.getValue());
            if (!match.equals(q.qMatch)) {
                if (query == null) {
                    q.run();
                }
                query = q;
            }
        }
    });
    filterPanel.add(filterTxt);
    projectsTab = new HighlightingProjectsTable() {

        @Override
        protected void movePointerTo(final int row, final boolean scroll) {
            super.movePointerTo(row, scroll);
            onMovePointerTo(getRowItem(row).name());
        }

        @Override
        protected void onOpenRow(final int row) {
            super.onOpenRow(row);
            openRow(getRowItem(row).name());
        }
    };
    projectsTab.setSavePointerId(currentPageLink);
    closeTop = createCloseButton();
    closeBottom = createCloseButton();
    popup = new DialogBox();
    popup.setModal(false);
    popup.setText(popupText);
}
Example 51
Project: gluster-ovirt-poc-master  File: SanStorageLunToTargetList.java View source code
@Override
protected TreeItem createRootNode(LunModel rootModel) {
    final EntityModelCellTable<ListModel> table = new EntityModelCellTable<ListModel>(true, (Resources) GWT.create(SanStorageListLunRootResources.class));
    // Create table
    initRootNodeTable(table);
    // Set custom selection column
    LunSelectionColumn lunSelectionColumn = new LunSelectionColumn() {

        @Override
        public LunModel getValue(LunModel object) {
            return object;
        }
    };
    table.setCustomSelectionColumn(lunSelectionColumn, "25px");
    // Add items
    List<LunModel> items = new ArrayList<LunModel>();
    items.add(rootModel);
    ListModel listModel = new ListModel();
    listModel.setItems(items);
    // Add selection handlers
    rootModel.getPropertyChangedEvent().addListener(new IEventListener() {

        @Override
        public void eventRaised(Event ev, Object sender, EventArgs args) {
            String propName = ((PropertyChangedEventArgs) args).PropertyName;
            if (propName.equals("IsSelected")) {
                LunModel lunModel = (LunModel) sender;
                if (lunModel.getIsSelected() != table.getSelectionModel().isSelected(lunModel)) {
                    table.getSelectionModel().setSelected(lunModel, lunModel.getIsSelected());
                }
            }
        }
    });
    table.getSelectionModel().addSelectionChangeHandler(new Handler() {

        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            LunModel lunModel = (LunModel) table.getVisibleItem(0);
            lunModel.setIsSelected(table.getSelectionModel().isSelected(lunModel));
        }
    });
    // Update table
    table.setRowData(items);
    table.setWidth("100%", true);
    // Create tree item
    HorizontalPanel panel = new HorizontalPanel();
    panel.add(table);
    TreeItem item = new TreeItem(panel);
    return item;
}
Example 52
Project: GWT-Hangouts-master  File: AudioTest.java View source code
protected void updateList(String url, boolean loop) {
    container.clear();
    AudioResource resources = Effects.createAudioResource(url);
    sound = resources.createSound(AudioResource.params().loop(loop));
    HorizontalPanel controler = new HorizontalPanel();
    container.add(controler);
    Button play = new Button("Play");
    play.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            sound.play();
        }
    });
    controler.add(play);
    Button stop = new Button("Stop");
    stop.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            sound.stop();
        }
    });
    controler.add(stop);
    container.add(new Label(sound.getAudioResource().getUrl()));
    container.add(new Label("loop:" + sound.isLooped()));
    container.add(new Label("volume:" + sound.getVolume()));
}
Example 53
Project: gwt-nextgen-master  File: WebSocketDemo.java View source code
public void onModuleLoad() {
    final WebSocket socket = new WebSocket("ws://echo.websocket.org/");
    final TextArea box = new TextArea();
    socket.addOpenHandler(new OpenHandler() {

        @Override
        public void onOpen(OpenEvent event) {
            Window.alert("Open: " + event);
        }
    });
    socket.addMessageHandler(new MessageHandler() {

        @Override
        public void onMessage(MessageEvent event) {
            box.setText(box.getValue() + "\n" + event.getData());
        }
    });
    socket.addErrorHandler(new ErrorHandler() {

        @Override
        public void onError(ErrorEvent event) {
            GWT.log("Error: " + event);
        }
    });
    socket.addCloseHandler(new CloseHandler() {

        @Override
        public void onClose(CloseEvent event) {
            GWT.log("Close: " + event);
        }
    });
    final TextBox line = new TextBox();
    Button send = new Button("SEND");
    send.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            socket.send(line.getText());
            line.setText("");
        }
    });
    HorizontalPanel lp = new HorizontalPanel();
    lp.add(line);
    lp.add(send);
    RootPanel.get().add(box);
    RootPanel.get().add(lp);
    RootPanel.get().add(send);
}
Example 54
Project: incubator-wave-master  File: DialogBox.java View source code
/**
   * Creates dialog box.
   *
   * @param popup - UniversalPopup on which the dialog is based
   * @param title - title placed in the title bar
   * @param innerWidget - the inner widget of the dialog
   * @param dialogButtons - buttons
   */
public static void create(UniversalPopup popup, String title, Widget innerWidget, DialogButton[] dialogButtons) {
    // Title
    popup.getTitleBar().setTitleText(title);
    VerticalPanel contents = new VerticalPanel();
    popup.add(contents);
    // Message
    contents.add(innerWidget);
    // Buttons
    HorizontalPanel buttonPanel = new HorizontalPanel();
    for (DialogButton dialogButton : dialogButtons) {
        Button button = new Button(dialogButton.getTitle());
        button.setStyleName(Dialog.getCss().dialogButton());
        buttonPanel.add(button);
        dialogButton.link(button);
    }
    contents.add(buttonPanel);
    buttonPanel.setStyleName(Dialog.getCss().dialogButtonPanel());
    contents.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT);
}
Example 55
Project: jbpm-form-builder-master  File: HorizontalAlignmentFormEffect.java View source code
@Override
public PopupPanel createPanel() {
    final PopupPanel panel = new PopupPanel();
    panel.setSize("300px", "200px");
    VerticalPanel vPanel = new VerticalPanel();
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.add(new Label(i18n.Alignment()));
    alignmentBox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            HorizontalAlignmentFormEffect.this.createStyles();
            panel.hide();
        }

        ;
    });
    hPanel.add(alignmentBox);
    Button fontSizeButton = new Button(i18n.ConfirmButton());
    fontSizeButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            HorizontalAlignmentFormEffect.this.createStyles();
            panel.hide();
        }
    });
    vPanel.add(alignmentBox);
    vPanel.add(fontSizeButton);
    panel.add(vPanel);
    return panel;
}
Example 56
Project: LanguageMemoryApp-master  File: ReportView.java View source code
public void showResults(StimuliGroup stimuliGroup, GroupScoreData calculatedScores) {
    int columnCount = calculatedScores.getScoreDataList().get(0).getColourData().size();
    int row = 0;
    final FlexTable grid = new FlexTable();
    grid.setStylePrimaryName("resultsTablePanel");
    final Label titleLabel = new Label(stimuliGroup.getGroupLabel());
    titleLabel.setStylePrimaryName("resultsTableTitle");
    grid.setWidget(0, 0, titleLabel);
    grid.getFlexCellFormatter().setColSpan(0, 0, columnCount + 1);
    row++;
    for (ScoreData scoreData : calculatedScores.getScoreDataList()) {
        for (int column = 0; column < columnCount; column++) {
            final Label label = new Label(scoreData.getStimulus().getValue());
            final ColourData colour = scoreData.getColourData().get(column);
            if (colour == null) {
                label.getElement().setAttribute("style", "color: grey;background: none;");
            } else {
                String foreground = (colour.getRed() + colour.getGreen() + colour.getBlue() > 128 * 3) ? "#A9A9A9" : "#D3D3D3";
                label.getElement().setAttribute("style", "background:" + foreground + ";color:rgb(" + colour.getRed() + "," + colour.getGreen() + "," + colour.getBlue() + ")");
            }
            grid.setWidget(row, column, label);
        }
        if (scoreData.getDistance() != null) {
            final HorizontalPanel bargraphOuter = new HorizontalPanel();
            final HorizontalPanel bargraphInner = new HorizontalPanel();
            bargraphOuter.setPixelSize(100, 10);
            bargraphInner.setPixelSize((int) (100.0 / 6 * scoreData.getDistance()), 10);
            bargraphOuter.setStyleName("bargraphOuter");
            bargraphInner.setStyleName("bargraphInner");
            bargraphOuter.add(bargraphInner);
            grid.setWidget(row, columnCount, bargraphOuter);
        }
        row++;
    }
    outerPanel.add(grid);
}
Example 57
Project: NASfVI-master  File: MessageBox.java View source code
/**
	 * Sets the content and a caption of this MessageBox.
	 * @param caption New caption of the box
	 * @param content New content of the box
	 */
public final void set(final String caption, final Widget content) {
    box.setText(caption);
    HorizontalPanel hori = new HorizontalPanel();
    VerticalPanel verti = new VerticalPanel();
    hori.setHorizontalAlignment(Label.ALIGN_CENTER);
    hori.add(ok);
    hori.setWidth("100%");
    verti.add(content);
    verti.add(hori);
    verti.setWidth("100%");
    verti.setSpacing(10);
    box.add(verti);
    box.center();
}
Example 58
Project: open-groups-gwt-master  File: EntityDataSummaryView.java View source code
@Override
public void update(Entity entity) {
    VerticalPanel container = getContainer();
    EntityState state = entity.getState();
    HorizontalPanel titlePane = new HorizontalPanel();
    if (state.isEntityTypeVisible()) {
        Label entityTypeLabel = new Label(entity.getCaption(MessagesKeys.ENTITY_TYPE));
        entityTypeLabel.setStylePrimaryName("og-EntityTypeLabel");
        titlePane.add(entityTypeLabel);
    }
    String lastActionTypeCaption = entity.getCaption(MessagesKeys.LAST_ACTION_TYPE);
    if (lastActionTypeCaption != null) {
        Label actionTypeLabel = new Label(lastActionTypeCaption);
        actionTypeLabel.setStylePrimaryName("og-ActionTypeLabel");
        titlePane.add(actionTypeLabel);
    }
    titlePane.add(new Hyperlink(entity.getTitle(), "" + entity.getId()));
    container.add(titlePane);
    container.add(getTagsAndDatePane(entity));
    container.add(getStatsPane(entity));
}
Example 59
Project: pentaho-commons-gwt-modules-master  File: ButtonHelper.java View source code
public static String createButtonLabel(Image img, String text, ButtonLabelType type, String cssName) {
    final HTML html = new HTML(text, false);
    if (cssName != null) {
        html.addStyleDependentName(cssName);
        img.addStyleDependentName(cssName);
    }
    if (type == ButtonLabelType.TEXT_ONLY) {
        return text;
    } else if (type == ButtonLabelType.TEXT_ON_LEFT || type == ButtonLabelType.TEXT_ON_RIGHT) {
        HorizontalPanel hpanel = new HorizontalPanel();
        if (cssName != null) {
            hpanel.addStyleName(cssName);
        }
        if (type == ButtonLabelType.TEXT_ON_LEFT) {
            hpanel.add(html);
            //$NON-NLS-1$
            hpanel.add(new HTML(" "));
            hpanel.add(img);
        } else {
            hpanel.add(img);
            //$NON-NLS-1$
            hpanel.add(new HTML(" "));
            hpanel.add(html);
        }
        hpanel.setCellVerticalAlignment(html, HasVerticalAlignment.ALIGN_MIDDLE);
        hpanel.setCellVerticalAlignment(img, HasVerticalAlignment.ALIGN_MIDDLE);
        return hpanel.getElement().getString();
    } else {
        VerticalPanel vpanel = new VerticalPanel();
        if (type == ButtonLabelType.TEXT_ON_TOP) {
            vpanel.add(html);
            vpanel.add(img);
        } else {
            vpanel.add(img);
            vpanel.add(html);
        }
        vpanel.setCellHorizontalAlignment(html, HasHorizontalAlignment.ALIGN_CENTER);
        vpanel.setCellHorizontalAlignment(img, HasHorizontalAlignment.ALIGN_CENTER);
        return vpanel.getElement().getString();
    }
}
Example 60
Project: pentaho-gwt-modules-master  File: ButtonHelper.java View source code
public static String createButtonLabel(Image img, String text, ButtonLabelType type, String cssName) {
    final HTML html = new HTML(text, false);
    if (cssName != null) {
        html.addStyleDependentName(cssName);
        img.addStyleDependentName(cssName);
    }
    if (type == ButtonLabelType.TEXT_ONLY) {
        return text;
    } else if (type == ButtonLabelType.TEXT_ON_LEFT || type == ButtonLabelType.TEXT_ON_RIGHT) {
        HorizontalPanel hpanel = new HorizontalPanel();
        if (cssName != null) {
            hpanel.addStyleName(cssName);
        }
        if (type == ButtonLabelType.TEXT_ON_LEFT) {
            hpanel.add(html);
            //$NON-NLS-1$
            hpanel.add(new HTML(" "));
            hpanel.add(img);
        } else {
            hpanel.add(img);
            //$NON-NLS-1$
            hpanel.add(new HTML(" "));
            hpanel.add(html);
        }
        hpanel.setCellVerticalAlignment(html, HasVerticalAlignment.ALIGN_MIDDLE);
        hpanel.setCellVerticalAlignment(img, HasVerticalAlignment.ALIGN_MIDDLE);
        return hpanel.getElement().getString();
    } else {
        VerticalPanel vpanel = new VerticalPanel();
        if (type == ButtonLabelType.TEXT_ON_TOP) {
            vpanel.add(html);
            vpanel.add(img);
        } else {
            vpanel.add(img);
            vpanel.add(html);
        }
        vpanel.setCellHorizontalAlignment(html, HasHorizontalAlignment.ALIGN_CENTER);
        vpanel.setCellHorizontalAlignment(img, HasHorizontalAlignment.ALIGN_CENTER);
        return vpanel.getElement().getString();
    }
}
Example 61
Project: pentaho-platform-master  File: ChangePasswordDialog.java View source code
public Panel getDialogContents() {
    HorizontalPanel hp = new HorizontalPanel();
    SimplePanel hspacer = new SimplePanel();
    hspacer.setWidth("10px");
    hp.add(hspacer);
    VerticalPanel vp = new VerticalPanel();
    hp.add(vp);
    SimplePanel vspacer = new SimplePanel();
    vspacer.setHeight("10px");
    vp.add(vspacer);
    Label nameLabel = new Label(Messages.getString("newPassword") + ":");
    vp.add(nameLabel);
    vp.add(newPasswordTextBox);
    Label passwordLabel = new Label(Messages.getString("retypePassword") + ":");
    vp.add(passwordLabel);
    vp.add(reTypePasswordTextBox);
    return hp;
}
Example 62
Project: rtgov-master  File: ServiceTable.java View source code
/**
     * Adds a single row to the table.
     * @param serviceSummaryBean
     */
public void addRow(final ServiceSummaryBean serviceSummaryBean) {
    int rowIdx = this.rowElements.size();
    //$NON-NLS-1$
    Anchor name = toDetailsPageLinkFactory.get("id", serviceSummaryBean.getServiceId());
    name.setText(serviceSummaryBean.getName());
    InlineLabel application = new InlineLabel(serviceSummaryBean.getApplication());
    InlineLabel interf4ce = new InlineLabel(serviceSummaryBean.getIface());
    add(rowIdx, 0, name);
    add(rowIdx, 1, application);
    add(rowIdx, 2, interf4ce);
    HorizontalPanel panel = new HorizontalPanel();
    for (BindingBean bindingBean : serviceSummaryBean.getBindings()) {
        Label bindingLabel = new Label(bindingBean.getType());
        bindingLabel.setStyleName(!bindingBean.isActive() ? "alert-danger" : "alert-success");
        panel.add(bindingLabel);
    }
    add(rowIdx, 3, panel);
}
Example 63
Project: socialpm-master  File: NewProjectViewImpl.java View source code
@Override
public void setup() {
    name.getElement().setAttribute("placeholder", "Project name...");
    FormPanel form = new FormPanel();
    HeroPanel hero = new HeroPanel();
    hero.setHeading("Start a new Project");
    hero.setContent("What do you call your project?");
    HorizontalPanel panel = new HorizontalPanel();
    panel.add(name);
    hero.getUnder().add(panel);
    create.addStyleName("btn btn-primary btn-large");
    hero.addAction(create);
    form.add(hero);
    content.add(form);
    setupInputs();
}
Example 64
Project: swellrt-master  File: DialogBox.java View source code
/**
   * Creates dialog box.
   *
   * @param popup - UniversalPopup on which the dialog is based
   * @param title - title placed in the title bar
   * @param innerWidget - the inner widget of the dialog
   * @param dialogButtons - buttons
   */
public static void create(UniversalPopup popup, String title, Widget innerWidget, DialogButton[] dialogButtons) {
    // Title
    popup.getTitleBar().setTitleText(title);
    VerticalPanel contents = new VerticalPanel();
    popup.add(contents);
    // Message
    contents.add(innerWidget);
    // Buttons
    HorizontalPanel buttonPanel = new HorizontalPanel();
    for (DialogButton dialogButton : dialogButtons) {
        Button button = new Button(dialogButton.getTitle());
        button.setStyleName(Dialog.getCss().dialogButton());
        buttonPanel.add(button);
        dialogButton.link(button);
    }
    contents.add(buttonPanel);
    buttonPanel.setStyleName(Dialog.getCss().dialogButtonPanel());
    contents.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT);
}
Example 65
Project: wb-master  File: FixtureLayout.java View source code
private void addFooter() {
    // add more execution sections.
    setWidget(layoutRow, 0, scenarioWidgetComponentCreator.createAddExecuteButton());
    layoutRow++;
    setWidget(layoutRow, 0, scenarioWidgetComponentCreator.createSmallLabel());
    // config section
    setWidget(layoutRow, 1, scenarioWidgetComponentCreator.createConfigWidget());
    layoutRow++;
    // global section
    HorizontalPanel horizontalPanel = scenarioWidgetComponentCreator.createHorizontalPanel();
    setWidget(layoutRow, 0, horizontalPanel);
    setWidget(layoutRow, 1, scenarioWidgetComponentCreator.createGlobalPanel(scenarioHelper, previousExecutionTrace));
}
Example 66
Project: akjava_gwtlib-master  File: ListEditorGenerator.java View source code
public VerticalPanel generatePanel(final SimpleCellTable<T> cellTable, final Converter<List<T>, String> converter, final Editor<T> editor, @SuppressWarnings("rawtypes") final SimpleBeanEditorDriver driver, Map<String, String> labelMaps, final ValueControler valueControler) {
    //check nulls
    final SimpleBeanEditorDriver<T, Editor<? super T>> castdriver = driver;
    if (labelMaps == null) {
        labelMaps = new HashMap<String, String>();
    }
    VerticalPanel panel = new VerticalPanel();
    panel.add(cellTable);
    easyCells = new EasyCellTableObjects<T>(cellTable) {

        @Override
        public void onSelect(T selection) {
            if (selection != null) {
                castdriver.edit(selection);
                //baseFormantEditor.setVisible(true);
                updateButton.setEnabled(true);
                removeButton.setEnabled(true);
                newButton.setEnabled(true);
                addButton.setEnabled(false);
                onEditMode();
            } else {
                //baseFormantEditor.setVisible(false);
                updateButton.setEnabled(false);
                removeButton.setEnabled(false);
                newButton.setEnabled(false);
                addButton.setEnabled(true);
                onAddMode();
            }
        }
    };
    castdriver.initialize(editor);
    castdriver.edit(createNewData());
    //some case no need value store
    if (valueControler != null) {
        String baseText = valueControler.getValue();
        //some case no need convert
        if (converter != null) {
            easyCells.setDatas(converter.reverse().convert(baseText));
            easyCells.update();
        }
    }
    HorizontalPanel buttons = new HorizontalPanel();
    buttons.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    panel.add(buttons);
    newButton = new Button(Objects.firstNonNull(labelMaps.get("new"), "New"), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            easyCells.unselect();
            castdriver.edit(createNewData());
        }
    });
    buttons.add(newButton);
    newButton.setEnabled(false);
    addButton = new Button(Objects.firstNonNull(labelMaps.get("add"), "Add"), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            T data = castdriver.flush();
            easyCells.addItem(data);
            castdriver.edit(createNewData());
            updateValue(converter, valueControler, easyCells.getDatas());
        }
    });
    buttons.add(addButton);
    addButton.setEnabled(true);
    updateButton = new Button(Objects.firstNonNull(labelMaps.get("update"), "Update"), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            driver.flush();
            easyCells.update(true);
            updateValue(converter, valueControler, easyCells.getDatas());
        }
    });
    updateButton.setEnabled(false);
    buttons.add(updateButton);
    removeButton = new Button(Objects.firstNonNull(labelMaps.get("remove"), "Remove"), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (easyCells.getSelection() != null) {
                easyCells.removeItem(easyCells.getSelection());
                castdriver.edit(createNewData());
                updateValue(converter, valueControler, easyCells.getDatas());
            }
        }
    });
    buttons.add(removeButton);
    removeButton.setEnabled(false);
    infoLabel = new Label();
    infoLabel.setStylePrimaryName("listedit_infolabel");
    buttons.add(infoLabel);
    return panel;
}
Example 67
Project: aokp-gerrit-master  File: DownloadBox.java View source code
private void insertPatch() {
    String id = revision.substring(0, 7);
    Anchor patchBase64 = new Anchor(id + ".diff.base64");
    patchBase64.setHref(new RestApi("/changes/").id(psId.getParentKey().get()).view("revisions").id(revision).view("patch").addParameterTrue("download").url());
    Anchor patchZip = new Anchor(id + ".diff.zip");
    patchZip.setHref(new RestApi("/changes/").id(psId.getParentKey().get()).view("revisions").id(revision).view("patch").addParameterTrue("zip").url());
    HorizontalPanel p = new HorizontalPanel();
    p.add(patchBase64);
    InlineLabel spacer = new InlineLabel("|");
    spacer.setStyleName(Gerrit.RESOURCES.css().downloadBoxSpacer());
    p.add(spacer);
    p.add(patchZip);
    insertCommand("Patch-File", p);
}
Example 68
Project: appinventor-sources-master  File: AdditionalChoicePropertyEditor.java View source code
/**
   * Initializes the additional choice panel.
   *
   * <p>This method must be called from any implementor's constructor.
   *
   * @param panel  panel containing additional choices
   */
protected void initAdditionalChoicePanel(Panel panel) {
    Button cancelButton = new Button(MESSAGES.cancelButton());
    cancelButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            closeAdditionalChoiceDialog(false);
        }
    });
    Button okButton = new Button(MESSAGES.okButton());
    okButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            closeAdditionalChoiceDialog(true);
        }
    });
    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.add(cancelButton);
    buttonPanel.add(okButton);
    buttonPanel.setWidth("100%");
    buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    VerticalPanel contentPanel = new VerticalPanel();
    contentPanel.add(panel);
    contentPanel.add(buttonPanel);
    popup = new PopupPanel(false, true);
    popup.setAutoHideEnabled(true);
    popup.setWidget(contentPanel);
    popup.setStylePrimaryName("ode-MultipleChoicePropertyEditor");
}
Example 69
Project: closure-compiler-master  File: DebuggerGwtMain.java View source code
@Override
public void onModuleLoad() {
    externs.setCharacterWidth(80);
    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);
}
Example 70
Project: geo-platform-master  File: CatalogSearchResultWidget.java View source code
private void addComponentsForTreePresence() {
    GPTreeLayerWidgetSupport catalogTreeLayer = new CatalogTreeLayerWidgetSupport(tree, recordsContainer, bus);
    HorizontalPanel hp = new HorizontalPanel();
    hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    hp.setStyleName("catalogTree-Button");
    hp.add(catalogTreeLayer.getAddOnTreeButton());
    hp.add(catalogTreeLayer.getLoadWMSCapabilitiesButton());
    super.add(catalogTreeLayer.getLabel());
    super.add(hp);
    this.recordsContainer.setSelectionContainer(true);
}
Example 71
Project: gwt-dnd-master  File: IndexedDropController.java View source code
@Override
protected LocationWidgetComparator getLocationWidgetComparator() {
    if (dropTarget instanceof HorizontalPanel) {
        if (isRtl()) {
            return LocationWidgetComparator.LEFT_HALF_COMPARATOR;
        } else {
            return LocationWidgetComparator.RIGHT_HALF_COMPARATOR;
        }
    } else {
        return LocationWidgetComparator.BOTTOM_HALF_COMPARATOR;
    }
}
Example 72
Project: GWT-OpenLayers-master  File: CqlWmsExample.java View source code
@Override
public void buildPanel() {
    OpenLayers.setProxyHost("olproxy?targetURL=");
    //create some MapOptions
    MapOptions defaultMapOptions = new MapOptions();
    defaultMapOptions.setNumZoomLevels(16);
    //Create a MapWidget
    MapWidget mapWidget = new MapWidget("800px", "500px", defaultMapOptions);
    //Create a WMS layer as base layer
    final WMSParams wmsParams = new WMSParams();
    wmsParams.setFormat("image/png");
    wmsParams.setLayers("topp:states");
    wmsParams.setStyles("");
    WMSOptions wmsLayerParams = new WMSOptions();
    wmsLayerParams.setUntiled();
    wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);
    String wmsUrl = "http://demo.opengeo.org/geoserver/wms";
    final WMS wmsLayer = new WMS("Basic WMS", wmsUrl, wmsParams, wmsLayerParams);
    //Add the WMS to the map
    Map map = mapWidget.getMap();
    map.addLayer(wmsLayer);
    //Lets add some default controls to the map
    //+ sign in the upperright corner to display the layer switcher
    map.addControl(new LayerSwitcher());
    //+ sign in the lowerright to display the overviewmap
    map.addControl(new OverviewMap());
    //Display the scaleline
    map.addControl(new ScaleLine());
    //Center and zoom to a location
    map.setCenter(new LonLat(-100, 40), 4);
    //Create a textbox and a button for CQL
    final TextBox txtCql = new TextBox();
    txtCql.setText("STATE_ABBR = 'TX'");
    Button butCql = new Button("Do CQL", new ClickHandler() {

        public void onClick(ClickEvent event) {
            //set the CQL filter
            wmsParams.setCQLFilter(txtCql.getText());
            //and force the layer to reread its WMSParams
            wmsLayer.mergeNewParams(wmsParams);
        }
    });
    HorizontalPanel hpCql = new HorizontalPanel();
    hpCql.setSpacing(3);
    hpCql.add(txtCql);
    hpCql.add(butCql);
    contentPanel.add(new HTML("<p>This example shows how to use a CQL filter on a WMS layer.</p><p>Enter the CQL filter in the textbox, and click the <b>'Do CQL'</b> button to execute the CQL. An example CQL you can execute is allready given in the textbox.</p>"));
    contentPanel.add(hpCql);
    contentPanel.add(mapWidget);
    initWidget(contentPanel);
    //force the map to fall behind popups
    mapWidget.getElement().getFirstChildElement().getStyle().setZIndex(0);
}
Example 73
Project: gwt-three.js-test-master  File: HelloCSS3DDemo.java View source code
@Override
public Widget getControler() {
    HorizontalPanel panel = new HorizontalPanel();
    Button bt = new Button("remove", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            css3.setVisible(false);
            scene.remove(css3);
            //i have no idea
            label.setVisible(false);
        }
    });
    panel.add(bt);
    return panel;
}
Example 74
Project: gwtphotoalbum-master  File: TiledLayout.java View source code
private int createTiles(CellPanel parent, ImageCollectionInfo info, String config, int i) {
    while (i < config.length()) {
        switch(config.charAt(i)) {
            case ('C'):
                {
                    parent.add(caption);
                    caption.addStyleDependentName("tiled");
                    parent.setCellVerticalAlignment(caption, HasVerticalAlignment.ALIGN_MIDDLE);
                    parent.setCellHorizontalAlignment(caption, HasHorizontalAlignment.ALIGN_CENTER);
                    parent.setCellWidth(caption, "100%");
                    break;
                }
            case ('O'):
                {
                    overlay = new CaptionOverlay(caption, imagePanel, slideshow, info.getInfo().get(CaptionOverlay.KEY_CAPTION_POSITION));
                }
            case ('I'):
                {
                    parent.add(imagePanel);
                    parent.setCellVerticalAlignment(imagePanel, HasVerticalAlignment.ALIGN_MIDDLE);
                    parent.setCellHorizontalAlignment(imagePanel, HasHorizontalAlignment.ALIGN_CENTER);
                    parent.setCellWidth(imagePanel, "100%");
                    parent.setCellHeight(imagePanel, "100%");
                    break;
                }
            case ('P'):
            case ('F'):
                {
                    assert control instanceof Widget;
                    parent.add((Widget) control);
                    ((Widget) control).addStyleDependentName("tiled");
                    parent.setCellVerticalAlignment(((Widget) control), HasVerticalAlignment.ALIGN_MIDDLE);
                    if (parent instanceof HorizontalPanel && parent.getWidgetCount() == 1) {
                        parent.setCellHorizontalAlignment(((Widget) control), HasHorizontalAlignment.ALIGN_RIGHT);
                    } else {
                        parent.setCellHorizontalAlignment(((Widget) control), HasHorizontalAlignment.ALIGN_CENTER);
                    }
                    break;
                }
            case ('-'):
                {
                    HTML horizLine = new HTML("<hr class=\"tiledSeparator\" />");
                    panel.add(horizLine);
                    break;
                }
            case (']'):
                {
                    return i;
                }
            case ('['):
                {
                    CellPanel panel;
                    if (parent instanceof VerticalPanel) {
                        panel = new HorizontalPanel();
                        panel.setStyleName("tiled");
                    } else {
                        panel = new VerticalPanel();
                        panel.setStyleName("tiled");
                    }
                    i = createTiles(panel, info, config, i + 1);
                    parent.add(panel);
                    break;
                }
            default:
                assert false : "Illegal token '" + config.charAt(i) + "' in config string";
        }
        i++;
    }
    return i;
}
Example 75
Project: ilarkesto-master  File: AIntegerViewEditWidget.java View source code
@Override
protected final void onViewerUpdate() {
    boolean editable = isEditable();
    if (panel == null || (editable && panel.getWidgetCount() < 3) || (!editable && panel.getWidgetCount() > 1)) {
        panel = new HorizontalPanel();
        if (editable) {
            panel.add(minus.update());
            panel.add(Gwt.createNbsp());
        }
        panel.add(viewer);
        if (editable) {
            panel.add(Gwt.createNbsp());
            panel.add(plus.update());
        }
        wrapper.setWidget(panel);
    }
    onIntegerViewerUpdate();
}
Example 76
Project: jain-slee-master  File: ActivityContextPropertiesPanel.java View source code
private Widget[] arrayToSbbLinksPanel(String[] sbbs) {
    if (sbbs == null || sbbs.length == 0)
        return new Widget[] { new Label("-") };
    Widget[] widgets = new Widget[sbbs.length];
    for (int q = 0; q < sbbs.length; q++) {
        HorizontalPanel sbbPanel = new HorizontalPanel();
        String sbbId = sbbs[q];
        Image sbbIcon = new Image("images/components.sbb.gif");
        sbbPanel.add(sbbIcon);
        sbbPanel.add(new SbbEntityLabel(sbbId, null, browseContainer));
        widgets[q] = sbbPanel;
    }
    return widgets;
}
Example 77
Project: konto-master  File: ReportResultViewImpl.java View source code
@Override
public void setReportLines(LineReportCriteria criteria, Map<AccountType, ReportLines> linesByType) {
    reportPanel.clear();
    LineReportType reportType = criteria.getType();
    Label titleLabel = new Label(reportType.getLabel());
    titleLabel.addStyleName(style.titleLabel());
    Label titleLabelSub = new Label(reportType.getLabelSub(dateFormat, criteria));
    titleLabelSub.addStyleName(style.titleLabelSub());
    VerticalPanel titlePanel = new VerticalPanel();
    titlePanel.addStyleName(style.titlePanel());
    titlePanel.add(titleLabel);
    titlePanel.add(titleLabelSub);
    reportPanel.add(titlePanel);
    for (Map.Entry<AccountType, ReportLines> me : linesByType.entrySet()) {
        VerticalPanel blockPanel = new VerticalPanel();
        blockPanel.addStyleName(style.blockPanel());
        HorizontalPanel blockTitlePanel = new HorizontalPanel();
        blockTitlePanel.addStyleName(style.blockTitlePanel());
        Label blockLabel = new Label(me.getKey().getLabel());
        blockLabel.addStyleName(style.blockLabel());
        blockTitlePanel.add(blockLabel);
        Label blockSumLabel = new Label();
        blockSumLabel.addStyleName(style.blockSumLabel());
        blockSumLabel.setText(reportType.getTypeSum(roundFractions, me.getKey(), linesByType));
        blockTitlePanel.add(blockSumLabel);
        blockPanel.add(blockTitlePanel);
        ReportLinesTable linesTable = new ReportLinesTable(new ReportLinesTable.Resources() {

            @Override
            public ReportLinesTable.Style style() {
                return style;
            }
        }) {

            @Override
            protected void onLineClick(LedgerCoordinates ledgerCoordinates) {
                presenter.goTo(new LedgerPlace(ledgerCoordinates));
            }
        };
        linesTable.setDateFormat(dateFormat);
        linesTable.setRoundFractions(roundFractions);
        linesTable.setValue(me.getValue(), criteria);
        linesTable.addStyleName(style.linesTable());
        blockPanel.add(linesTable);
        reportPanel.add(blockPanel);
    }
    String totalSum = reportType.getTotalSum(roundFractions, linesByType);
    if (totalSum != null) {
        Label totalLabel = new Label(totalSum);
        totalLabel.addStyleName(style.totalSumLabel());
        VerticalPanel totalPanel = new VerticalPanel();
        totalPanel.addStyleName(style.totalPanel());
        totalPanel.add(totalLabel);
        reportPanel.add(totalPanel);
    }
    getWidget().setVisible(true);
}
Example 78
Project: m3s-master  File: Pagination.java View source code
/**
	 * 
	 * @param firstPageNumber
	 *          the initial page number to show
	 * @param lastPageNumber
	 *          the last page number to show
	 * @param LESS
	 *          show the LESS pages message ("anteriores")
	 * @param MORE
	 *          show the MORE pages message ("siguientes")
	 */
private void generateUIElement(int firstPageNumber, int lastPageNumber, boolean less, boolean more) {
    pages.removeFromParent();
    pages = new HorizontalPanel();
    pages.setSpacing(5);
    Label item;
    if (less) {
        item = new Label(Pagination.LESS);
        item.addClickListener(this);
        item.setStyleName("pagination-text");
        pages.add(item);
    }
    for (int i = firstPageNumber; i <= lastPageNumber; i++) {
        item = new Label(String.valueOf(i));
        item.addClickListener(this);
        if (i == this.actualPage)
            item.setStyleName("pagination-text-selected");
        else
            item.setStyleName("pagination-text");
        pages.add(item);
    }
    if (more) {
        item = new Label(Pagination.MORE);
        item.addClickListener(this);
        item.setStyleName("pagination-text");
        pages.add(item);
    }
    main.add(pages);
}
Example 79
Project: mini-git-server-master  File: PagedSingleListScreen.java View source code
@Override
protected void onInitUI() {
    super.onInitUI();
    prev = new Hyperlink(Util.C.pagedChangeListPrev(), true, "");
    prev.setVisible(false);
    next = new Hyperlink(Util.C.pagedChangeListNext(), true, "");
    next.setVisible(false);
    table = new ChangeTable(true) {

        {
            keysNavigation.add(new DoLinkCommand(0, 'p', Util.C.changeTablePagePrev(), prev));
            keysNavigation.add(new DoLinkCommand(0, 'n', Util.C.changeTablePageNext(), next));
        }
    };
    section = new ChangeTable.Section(null, ApprovalViewType.STRONGEST, null);
    table.addSection(section);
    table.setSavePointerId(anchorPrefix);
    add(table);
    final HorizontalPanel buttons = new HorizontalPanel();
    buttons.setStyleName(Gerrit.RESOURCES.css().changeTablePrevNextLinks());
    buttons.add(prev);
    buttons.add(next);
    add(buttons);
}
Example 80
Project: mobicents-master  File: RequestColumnsContainer.java View source code
private Widget buildTitles() {
    HorizontalPanel titles = new HorizontalPanel();
    titles.setStyleName(CSS_TITLE);
    titles.setSpacing(SPACING);
    Label spacerLabel = new Label("");
    spacerLabel.setPixelSize(14, 7);
    titles.add(spacerLabel);
    for (int col = 0; col < COLUMNS.length; col++) {
        titles.add(makeTitle(COLUMNS[col]));
    }
    return titles;
}
Example 81
Project: opennms_dashboard-master  File: VerticalDBLayout.java View source code
@Override
public void init() {
    dragHandler = new GridViewDragHandler();
    bodyPanel = new HorizontalPanel();
    columnList = new ArrayList<VerticalPanel>();
    resizeDragController = new ResizeDragController(RootPanel.get());
    resizeDragController.setBehaviorConstrainedToBoundaryPanel(true);
    resizeDragController.setBehaviorMultipleSelection(false);
    // initialize our widget drag controller
    moveDragController = new PickupDragController(this, false);
    moveDragController.setBehaviorMultipleSelection(false);
    moveDragController.setBehaviorDragStartSensitivity(5);
    moveDragController.addDragHandler(dragHandler);
    // initialize our column drag controller
    columnDragController = new PickupDragController(this, false);
    columnDragController.setBehaviorMultipleSelection(false);
    columnDragController.addDragHandler(dragHandler);
    // initialize our column drop controller
    columnDropController = new HorizontalPanelDropController(bodyPanel);
    columnDragController.registerDropController(columnDropController);
    for (int col = 0; col < COLUMNS; col++) {
        addNewColumn();
    }
}
Example 82
Project: optimization-master  File: DebuggerGwtMain.java View source code
@Override
public void onModuleLoad() {
    externs.setCharacterWidth(80);
    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);
}
Example 83
Project: org.ops4j.pax.vaadin-master  File: GwtColorPicker.java View source code
/** Sets the currently selected color. */
public void setColor(String newcolor) {
    // Give client-side feedback by changing the color name in the label
    currentcolor.setText(newcolor);
    // Obtain the DOM elements. This assumes that the <td> element
    // of the HorizontalPanel is the parent of the label element.
    final Element nameelement = currentcolor.getElement();
    final Element cell = DOM.getParent(nameelement);
    // Give feedback by changing the background color
    DOM.setStyleAttribute(cell, "background", newcolor);
    DOM.setStyleAttribute(nameelement, "background", newcolor);
    if ("black navy maroon blue purple".indexOf(newcolor) != -1) {
        DOM.setStyleAttribute(nameelement, "color", "white");
    } else {
        DOM.setStyleAttribute(nameelement, "color", "black");
    }
}
Example 84
Project: pentaho-open-admin-console-master  File: PentahoAdminConsole.java View source code
protected HorizontalPanel buildTopPanel() {
    HorizontalPanel topPanel = new HorizontalPanel();
    SimplePanel logo = new SimplePanel();
    //$NON-NLS-1$
    logo.setStyleName("logo");
    //$NON-NLS-1$
    topPanel.setWidth("100%");
    topPanel.add(logo);
    topPanel.add(toolbar);
    //$NON-NLS-1$
    topPanel.setCellWidth(toolbar, "100%");
    return topPanel;
}
Example 85
Project: prima-gwt-lib-master  File: DeleteContentObjectTool.java View source code
private static void showConfiramtionDialog(Panel parent, UIObject showRelativeTo, final PageLayoutC layout, final ContentObjectC object, final PageSyncManager syncManager, final SelectionManager selectionManager) {
    final DialogBox confirmationDialog = new DialogBox();
    final VerticalPanel vertPanel = new VerticalPanel();
    confirmationDialog.add(vertPanel);
    Label confirmLabel = new Label();
    vertPanel.add(confirmLabel);
    final HorizontalPanel horPanel = new HorizontalPanel();
    horPanel.setWidth("100%");
    horPanel.setSpacing(5);
    horPanel.setHorizontalAlignment(HorizontalAlignmentConstant.endOf(Direction.LTR));
    vertPanel.add(horPanel);
    Button buttonCancel = new Button("Cancel");
    horPanel.add(buttonCancel);
    buttonCancel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            confirmationDialog.hide();
        }
    });
    Button buttonDelete = new Button("Delete");
    horPanel.add(buttonDelete);
    buttonDelete.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            syncManager.deleteContentObject(object);
            layout.remove(object);
            selectionManager.clearSelection();
            confirmationDialog.hide();
        }
    });
    String text = "Delete selected ";
    if (object.getType() instanceof RegionType)
        text += "region";
    else if (LowLevelTextType.TextLine.equals(object.getType()))
        text += "text line";
    else if (LowLevelTextType.Word.equals(object.getType()))
        text += "word";
    else if (LowLevelTextType.Glyph.equals(object.getType()))
        text += "glyph";
    text += "?";
    confirmLabel.setText(text);
    parent.add(confirmationDialog);
    if (showRelativeTo != null)
        confirmationDialog.showRelativeTo(showRelativeTo);
    else
        confirmationDialog.show();
}
Example 86
Project: RedQueryBuilder-master  File: Comparison.java View source code
private void init() {
    HorizontalPanel v = new HorizontalPanel();
    v.addStyleName("rqbComparison");
    v.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    v.add(xleft);
    v.add(op);
    op.addValueChangeHandler(new ValueChangeHandler<Operator>() {

        @Override
        public void onValueChange(ValueChangeEvent<Operator> event) {
            setOperator(op.getValue());
            fireDirty();
        }
    });
    v.add(xright);
    v.add(remove);
    remove.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            remove();
            fireDirty();
        }
    });
    Button add = new Button("+");
    v.add(add);
    add.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            add();
            fireDirty();
        }
    });
    initWidget(v);
}
Example 87
Project: remote-connection-master  File: TextChatWidget.java View source code
private void buildUI() {
    VerticalPanel vl = new VerticalPanel();
    // Our id
    myid = new TextBox();
    myid.setValue("Connecting...");
    myid.setReadOnly(true);
    vl.add(myid);
    // Remote id
    final TextBox remoteId = new TextBox();
    Button connectToRemote = new Button("Connect", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            RemoteChannel channel = peer.openChannel(remoteId.getValue());
            channel.addConnectedListener(new ConnectedListener() {

                @Override
                public void connected(String channelId) {
                    remoteId.setReadOnly(true);
                    messages.setText(messages.getText() + "Connected to channel " + channelId + "\n");
                }
            });
        }
    });
    HorizontalPanel pnl = new HorizontalPanel();
    pnl.add(remoteId);
    pnl.add(connectToRemote);
    vl.add(pnl);
    // Message display where messages are displayed    	
    messages = new TextArea();
    messages.setReadOnly(true);
    messages.setWidth("400px");
    messages.setHeight("300px");
    vl.add(messages);
    // Message field
    final TextBox message = new TextBox();
    Button send = new Button("Send", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            // Show message in message window
            messages.setValue(messages.getValue() + peer.getConfiguration().getId() + " >> " + message.getValue() + "\n");
            // Broadcast the message to all connected peers
            peer.broadcast(message.getValue());
            message.setValue("");
        }
    });
    pnl = new HorizontalPanel();
    pnl.add(message);
    pnl.add(send);
    vl.add(pnl);
    initWidget(vl);
}
Example 88
Project: sigmah-master  File: ImportModelView.java View source code
@Override
public void initialize() {
    importPanel = Forms.panel();
    // importPanel.setLayout(Layouts.vBoxLayout());
    importPanel.setEncoding(Encoding.MULTIPART);
    importPanel.setMethod(Method.POST);
    importPanel.setBodyBorder(false);
    importPanel.setHeaderVisible(false);
    importPanel.setPadding(5);
    importPanel.setLabelWidth(120);
    importPanel.setFieldWidth(250);
    importPanel.setAutoHeight(true);
    importPanel.setAutoWidth(true);
    uploadField = new FileUploadField();
    uploadField.setAllowBlank(false);
    uploadField.setName(FileUploadUtils.DOCUMENT_CONTENT);
    uploadField.setFieldLabel(I18N.CONSTANTS.adminFileImport());
    importPanel.add(uploadField, Layouts.vBoxData());
    // Add project model type choice
    labelProjectModelType = new Label(I18N.CONSTANTS.adminProjectModelType());
    labelProjectModelType.setStyleAttribute("font-size", "12px");
    labelProjectModelType.setStyleAttribute("margin-right", "30px");
    projectModelTypeList = new ListBox();
    projectModelTypeList.setName("project-model-type");
    projectModelTypeList.setVisibleItemCount(1);
    projectModelTypeList.addItem(ProjectModelType.getName(ProjectModelType.NGO), "NGO");
    projectModelTypeList.addItem(ProjectModelType.getName(ProjectModelType.FUNDING), "FUNDING");
    projectModelTypeList.addItem(ProjectModelType.getName(ProjectModelType.LOCAL_PARTNER), "LOCAL_PARTNER");
    HorizontalPanel hProjectPanel = new HorizontalPanel();
    hProjectPanel.add(labelProjectModelType);
    hProjectPanel.add(projectModelTypeList);
    importPanel.add(hProjectPanel, Layouts.vBoxData());
    labelProjectModelType.hide();
    projectModelTypeList.setVisible(false);
    importButton = new Button(I18N.CONSTANTS.ok());
    cancelButton = new Button(I18N.CONSTANTS.cancel());
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.add(importButton);
    hPanel.add(cancelButton);
    importPanel.add(hPanel, Layouts.vBoxData());
    initPopup(importPanel);
}
Example 89
Project: similarity-for-message-threads-master  File: GadgetStatisticsPage.java View source code
public void onSuccess(Map<String, String> result) {
    Panel panel = null;
    Label lbl = null;
    generalContentPanelInfo.clear();
    panel = new HorizontalPanel();
    panel.addStyleName(STYLE_PANEL);
    lbl = new Label("Total number of words");
    lbl.addStyleName(STYLE_LABEL);
    panel.add(lbl);
    lbl = new Label(result.get("num-words"));
    lbl.addStyleName(STYLE_INFO);
    panel.add(lbl);
    generalContentPanelInfo.add(panel);
    panel = new HorizontalPanel();
    panel.addStyleName(STYLE_PANEL);
    lbl = new Label("Distinct words");
    lbl.addStyleName(STYLE_LABEL);
    panel.add(lbl);
    lbl = new Label(result.get("num-distinct-words"));
    lbl.addStyleName(STYLE_INFO);
    panel.add(lbl);
    generalContentPanelInfo.add(panel);
    panel = new HorizontalPanel();
    panel.addStyleName(STYLE_PANEL);
    lbl = new Label("Total number of boards");
    lbl.addStyleName(STYLE_LABEL);
    panel.add(lbl);
    lbl = new Label(result.get("num-boards"));
    lbl.addStyleName(STYLE_INFO);
    panel.add(lbl);
    generalContentPanelInfo.add(panel);
    panel = new HorizontalPanel();
    panel.addStyleName(STYLE_PANEL);
    lbl = new Label("Total number of discussions");
    lbl.addStyleName(STYLE_LABEL);
    panel.add(lbl);
    lbl = new Label(result.get("num-threads"));
    lbl.addStyleName(STYLE_INFO);
    panel.add(lbl);
    generalContentPanelInfo.add(panel);
    panel = new HorizontalPanel();
    panel.addStyleName(STYLE_PANEL);
    lbl = new Label("Total number of messages");
    lbl.addStyleName(STYLE_LABEL);
    panel.add(lbl);
    lbl = new Label(result.get("num-messages"));
    lbl.addStyleName(STYLE_INFO);
    panel.add(lbl);
    generalContentPanelInfo.add(panel);
    panel = new HorizontalPanel();
    panel.addStyleName(STYLE_PANEL);
    lbl = new Label("Invalid messages");
    lbl.addStyleName(STYLE_LABEL);
    panel.add(lbl);
    int numInvalid = Integer.parseInt(result.get("num-invalid-messages"));
    int numMessages = Integer.parseInt(result.get("num-messages"));
    float proc = (float) numInvalid * 100.0f / numMessages;
    lbl = new Label("" + numInvalid + "(" + FORMAT_FLOATS.format(proc) + " %)");
    lbl.addStyleName(STYLE_INFO);
    panel.add(lbl);
    generalContentPanelInfo.add(panel);
    panel = new HorizontalPanel();
    panel.addStyleName(STYLE_PANEL);
    lbl = new Label("Total number of users");
    lbl.addStyleName(STYLE_LABEL);
    panel.add(lbl);
    lbl = new Label(result.get("num-users"));
    lbl.addStyleName(STYLE_INFO);
    panel.add(lbl);
    generalContentPanelInfo.add(panel);
}
Example 90
Project: skWiki-master  File: IndexedDropController.java View source code
@Override
protected Widget newPositioner(DragContext context) {
    // Use two widgets so that setPixelSize() consistently affects dimensions
    // excluding positioner border in quirks and strict modes
    SimplePanel outer = new SimplePanel();
    outer.addStyleName(DragClientBundle.INSTANCE.css().positioner());
    // place off screen for border calculation
    RootPanel.get().add(outer, -500, -500);
    // Ensure IE quirks mode returns valid outer.offsetHeight, and thus valid
    // DOMUtil.getVerticalBorders(outer)
    outer.setWidget(DUMMY_LABEL_IE_QUIRKS_MODE_OFFSET_HEIGHT);
    int width = 0;
    int height = 0;
    if (dropTarget instanceof HorizontalPanel) {
        for (Widget widget : context.selectedWidgets) {
            width += widget.getOffsetWidth();
            height = Math.max(height, widget.getOffsetHeight());
        }
    } else {
        for (Widget widget : context.selectedWidgets) {
            width = Math.max(width, widget.getOffsetWidth());
            height += widget.getOffsetHeight();
        }
    }
    SimplePanel inner = new SimplePanel();
    inner.setPixelSize(width - DOMUtil.getHorizontalBorders(outer), height - DOMUtil.getVerticalBorders(outer));
    outer.setWidget(inner);
    return outer;
}
Example 91
Project: tools_gerrit-master  File: PagedSingleListScreen.java View source code
@Override
protected void onInitUI() {
    super.onInitUI();
    prev = new Hyperlink(Util.C.pagedChangeListPrev(), true, "");
    prev.setVisible(false);
    next = new Hyperlink(Util.C.pagedChangeListNext(), true, "");
    next.setVisible(false);
    table = new ChangeTable(true) {

        {
            keysNavigation.add(new DoLinkCommand(0, 'p', Util.C.changeTablePagePrev(), prev));
            keysNavigation.add(new DoLinkCommand(0, 'n', Util.C.changeTablePageNext(), next));
        }
    };
    section = new ChangeTable.Section(null, ApprovalViewType.STRONGEST, null);
    table.addSection(section);
    table.setSavePointerId(anchorPrefix);
    add(table);
    final HorizontalPanel buttons = new HorizontalPanel();
    buttons.setStyleName(Gerrit.RESOURCES.css().changeTablePrevNextLinks());
    buttons.add(prev);
    buttons.add(next);
    add(buttons);
}
Example 92
Project: utilities-master  File: AIntegerViewEditWidget.java View source code
@Override
protected final void onViewerUpdate() {
    boolean editable = isEditable();
    if (panel == null || (editable && panel.getWidgetCount() < 3) || (!editable && panel.getWidgetCount() > 1)) {
        panel = new HorizontalPanel();
        if (editable) {
            panel.add(minus.update());
            panel.add(Gwt.createNbsp());
        }
        panel.add(viewer);
        if (editable) {
            panel.add(Gwt.createNbsp());
            panel.add(plus.update());
        }
        wrapper.setWidget(panel);
    }
    onIntegerViewerUpdate();
}
Example 93
Project: werti-master  File: Categories.java View source code
/**
	 * Build a user interface for this component.
	 *
	 * This component allows selection of one enhancement method and several
	 * PoS tags as targets.
	 *
	 * @return A GWT <code>Widget</code> that allows the user to configure this task.
	 */
public Widget userInterface() {
    final VerticalPanel main = new VerticalPanel();
    final HorizontalPanel enhancements = new HorizontalPanel();
    final HorizontalPanel targets = new HorizontalPanel();
    targets.add(dets);
    targets.add(prps);
    dets.setChecked(true);
    final DisclosurePanel advanced = new DisclosurePanel("Advanced…");
    advanced.setAnimationEnabled(true);
    final VerticalPanel advancedContent = new VerticalPanel();
    advancedContent.add(new Label("Custom PoS Tags (comma separated)"));
    advancedContent.add(customCats);
    advanced.setContent(advancedContent);
    advanced.addEventHandler(new DisclosureHandler() {

        public void onClose(DisclosureEvent e) {
            toggleCats(true);
        }

        public void onOpen(DisclosureEvent e) {
            toggleCats(false);
        }

        private void toggleCats(boolean to) {
            dets.setEnabled(to);
            prps.setEnabled(to);
            customCats.setEnabled(!to);
        }
    });
    clr.setChecked(true);
    enhancements.add(clr);
    enhancements.add(ask);
    enhancements.add(fib);
    main.add(targets);
    main.add(advanced);
    main.add(enhancements);
    return main;
}
Example 94
Project: ahome-ace-master  File: AceDemo.java View source code
/**
	 * This method builds the UI. It creates UI widgets that exercise most/all of the AceEditor methods, so it's a bit of a kitchen sink.
	 */
private void buildUI() {
    VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.setWidth("100%");
    mainPanel.add(new Label("Label above!"));
    mainPanel.add(editor1);
    // Label to display current row/column
    rowColLabel = new InlineLabel("");
    mainPanel.add(rowColLabel);
    // Create some buttons for testing various editor APIs
    HorizontalPanel buttonPanel = new HorizontalPanel();
    // Add button to insert text at current cursor position
    Button insertTextButton = new Button("Insert");
    insertTextButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            // Window.alert("Cursor at: " + editor1.getCursorPosition());
            editor1.insertAtCursor("inserted text!");
        }
    });
    buttonPanel.add(insertTextButton);
    // Add check box to enable/disable soft tabs
    final CheckBox softTabsBox = new CheckBox("Soft tabs");
    // I think soft tabs is the default
    softTabsBox.setValue(true);
    softTabsBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editor1.setUseSoftTabs(softTabsBox.getValue());
        }
    });
    buttonPanel.add(softTabsBox);
    // add text box and button to set tab size
    final TextBox tabSizeTextBox = new TextBox();
    tabSizeTextBox.setWidth("4em");
    Button setTabSizeButton = new Button("Set tab size");
    setTabSizeButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editor1.setTabSize(Integer.parseInt(tabSizeTextBox.getText()));
        }
    });
    buttonPanel.add(new InlineLabel("Tab size: "));
    buttonPanel.add(tabSizeTextBox);
    buttonPanel.add(setTabSizeButton);
    // add text box and button to go to a given line
    final TextBox gotoLineTextBox = new TextBox();
    gotoLineTextBox.setWidth("4em");
    Button gotoLineButton = new Button("Go to line");
    gotoLineButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editor1.gotoLine(Integer.parseInt(gotoLineTextBox.getText()));
        }
    });
    buttonPanel.add(new InlineLabel("Go to line: "));
    buttonPanel.add(gotoLineTextBox);
    buttonPanel.add(gotoLineButton);
    // checkbox to set whether or not horizontal scrollbar is always visible
    final CheckBox hScrollBarAlwaysVisibleBox = new CheckBox("H scrollbar: ");
    hScrollBarAlwaysVisibleBox.setValue(true);
    hScrollBarAlwaysVisibleBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editor1.setHScrollBarAlwaysVisible(hScrollBarAlwaysVisibleBox.getValue());
        }
    });
    buttonPanel.add(hScrollBarAlwaysVisibleBox);
    // checkbox to show/hide gutter
    final CheckBox showGutterBox = new CheckBox("Show gutter: ");
    showGutterBox.setValue(true);
    showGutterBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editor1.setShowGutter(showGutterBox.getValue());
        }
    });
    buttonPanel.add(showGutterBox);
    // checkbox to set/unset readonly mode
    final CheckBox readOnlyBox = new CheckBox("Read only: ");
    readOnlyBox.setValue(false);
    readOnlyBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editor1.setReadOnly(readOnlyBox.getValue());
        }
    });
    buttonPanel.add(readOnlyBox);
    // checkbox to show/hide print margin
    final CheckBox showPrintMarginBox = new CheckBox("Show print margin: ");
    showPrintMarginBox.setValue(true);
    showPrintMarginBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editor1.setShowPrintMargin(showPrintMarginBox.getValue());
        }
    });
    buttonPanel.add(showPrintMarginBox);
    mainPanel.add(buttonPanel);
    mainPanel.add(editor2);
    mainPanel.add(new Label("Label below!"));
    RootPanel.get().add(mainPanel);
}
Example 95
Project: CellBots-master  File: WiimoteEntry.java View source code
@SuppressWarnings("deprecation")
public void onModuleLoad() {
    String path = Window.Location.getPath();
    if (path.endsWith("/"))
        path = path.substring(0, path.length() - 1);
    SENSORSTATE_URL = path + SENSORSTATE_URL;
    BOT_ID = Window.Location.getParameter("BOTID");
    Window.setTitle(BOT_ID + " Cellserv");
    final WiimoteServiceAsync wiiService = GWT.create(WiimoteService.class);
    final VerticalPanel mainPanel = new VerticalPanel();
    final VerticalPanel controlPanel = new VerticalPanel();
    final HorizontalPanel horizontalPanel = new HorizontalPanel();
    final HorizontalPanel hudPanel = new HorizontalPanel();
    final HorizontalPanel cmdPanel = new HorizontalPanel();
    final TextBox txtCommand = new TextBox();
    // txtCommand.setWidth("30em");
    debugConsole.setWidth("95%");
    debugConsole.setHeight("95%");
    txtCommand.addKeyPressHandler(new AndroidClickHandler(wiiService));
    final Timer elapsedTimer;
    final Timer sensorTimer;
    final Button fwdButton = new Button("FWD");
    fwdButton.addClickHandler(new AndroidClickHandler(wiiService, AndroidKeyCode.KEYCODE_DPAD_UP));
    final Button bkwdButton = new Button("BKWD");
    bkwdButton.addClickHandler(new AndroidClickHandler(wiiService, AndroidKeyCode.KEYCODE_DPAD_DOWN));
    final Button leftButton = new Button("LEFT");
    leftButton.addClickHandler(new AndroidClickHandler(wiiService, AndroidKeyCode.KEYCODE_DPAD_LEFT));
    final Button rightButton = new Button("RIGHT");
    rightButton.addClickHandler(new AndroidClickHandler(wiiService, AndroidKeyCode.KEYCODE_DPAD_RIGHT));
    final Button stopButton = new Button("STOP");
    stopButton.addClickHandler(new AndroidClickHandler(wiiService, AndroidKeyCode.KEYCODE_DPAD_CENTER));
    final Image videoImage = new Image(VIDEO_URL);
    videoImage.addErrorHandler(new ErrorHandler() {

        public void onError(ErrorEvent event) {
            dbg("could not load video frame");
        }
    });
    videoImage.setUrl("video");
    fwdButton.setWidth("100%");
    bkwdButton.setWidth("100%");
    horizontalPanel.add(leftButton);
    horizontalPanel.add(stopButton);
    horizontalPanel.add(rightButton);
    controlPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    controlPanel.add(fwdButton);
    controlPanel.add(horizontalPanel);
    controlPanel.add(bkwdButton);
    controlPanel.setHeight("64px");
    hudPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    hudPanel.setWidth("100%");
    hudPanel.add(controlPanel);
    hudPanel.add(canvas);
    hudPanel.add(debugConsole);
    hudPanel.setCellWidth(debugConsole, "50%");
    hudPanel.setCellWidth(controlPanel, "20%");
    cmdPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    cmdPanel.setWidth("100%");
    cmdPanel.add(cmdLabel);
    txtCommand.setWidth("32em");
    cmdPanel.add(txtCommand);
    hudPanel.setCellWidth(txtCommand, "60%");
    cmdPanel.add(messageLabel);
    mainPanel.setWidth("600px");
    mainPanel.setBorderWidth(2);
    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.add(videoImage);
    mainPanel.add(hudPanel);
    mainPanel.add(cmdPanel);
    RootPanel.get().add(mainPanel);
    // Create a new timer
    elapsedTimer = new Timer() {

        public void run() {
            loadingImg = true;
            videoImage.setUrl("video?BOTID=" + BOT_ID + "&ts=" + System.currentTimeMillis());
        }
    };
    /*  videoImage.addLoadListener(new LoadListener()
    {

      //do a bit of throttleing 
      public void onLoad(Widget sender)
      {
        // TODO Auto-generated method stub
        if (framePoleInterval > 50)
          framePoleInterval = framePoleInterval - 10;
        loadingImg = false;
        elapsedTimer.scheduleRepeating(framePoleInterval);
      }
      public void onError(Widget sender)
      {
        // TODO Auto-generated method stub
        loadingImg = false;
        if (framePoleInterval < 4000)
          framePoleInterval = framePoleInterval + 10;
        elapsedTimer.scheduleRepeating(framePoleInterval);

      }
    });*/
    // Create a new timer
    sensorTimer = new Timer() {

        public void run() {
            RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, SENSORSTATE_URL + "?BOTID=" + BOT_ID);
            try {
                builder.setHeader("Content-Type", "application/json");
                builder.sendRequest(null, new RequestCallback() {

                    public void onError(Request request, Throwable exception) {
                        dbg("Couldn't retrieve JSON");
                    }

                    public void onResponseReceived(Request request, Response response) {
                        if (response.getStatusCode() == 200)
                            showPhoneState(PhoneState.parse(response.getText()));
                        else
                            dbg("Couldn't retrieve JSON");
                    }
                });
            } catch (RequestException e) {
                dbg("Couldn't retrieve JSON");
            }
        }
    };
    elapsedTimer.scheduleRepeating(framePoleInterval);
    sensorTimer.scheduleRepeating(framePoleInterval * 2);
    drawCompass(0);
    drawBattery(50);
}
Example 96
Project: DendrytAA-master  File: ProblemOverview.java View source code
VerticalPanel generateLeftVerticalPanel() {
    VerticalPanel leftVerticalPanel = new VerticalPanel();
    leftVerticalPanel.add(new Label("LISTA PROBLEMOW"));
    leftVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    AbsolutePanel absolutePanel = new AbsolutePanel();
    leftVerticalPanel.add(absolutePanel);
    absolutePanel.setSize("250", "300");
    absolutePanel.add(_listBox);
    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    leftVerticalPanel.add(horizontalPanel_1);
    horizontalPanel_1.setWidth("200");
    Label label = new Label("Wyszukaj:");
    horizontalPanel_1.add(label);
    horizontalPanel_1.add(_suggestBox);
    _suggestBox.setWidth("120");
    leftVerticalPanel.add(_refreshListButton);
    return leftVerticalPanel;
}
Example 97
Project: fred-master  File: MessageManager.java View source code
/** Redraw the messages panel */
private void redrawMessages() {
    // Clear it first
    messagesPanel.clear();
    FreenetJs.log("REDRAWING MESSAGES");
    messagesPanel.getElement().getStyle().setProperty("background", "white");
    // Cycle through the messages
    for (int i = 0; i < messages.size(); i++) {
        final Message m = messages.get(i);
        FreenetJs.log("REDRAWING MESSAGE:" + m.getMsg());
        // The panel which will hold the message
        HorizontalPanel hpanel = new HorizontalPanel();
        // Sets the background color based on the priority
        switch(m.getPriority()) {
            case MINOR:
                hpanel.getElement().getStyle().setProperty("background", "green");
                break;
            case WARNING:
                hpanel.getElement().getStyle().setProperty("background", "yellow");
                break;
            case ERROR:
                hpanel.getElement().getStyle().setProperty("background", "orange");
                break;
            case CRITICAL:
                hpanel.getElement().getStyle().setProperty("background", "red");
                break;
        }
        // Sets some css properties
        hpanel.getElement().getStyle().setProperty("width", "100%");
        hpanel.getElement().getStyle().setProperty("height", "100%");
        hpanel.getElement().getStyle().setProperty("display", "block");
        hpanel.getElement().getStyle().setPropertyPx("padding", 3);
        // The short description label
        Label msgLabel = new Label(m.getMsg());
        hpanel.add(msgLabel);
        msgLabel.getElement().getParentElement().getStyle().setProperty("border", "none");
        if (m.getAnchor() != null) {
            Anchor showElement = new Anchor(L10n.get("show"), "/alerts/#" + m.getAnchor());
            hpanel.add(showElement);
            showElement.getElement().getParentElement().getStyle().setProperty("border", "none");
        }
        if (m.isCanDismiss()) {
            // The hide link, it will hide the message if clicked on
            Anchor hideElement = new Anchor(L10n.get("hide"));
            hideElement.addMouseDownHandler(new MouseDownHandler() {

                @Override
                public void onMouseDown(MouseDownEvent event) {
                    // Only send a request if the message is originated from the server
                    if (m.getAnchor() != null) {
                        FreenetRequest.sendRequest(UpdaterConstants.dismissAlertPath, new QueryParameter("anchor", m.getAnchor()), new RequestCallback() {

                            @Override
                            public void onResponseReceived(Request request, Response response) {
                                // When a response is got, the server is already removed the message. We can remove it too safely
                                removeMessage(m);
                            }

                            @Override
                            public void onError(Request request, Throwable exception) {
                            // Don't do anything. If the server removed the message, it will push the change, if not, the user will try again
                            }
                        });
                    } else {
                        // If it is originated from the client, then simply hide it
                        messages.remove(m);
                        redrawMessages();
                    }
                }
            });
            hpanel.add(hideElement);
            hideElement.getElement().getParentElement().getStyle().setProperty("border", "none");
        }
        // Adds the message to the panel
        messagesPanel.add(hpanel);
    }
}
Example 98
Project: geomajas-gwt2-quickstart-application-master  File: LayerLegend.java View source code
/**
	 * Get a fully build layer legend for a LayersModel.
	 *
	 * @param layerPopupPanelContent Original HTMLPanel
	 * @param layersModel LayersModel of the map
	 * @return HTMLPanel fully build legend.
	 */
private HTMLPanel getLayersLegend(HTMLPanel layerPopupPanelContent, LayersModel layersModel) {
    for (int i = 0; i < mapPresenter.getLayersModel().getLayerCount(); i++) {
        HTMLPanel layer = new HTMLPanel("");
        CheckBox visible = new CheckBox();
        final int finalI = i;
        visible.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                if (mapPresenter.getLayersModel().getLayer(finalI).isMarkedAsVisible()) {
                    mapPresenter.getLayersModel().getLayer(finalI).setMarkedAsVisible(false);
                } else {
                    mapPresenter.getLayersModel().getLayer(finalI).setMarkedAsVisible(true);
                }
            }
        });
        if (mapPresenter.getLayersModel().getLayer(i).isMarkedAsVisible()) {
            visible.setValue(true);
        }
        InlineLabel layerName = new InlineLabel(mapPresenter.getLayersModel().getLayer(i).getTitle());
        layer.add(visible);
        layer.add(layerName);
        layerPopupPanelContent.add(layer);
        ////////////////////////////////
        // Add legend items
        ////////////////////////////////
        Layer legendLayer = mapPresenter.getLayersModel().getLayer(i);
        if (legendLayer instanceof VectorServerLayerImpl) {
            VectorServerLayerImpl serverLayer = (VectorServerLayerImpl) legendLayer;
            String legendUrl = GeomajasServerExtension.getInstance().getEndPointService().getLegendServiceUrl();
            NamedStyleInfo styleInfo = serverLayer.getLayerInfo().getNamedStyleInfo();
            String name = serverLayer.getLayerInfo().getNamedStyleInfo().getName();
            int x = 0;
            for (FeatureTypeStyleInfo sfi : styleInfo.getUserStyle().getFeatureTypeStyleList()) {
                for (RuleInfo rInfo : sfi.getRuleList()) {
                    UrlBuilder url = new UrlBuilder(legendUrl);
                    url.addPath(serverLayer.getServerLayerId());
                    url.addPath(name);
                    url.addPath(x + ".png");
                    x++;
                    HorizontalPanel layout = new HorizontalPanel();
                    layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
                    layout.add(new Image(url.toString()));
                    Label labelUi = new Label(rInfo.getName());
                    labelUi.getElement().getStyle().setMarginLeft(5, Style.Unit.PX);
                    layout.add(labelUi);
                    layout.getElement().getStyle().setMarginLeft(20, Style.Unit.PX);
                    layout.getElement().getStyle().setMarginTop(3, Style.Unit.PX);
                    layerPopupPanelContent.add(layout);
                }
            }
        } else if (legendLayer instanceof RasterServerLayerImpl) {
            RasterServerLayerImpl serverLayer = (RasterServerLayerImpl) legendLayer;
            String legendUrl = GeomajasServerExtension.getInstance().getEndPointService().getLegendServiceUrl();
            UrlBuilder url = new UrlBuilder(legendUrl);
            url.addPath(serverLayer.getServerLayerId() + ".png");
            HorizontalPanel layout = new HorizontalPanel();
            layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            layout.add(new Image(url.toString()));
            Label labelUi = new Label("");
            labelUi.getElement().getStyle().setMarginLeft(5, Style.Unit.PX);
            layout.add(labelUi);
            layout.getElement().getStyle().setMarginLeft(20, Style.Unit.PX);
            layout.getElement().getStyle().setMarginTop(3, Style.Unit.PX);
            layerPopupPanelContent.add(layout);
        }
    }
    return layerPopupPanelContent;
}
Example 99
Project: goldenorb-master  File: OrbTrackerStatus.java View source code
@Override
public void onModuleLoad() {
    RootPanel rootPanel = RootPanel.get();
    mainPanel = new VerticalPanel();
    rootPanel.add(mainPanel);
    Image image = new Image("images/logo-full.jpg");
    mainPanel.add(image);
    // Label titleLabel = new Label("GoldenOrb");
    // mainPanel.add(titleLabel);
    lastUpdatedLabel = new Label("Last Updated : ");
    mainPanel.add(lastUpdatedLabel);
    Label lblOrbtrackermembers = new Label("OrbTrackerMembers");
    mainPanel.add(lblOrbtrackermembers);
    orbTrackerFlexTable = new FlexTable();
    mainPanel.add(orbTrackerFlexTable);
    orbTrackerFlexTable.setSize("761px", "116px");
    orbTrackerFlexTable.setText(0, 0, "Node Name");
    orbTrackerFlexTable.setText(0, 1, "Partition Capacity");
    orbTrackerFlexTable.setText(0, 2, "Available Partitions");
    orbTrackerFlexTable.setText(0, 3, "Reserved Partitions");
    orbTrackerFlexTable.setText(0, 4, "In Use Partitions");
    orbTrackerFlexTable.setText(0, 5, "Host Name");
    orbTrackerFlexTable.setText(0, 6, "Leader");
    orbTrackerFlexTable.setText(0, 7, "Port");
    jobsGroupedPanel = new HorizontalPanel();
    mainPanel.add(jobsGroupedPanel);
    jobsGroupedPanel.setSize("258px", "100px");
    jobsInProgressPanel = new FlexTable();
    jobsInProgressPanel.setText(0, 0, "Jobs In Progress");
    jobsGroupedPanel.add(jobsInProgressPanel);
    jobsInQueuePanel = new FlexTable();
    jobsInQueuePanel.setText(0, 0, "Jobs In Queue");
    jobsGroupedPanel.add(jobsInQueuePanel);
    jobsInProgressPanel.setTitle("Jobs In Progress");
    jobsInQueuePanel.setTitle("Jobs in Queue");
    errorLabelOTM = new Label("");
    mainPanel.add(errorLabelOTM);
    errorLabelJIP = new Label("");
    mainPanel.add(errorLabelJIP);
    errorLabelJQ = new Label("");
    mainPanel.add(errorLabelJQ);
    Timer refreshTimer = new Timer() {

        public void run() {
            refreshWatchDataList();
            refreshJobsInProgress();
            refreshJobsInQueue();
        }
    };
    refreshTimer.scheduleRepeating(REFRESH_INTERVAL);
}
Example 100
Project: gotefarm-master  File: Guilds.java View source code
void showGuilds(JSAccount account) {
    vpanel.clear();
    final HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setWidth("100%");
    final ListBox lb = new ListBox();
    hpanel.add(lb);
    hpanel.add(flex);
    lb.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            final int index = lb.getSelectedIndex();
            if (index < 0) {
                return;
            }
            final String key = lb.getValue(index);
            GoteFarm.goteService.setActiveGuild(key, new AsyncCallback<JSGuild>() {

                public void onSuccess(JSGuild guild) {
                    // Update cached JSGuild with this latest one
                    refreshGuild(guild);
                    // Update active_guild
                    Guilds.this.account.active_guild = guild;
                    setValue(Guilds.this.account.active_guild, true);
                }

                public void onFailure(Throwable caught) {
                // TODO: show error message
                }
            });
        }
    });
    lb.setVisibleItemCount(5);
    for (JSGuild g : account.guilds) {
        lb.addItem(g.name, g.key);
        if (account.active_guild != null && g.key.equals(account.active_guild.key)) {
            lb.setSelectedIndex(lb.getItemCount() - 1);
        }
    }
    vpanel.add(hpanel);
    // TODO: Add a way for a user to add additional guilds
    setValue(account.active_guild, true);
}
Example 101
Project: gwt-marketplace-master  File: EditProductPage.java View source code
@Override
protected void onConstruct(HorizontalPanel view) {
    name.getComponent().setEnabled(false);
    this.containerPanel = view;
    descriptionToolbarContainer.add(new RichTextToolbar(description));
    WidgetUtil.load(status.getComponent(), Status.VALUES, "Choose a status");
    WidgetUtil.load(license.getComponent(), License.VALUES, "Choose a license");
    saveBtn.addClickHandler(this);
    cancelBtn.addClickHandler(this);
    new GetProductCategoriesCommand() {

        @Override
        public void onSuccess(ArrayList<Category> result) {
            WidgetUtil.load(category.getComponent(), result, "Select a category");
        }
    }.execute();
}