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

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

Introduction

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

Prototype

public SimpleCheckBox() 

Source Link

Document

Creates a new simple checkbox.

Usage

From source file:com.dawg6.web.dhcalc.client.BuffPanel.java

License:Open Source License

public BuffPanel() {

    CaptionPanel cptnpnlNewPanel = new CaptionPanel("Follower Buffs");
    initWidget(cptnpnlNewPanel);/*  w w  w  . j  a  v a 2 s. c o m*/

    FlexTable flexTable = new FlexTable();
    cptnpnlNewPanel.setContentWidget(flexTable);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setSpacing(5);
    flexTable.setWidget(0, 0, horizontalPanel);

    Label lblNewLabel = new Label("Enchantress");
    horizontalPanel.add(lblNewLabel);

    Anchor anchor = new Anchor("Focused Mind:");
    anchor.setTarget("_blank");
    anchor.setHref("http://us.battle.net/d3/en/follower/enchantress/skill/focused-mind");
    horizontalPanel.add(anchor);

    Label lblNewLabel_1 = new Label((String) null);
    horizontalPanel.add(lblNewLabel_1);

    focusedMind = new SimpleCheckBox();
    flexTable.setWidget(0, 1, focusedMind);

    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_1.setSpacing(5);
    flexTable.setWidget(1, 0, horizontalPanel_1);

    Label lblScoundrel = new Label("Scoundrel");
    horizontalPanel_1.add(lblScoundrel);

    Anchor anchor_1 = new Anchor("Anatomy:");
    anchor_1.setTarget("_blank");
    anchor_1.setHref("http://us.battle.net/d3/en/follower/scoundrel/skill/anatomy");
    horizontalPanel_1.add(anchor_1);

    anatomy = new SimpleCheckBox();
    flexTable.setWidget(1, 1, anatomy);

    HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_2.setSpacing(5);
    flexTable.setWidget(2, 0, horizontalPanel_2);

    Label label = new Label("Scoundrel");
    horizontalPanel_2.add(label);

    Anchor anchor_2 = new Anchor("Hysteria:");
    anchor_2.setTarget("_blank");
    anchor_2.setHref("http://us.battle.net/d3/en/follower/scoundrel/skill/hysteria");
    horizontalPanel_2.add(anchor_2);

    hysteria = new SimpleCheckBox();
    flexTable.setWidget(2, 1, hysteria);

    HorizontalPanel horizontalPanel_3 = new HorizontalPanel();
    horizontalPanel_3.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_3.setSpacing(5);
    flexTable.setWidget(3, 0, horizontalPanel_3);

    Label lblTemplar = new Label("Templar");
    horizontalPanel_3.add(lblTemplar);

    Anchor anchor_3 = new Anchor("Hysteria:");
    anchor_3.setHTML("Inspire:");
    anchor_3.setText("Inspire:");
    anchor_3.setTarget("_blank");
    anchor_3.setHref("http://us.battle.net/d3/en/follower/templar/skill/inspire");
    horizontalPanel_3.add(anchor_3);

    inspire = new SimpleCheckBox();
    flexTable.setWidget(3, 1, inspire);
}

From source file:com.dawg6.web.dhcalc.client.ItemPanel.java

License:Open Source License

public ItemPanel() {

    disableListeners = false;//  w w  w . j a v a2s  .c o m

    CaptionPanel cptnpnlSpecialItems = new CaptionPanel("Items");
    initWidget(cptnpnlSpecialItems);

    table = new FlexTable();
    cptnpnlSpecialItems.setContentWidget(table);

    int row = 0;

    Label label_1 = new Label("General", false);
    label_1.addStyleName("boldText");
    table.setWidget(row, 0, label_1);

    row++;

    Label label_4 = new Label("# Ancient Items:", false);
    table.setWidget(row, 0, label_4);

    numAncients = new NumberSpinner();
    numAncients.setVisibleLength(4);
    numAncients.setTitle("# Ancient items worn");
    table.setWidget(row, 1, numAncients);

    row++;

    Label label_2 = new Label("Area Damage +%:", false);
    table.setWidget(row, 0, label_2);

    areaDamageEquipment = new NumberSpinner();
    areaDamageEquipment.setMax(100);
    areaDamageEquipment.setVisibleLength(4);
    areaDamageEquipment.setTitle("Added Area Damage from Equipment only");
    table.setWidget(row, 1, areaDamageEquipment);

    row++;

    Label label_3 = new Label("Elite Damage +%:", false);
    table.setWidget(row, 0, label_3);

    eliteDamagePercent = new NumberSpinner();
    eliteDamagePercent.setVisibleLength(4);
    eliteDamagePercent.setTitle(
            "Added Elite Damage from Armor and Weapons only (do not include Bane of the Powerful bonus)");
    table.setWidget(row, 1, eliteDamagePercent);

    row++;

    Label label_3a = new Label(
            "Note: subtract 15% from the value displayed in-game if Bane of the Powerful is rank 25 or more.",
            true);
    label_3a.addStyleName("boldText");
    label_3a.setWidth("350px");
    table.setWidget(row, 0, label_3a);
    table.getFlexCellFormatter().setColSpan(row, 0, 2);

    row++;

    Label label_5 = new Label("Set Bonuses", false);
    label_5.addStyleName("boldText");
    table.setWidget(row, 0, label_5);

    row++;

    Label label_4b = new Label("Other Set Bonuses?", false);
    table.setWidget(row, 0, label_4b);

    this.otherSets = new SimpleCheckBox();
    this.otherSets.setTitle("Select if any set bonuses not listed below are in effect.");
    table.setWidget(row, 1, this.otherSets);

    row++;

    for (ItemSet set : ItemSet.values()) {
        Anchor anchor = new Anchor(set.getName());
        anchor.setWordWrap(false);
        anchor.setTarget("_blank");
        anchor.setHref(set.getUrl());
        table.setWidget(row, 0, anchor);

        final ItemSet thisSet = set;

        if (set.getMaxPieces() > 2) {

            NumberSpinner number = new NumberSpinner();
            number.setMax(set.getMaxPieces());
            number.setVisibleLength(2);
            number.setTitle("# of pieces of this set worn (add 1 if using RoRG)");
            table.setWidget(row, 1, number);

            setCounts.put(thisSet, number);

            number.addChangeHandler(new ChangeHandler() {

                @Override
                public void onChange(ChangeEvent event) {
                    setChanged(thisSet);

                }
            });

        } else {
            SimpleCheckBox checkBox = new SimpleCheckBox();
            table.setWidget(row, 1, checkBox);

            setToggles.put(thisSet, checkBox);

            checkBox.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    setChanged(thisSet);
                }
            });
        }

        row++;
    }

    Label label_4a = new Label("Note: Add 1 to Set Item count if using RROG", true);
    label_4a.addStyleName("boldText");
    label_4a.setWidth("350px");
    table.setWidget(row, 0, label_4a);
    table.getFlexCellFormatter().setColSpan(row, 0, 2);

    row++;

    Label label_6 = new Label("Special Item Bonuses", false);
    label_6.addStyleName("boldText");
    table.setWidget(row, 0, label_6);

    row++;

    for (Slot slot : Slot.values()) {
        List<SpecialItemType> types = SpecialItemType.getItemsBySlot(slot);

        if (!types.isEmpty()) {

            rows.put(slot, row);

            Anchor anchor = new Anchor(slot.getName());
            anchor.setWordWrap(false);
            anchor.setHref("javascript:void(0)");
            anchor.setTarget("_blank");
            table.setWidget(row, 0, anchor);
            anchors.put(slot, anchor);

            ListBox list = new ListBox();
            list.setWidth("100%");
            list.addItem("Other/None", "");

            for (SpecialItemType t : types) {
                list.addItem(t.getName(), t.name());
            }

            list.setSelectedIndex(0);

            final Slot thisSlot = slot;
            list.addChangeHandler(new ChangeHandler() {

                @Override
                public void onChange(ChangeEvent event) {
                    itemChanged(thisSlot);
                }
            });

            listBoxes.put(slot, list);
            table.setWidget(row, 1, list);

            attributeSpinners.put(slot, new TreeMap<String, BaseSpinner<?>>());

            row += 2;
        }

    }

}

