Example usage for com.google.gwt.user.client.ui CheckBox CheckBox

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

Introduction

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

Prototype

protected CheckBox(Element elem) 

Source Link

Usage

From source file:carteirainveste.client.DateUtil.java

License:Creative Commons License

SummaryAsset(String aName) {
    Carteira curr = CarteiraInveste.carteiraAtual;
    assetName = aName;//from w ww .j av  a 2s. c o m
    checkBox = new CheckBox(aName);
    checkBox.setValue(true);
    checkBox.addValueChangeHandler(curr.summaryAssetHandler);
}

From source file:com.achow101.bittipaddr.client.bittipaddr.java

License:Open Source License

/**
 * This is the entry point method./*from  w w  w  .j a  v  a2 s  . c  o  m*/
 */
public void onModuleLoad() {

    // Add textboxes
    TextBox unitLookupBox = new TextBox();
    TextBox unitPassBox = new TextBox();
    TextBox xpubBox = new TextBox();
    xpubBox.setWidth("600");
    TextArea addrsArea = new TextArea();
    addrsArea.setWidth("300");
    addrsArea.setHeight("300");

    // Checkbox to enable editing with lookup
    CheckBox submitEdit = new CheckBox("Submit changes after clicking button");
    CheckBox allowEdit = new CheckBox("Allow editing the unit");

    // Add text elements
    HTML output = new HTML();

    // Create Button
    Button submitBtn = new Button("Submit");

    submitBtn.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {

            // Clear previous output
            output.setHTML("");

            // Get entered data and some prelim checking
            String xpub = xpubBox.getText();
            String pass = unitPassBox.getText();
            String unit = unitLookupBox.getText();
            String[] addrs = addrsArea.getText().split("\n");
            if (!xpub.isEmpty() && !addrs[0].isEmpty() && unit.isEmpty() && pass.isEmpty()) {
                output.setHTML("<p style=\"color:red;\">Cannot set both xpub and a list of addresses</p>");
                return;
            }

            // Send to server
            AddrReq req = new AddrReq();
            if (!unit.isEmpty()) {
                req.setId(unit);
                req.setPassword(pass);
                req.setEditable(allowEdit.getValue());
                if (edited) {
                    if (xpub.isEmpty()) {
                        output.setHTML(
                                "<p style=\"color:red;\">Must have an xpub. Set as \"NONE\" (without quotes) if no xpub</p>");
                        return;
                    }

                    req.setEdited();
                    req.setAddresses(addrs);
                    req.setXpub(xpub.isEmpty() ? "NONE" : xpub);
                }
            } else if (!xpub.isEmpty()) {
                req = new AddrReq(xpub);
            } else if (addrs.length != 0) {
                req = new AddrReq(addrs);
            }
            bittipaddrService.App.getInstance().addAddresses(req,
                    new AddAddrAsyncCallback(output, xpubBox, addrsArea));
        }
    });

    // Add to html
    RootPanel.get("submitBtn").add(submitBtn);
    RootPanel.get("unitLookup").add(unitLookupBox);
    RootPanel.get("unitPass").add(unitPassBox);
    RootPanel.get("enterxpub").add(xpubBox);
    RootPanel.get("enterAddrList").add(addrsArea);
    RootPanel.get("completedReqOutput").add(output);
    RootPanel.get("edit").add(submitEdit);
    RootPanel.get("allowEdit").add(allowEdit);
}

From source file:com.ait.toolkit.ace.examples.client.AceDemo.java

License:Open Source License

/**
 * 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.
 *///from  ww w. j  a  v a  2 s  .co  m
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");
    softTabsBox.setValue(true); // I think soft tabs is the default
    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);
}

From source file:com.akjava.gwt.threetest.client.DragDemo.java

License:Apache License

@Override
public Widget getControler() {
    if (exportButton == null) {
        exportButton = new CheckBox("visible mouse-detect plane");
        exportButton.addClickHandler(new ClickHandler() {

            @Override/*from www.  j a  va2 s . c  o  m*/
            public void onClick(ClickEvent event) {
                dragObjectControler.getMouseCatchPlane().setVisible(exportButton.getValue());
            }
        });
    }
    return exportButton;
}

