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:asquare.gwt.tests.focus.client.Demo.java

License:Apache License

private Widget createFocusPanel() {
    Table outer = new Table();

    outer.add(new FocusPanel(new Label("Label in a FocusPanel")));
    outer.add(new Button("Button"));
    outer.add(new CheckBox("CheckBox"));
    outer.add(new TextBox());
    outer.add(new PasswordTextBox());
    outer.add(new TextArea());
    outer.add(new RadioButton("group1", "RadioButton1"));
    outer.add(new RadioButton("group1", "RadioButton2"));
    ListBox listBox1 = new ListBox();
    listBox1.addItem("ListBox1");
    listBox1.addItem("item2");
    listBox1.addItem("item3");
    outer.add(listBox1);//from   w w w . java2 s. c  o m
    ListBox listBox2 = new ListBox(true);
    listBox2.setVisibleItemCount(3);
    listBox2.addItem("ListBox2");
    listBox2.addItem("item2");
    listBox2.addItem("item3");
    outer.add(listBox2);
    Tree tree = new Tree();
    tree.addItem("Tree");
    tree.addItem("item2");
    tree.addItem("item3");
    outer.add(tree);

    return outer;
}

From source file:asquare.gwt.tests.focusevent.client.Demo.java

License:Apache License

private Widget createDemoPanel() {
    TestPanel outer = new TestPanel();

    outer.add(new Label("GWT onfocus Event Handler"));
    outer.add(new Button("Button"), "Button");
    outer.add(new CheckBox("CheckBox"), "CheckBox");
    outer.add(new RadioButton("group1", "RadioButton1"), "RadioButton1");
    TextBox textBox = new TextBox();
    textBox.setText("TextBox");
    outer.add(textBox, "TextBox");
    PasswordTextBox passwordTextBox = new PasswordTextBox();
    passwordTextBox.setText("PasswordTextBox");
    outer.add(passwordTextBox, "PasswordTextBox");
    TextArea textArea = new TextArea();
    textArea.setText("TextArea");
    outer.add(textArea, "TextArea");
    ListBox listBox = new ListBox();
    listBox.addItem("ListBox");
    listBox.addItem("item2");
    listBox.addItem("item3");
    outer.add(listBox, "ListBox");
    outer.add(new FocusPanel(new Label("Label in a FocusPanel")), "FocusPanel");
    Tree tree = new Tree();
    tree.addItem("item1");
    tree.addItem("item2");
    tree.addItem("item3");
    outer.add(tree, "Tree");

    return outer;
}

From source file:asquare.gwt.tk.demo.client.DebugPanel.java

License:Apache License

private void addCheckBox(ComplexPanel parent, String label, int mask, ClickListener listener) {
    CheckBox cb = new CheckBox(label);
    cb.setChecked((m_eventListener.getEventMask() & mask) != 0);
    cb.addClickListener(listener);/*from w w w  .j a  v  a  2  s  . c  om*/
    parent.add(cb);
    DOM.appendChild(parent.getElement(), DOM.createElement("br"));
}

From source file:asquare.gwt.tkdemo.client.demos.DebugPanel.java

License:Apache License

private void addCheckBox(ColumnPanel parent, String label, int mask, ClickHandler listener) {
    CheckBox cb = new CheckBox(label);
    DomUtil.setStyleAttribute(cb, "display", "block");
    DomUtil.setStyleAttribute(cb, "whiteSpace", "nowrap");
    cb.setValue((m_eventListener.getEventMask() & mask) != 0);
    cb.addClickHandler(listener);/* ww  w . j  a v  a  2s.  c  o m*/
    parent.addWidget(cb, false);
}

From source file:asquare.gwt.tkdemo.client.demos.EventsPanel.java

License:Apache License

private static Collection<Widget> createSomeWidgets() {
    ArrayList<Widget> result = new ArrayList<Widget>();
    result.add(new HTML("<b>Double-click a widget to select it</b>"));
    result.add(new Button("Button"));
    result.add(new CheckBox("CheckBox"));
    result.add(new RadioButton("group", "RadioButton"));
    result.add(new SimpleHyperLink("SimpleHyperLink"));
    TextBox tb = new TextBox();
    tb.setText("TextBox");
    result.add(tb);// w  w  w. j a v  a  2 s. c  o m
    PasswordTextBox ptb = new PasswordTextBox();
    ptb.setText("PasswordTextBox");
    result.add(ptb);
    return result;
}

From source file:asquare.gwt.tkdemo.client.demos.FocusCycleDemo.java

License:Apache License