From source file:com.dawg6.web.dhcalc.client.PlayerBuffPanel.java

License:Open Source License

public PlayerBuffPanel() {

    disableListeners = true;//  w  w w .  j a va2  s  .  c o  m

    CaptionPanel cptnpnlNewPanel = new CaptionPanel("Other Player Buffs");
    initWidget(cptnpnlNewPanel);

    FlexTable flexTable = new FlexTable();
    cptnpnlNewPanel.setContentWidget(flexTable);

    int row = 0;

    Anchor anchor = new Anchor("Companion/Wolf (from other DH):");
    anchor.setWordWrap(false);
    flexTable.setWidget(row, 0, anchor);
    anchor.setTarget("_blank");
    anchor.setHref("http://us.battle.net/d3/en/class/demon-hunter/active/companion#c");

    wolf = new SimpleCheckBox();
    flexTable.setWidget(row, 1, wolf);

    Label lblNewLabel = new Label("% Uptime:");
    lblNewLabel.setWordWrap(false);
    flexTable.setWidget(row, 2, lblNewLabel);

    wolfUptime = new DoubleSpinner();
    wolfUptime.setVisibleLength(5);
    wolfUptime.setValue(33.33);
    flexTable.setWidget(row, 3, wolfUptime);
    wolfUptime.setTitle("% of time that another player's Wolf will be active");

    calcWolfButton = new Button("Calculate");
    calcWolfButton.setTitle("Calculate Wolf uptime based on your effective Cooldown Reduction");
    flexTable.setWidget(row, 4, calcWolfButton);

    row++;

    Anchor anchor_1 = new Anchor("Big Bad Voodoo:");
    anchor_1.setWordWrap(false);
    anchor_1.setTarget("_blank");
    anchor_1.setHref("http://us.battle.net/d3/en/class/witch-doctor/active/big-bad-voodoo");
    flexTable.setWidget(row, 0, anchor_1);

    bbv = new SimpleCheckBox();
    flexTable.setWidget(row, 1, bbv);

    Label label = new Label("% Uptime:");
    label.setWordWrap(false);
    flexTable.setWidget(row, 2, label);

    bbvUptime = new DoubleSpinner();
    bbvUptime.setValue(17.67);
    bbvUptime.setVisibleLength(5);
    flexTable.setWidget(row, 3, bbvUptime);

    Anchor anchor_10 = new Anchor("Slam Dance:");
    anchor_10.setWordWrap(false);
    anchor_10.setTarget("_blank");
    anchor_10.setHref("http://us.battle.net/d3/en/class/witch-doctor/active/big-bad-voodoo#a+");
    flexTable.setWidget(row, 4, anchor_10);

    slamDance = new SimpleCheckBox();
    flexTable.setWidget(row, 5, slamDance);
    slamDance.setTitle("Check this box if the Witch Doctor is using the Slam Dance rune");

    row++;

    Anchor anchor_1a = new Anchor("Slow Time/Stretch Time:");
    anchor_1a.setWordWrap(false);
    anchor_1a.setTarget("_blank");
    anchor_1a.setHref("http://us.battle.net/d3/en/class/wizard/active/slow-time#e+");
    flexTable.setWidget(row, 0, anchor_1a);

    stretchTime = new SimpleCheckBox();
    flexTable.setWidget(row, 1, stretchTime);

    Label labela = new Label("% Uptime:");
    labela.setWordWrap(false);
    flexTable.setWidget(row, 2, labela);

    stretchTimeUptime = new NumberSpinner();
    stretchTimeUptime.setValue(0);
    stretchTimeUptime.setVisibleLength(5);
    flexTable.setWidget(row, 3, stretchTimeUptime);

    row++;

    Anchor anchor_1b = new Anchor("Slow Time/Time Warp:");
    anchor_1b.setWordWrap(false);
    anchor_1b.setTarget("_blank");
    anchor_1b.setHref("http://us.battle.net/d3/en/class/wizard/active/slow-time#a+");
    flexTable.setWidget(row, 0, anchor_1b);

    timeWarp = new SimpleCheckBox();
    flexTable.setWidget(row, 1, timeWarp);

    Label labelb = new Label("% Uptime:");
    labelb.setWordWrap(false);
    flexTable.setWidget(row, 2, labelb);

    timeWarpUptime = new NumberSpinner();
    timeWarpUptime.setValue(0);
    timeWarpUptime.setVisibleLength(5);
    flexTable.setWidget(row, 3, timeWarpUptime);

    row++;

    Anchor anchor_2 = new Anchor("Mass Confusion/Paranoia:");
    anchor_2.setWordWrap(false);
    anchor_2.setTarget("_blank");
    anchor_2.setHref("http://us.battle.net/d3/en/class/witch-doctor/active/mass-confusion#a+");
    flexTable.setWidget(row, 0, anchor_2);

    massConfusion = new SimpleCheckBox();
    flexTable.setWidget(row, 1, massConfusion);

    Label label_1 = new Label("% Uptime:");
    label_1.setWordWrap(false);
    flexTable.setWidget(row, 2, label_1);

    massConfusionUptime = new DoubleSpinner();
    massConfusionUptime.setVisibleLength(5);
    flexTable.setWidget(row, 3, massConfusionUptime);

    row++;

    Anchor anchor_6 = new Anchor("Piranhas:");
    anchor_6.setWordWrap(false);
    anchor_6.setTarget("_blank");
    anchor_6.setHref("http://us.battle.net/d3/en/class/witch-doctor/active/piranhas");
    flexTable.setWidget(row, 0, anchor_6);

    piranhas = new SimpleCheckBox();
    flexTable.setWidget(row, 1, piranhas);

    Label label_5 = new Label("% Uptime:");
    label_5.setWordWrap(false);
    flexTable.setWidget(row, 2, label_5);

    piranhasUptime = new DoubleSpinner();
    piranhasUptime.setVisibleLength(5);
    flexTable.setWidget(row, 3, piranhasUptime);

    row++;

    Anchor anchor_8 = new Anchor("Laws of Valor:");
    anchor_8.setWordWrap(false);
    anchor_8.setTarget("_blank");
    anchor_8.setHref("http://us.battle.net/d3/en/class/crusader/active/laws-of-valor");
    flexTable.setWidget(row, 0, anchor_8);

    valor = new SimpleCheckBox();
    flexTable.setWidget(row, 1, valor);

    Label label_4 = new Label("% Active:");
    label_4.setWordWrap(false);
    flexTable.setWidget(row, 2, label_4);

    valorActiveUptime = new DoubleSpinner();
    valorActiveUptime.setVisibleLength(5);
    flexTable.setWidget(row, 3, valorActiveUptime);
    valorActiveUptime.setTitle("Percent of the time that Laws of Valor's Active buff (only) applies");

    row++;

    Label label_4a = new Label("% Passive:");
    label_4a.setWordWrap(false);
    flexTable.setWidget(row, 2, label_4a);

    valorPassiveUptime = new DoubleSpinner();
    valorPassiveUptime.setVisibleLength(5);
    flexTable.setWidget(row, 3, valorPassiveUptime);
    valorPassiveUptime.setTitle("Percent of the time that Laws of Valor's Passive buff (only) applies");

    row++;

    Anchor anchor_3 = new Anchor("Inner Sanctuary/Forbidden Palace:");
    anchor_3.setWordWrap(false);
    anchor_3.setTarget("_blank");
    anchor_3.setHref("http://us.battle.net/d3/en/class/monk/active/inner-sanctuary#e+");
    flexTable.setWidget(row, 0, anchor_3);

    innerSanctuary = new SimpleCheckBox();
    flexTable.setWidget(row, 1, innerSanctuary);

    Label label_2 = new Label("% Uptime:");
    label_2.setWordWrap(false);
    flexTable.setWidget(row, 2, label_2);

    innerSanctuaryUptime = new DoubleSpinner();
    innerSanctuaryUptime.setVisibleLength(5);
    flexTable.setWidget(row, 3, innerSanctuaryUptime);

    row++;

    Anchor anchor_4 = new Anchor("Crippling Wave/Breaking Wave:");
    anchor_4.setWordWrap(false);
    anchor_4.setTarget("_blank");
    anchor_4.setHref("http://us.battle.net/d3/en/class/monk/active/crippling-wave#e+");
    flexTable.setWidget(row, 0, anchor_4);

    cripplingWave = new SimpleCheckBox();
    flexTable.setWidget(row, 1, cripplingWave);

    Label label_3 = new Label("% Uptime:");
    label_3.setWordWrap(false);
    flexTable.setWidget(row, 2, label_3);

    cripplingWaveUptime = new DoubleSpinner();
    cripplingWaveUptime.setVisibleLength(5);
    flexTable.setWidget(row, 3, cripplingWaveUptime);

    row++;

    Anchor anchor_9 = new Anchor("Mantra of Retribution/Transgression:");
    anchor_9.setWordWrap(false);
    anchor_9.setTarget("_blank");
    anchor_9.setHref("http://us.battle.net/d3/en/class/monk/active/mantra-of-retribution#b+");
    flexTable.setWidget(row, 0, anchor_9);

    retribution = new SimpleCheckBox();
    flexTable.setWidget(row, 1, retribution);

    Label label_6 = new Label("% Uptime:");
    label_6.setWordWrap(false);
    flexTable.setWidget(row, 2, label_6);

    retributionUptime = new DoubleSpinner();
    retributionUptime.setVisibleLength(5);
    flexTable.setWidget(row, 3, retributionUptime);

    row++;

    Anchor anchor_5 = new Anchor("Mantra of Conviction:");
    anchor_5.setWordWrap(false);
    anchor_5.setTarget("_blank");
    anchor_5.setHref("http://us.battle.net/d3/en/class/monk/active/mantra-of-conviction");
    flexTable.setWidget(row, 0, anchor_5);

    conviction = new SimpleCheckBox();
    flexTable.setWidget(row, 1, conviction);

    Label lblPassiveUptime = new Label("% Passive:");
    lblPassiveUptime.setWordWrap(false);
    flexTable.setWidget(row, 2, lblPassiveUptime);

    convictionPassiveUptime = new DoubleSpinner();
    convictionPassiveUptime.setVisibleLength(5);
    convictionPassiveUptime
            .setTitle("Percent of time that Mantra of Conviction's passive bonus [only] applies");
    flexTable.setWidget(row, 3, convictionPassiveUptime);

    Anchor anchor_7 = new Anchor("Overawe:");
    anchor_7.setWordWrap(false);
    anchor_7.setTarget("_blank");
    anchor_7.setHref("http://us.battle.net/d3/en/class/monk/active/mantra-of-conviction#a");
    flexTable.setWidget(row, 4, anchor_7);

    overawe = new SimpleCheckBox();
    overawe.setTitle("Check this box if the monk is using the Overawe rune.");
    flexTable.setWidget(row, 5, overawe);

    row++;

    Label lblActiveUptime = new Label("% Active:");
    lblActiveUptime.setWordWrap(false);
    flexTable.setWidget(row, 2, lblActiveUptime);

    convictionActiveUptime = new DoubleSpinner();
    convictionActiveUptime.setTitle("Percent of time that Matra of Conviction's active bonus [only] applies");
    convictionActiveUptime.setVisibleLength(5);
    flexTable.setWidget(row, 3, convictionActiveUptime);

    row++;

    wolfUptime.setMax(100.0);
    bbvUptime.setMax(100.0);
    massConfusionUptime.setMax(100.0);
    piranhasUptime.setMax(100.0);
    cripplingWaveUptime.setMax(100.0);
    innerSanctuaryUptime.setMax(100.0);
    convictionPassiveUptime.setMax(100.0);
    convictionActiveUptime.setMax(100.0);
    valorActiveUptime.setMax(100.0);
    valorPassiveUptime.setMax(100.0);
    retributionUptime.setMax(100.0);
    stretchTimeUptime.setMax(100);
    timeWarpUptime.setMax(100);

    convictionPassiveUptime.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {

            if (!disableListeners) {
                disableListeners = true;

                double a = convictionPassiveUptime.getValue();
                double b = convictionActiveUptime.getValue();

                convictionActiveUptime.setValue(Math.min(100.0 - a, b));

                disableListeners = false;
            }

        }
    });

    convictionActiveUptime.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {

            if (!disableListeners) {
                disableListeners = true;

                double a = convictionPassiveUptime.getValue();
                double b = convictionActiveUptime.getValue();

                convictionPassiveUptime.setValue(Math.min(100.0 - b, a));

                disableListeners = false;
            }

        }
    });

    valorPassiveUptime.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {

            if (!disableListeners) {
                disableListeners = true;

                double a = valorPassiveUptime.getValue();
                double b = valorActiveUptime.getValue();

                valorActiveUptime.setValue(Math.min(100.0 - a, b));

                disableListeners = false;
            }

        }
    });

    valorActiveUptime.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {

            if (!disableListeners) {
                disableListeners = true;

                double a = valorPassiveUptime.getValue();
                double b = valorActiveUptime.getValue();

                valorPassiveUptime.setValue(Math.min(100.0 - b, a));

                disableListeners = false;
            }

        }
    });

    disableListeners = false;

}