From source file:com.allen_sauer.gwt.dnd.demo.client.example.palette.PaletteExample.java

License:Apache License

public PaletteExample(DemoDragHandler demoDragHandler) {
    addStyleName(CSS_DEMO_PALETTE_EXAMPLE);

    // use the boundary panel as this composite's widget
    AbsolutePanel boundaryPanel = new AbsolutePanel();
    boundaryPanel.setPixelSize(500, 300);
    setWidget(boundaryPanel);//from   www.  jav a  2s .  c o  m

    dragController = new PickupDragController(boundaryPanel, true);
    dragController.setBehaviorMultipleSelection(false);
    dragController.setBehaviorDragProxy(false);
    dragController.setBehaviorConstrainedToBoundaryPanel(true);
    dragController.addDragHandler(demoDragHandler);

    PalettePanel palette = new PalettePanel(dragController);
    palette.add(new PaletteWidget(new Label("New Label")));
    palette.add(new PaletteWidget(new RadioButton("name", "New Radio Button")));
    palette.add(new PaletteWidget(new CheckBox("New Check Box")));
    boundaryPanel.add(palette, 10, 10);
}

From source file:com.anzsoft.client.ui.LoginForm.java

License:Open Source License

private Widget createAdvancedForm() {
    iJabConstants constants = (iJabConstants) GWT.create(iJabConstants.class);
    // Create a table to layout the form options
    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);//from   w ww  .java 2  s  . co m
    layout.setWidth("300px");
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();

    // Add a title to the form
    /*
    layout.setHTML(0, 0,constants.iJabLogin());
    cellFormatter.setColSpan(0, 0, 2);
    cellFormatter.setHorizontalAlignment(0, 0,
        HasHorizontalAlignment.ALIGN_CENTER);
    */
    // Add some standard form options
    final TextBox userBox = new TextBox();
    userBox.setText("imdev");
    layout.setHTML(0, 0, constants.user());
    layout.setWidget(0, 1, userBox);
    final PasswordTextBox passBox = new PasswordTextBox();
    passBox.setText("imdev631");

    layout.setHTML(1, 0, constants.password());
    layout.setWidget(1, 1, passBox);

    // Create some advanced options
    Grid advancedOptions = new Grid(5, 2);
    advancedOptions.setCellSpacing(6);

    final TextBox hostBox = new TextBox();
    final TextBox portBox = new TextBox();
    final TextBox domainBox = new TextBox();
    final CheckBox authCheck = new CheckBox("SASL");
    authCheck.setChecked(false);

    hostBox.setEnabled(false);
    portBox.setEnabled(false);
    domainBox.setEnabled(false);
    authCheck.setEnabled(false);

    final CheckBox serverConfig = new CheckBox(constants.defineServerConfig());
    advancedOptions.setWidget(0, 0, serverConfig);
    serverConfig.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (serverConfig.isChecked()) {
                hostBox.setEnabled(true);
                portBox.setEnabled(true);
                domainBox.setEnabled(true);
                authCheck.setEnabled(true);
            } else {
                hostBox.setEnabled(false);
                portBox.setEnabled(false);
                domainBox.setEnabled(false);
                authCheck.setEnabled(false);
            }

        }

    });

    serverConfig.setChecked(false);

    advancedOptions.setHTML(1, 0, constants.domain());
    advancedOptions.setWidget(1, 1, hostBox);

    advancedOptions.setHTML(2, 0, constants.host());
    advancedOptions.setWidget(2, 1, portBox);

    advancedOptions.setHTML(3, 0, constants.port());
    advancedOptions.setWidget(3, 1, domainBox);

    advancedOptions.setWidget(4, 0, authCheck);

    // Add advanced options to form in a disclosure panel
    DisclosurePanel advancedDisclosure = new DisclosurePanel(constants.moreOptions());
    advancedDisclosure.setAnimationEnabled(true);
    advancedDisclosure.ensureDebugId("cwDisclosurePanel");
    advancedDisclosure.setContent(advancedOptions);
    layout.setWidget(2, 0, advancedDisclosure);

    Button loginButton = new Button(constants.login());

    layout.setWidget(3, 0, loginButton);
    loginButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
        public void componentSelected(ButtonEvent ce) {
            String user = userBox.getText();
            String pass = passBox.getText();
            String domain = domainBox.getText();
            String host = domainBox.getText();
            boolean sasl = authCheck.isChecked();
            if (serverConfig.isChecked()) {
                int port = Integer.parseInt(portBox.getText());
                //JabberApp.instance().onLogin(host, port, domain, sasl, user, pass);
            } else {
                //JabberApp.instance().onLogin(user, pass);
            }
        }

    });

    cellFormatter.setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER);

    cellFormatter.setColSpan(3, 0, 2);

    return layout;
}