private Widget createFocusCycle1() {
    FocusCyclePanel cycle1 = new FocusCyclePanel("div", "block");

    cycle1.add(new Label("Cycle 1"));

    cycle1.add(new FocusStyleDecorator(new Button("Button")));

    Button buttonDisabled = new Button("disabled");
    buttonDisabled.setEnabled(false);//from   w  w  w.j  av a 2 s .com
    cycle1.add(new FocusStyleDecorator(buttonDisabled));

    Button buttonNegativeTabIndex = new Button("tabIndex = -1");
    buttonNegativeTabIndex.setTabIndex(-1);
    cycle1.add(new FocusStyleDecorator(buttonNegativeTabIndex));

    cycle1.add(new FocusStyleDecorator(new CheckBox("CheckBox")));

    cycle1.add(new FocusStyleDecorator(new FocusPanel(new Label("FocusPanel"))));

    ListBox listBox = new ListBox();
    listBox.addItem("ListBox");
    listBox.addItem("Item 1");
    listBox.addItem("Item 2");
    listBox.addItem("Item 3");
    cycle1.add(new FocusStyleDecorator(listBox));

    TextBox textBox = new TextBox();
    textBox.setText("TextBox");
    cycle1.add(new FocusStyleDecorator(textBox));

    PasswordTextBox pwBox = new PasswordTextBox();
    pwBox.setText("PasswordTextBox");
    cycle1.add(new FocusStyleDecorator(pwBox));

    TextArea textArea = new TextArea();
    textArea.setText("TextArea");
    cycle1.add(new FocusStyleDecorator(textArea));

    Tree tree = new Tree();
    TreeItem treeRoot = new TreeItem("Tree");
    for (int branchNum = 1; branchNum < 4; branchNum++) {
        TreeItem branch = new TreeItem("Branch " + branchNum);
        for (int item = 1; item < 4; item++) {
            branch.addItem("Item " + item);
        }
        treeRoot.addItem(branch);
    }
    tree.addItem(treeRoot);
    cycle1.add(new FocusStyleDecorator(tree));

    new WidgetFocusStyleController(cycle1.getFocusModel());

    return cycle1;
}

From source file:ca.upei.ic.timetable.client.DepartmentModelView.java

License:Apache License

public void loadJSON(JSONValue value) {
    JSONArray array = (JSONArray) value;

    // iterate all json results
    for (int i = 0; i < array.size(); i++) {
        JSONString s = (JSONString) array.get(i);
        CheckBox box = new CheckBox(s.stringValue());
        box.setName(s.stringValue());/*from  w  w w . j a  va 2s  .c  o  m*/
        // add the click listener
        box.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                final CheckBox box = (CheckBox) sender;
                final String name = box.getName();
                controller_.setDepartmentCriteria(name, box.isChecked());
            }

        });
        panel_.add(box);
    }
}

From source file:ca.upei.ic.timetable.client.LevelModelView.java

License:Apache License

public void loadJSON(JSONValue value) {
    JSONArray array = (JSONArray) value;
    // load the values
    for (int i = 0; i < array.size(); i++) {
        // set value and name
        JSONString s = (JSONString) array.get(i);
        CheckBox box = new CheckBox("Level " + s.stringValue());
        box.setName(s.stringValue()); // to store the value
        box.setChecked(true);//from   w  w  w  .ja  v a2 s  .co  m
        controller_.setLevelCriteria(s.stringValue(), true);

        // add click listener
        box.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                final CheckBox box = (CheckBox) sender;
                final String name = box.getName();
                controller_.setLevelCriteria(name, box.isChecked());
            }

        });

        panel_.add(box);
    }
}

From source file:ca.upei.ic.timetable.client.SemesterModelView.java

License:Apache License

public void loadJSON(JSONValue value) {
    JSONArray array = (JSONArray) value;

    // get the current month
    int month = new Date().getMonth() + 1;

    // iterate all json results
    for (int i = 0; i < array.size(); i++) {
        JSONString s = (JSONString) array.get(i);
        String name = s.stringValue();

        CheckBox box = new CheckBox(name);
        box.setName(name);/* w  w  w.  j a  v a  2  s  .co m*/
        if (name.equals("First Semester") && month > 6 && month < 11) {
            box.setChecked(true);
            controller_.setSemesterCriteria(name, true);
        }
        if (name.equals("Second Semester") && (month > 10 || month < 4)) {
            box.setChecked(true);
            controller_.setSemesterCriteria(name, true);
        }
        // add the click listener
        box.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                final CheckBox box = (CheckBox) sender;
                final String name = box.getName();
                controller_.setSemesterCriteria(name, box.isChecked());
            }

        });
        panel_.add(box);
    }
}

From source file:carteirainveste.client.DateUtil.java

License:Creative Commons License

SummaryAccount(String accName) {
    Carteira curr = CarteiraInveste.carteiraAtual;
    accountName = accName;//from w  w  w. j a v  a 2s .  c om
    checkBox = new CheckBox(accName);
    checkBox.setValue(true);
    checkBox.addValueChangeHandler(curr.summaryAccountHandler);
}