From source file:com.dawg6.web.dhcalc.client.StatsPanel.java

License:Open Source License

public StatsPanel() {

    CaptionPanel cptnpnlNewPanel = new CaptionPanel("Statistics");
    initWidget(cptnpnlNewPanel);//  w  w w .j  a v  a 2s  .  c  o m
    cptnpnlNewPanel.setSize("1005px", "619px");

    FlexTable flexTable = new FlexTable();
    SimplePanel panel = new SimplePanel();

    panel.setWidget(flexTable);
    flexTable.setHeight("554px");
    cptnpnlNewPanel.setContentWidget(panel);
    panel.setSize("100%", "100%");

    Label lblNewLabel = new Label("Total # of Profiles Analyzed:");
    lblNewLabel.setStyleName("boldText");
    lblNewLabel.setWordWrap(false);
    flexTable.setWidget(0, 0, lblNewLabel);

    totalLabel = new Label("Loading...");
    flexTable.setWidget(0, 1, totalLabel);

    CaptionPanel cptnpnlNewPanel_1 = new CaptionPanel("Global Statistics");
    flexTable.setWidget(1, 0, cptnpnlNewPanel_1);

    mainTable = new FlexTable();
    mainTable.setStyleName("statsTable");

    SimplePanel panel2 = new SimplePanel();
    panel2.setWidget(mainTable);
    cptnpnlNewPanel_1.setContentWidget(panel2);

    Label lblStatistic = new Label("Statistic");
    lblStatistic.setStyleName("boldText");
    lblStatistic.setWordWrap(false);
    mainTable.setWidget(0, 0, lblStatistic);

    Label lblAverage = new Label("Average DPS");
    lblAverage.setWordWrap(false);
    lblAverage.setStyleName("boldText");
    mainTable.setWidget(0, 1, lblAverage);

    Label lblNewLabel_1 = new Label("Max DPS");
    lblNewLabel_1.setStyleName("boldText");
    lblNewLabel_1.setWordWrap(false);
    mainTable.setWidget(0, 2, lblNewLabel_1);

    Label lblProfile = new Label("Link to Profile");
    lblProfile.setWordWrap(false);
    lblProfile.setStyleName("boldText");
    mainTable.setWidget(0, 3, lblProfile);
    mainTable.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    mainTable.getCellFormatter().setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_RIGHT);
    mainTable.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);

    Label lblImport = new Label("Import");
    lblImport.setWordWrap(false);
    lblImport.setStyleName("boldText");
    mainTable.setWidget(0, 4, lblImport);
    mainTable.getCellFormatter().setHorizontalAlignment(0, 4, HasHorizontalAlignment.ALIGN_CENTER);

    flexTable.getFlexCellFormatter().setColSpan(1, 0, 2);

    CaptionPanel cptnpnlNewPanel_2 = new CaptionPanel("Build Statistics");
    flexTable.setWidget(2, 0, cptnpnlNewPanel_2);
    cptnpnlNewPanel_2.setHeight("367px");

    VerticalPanel verticalPanel = new VerticalPanel();
    cptnpnlNewPanel_2.setContentWidget(verticalPanel);

    filterTable = new FlexTable();

    SimplePanel panel3 = new SimplePanel();
    panel3.setWidget(filterTable);
    verticalPanel.add(panel3);
    panel3.setHeight("80px");

    Label sentryLabel = new Label("Sentry:");
    sentryLabel.setWordWrap(false);
    sentryLabel.setStyleName("boldText");
    filterTable.setWidget(0, 0, sentryLabel);

    sentry = new SimpleCheckBox();
    filterTable.setWidget(0, 1, sentry);

    Label lblNewLabel_2 = new Label("Rune:");
    lblNewLabel_2.setWordWrap(false);
    lblNewLabel_2.setStyleName("boldText");
    filterTable.setWidget(0, 2, lblNewLabel_2);

    sentryRune = new ListBox();
    filterTable.setWidget(0, 3, sentryRune);

    Label lblSkill = new Label("Skill 1:");
    lblSkill.setWordWrap(false);
    lblSkill.setStyleName("boldText");
    filterTable.setWidget(0, 2, lblSkill);

    skill1 = new ListBox();
    filterTable.setWidget(0, 3, skill1);

    Label lblSkill_1 = new Label("Skill 2:");
    lblSkill_1.setWordWrap(false);
    lblSkill_1.setStyleName("boldText");
    filterTable.setWidget(0, 4, lblSkill_1);

    skill2 = new ListBox();
    filterTable.setWidget(0, 5, skill2);

    //      Label lblSkill_2 = new Label("Skill 3:");
    //      lblSkill_2.setWordWrap(false);
    //      lblSkill_2.setStyleName("boldText");
    //      filterTable.setWidget(0, 6, lblSkill_2);
    //
    //      skill3 = new ListBox();
    //      filterTable.setWidget(0, 7, skill3);
    //
    Button button = new Button("Copy My Build");
    filterTable.setWidget(0, 6, button);

    button.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            copyBuild();
        }
    });

    Button btnNewButton = new Button("Update");
    btnNewButton.setText("Filter/Refresh");
    filterTable.setWidget(1, 0, btnNewButton);
    btnNewButton.setWidth("100%");

    btnNewButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            updateStats();
        }
    });

    Label lblRune = new Label("Rune 1:");
    lblRune.setWordWrap(false);
    lblRune.setStyleName("boldText");
    filterTable.setWidget(1, 2, lblRune);

    rune1 = new ListBox();
    filterTable.setWidget(1, 3, rune1);

    Label lblRune_1 = new Label("Rune 2:");
    lblRune_1.setWordWrap(false);
    lblRune_1.setStyleName("boldText");
    filterTable.setWidget(1, 4, lblRune_1);

    rune2 = new ListBox();
    filterTable.setWidget(1, 5, rune2);

    //      Label lblRune_2 = new Label("Rune 3:");
    //      lblRune_2.setWordWrap(false);
    //      lblRune_2.setStyleName("boldText");
    //      filterTable.setWidget(1, 6, lblRune_2);
    //
    //      rune3 = new ListBox();
    //      filterTable.setWidget(1, 7, rune3);
    //      filterTable.getFlexCellFormatter().setColSpan(1, 0, 2);

    buildTable = new FlexTable();
    buildTable.setStyleName("statsTable");

    ScrollPanel scroll = new ScrollPanel();
    scroll.setWidget(buildTable);
    verticalPanel.add(scroll);
    scroll.setSize("975px", "269px");

    Anchor lblSentryRune = new Anchor("Sentry Rune");
    lblSentryRune.setWordWrap(false);
    lblSentryRune.setStyleName("boldText");
    lblSentryRune.setHref("javascript:void(0);");
    buildTable.setWidget(0, 0, lblSentryRune);

    lblSentryRune.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            //            sortStats(StatSorter.SENTRY_RUNE);
        }
    });

    Anchor lblSkill_3 = new Anchor("Skills/Runes");
    lblSkill_3.setHref("javascript:void(0);");
    lblSkill_3.setWordWrap(false);
    lblSkill_3.setStyleName("boldText");
    buildTable.setWidget(0, 1, lblSkill_3);

    lblSkill_3.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            //            sortStats(StatSorter.SKILLS);
        }
    });
    buildTable.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);

    Anchor lblCount = new Anchor("Count");
    lblCount.setHref("javascript:void(0);");
    lblCount.setWordWrap(false);
    lblCount.setStyleName("boldText");
    buildTable.setWidget(0, 2, lblCount);

    lblCount.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            sortStats(StatSorter.COUNT);
        }
    });

    flexTable.getFlexCellFormatter().setColSpan(2, 0, 2);
    flexTable.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    flexTable.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    disableListeners = true;

    int row = 1;
    int col = 3;

    for (StatCategory c : StatCategory.values()) {
        Label label = new Label(c.getDescription());
        label.setWordWrap(false);

        if ((row % 2) == 0)
            mainTable.getRowFormatter().addStyleName(row, "even");
        else
            mainTable.getRowFormatter().addStyleName(row, "odd");

        for (int i = 0; i < 4; i++) {
            Label label3 = new Label("Loading...");
            label3.addStyleName("right");
            mainTable.setWidget(row, i + 1, label3);
        }

        mainTable.setWidget(row++, 0, label);

        FlexTable table = new FlexTable();
        buildTable.setWidget(0, col, table);

        Anchor avg = new Anchor("Avg");
        avg.setWordWrap(false);
        avg.setHref("javascript:void(0);");
        avg.setStyleName("boldText");

        Anchor max = new Anchor("Max");
        max.setWordWrap(false);
        max.setHref("javascript:void(0);");
        max.setStyleName("boldText");

        Label split = new Label("/");
        split.setWordWrap(false);
        split.setStyleName("boldText");

        table.setWidget(0, 0, avg);
        table.setWidget(0, 1, split);
        table.setWidget(0, 2, max);
        table.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
        table.getFlexCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);
        table.getFlexCellFormatter().setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER);

        Label label2 = new Label(c.getDescription());
        label2.setWordWrap(true);
        label2.setStyleName("boldText");

        table.setWidget(1, 0, label2);
        table.getFlexCellFormatter().setColSpan(1, 0, 3);
        table.getFlexCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);

        buildTable.getFlexCellFormatter().setHorizontalAlignment(0, col, HasHorizontalAlignment.ALIGN_CENTER);

        final StatCategory cat = c;

        avg.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                sortStats(new StatSorter.AverageCategorySorter(cat));
            }
        });

        max.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                sortStats(new StatSorter.MaxCategorySorter(cat));
            }
        });

        col++;
    }

    skills = new ListBox[] { skill1, skill2 }; //, skill3 };
    runes = new ListBox[] { rune1, rune2 }; //, rune3 };

    for (int i = 0; i < skills.length; i++) {
        populateSkillsAndRunes(i);
        final int j = i;

        skills[i].addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
                if (!disableListeners) {
                    skillChanged(j);
                }

            }
        });

    }

    disableListeners = false;
}