From source file:com.blackducksoftware.tools.commonframework.core.gwt.ui.StandardLoginScreen.java

License:Open Source License

/**
 * Builds the remember me check box./*w  w  w  . j  a v  a  2  s.  c om*/
 *
 * @return the check box
 */
@SuppressWarnings("deprecation")
private CheckBox buildRememberMeCheckBox() {
    CheckBox rememberMeCheckBox = new CheckBox("Remember me please!");
    rememberMeCheckBox.setStyleName("gwt-Login-RememberMe");
    rememberMeCheckBox.setChecked(true);
    rememberMeCheckBox.setSize("157px", "20px");
    return rememberMeCheckBox;
}

From source file:com.calclab.emite.example.pingpong.client.PingPongWidget.java

License:Open Source License

public PingPongWidget() {
    maxOutput = 500;/* w ww. j a v a2  s .  c o m*/
    hideEvents = true;
    header = new VerticalPanel();
    add(header);
    currentUser = new Label("no user yet.");
    sessionStatus = new Label("no session status yet.");
    final FlowPanel status = new FlowPanel();
    status.add(currentUser);
    status.add(sessionStatus);
    add(status);
    login = new Button("Login");
    logout = new Button("Logout");
    clear = new Button("Clear");
    final CheckBox hideEventsCheck = new CheckBox("Hide events");
    buttons = new FlowPanel();
    buttons.add(login);
    buttons.add(logout);
    buttons.add(clear);
    buttons.add(hideEventsCheck);
    add(buttons);
    output = new VerticalPanel();
    add(output);

    hideEventsCheck.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(final ValueChangeEvent<Boolean> event) {
            hideEvents = event.getValue();
            final int widgetCount = output.getWidgetCount();
            for (int index = 0; index < widgetCount; index++) {
                final Widget w = output.getWidget(index);
                if (isEventWidget(w)) {
                    w.setVisible(!hideEvents);
                }
            }
        }
    });
    hideEventsCheck.setValue(hideEvents);
}

From source file:com.cognitivemedicine.metricsdashboard.client.charts.ChartEditorPanel.java

License:Apache License