From source file:gov.nist.appvet.gwt.client.gui.dialog.UserInfoAdminEditDialogBox.java

License:Open Source License

@SuppressWarnings("deprecation")
public UserInfoAdminEditDialogBox(UserInfoGwt userInfo, UsersListPagingDataGrid<UserInfoGwt> usersListTable,
        List<UserInfoGwt> allUsers) {
    setWidth("386px");

    this.usersListTable = usersListTable;
    this.allUsers = allUsers;
    if (userInfo == null) {
        newUser = true;/*from  ww w .  j av a  2  s . c o m*/
    }
    changePasswordCheckBox = new SimpleCheckBox();
    if (newUser) {
        passwordLabel = new Label("Password: ");
    } else {
        passwordLabel = new Label("Password Reset: ");
    }
    passwordLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    if (newUser) {
        passwordAgainLabel = new Label("Password (again): ");
    } else {
        passwordAgainLabel = new Label("Password Reset (again): ");
    }
    passwordAgainLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    final VerticalPanel verticalPanel_1 = new VerticalPanel();
    verticalPanel_1.setSize("100%", "100%");
    verticalPanel_1.setSpacing(5);
    verticalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    final HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_1);
    horizontalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblNewLabel = new Label("Last Name: ");
    horizontalPanel_1.add(lblNewLabel);
    horizontalPanel_1.setCellHorizontalAlignment(lblNewLabel, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_1.setCellVerticalAlignment(lblNewLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    lblNewLabel.setWidth("170px");
    horizontalPanel_1.setCellWidth(lblNewLabel, "50%");
    lblNewLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    lastNameTextBox = new TextBox();
    lastNameTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    lastNameTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_1.add(lastNameTextBox);
    horizontalPanel_1.setCellHorizontalAlignment(lastNameTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_1.setCellVerticalAlignment(lastNameTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_1.setCellWidth(lastNameTextBox, "50%");
    lastNameTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_2);
    horizontalPanel_2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblNewLabel_1 = new Label("First Name: ");
    horizontalPanel_2.add(lblNewLabel_1);
    lblNewLabel_1.setWidth("170px");
    horizontalPanel_2.setCellWidth(lblNewLabel_1, "50%");
    horizontalPanel_2.setCellVerticalAlignment(lblNewLabel_1, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_2.setCellHorizontalAlignment(lblNewLabel_1, HasHorizontalAlignment.ALIGN_CENTER);
    lblNewLabel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    firstNameTextBox = new TextBox();
    firstNameTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    firstNameTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_2.add(firstNameTextBox);
    horizontalPanel_2.setCellWidth(firstNameTextBox, "50%");
    horizontalPanel_2.setCellVerticalAlignment(firstNameTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_2.setCellHorizontalAlignment(firstNameTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    firstNameTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_3 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_3);
    horizontalPanel_3.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_3.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblUserId = new Label("User ID:");
    horizontalPanel_3.add(lblUserId);
    lblUserId.setWidth("170px");
    horizontalPanel_3.setCellVerticalAlignment(lblUserId, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_3.setCellHorizontalAlignment(lblUserId, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_3.setCellWidth(lblUserId, "50%");
    lblUserId.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    userIdTextBox = new TextBox();
    userIdTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    userIdTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_3.add(userIdTextBox);
    horizontalPanel_3.setCellWidth(userIdTextBox, "50%");
    horizontalPanel_3.setCellVerticalAlignment(userIdTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_3.setCellHorizontalAlignment(userIdTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    userIdTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_6 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_6);
    horizontalPanel_6.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_6.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblOrganization = new Label("Organization: ");
    horizontalPanel_6.add(lblOrganization);
    lblOrganization.setWidth("170px");
    horizontalPanel_6.setCellVerticalAlignment(lblOrganization, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_6.setCellHorizontalAlignment(lblOrganization, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_6.setCellWidth(lblOrganization, "50%");
    lblOrganization.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    organizationTextBox = new TextBox();
    organizationTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    organizationTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_6.add(organizationTextBox);
    horizontalPanel_6.setCellVerticalAlignment(organizationTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_6.setCellHorizontalAlignment(organizationTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_6.setCellWidth(organizationTextBox, "50%");
    organizationTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_7 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_7);
    horizontalPanel_7.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_7.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblEmail = new Label("Email: ");
    horizontalPanel_7.add(lblEmail);
    lblEmail.setWidth("170px");
    horizontalPanel_7.setCellVerticalAlignment(lblEmail, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_7.setCellHorizontalAlignment(lblEmail, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_7.setCellWidth(lblEmail, "50%");
    lblEmail.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    emailTextBox = new TextBox();
    emailTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    emailTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_7.add(emailTextBox);
    horizontalPanel_7.setCellVerticalAlignment(emailTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_7.setCellHorizontalAlignment(emailTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_7.setCellWidth(emailTextBox, "50%");
    emailTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_8 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_8);
    horizontalPanel_8.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_8.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblRole = new Label("Role: ");
    horizontalPanel_8.add(lblRole);
    horizontalPanel_8.setCellHorizontalAlignment(lblRole, HasHorizontalAlignment.ALIGN_CENTER);
    lblRole.setWidth("170px");
    horizontalPanel_8.setCellVerticalAlignment(lblRole, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_8.setCellWidth(lblRole, "50%");
    lblRole.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    roleComboBox = new ListBox();
    horizontalPanel_8.add(roleComboBox);
    horizontalPanel_8.setCellWidth(roleComboBox, "50%");
    horizontalPanel_8.setCellVerticalAlignment(roleComboBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_8.setCellHorizontalAlignment(roleComboBox, HasHorizontalAlignment.ALIGN_CENTER);
    roleComboBox.addItem("DEV");
    roleComboBox.addItem("ANALYST");
    roleComboBox.addItem("ADMIN");
    roleComboBox.addItem("APPSTORE");
    roleComboBox.addItem("TOOL_SERVICE_PROVIDER");
    roleComboBox.addItem("OTHER_CLIENT");

    roleComboBox.setWidth("190px");

    final HorizontalPanel horizontalPanel_13 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_13);
    horizontalPanel_13.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_13.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_13.setWidth("366px");

    changePasswordCheckBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (changePasswordCheckBox.isChecked()) {
                password1TextBox.setEnabled(true);
                password2TextBox.setEnabled(true);
            } else {
                password1TextBox.setText(null);
                password1TextBox.setEnabled(false);
                password2TextBox.setText(null);
                password2TextBox.setEnabled(false);
            }
        }

    });
    horizontalPanel_13.add(changePasswordCheckBox);
    horizontalPanel_13.setCellVerticalAlignment(changePasswordCheckBox, HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblNewLabel_2 = new Label("Change Password");
    lblNewLabel_2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    horizontalPanel_13.add(lblNewLabel_2);
    horizontalPanel_13.setCellVerticalAlignment(lblNewLabel_2, HasVerticalAlignment.ALIGN_MIDDLE);
    lblNewLabel_2.setWidth("340px");

    final HorizontalPanel horizontalPanel_4 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_4);
    horizontalPanel_4.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_4.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    horizontalPanel_4.add(passwordLabel);
    passwordLabel.setWidth("170px");
    horizontalPanel_4.setCellWidth(passwordLabel, "50%");
    horizontalPanel_4.setCellVerticalAlignment(passwordLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_4.setCellHorizontalAlignment(passwordLabel, HasHorizontalAlignment.ALIGN_CENTER);
    passwordLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    password1TextBox = new PasswordTextBox();
    password1TextBox.setEnabled(false);
    password1TextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    password1TextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_4.add(password1TextBox);
    horizontalPanel_4.setCellVerticalAlignment(password1TextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_4.setCellHorizontalAlignment(password1TextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_4.setCellWidth(password1TextBox, "50%");
    password1TextBox.setSize("180px", "");

    final HorizontalPanel horizontalPanel_5 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_5);
    horizontalPanel_5.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_5.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    horizontalPanel_5.add(passwordAgainLabel);
    passwordAgainLabel.setWidth("170px");
    horizontalPanel_5.setCellVerticalAlignment(passwordAgainLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_5.setCellHorizontalAlignment(passwordAgainLabel, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_5.setCellWidth(passwordAgainLabel, "50%");
    passwordAgainLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    password2TextBox = new PasswordTextBox();
    password2TextBox.setEnabled(false);
    password2TextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    password2TextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_5.add(password2TextBox);
    horizontalPanel_5.setCellVerticalAlignment(password2TextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_5.setCellHorizontalAlignment(password2TextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_5.setCellWidth(password2TextBox, "50%");
    password2TextBox.setSize("180px", "");

    final HorizontalPanel horizontalPanel_9 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_9);
    horizontalPanel_9.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_9.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final HorizontalPanel horizontalPanel_10 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_10);
    horizontalPanel_10.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_10.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblLastLogon = new Label("Last Logon: ");
    horizontalPanel_10.add(lblLastLogon);
    lblLastLogon.setWidth("170px");
    horizontalPanel_10.setCellVerticalAlignment(lblLastLogon, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_10.setCellHorizontalAlignment(lblLastLogon, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_10.setCellWidth(lblLastLogon, "50%");
    lblLastLogon.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    final TextBox lastLogonTextBox = new TextBox();
    lastLogonTextBox.setEnabled(false);
    lastLogonTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    lastLogonTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_10.add(lastLogonTextBox);
    horizontalPanel_10.setCellVerticalAlignment(lastLogonTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_10.setCellHorizontalAlignment(lastLogonTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_10.setCellWidth(lastLogonTextBox, "50%");
    lastLogonTextBox.setReadOnly(true);
    lastLogonTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_11 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_11);
    horizontalPanel_11.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_11.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblFromHost = new Label("From Host: ");
    horizontalPanel_11.add(lblFromHost);
    lblFromHost.setWidth("170px");
    horizontalPanel_11.setCellWidth(lblFromHost, "50%");
    horizontalPanel_11.setCellVerticalAlignment(lblFromHost, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_11.setCellHorizontalAlignment(lblFromHost, HasHorizontalAlignment.ALIGN_CENTER);
    lblFromHost.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    final TextBox fromHostTextBox = new TextBox();
    fromHostTextBox.setEnabled(false);
    fromHostTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    fromHostTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_11.add(fromHostTextBox);
    horizontalPanel_11.setCellVerticalAlignment(fromHostTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_11.setCellHorizontalAlignment(fromHostTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_11.setCellWidth(fromHostTextBox, "50%");
    fromHostTextBox.setReadOnly(true);
    fromHostTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_12 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_12);
    horizontalPanel_12.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_12.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final HorizontalPanel horizontalPanel = new HorizontalPanel();

    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setSize("200px", "50px");
    horizontalPanel.setStyleName("buttonPanelStyle");
    cancelButton = new PushButton("Cancel");
    cancelButton.setHTML("Cancel");
    horizontalPanel.add(cancelButton);

    final Label buttonSpacerLabel = new Label("");

    horizontalPanel.add(buttonSpacerLabel);
    horizontalPanel.setCellVerticalAlignment(buttonSpacerLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setCellHorizontalAlignment(buttonSpacerLabel, HasHorizontalAlignment.ALIGN_CENTER);
    buttonSpacerLabel.setSize("60px", "18px");
    horizontalPanel.setCellHorizontalAlignment(cancelButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setCellVerticalAlignment(cancelButton, HasVerticalAlignment.ALIGN_MIDDLE);
    cancelButton.setSize("70px", "18px");
    okButton = new PushButton("Submit");

    horizontalPanel.add(okButton);
    horizontalPanel.setCellHorizontalAlignment(okButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setCellVerticalAlignment(okButton, HasVerticalAlignment.ALIGN_MIDDLE);
    okButton.setSize("70px", "18px");
    if (!newUser) {
        lastNameTextBox.setText(userInfo.getLastName());
        firstNameTextBox.setText(userInfo.getFirstName());
        userIdTextBox.setText(userInfo.getUserName());
        userIdTextBox.setReadOnly(true);
        lastLogonTextBox.setText(userInfo.getLastLogon());
        fromHostTextBox.setText(userInfo.getFromHost());
        organizationTextBox.setText(userInfo.getOrganization());
        emailTextBox.setText(userInfo.getEmail());
        if (userInfo.getRole().equals("DEV")) {
            roleComboBox.setSelectedIndex(0);
        } else if (userInfo.getRole().equals("ANALYST")) {
            roleComboBox.setSelectedIndex(1);
        } else if (userInfo.getRole().equals("ADMIN")) {
            roleComboBox.setSelectedIndex(2);
        } else if (userInfo.getRole().equals("APPSTORE")) {
            roleComboBox.setSelectedIndex(3);
        } else if (userInfo.getRole().equals("TOOL_SERVICE_PROVIDER")) {
            roleComboBox.setSelectedIndex(4);
        } else if (userInfo.getRole().equals("OTHER_CLIENT")) {
            roleComboBox.setSelectedIndex(5);
        }
    }

    final SimplePanel simplePanel = new SimplePanel();
    simplePanel.setStyleName("userFormPanel");
    simplePanel.setWidget(verticalPanel_1);

    final DockPanel dockPanel = new DockPanel();
    dockPanel.setStyleName("gwt-DialogBox");
    setWidget(dockPanel);
    dockPanel.setSize("386px", "");
    dockPanel.add(horizontalPanel, DockPanel.SOUTH);
    dockPanel.setCellVerticalAlignment(horizontalPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_CENTER);
    dockPanel.add(simplePanel, DockPanel.CENTER);
}

From source file:n3phele.client.view.CommandListGridView.java

License:Open Source License

public CommandListGridView() {
    super(new MenuItem(N3phele.n3pheleResource.commandIcon(), "Commands", null));
    String html = "<img style='border:none; vertical-align:bottom; margin:-2px; padding-right:2px;' width=20 height=20 src='"
            + N3phele.n3pheleResource.commandIcon().getURL() + "'/>create a new command";
    Button addDataSet = new Button(html, new ClickHandler() {

        @Override// w w w .  ja v a 2 s  .  co  m
        public void onClick(ClickEvent event) {
            createUploadPopup();
        }
    });
    addDataSet.setStyleName(N3phele.n3pheleResource.css().newCommandButton());
    this.strip.add(addDataSet);
    HorizontalPanel heading = new HorizontalPanel();
    heading.setWidth("500px");
    heading.setStyleName(N3phele.n3pheleResource.css().sectionPanelHeader());
    add(heading);
    SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
    simplePager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
    heading.add(simplePager);

    textBox = new TextBox();
    textBox.setTitle("search for a command");
    heading.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    heading.add(textBox);
    heading.setCellHorizontalAlignment(textBox, HorizontalPanel.ALIGN_RIGHT);
    textBox.addKeyPressHandler(new KeyPressHandler() {
        public void onKeyPress(KeyPressEvent event) {
            if (KeyCodes.KEY_ENTER == event.getNativeEvent().getKeyCode()) {
                commandActivity.fetch(0, searchText = textBox.getText(), !allVersions.getValue());
            }
        }
    });

    Image searchIcon = new Image(N3phele.n3pheleResource.searchIcon().getURL());
    searchIcon.setPixelSize(20, 20);
    PushButton search = new PushButton(searchIcon);
    search.setTitle("search for a command");
    search.setStyleName(N3phele.n3pheleResource.css().commandSearchButton());
    heading.add(search);
    search.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            commandActivity.fetch(0, searchText = textBox.getText(), !allVersions.getValue());

        }
    });

    heading.setCellHorizontalAlignment(simplePager, HorizontalPanel.ALIGN_CENTER);
    DisclosurePanel more = new DisclosurePanel("advanced");
    more.setStyleName(N3phele.n3pheleResource.css().sectionPanelHeader());
    heading.add(more);
    heading.setCellHorizontalAlignment(more, HorizontalPanel.ALIGN_LEFT);
    HorizontalPanel disclosed = new HorizontalPanel();
    more.add(disclosed);
    disclosed.add(new InlineLabel("Search all versions"));

    allVersions = new SimpleCheckBox();
    allVersions.setName("allVersions");
    allVersions.setFormValue("Search all versions");
    disclosed.add(allVersions);

    grid = new CellTable<List<Command>>();
    grid.setWidth("100%", true);
    HasCell<Command, ?> nameHasCell = new HasCell<Command, Command>() {

        @Override
        public Cell<Command> getCell() {
            return new CommandTextCell(CommandNameRenderer.getInstance());
        }

        @Override
        public FieldUpdater<Command, Command> getFieldUpdater() {
            return new FieldUpdater<Command, Command>() {

                @Override
                public void update(int index, Command object, Command value) {
                    //                  if(value != null) {
                    //                     GWT.log("got-139 "+index+" "+value.getName());
                    //                     commandActivity.goTo(new CommandPlace(value.getUri()));
                    //                  }

                }
            };
        }

        @Override
        public Command getValue(Command object) {
            return object;
        }

    };
    HasCell<Command, ?> versionHasCell = new HasCell<Command, Command>() {

        @Override
        public Cell<Command> getCell() {
            return new CommandTextCell(CommandVersionRenderer.getInstance());
        }

        @Override
        public FieldUpdater<Command, Command> getFieldUpdater() {
            return new FieldUpdater<Command, Command>() {

                @Override
                public void update(int index, Command object, Command value) {
                    //                  if(value != null) {
                    //                     GWT.log("got-166 "+index+" "+value.getName());
                    //                     commandActivity.goTo(new CommandPlace(value.getUri()));
                    //                  }

                }
            };
        }

        @Override
        public Command getValue(Command object) {
            return object;
        }

    };

    List<HasCell<Command, ?>> hasCells = new ArrayList<HasCell<Command, ?>>(2);
    hasCells.add(nameHasCell);
    hasCells.add(versionHasCell);
    for (int i = 0; i < ROWLENGTH; i++) {
        Column<List<Command>, Command> c = new Column<List<Command>, Command>(new CommandIconTextCell(
                N3phele.n3pheleResource.scriptIcon(), new CompositeCell<Command>(hasCells), i)) {

            @Override
            public Command getValue(List<Command> object) {
                int index = ((CommandIconTextCell) this.getCell()).getIndex();
                if (index < object.size()) {
                    return object.get(index);
                } else {
                    return null;
                }
            }
        };
        c.setFieldUpdater(new FieldUpdater<List<Command>, Command>() {

            @Override
            public void update(int index, List<Command> object, Command value) {
                if (value != null) {
                    GWT.log("got-201 " + index + " " + value.getName());
                    commandActivity.goTo(new CommandPlace(value.getUri()));
                }

            }
        });
        grid.addColumn(c);
        grid.setColumnWidth(c, 100.0 / ROWLENGTH, Unit.PCT);
    }

    grid.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    simplePager.setDisplay(grid);
    simplePager.setPageSize(PAGESIZE);
    grid.addRangeChangeHandler(new RangeChangeEvent.Handler() {

        /* (non-Javadoc)
         * @see com.google.gwt.view.client.RangeChangeEvent.Handler#onRangeChange(com.google.gwt.view.client.RangeChangeEvent)
         */
        @Override
        public void onRangeChange(RangeChangeEvent event) {
            if (suppressEvent)
                return;
            Range range = grid.getVisibleRange();
            GWT.log("Table range is " + range.getStart() + " length " + range.getLength());
            int start = range.getStart();
            if (start > total)
                start = total;
            //            if(data == null || (data.size() < start) ){

            commandActivity.fetch(start, searchText, !allVersions.getValue());
            //            } else {
            //               if(length+start > data.size())
            //                  length = data.size()-start;
            //               GWT.log("data available start="+start);
            //               grid.setRowData(start, chunk(data.subList(start, start+length)));
            //            }
        }

    });
    this.add(grid);
}

From source file:n3phele.client.view.RepoView.java

License:Open Source License

public RepoView() {
    super(new MenuItem(N3phele.n3pheleResource.repositoryIcon(), "Repository", null));
    table = new FlexTable();
    table.setCellPadding(10);/*from   w  ww  .  j a  v a  2s  .  co  m*/

    ChangeHandler update = new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            validateRepositorySpecification(true);
        }
    };
    KeyUpHandler keyup = new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            validateRepositorySpecification(true);
        }

    };
    this.repository = null;
    Label lblNewLabel = new Label("Name");
    table.setWidget(0, 0, lblNewLabel);
    nameValid = new ValidInputIndicatorWidget("Text value required", false);
    table.setWidget(0, 1, nameValid);

    name = new TextBox();
    name.setVisibleLength(30);
    name.addChangeHandler(update);
    name.addKeyUpHandler(keyup);
    table.setWidget(0, 2, name);

    Label lblNewLabel_1 = new Label("Description");
    table.setWidget(1, 0, lblNewLabel_1);

    description = new TextBox();
    description.setVisibleLength(30);
    description.addChangeHandler(update);
    table.setWidget(1, 2, description);

    Label lblNewLabel_2 = new Label("Location URL");
    table.setWidget(2, 0, lblNewLabel_2);
    //   locationUrlSupplied = new ValidInputIndicatorWidget("http, https or ftp URL required", false);
    locationUrlSupplied = new ValidInputIndicatorWidget("http or https URL required", false);
    table.setWidget(2, 1, locationUrlSupplied);

    location = new TextBox();
    location.setVisibleLength(30);
    location.addChangeHandler(update);
    location.addKeyUpHandler(keyup);
    table.setWidget(2, 2, location);

    Label lblNewLabel_3 = new Label("Kind");
    table.setWidget(3, 0, lblNewLabel_3);
    kindSelected = new ValidInputIndicatorWidget("Kind selection required.", false);
    table.setWidget(3, 1, kindSelected);

    kind = new ListBox(false);
    kindMap = new HashMap<String, Integer>();
    for (int i = 0; i < kinds.length; i++) {
        kind.addItem(kinds[i]);
        kindMap.put(kinds[i], i);
    }
    kind.addChangeHandler(update);
    table.setWidget(3, 2, kind);
    kind.addChangeHandler(update);
    kind.addKeyUpHandler(keyup);

    Label lblNewLabel_4 = new Label("Base path");
    table.setWidget(4, 0, lblNewLabel_4);
    basePathSupplied = new ValidInputIndicatorWidget("bucket or other base path required", false);
    table.setWidget(4, 1, basePathSupplied);

    root = new TextBox();
    root.setVisibleLength(30);
    root.addChangeHandler(update);
    root.addKeyUpHandler(keyup);
    table.setWidget(4, 2, root);

    Label lblNewLabel_5 = new Label("Authentication Id");
    table.setWidget(5, 0, lblNewLabel_5);
    gotAuthId = new ValidInputIndicatorWidget("id required", false);
    table.setWidget(5, 1, gotAuthId);

    authId = new TextBox();
    authId.setVisibleLength(30);
    authId.addChangeHandler(update);
    authId.addKeyUpHandler(keyup);
    table.setWidget(5, 2, authId);

    Label lblNewLabel_6 = new Label("New password");
    table.setWidget(6, 0, lblNewLabel_6);
    passwordTextSupplied = new ValidInputIndicatorWidget("Password text required", false);
    table.setWidget(6, 1, passwordTextSupplied);

    password = new PasswordTextBox();
    password.setVisibleLength(30);
    password.addChangeHandler(update);
    password.addKeyUpHandler(keyup);
    table.setWidget(6, 2, password);

    Label lblNewLabel_7 = new Label("Confirm Password");
    table.setWidget(7, 0, lblNewLabel_7);
    passwordConfirmSupplied = new ValidInputIndicatorWidget("Matching password text required", false);
    table.setWidget(7, 1, passwordConfirmSupplied);

    confirmPassword = new PasswordTextBox();
    confirmPassword.setVisibleLength(30);
    confirmPassword.addChangeHandler(update);
    confirmPassword.addKeyUpHandler(keyup);
    table.setWidget(7, 2, confirmPassword);

    lblNewLabel_8 = new Label("Accessible to all n3phele user?");
    table.setWidget(8, 0, lblNewLabel_8);

    isPublic = new SimpleCheckBox();
    table.setWidget(8, 1, isPublic);

    cancel = new Button("cancel", new ClickHandler() {
        public void onClick(ClickEvent event) {
            do_cancel();
        }
    });

    table.setWidget(9, 3, cancel);

    save = new Button("save", new ClickHandler() {
        public void onClick(ClickEvent event) {
            do_save();
        }
    });
    table.setWidget(9, 2, save);
    table.getFlexCellFormatter().setHorizontalAlignment(9, 3, HasHorizontalAlignment.ALIGN_RIGHT);
    errorsOnPage = new ValidInputIndicatorWidget(
            "check for missing or invalid parameters marked with this icon", false);
    table.setWidget(9, 1, errorsOnPage);

    for (int i = 0; i < 8; i++) {
        table.getFlexCellFormatter().setColSpan(i, 2, 3);
        table.getFlexCellFormatter().setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_MIDDLE);
        table.getFlexCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        table.getFlexCellFormatter().setVerticalAlignment(i, 2, HasVerticalAlignment.ALIGN_MIDDLE);
        table.getFlexCellFormatter().setHorizontalAlignment(i, 2, HasHorizontalAlignment.ALIGN_LEFT);

    }
    table.getColumnFormatter().setWidth(1, "18px");
    table.getColumnFormatter().setWidth(4, "16px");
    table.setCellPadding(1);
    table.setCellSpacing(5);
    this.add(table);
}

From source file:net.sf.mmm.client.ui.impl.gwt.widget.complex.adapter.UiWidgetAdapterGwtAbstractDataTable.java

License:Apache License

/**
 * @return the {@link SimpleCheckBox} for the multi-selection in the header to select / deselect all.
 *//*from w w  w  .  ja  v a2s . c o m*/
private SimpleCheckBox getHeaderMultiSelectionWidget() {

    if (this.headerMultiSelectionWidget == null) {
        this.headerMultiSelectionWidget = new SimpleCheckBox();
        HandlerRegistration registration = this.headerMultiSelectionWidget.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {

                Boolean checked = UiWidgetAdapterGwtAbstractDataTable.this.headerMultiSelectionWidget
                        .getValue();
                SelectionOperation operation;
                if (Boolean.TRUE.equals(checked)) {
                    operation = SelectionOperation.SET;
                } else {
                    operation = SelectionOperation.REMOVE;
                }
                getUiWidgetTyped().setSelection(SelectionChoice.ALL, operation);
            }
        });
        addHandlerRegistration(registration);
        // TODO set I18N based tooltip
    }
    return this.headerMultiSelectionWidget;
}

From source file:net.sf.mmm.client.ui.impl.gwt.widget.complex.ItemContainerGwt.java

License:Apache License

/**
 * @return the multiSelectCheckbox/* w w w.  j  ava 2  s  .  co m*/
 */
public SimpleCheckBox getMultiSelectionCheckbox() {

    if (this.multiSelectionCheckbox == null) {
        this.multiSelectionCheckbox = new SimpleCheckBox();
        this.multiSelectionCheckbox.addClickHandler(this);
    }
    return this.multiSelectionCheckbox;
}

From source file:org.eclipse.che.ide.ui.switcher.Switcher.java

License:Open Source License

public Switcher() {
    FlowPanel mainPanel = new FlowPanel();
    mainPanel.setStyleName(resources.switcherCSS().onoffswitch());

    checkbox = new SimpleCheckBox();
    checkbox.getElement().setId("switcher");
    checkbox.setName("onoffswitch");
    checkbox.setStyleName(resources.switcherCSS().onoffswitchCheckbox());
    mainPanel.add(checkbox);//  w  w  w. ja  v  a  2  s  .c o m

    Element label = DOM.createLabel();
    label.setClassName(resources.switcherCSS().onoffswitchLabel());
    label.setAttribute("for", "switcher");

    Element inner = DOM.createDiv();
    inner.setClassName(resources.switcherCSS().onoffswitchInner());
    label.appendChild(inner);

    Element sw = DOM.createDiv();
    sw.setClassName(resources.switcherCSS().onoffswitchSwitch());
    label.appendChild(sw);

    mainPanel.getElement().appendChild(label);

    initWidget(mainPanel);
}