public ChartEditorPanel(ChartWidget parent, DashboardController dashboardController,
        DashboardSettings dashboardSettings, ChartSettings chartSettings) {
    this.parentWidget = parent;
    this.controller = dashboardController;

    String parentId = parent.getElement().getId();

    titleBox = new TextBox();
    titleBox.getElement().setId(parentId + "chartTitleBox");

    periodList = new ListBox();
    periodList.setVisibleItemCount(1);/*from  w w  w . ja va 2  s  .com*/
    periodList.getElement().setId(parentId + "periodList");
    for (Period p : Period.values()) {
        periodList.addItem(p.getDisplayValue(), p.getSymbol());
    }

    datetimePicker = new CalendarPicker(parentId, true);

    granularityList = new ListBox();
    granularityList.setVisibleItemCount(1);
    granularityList.getElement().setId(parentId + "granularityList");
    granularityList.addItem("", "");
    for (Granularity g : Granularity.values()) {
        granularityList.addItem(g.getDisplayValue(), g.getSymbol());
    }

    metricGroupList = new ListBox();
    metricGroupList.setVisibleItemCount(1);
    metricGroupList.getElement().setId(parentId + "groupList");
    //        for (MetricGroup g : controller.getMetricsGroups().values()) {
    //            metricGroupList.addItem(g.getName(), g.getName());
    //        }
    metricGroupList.addItem(ALL_METRICS);
    for (String g : controller.getMetaGroupMap().keySet()) {
        metricGroupList.addItem(g, g);
    }
    metricGroupList.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            metricGroupListChanged();
        }
    });

    availableMetricsList = new MultiSelectListBox();
    availableMetricsList.setVisibleItemCount(6);
    availableMetricsList.getElement().setId(parentId + "availableMetricsList");
    //        for (Metric m : controller.getAvailableMetrics().values()) {
    //            availableMetricsList.addItem(m.getName(), m.getName());
    //        }
    for (MetaDefinition m : controller.getMetaDefinitions()) {
        availableMetricsList.addItem(m.toString(), m.toString());
    }

    chartTypeList = new ListBox();
    chartTypeList.setVisibleItemCount(1);
    chartTypeList.getElement().setId(parentId + "chartTypeList");
    for (ChartType c : ChartType.values()) {
        chartTypeList.addItem(c.name());
    }

    liveUpdatesCheckBox = new CheckBox("Live Updates");
    liveUpdatesCheckBox.getElement().setId(parentId + "liveUpdatesCheckBox");

    if (chartSettings != null) {
        loadChartSettings(chartSettings);
    }

    dashboardSettingsUpdated(dashboardSettings);

    mainPanel = new VerticalPanel();
    mainPanel.setSpacing(4);
    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    // this.add(createFormPanel("Title", titleBox));
    HorizontalPanel titlePanel = new HorizontalPanel();
    HTML titleLabel = new HTML("Title" + ": ");
    titleLabel.setWidth("115px");
    titleBox.setWidth("265px");
    titlePanel.add(titleLabel);
    titlePanel.add(titleBox);
    titlePanel.setCellHorizontalAlignment(titleLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    mainPanel.add(titlePanel);
    mainPanel.add(new HTML("<hr>"));
    mainPanel.add(createFormPanel("Metric", metricGroupList));
    mainPanel.add(createFormPanel("Supported Queries", availableMetricsList));
    //        mainPanel.add(createFormPanel("Chart Type", chartTypeList));
    mainPanel.add(new HTML("<hr>"));
    mainPanel.add(createFormPanel("Period", periodList));
    mainPanel.add(datetimePicker);
    mainPanel.add(new HTML("<hr>"));
    mainPanel.add(createFormPanel("Granularity", granularityList));
    // mainPanel.add(new HTML("<hr>"));
    HorizontalPanel updatePanel = new HorizontalPanel();
    HTML updateLabel = new HTML("Live Updates: ");
    updateLabel.setWidth("115px");
    //        titleBox.setWidth("190px");
    // updatePanel.add(updateLabel);
    updatePanel.add(liveUpdatesCheckBox);
    updatePanel.setCellHorizontalAlignment(updateLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    // mainPanel.add(updatePanel);

    this.setHeight("100%");
    this.setWidth("100%");
    this.add(mainPanel);
    this.setCellHorizontalAlignment(mainPanel, HasHorizontalAlignment.ALIGN_CENTER);
    this.setCellVerticalAlignment(mainPanel, HasVerticalAlignment.ALIGN_MIDDLE);

    // this.add(new HTML(, liveUpdatesCheckBox));
    // this.add(buttonPanel);
    // this.setCellHorizontalAlignment(buttonPanel,HasHorizontalAlignment.ALIGN_CENTER);
}

From source file:com.controlj.addon.gwttree.client.TreeManager.java

License:Open Source License

private TreeItem createTreeItem(final TreeEntry entry) {
    TreeItem item = new TreeItem();
    if (!entry.hasTrendSources())
        item.setText(entry.getName());/*from  w w w.j  a  v  a 2s. co  m*/
    else {
        CheckBox checkBox = new CheckBox(entry.getName());
        checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
            @Override
            public void onValueChange(ValueChangeEvent<Boolean> event) {
                if (event.getValue())
                    checkedEntries.add(entry);
                else
                    checkedEntries.remove(entry);
                listener.selectionChanged();
            }
        });
        item.setWidget(checkBox);
    }

    item.setUserObject(entry);
    return item;
}