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

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

Introduction

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

Prototype

public FlexTable() 

Source Link

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 .  co 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.CDRPanel.java

License:Open Source License

public CDRPanel() {

    CaptionPanel cptnpnlCooldownReduction = new CaptionPanel("Cooldown Reduction");
    initWidget(cptnpnlCooldownReduction);

    flexTable = new FlexTable();
    flexTable.setCellPadding(2);/*from   w  ww.  ja va2s .  c  o  m*/
    cptnpnlCooldownReduction.setContentWidget(flexTable);

    Label lblNewLabel = new Label("Helm (Diamond):");
    lblNewLabel.setStyleName("boldText");
    lblNewLabel.setWordWrap(false);
    flexTable.setWidget(0, 0, lblNewLabel);

    diamond = new ListBox();
    flexTable.setWidget(0, 2, diamond);

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

    Label lblShoulders = new Label("Shoulders (%):");
    lblShoulders.setWordWrap(false);
    lblShoulders.setStyleName("boldText");
    flexTable.setWidget(2, 0, lblShoulders);

    shoulders = new NumberSpinner();
    shoulders.setVisibleLength(4);
    flexTable.setWidget(2, 2, shoulders);

    Label lblGloves = new Label("Gloves (%):");
    lblGloves.setWordWrap(false);
    lblGloves.setStyleName("boldText");
    flexTable.setWidget(3, 0, lblGloves);

    gloves = new NumberSpinner();
    gloves.setVisibleLength(4);
    flexTable.setWidget(3, 2, gloves);

    Label lblAmulet = new Label("Amulet (%):");
    lblAmulet.setWordWrap(false);
    lblAmulet.setStyleName("boldText");
    flexTable.setWidget(4, 0, lblAmulet);

    amulet = new NumberSpinner();
    amulet.setVisibleLength(4);
    flexTable.setWidget(4, 2, amulet);

    Label lblRing = new Label("Ring 1 (%):");
    lblRing.setWordWrap(false);
    lblRing.setStyleName("boldText");
    flexTable.setWidget(5, 0, lblRing);

    ring1 = new NumberSpinner();
    ring1.setVisibleLength(4);
    flexTable.setWidget(5, 2, ring1);

    Label lblRing_1 = new Label("Ring 2 (%):");
    lblRing_1.setWordWrap(false);
    lblRing_1.setStyleName("boldText");
    flexTable.setWidget(6, 0, lblRing_1);

    ring2 = new NumberSpinner();
    ring2.setVisibleLength(4);
    flexTable.setWidget(6, 2, ring2);

    Label lblBelt = new Label("Belt (%):");
    lblBelt.setWordWrap(false);
    lblBelt.setStyleName("boldText");
    flexTable.setWidget(7, 0, lblBelt);

    belt = new NumberSpinner();
    belt.setVisibleLength(4);
    flexTable.setWidget(7, 2, belt);

    Label lblWeapon = new Label("Main Hand (%):");
    lblWeapon.setWordWrap(false);
    lblWeapon.setStyleName("boldText");
    flexTable.setWidget(8, 0, lblWeapon);

    weapon = new NumberSpinner();
    weapon.setVisibleLength(4);
    flexTable.setWidget(8, 2, weapon);

    Label lblQuiver = new Label("Off Hand (%):");
    lblQuiver.setWordWrap(false);
    lblQuiver.setStyleName("boldText");
    flexTable.setWidget(9, 0, lblQuiver);

    quiver = new NumberSpinner();
    quiver.setVisibleLength(4);
    flexTable.setWidget(9, 2, quiver);

    for (GemLevel l : GemLevel.values()) {
        this.diamond.addItem(l.getDisplayName(), l.name());
    }

    diamond.setSelectedIndex(0);

    this.shoulders.setMax(8);
    this.gloves.setMax(8);
    this.ring1.setMax(8);
    this.ring2.setMax(8);
    this.belt.setMax(8);
    this.weapon.setMax(10);
    this.quiver.setMax(10);
    this.amulet.setMax(8);

    Label l10 = new Label("Effective CDR:");
    l10.addStyleName("boldText");
    l10.setWordWrap(false);
    flexTable.setWidget(10, 0, l10);
    this.effCDR = new Label("0.0%");
    this.effCDR.addStyleName("boldText");
    flexTable.setWidget(10, 2, effCDR);

    this.skills = new TreeMap<ActiveSkill, Rune>();
    this.items = new TreeMap<Slot, ItemHolder>();

    this.cdr = 0.0;

    updateSkills();
}

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

License:Open Source License

public DamageTypePanel() {

    CaptionPanel captionPanel = new CaptionPanel("Elemental Damage Modifiers");
    initWidget(captionPanel);//from   www.  jav a2 s  . c  om

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

    List<DamageType> list = new Vector<DamageType>(DamageType.values().length);
    listBox = new ListBox();

    for (DamageType type : DamageType.values()) {
        list.add(type);
    }

    Collections.sort(list, new Comparator<DamageType>() {

        @Override
        public int compare(DamageType o1, DamageType o2) {
            return o1.getLongName().compareTo(o2.getLongName());
        }
    });

    for (DamageType s : list) {
        listBox.addItem(s.getLongName(), s.name());
    }

    listBox.setSelectedIndex(0);
    addButton = new Button("Add");

    addButton.addClickHandler(new ClickHandler() {

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

    flexTable.setWidget(0, 0, new Label("Type:", false));
    flexTable.setWidget(0, 1, listBox);
    flexTable.getFlexCellFormatter().setColSpan(0, 1, 2);
    flexTable.setWidget(0, 2, addButton);

}

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

License:Open Source License

public DPSCalculator(MainPanel main) {

    this.main = main;

    ChangeHandler handler = new ChangeHandler() {

        @Override/*from  w w  w. ja va 2  s  .  c o  m*/
        public void onChange(ChangeEvent event) {
            if (!disableListeners)
                calculate();
        }

    };

    ClickHandler clickHandler = new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            Service.getInstance().checkNews(null);
            calculate();
        }
    };

    FlexTable grid = new FlexTable();
    grid.setBorderWidth(0);
    grid.setCellPadding(5);
    initWidget(grid);

    mainHand = new WeaponPanel("Main Hand", false);
    grid.setWidget(0, 0, mainHand);
    grid.getFlexCellFormatter().setColSpan(0, 0, 2);

    offHand = new WeaponPanel("Off Hand", true);
    grid.setWidget(1, 0, offHand);
    grid.getFlexCellFormatter().setColSpan(1, 0, 2);

    CaptionPanel cptnpnlNewPanel_2 = new CaptionPanel("Equipment");
    grid.setWidget(2, 0, cptnpnlNewPanel_2);

    FlexTable flexTable_2 = new FlexTable();
    flexTable_2.setCellPadding(2);
    cptnpnlNewPanel_2.setContentWidget(flexTable_2);

    Label lblJewelryDamage = new Label("Jewelry Damage:");
    flexTable_2.setWidget(0, 0, lblJewelryDamage);
    lblJewelryDamage.setWordWrap(false);

    minJewelDamage = new NumberSpinner();
    minJewelDamage.box.setTitle("Total of all jewelry damage");
    flexTable_2.setWidget(0, 1, minJewelDamage);
    minJewelDamage.setVisibleLength(6);
    minJewelDamage.addChangeHandler(handler);

    Label label_1 = new Label(" to ");
    flexTable_2.setWidget(0, 2, label_1);
    label_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    maxJewelDamage = new NumberSpinner();
    maxJewelDamage.box.setTitle("Total of all jewelry damage");
    flexTable_2.setWidget(0, 3, maxJewelDamage);
    maxJewelDamage.setVisibleLength(6);
    maxJewelDamage.addChangeHandler(handler);

    Label lblNewLabel_2b = new Label("Equipment IAS (%):");
    flexTable_2.setWidget(1, 0, lblNewLabel_2b);
    lblNewLabel_2b.setWordWrap(false);

    equipIAS = new NumberSpinner();
    equipIAS.box.setTitle("Increased attack speed from equipment, except Weapon");
    flexTable_2.setWidget(1, 1, equipIAS);
    equipIAS.setVisibleLength(6);
    equipIAS.addChangeHandler(handler);

    Label lblNewLabel_4 = new Label("Crit Chance (%):");
    flexTable_2.setWidget(3, 0, lblNewLabel_4);
    lblNewLabel_4.setWordWrap(false);

    critChance = new DoubleSpinner();
    critChance.box.setTitle("Increased Crit Chance from equipment and set bonuses");
    flexTable_2.setWidget(3, 1, critChance);
    critChance.setVisibleLength(6);
    critChance.addChangeHandler(handler);
    critChance.setMax(95.0);

    Label lblNewLabel_5 = new Label("Crit Hit Damage (%):");
    flexTable_2.setWidget(4, 0, lblNewLabel_5);
    lblNewLabel_5.setWordWrap(false);

    critDamage = new NumberSpinner();
    critDamage.box.setTitle("Increased Crit Hit Damage from equipment and set bonuses");
    flexTable_2.setWidget(4, 1, critDamage);
    critDamage.setVisibleLength(6);
    critDamage.addChangeHandler(handler);

    FlexTable flexTable_7 = new FlexTable();
    grid.setWidget(2, 1, flexTable_7);

    flexTable_7.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
    flexTable_7.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);

    CaptionPanel cptnpnlNewPanel_4 = new CaptionPanel("Hero");
    grid.setWidget(2, 1, cptnpnlNewPanel_4);
    grid.getCellFormatter().setVerticalAlignment(2, 1, HasVerticalAlignment.ALIGN_TOP);

    FlexTable flexTable_4 = new FlexTable();
    flexTable_4.setCellPadding(2);
    cptnpnlNewPanel_4.setContentWidget(flexTable_4);

    Label lblHeroLevel = new Label("Hero Level:");
    lblHeroLevel.setWordWrap(false);
    flexTable_4.setWidget(0, 0, lblHeroLevel);

    heroLevel = new NumberSpinner();
    heroLevel.box.setTitle("Hero's level");
    heroLevel.setVisibleLength(6);
    heroLevel.setMin(1);
    heroLevel.setMax(70);
    flexTable_4.setWidget(0, 1, heroLevel);

    heroLevel.addChangeHandler(handler);

    Label lblNewLabel_3 = new Label("Dexterity from Items:");
    flexTable_4.setWidget(1, 0, lblNewLabel_3);
    lblNewLabel_3.setWordWrap(false);

    dexterity = new NumberSpinner();
    dexterity.box.setTitle("Total of all dexterity from items and set bonuses only");
    flexTable_4.setWidget(1, 1, dexterity);
    dexterity.setVisibleLength(6);

    dexterity.addChangeHandler(handler);

    CaptionPanel cptnpnlNewPanel_6 = new CaptionPanel("Breakpoint Calculator");
    grid.setWidget(3, 0, cptnpnlNewPanel_6);
    grid.getFlexCellFormatter().setColSpan(3, 0, 2);

    FlexTable flexTable_6 = new FlexTable();
    flexTable_6.setCellPadding(5);
    cptnpnlNewPanel_6.setContentWidget(flexTable_6);

    Label lblNewLabel_7 = new Label("Sheet DPS:");
    flexTable_6.setWidget(0, 0, lblNewLabel_7);
    lblNewLabel_7.setWordWrap(false);
    lblNewLabel_7.setStyleName("boldText");

    dps = new Label("0");
    dps.setTitle("This is the shet dps shown on charcter screen as \"Damage\"");
    flexTable_6.setWidget(0, 1, dps);
    dps.setStyleName("boldText");

    Label label_11 = new Label("Skill APS:");
    flexTable_6.setWidget(1, 2, label_11);
    label_11.setWordWrap(false);
    label_11.setStyleName("boldText");

    skillApsLabel = new Label("0");
    skillApsLabel.setTitle("APS for selected skill");
    flexTable_6.setWidget(1, 3, skillApsLabel);
    skillApsLabel.setStyleName("boldText");

    Label lblBreakPoint = new Label("Break Point #:");
    flexTable_6.setWidget(2, 2, lblBreakPoint);
    lblBreakPoint.setWordWrap(false);
    lblBreakPoint.setStyleName("boldText");

    breakpoint = new Label("0");
    breakpoint.setTitle("Break Point # for selected skill");
    flexTable_6.setWidget(2, 3, breakpoint);
    breakpoint.setStyleName("boldText");

    CaptionPanel cptnpnlNewPanel = new CaptionPanel("Next/Previous Breakpoint");
    flexTable_6.setWidget(0, 4, cptnpnlNewPanel);
    cptnpnlNewPanel.setStyleName("boldText");

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

    Label skill = new Label("Skill:");
    skill.setWordWrap(false);
    flexTable.setWidget(0, 0, skill);

    skillBox = new ListBox();
    skillBox.setWidth("100%");
    flexTable.setWidget(0, 1, skillBox);

    List<Pair<String, String>> list = new Vector<Pair<String, String>>();

    for (ActiveSkill s : ActiveSkill.values()) {

        if (DamageFunction.hasDamage(s) && (s.getFrames() != 0))
            list.add(new Pair<String, String>(s.getLongName(), s.name()));
    }

    Collections.sort(list, new Comparator<Pair<String, String>>() {

        @Override
        public int compare(Pair<String, String> o1, Pair<String, String> o2) {
            return o1.getA().toLowerCase().compareTo(o2.getA().toLowerCase());
        }
    });

    for (Pair<String, String> p : list) {
        skillBox.addItem(p.getA(), p.getB());
    }

    skillBox.setSelectedIndex(0);

    skillBox.addChangeHandler(new ChangeHandler() {

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

    Label lblWithRepectTo = new Label("With Repect To:");
    lblWithRepectTo.setWordWrap(false);
    flexTable.setWidget(1, 0, lblWithRepectTo);

    iasType = new ListBox();
    flexTable.setWidget(1, 1, iasType);
    iasType.setWidth("100%");
    iasType.setSelectedIndex(0);

    Label lblApsForNext = new Label("IAS for next BP:");
    flexTable.setWidget(2, 0, lblApsForNext);
    lblApsForNext.setWordWrap(false);
    lblApsForNext.setStyleName("boldText");

    nextBP = new Label("0");
    nextBP.setTitle("IAS needed for next BP");
    flexTable.setWidget(2, 1, nextBP);
    nextBP.setWordWrap(false);
    nextBP.setStyleName("boldText");

    Label lblextraIas = new Label("\"Extra\" IAS:");
    flexTable.setWidget(3, 0, lblextraIas);
    lblextraIas.setWordWrap(false);
    lblextraIas.setStyleName("boldText");

    prevBP = new Label("0");
    prevBP.setTitle("Extra IAS that can be removed without lowering BP");
    flexTable.setWidget(3, 1, prevBP);
    prevBP.setWordWrap(false);
    prevBP.setStyleName("boldText");

    iasType.addChangeHandler(new ChangeHandler() {

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

    Label lblNewLabel_7b = new Label("Player APS:");
    flexTable_6.setWidget(1, 0, lblNewLabel_7b);
    lblNewLabel_7b.setWordWrap(false);
    lblNewLabel_7b.setStyleName("boldText");

    aps = new Label("0.0");
    aps.setTitle("This is the APS for the character, as shown on the details screen under offense");
    flexTable_6.setWidget(1, 1, aps);
    aps.setStyleName("boldText");

    Label lblPetAps = new Label("Pet APS:");
    flexTable_6.setWidget(0, 2, lblPetAps);
    lblPetAps.setWordWrap(false);
    lblPetAps.setStyleName("boldText");

    petAps = new Label("0.0");
    petAps.setTitle("Calculated Pet/Sentry APS");
    flexTable_6.setWidget(0, 3, petAps);
    petAps.setStyleName("boldText");

    Label lblTotal = new Label("Total Crit Chance:");
    flexTable_6.setWidget(2, 0, lblTotal);
    lblTotal.setStyleName("boldText");

    actualCC = new Label("0.0%");
    actualCC.setTitle("Total CC as shown on character details screen under offense");
    flexTable_6.setWidget(2, 1, actualCC);
    actualCC.setStyleName("boldText");

    Label lblAttacksPer = new Label("FPA");
    lblAttacksPer.setWordWrap(false);
    lblAttacksPer.setStyleName("boldText");
    flexTable_6.setWidget(3, 2, lblAttacksPer);

    fpaLabel = new Label("0");
    fpaLabel.setTitle("Frames per Attack");
    fpaLabel.setStyleName("boldText");
    flexTable_6.setWidget(3, 3, fpaLabel);

    Label lblTotalCritDamage = new Label("Total Crit Hit Damage:");
    flexTable_6.setWidget(3, 0, lblTotalCritDamage);
    lblTotalCritDamage.setStyleName("boldText");

    actualCD = new Label("0.0%");
    actualCD.setTitle("Total CHD as shown on character details screen under offense");
    flexTable_6.setWidget(3, 1, actualCD);
    actualCD.setStyleName("boldText");

    Label lblBpAps = new Label("Actual APS:");
    flexTable_6.setWidget(4, 2, lblBpAps);
    lblBpAps.setWordWrap(false);
    lblBpAps.setStyleName("boldText");

    actualAps = new Label("0");
    actualAps.setTitle("Actual APS (based on Breakpoint)");
    flexTable_6.setWidget(4, 3, actualAps);
    actualAps.setStyleName("boldText");

    Label lblTotalDexterity = new Label("Total Dexterity:");
    lblTotalDexterity.setStyleName("boldText");
    flexTable_6.setWidget(4, 0, lblTotalDexterity);

    dexterityLabel = new Label("0");
    dexterityLabel.setTitle("This is the total of all Dexterity from items, levels and paragon points");
    dexterityLabel.setStyleName("boldText");
    flexTable_6.setWidget(4, 1, dexterityLabel);

    flexTable_6.getFlexCellFormatter().setRowSpan(0, 4, 5);
    flexTable_6.getCellFormatter().setVerticalAlignment(0, 4, HasVerticalAlignment.ALIGN_TOP);
    flexTable_6.getCellFormatter().setHorizontalAlignment(0, 4, HasHorizontalAlignment.ALIGN_LEFT);
    grid.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_LEFT);
    grid.getCellFormatter().setVerticalAlignment(2, 1, HasVerticalAlignment.ALIGN_TOP);
    grid.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_LEFT);
    grid.getCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP);

    for (IasType t : IasType.values()) {
        iasType.addItem(t.getDescription(), t.name());
    }
    grid.getFlexCellFormatter().setColSpan(3, 0, 2);
    grid.getFlexCellFormatter().setColSpan(0, 0, 2);
    grid.getFlexCellFormatter().setColSpan(1, 0, 2);

    mainHand.getWeaponType().addChangeHandler(handler);
    mainHand.getBaseMin().addChangeHandler(handler);
    mainHand.getBaseMax().addChangeHandler(handler);
    mainHand.getAddMin().addChangeHandler(handler);
    mainHand.getAddMax().addChangeHandler(handler);
    mainHand.getWeaponIAS().addChangeHandler(handler);
    mainHand.getWeaponDamage().addChangeHandler(handler);

    offHand.getWeaponType().addChangeHandler(handler);
    offHand.getBaseMin().addChangeHandler(handler);
    offHand.getBaseMax().addChangeHandler(handler);
    offHand.getAddMin().addChangeHandler(handler);
    offHand.getAddMax().addChangeHandler(handler);
    offHand.getWeaponIAS().addChangeHandler(handler);
    offHand.getWeaponDamage().addChangeHandler(handler);

}

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

License:Open Source License

@SuppressWarnings("unchecked")
public GearPanel() {

    HorizontalPanel panel = new HorizontalPanel();
    initWidget(panel);/*from  w  ww. ja v  a2s. com*/

    VerticalPanel verticalPanel_1 = new VerticalPanel();
    panel.add(verticalPanel_1);

    CaptionPanel captionPanel = new CaptionPanel("Current Items");
    verticalPanel_1.add(captionPanel);

    FlexTable table = new FlexTable();
    captionPanel.add(table);

    CaptionPanel cptnpnlNewPanel = new CaptionPanel("Saved Items");
    panel.add(cptnpnlNewPanel);

    VerticalPanel verticalPanel = new VerticalPanel();
    cptnpnlNewPanel.setContentWidget(verticalPanel);
    verticalPanel.setSize("5cm", "3cm");

    savedItems = new ListBox();
    verticalPanel.add(savedItems);
    savedItems.setVisibleItemCount(20);
    savedItems.setWidth("100%");

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(5);
    verticalPanel.add(horizontalPanel);

    Button btnNewButton = new Button("New button");
    btnNewButton.setText("Rename...");
    horizontalPanel.add(btnNewButton);

    btnNewButton.addClickHandler(new ClickHandler() {

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

    Button btnNewButton_1 = new Button("New button");
    btnNewButton_1.setText("Delete");
    horizontalPanel.add(btnNewButton_1);

    btnNewButton_1.addClickHandler(new ClickHandler() {

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

    int row = 0;

    for (Slot slot : Slot.values())
        if (!slot.isCube()) {
            final Slot thisSlot = slot;

            Label label = new Label(slot.name());
            label.addStyleName("boldText");
            table.setWidget(row, 0, label);

            Anchor status = new Anchor("unloaded");
            status.setTarget("_blank");
            status.setHref("javascript:void(0);");
            table.setWidget(row, 1, status);
            labels.put(slot, status);
            status.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    event.preventDefault();
                    clickItem(thisSlot);

                }
            });

            Button saveButton = new Button("save");
            table.setWidget(row, 2, saveButton);
            saveButton.addClickHandler(new ClickHandler() {

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

            Button replaceButton = new Button("replace");
            table.setWidget(row, 3, replaceButton);
            replaceButton.addClickHandler(new ClickHandler() {

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

            Button clearButton = new Button("clear");
            table.setWidget(row, 4, clearButton);
            clearButton.addClickHandler(new ClickHandler() {

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

            row++;
        }

    Storage storage = getStorage();

    if (storage != null) {
        String data = storage.getItem(SAVED_ITEMS);
        JsoArray<Entry> list = null;

        if (data != null) {
            list = JsonUtils.safeEval(data);
        } else {
            list = (JsoArray<Entry>) JavaScriptObject.createArray();
        }

        for (int i = 0; i < list.length(); i++) {
            Entry e = list.get(i);
            savedItems.addItem(e.getName(), e.getItem());
        }

    }

    setVisible(false);
}

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

License:Open Source License

public GemsPanel() {

    CaptionPanel captionPanel = new CaptionPanel("Legendary Gems");
    initWidget(captionPanel);//from  w  w w . j a  v a2 s  .  c o  m

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

    List<GemSkill> gems = new Vector<GemSkill>();

    for (GemSkill gem : GemSkill.values())
        gems.add(gem);

    Collections.sort(gems, new Comparator<GemSkill>() {

        @Override
        public int compare(GemSkill o1, GemSkill o2) {
            return o1.getDisplayName().toLowerCase().compareTo(o2.getDisplayName().toLowerCase());
        }
    });

    for (int i = 0; i < NUM_GEMS; i++) {
        final int row = i;
        Anchor anchor = new Anchor("Gem " + (i + 1));
        anchor.setWordWrap(false);
        anchor.setTarget("_blank");
        anchor.setHref("javascript:void(0)");
        anchors.add(anchor);
        table.setWidget(row, 0, anchor);

        ListBox list = new ListBox();
        list.addItem("None", "");
        list.setWidth("100%");
        table.setWidget(row, 1, list);
        listBoxes.add(list);
        list.setSelectedIndex(0);
        selected.add(null);

        for (GemSkill gem : gems) {
            list.addItem(gem.getDisplayName(), gem.name());
        }

        list.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
                gemChanged(row);
            }
        });

        Label label = new Label("Level:", false);
        table.setWidget(row, 2, label);

        NumberSpinner level = new NumberSpinner();
        level.setMax(100);
        level.setVisibleLength(4);
        table.setWidget(row, 3, level);
        levels.add(level);
        level.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
                levelChanged(row);
            }
        });

        attributes.add(null);
    }

}

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

License:Open Source License

public HatredPanel() {

    CaptionPanel captionPanel = new CaptionPanel("Hatred/Discipline");
    initWidget(captionPanel);//from   ww w .  j  a v a 2 s .  co m

    FlexTable flexTable = new FlexTable();
    flexTable.setCellPadding(2);
    captionPanel.setContentWidget(flexTable);

    Label lblHatredPerSecond = new Label("+ Hatred per Second:");
    flexTable.setWidget(0, 0, lblHatredPerSecond);

    hatredPerSecond = new DoubleSpinner();
    hatredPerSecond.setVisibleLength(5);

    flexTable.setWidget(0, 1, hatredPerSecond);

    Label label = new Label("+ Maximum Discipline:");
    flexTable.setWidget(1, 0, label);

    equipmentDiscipline = new NumberSpinner();
    equipmentDiscipline.setVisibleLength(5);
    flexTable.setWidget(1, 1, equipmentDiscipline);

    Label lblNewLabel_1 = new Label(
            "Only include increased Hatred per Second and Max Discipline from items. Do not include gains from skills (e.g. Archery) or buffs (e.g. Inspire).");
    lblNewLabel_1.setWordWrap(true);
    lblNewLabel_1.addStyleName("boldText");
    flexTable.setWidget(2, 0, lblNewLabel_1);
    flexTable.getFlexCellFormatter().setColSpan(2, 0, 2);
    lblNewLabel_1.setWidth("400px");
}

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

License:Open Source License

public ItemPanel() {

    disableListeners = false;/*from w ww  . ja v  a 2s .  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.ItemPanel.java

License:Open Source License

private boolean setItem(final Slot slot, SpecialItemType type, AttributeData data) {

    boolean changed = false;

    SpecialItemType prev = selected.get(slot);
    selected.put(slot, type);/* w  w  w .ja  va2  s  .  c om*/

    int row = rows.get(slot);

    if ((prev != null) && (type != prev)) {
        table.removeCell(row + 1, 1);
        attributeSpinners.get(slot).clear();

        changed |= true;
    }

    if (type != prev)
        setItem(slot, type);

    if ((type != null) && (type != prev)) {

        changed |= true;

        FlexTable aTable = new FlexTable();
        table.setWidget(row + 1, 1, aTable);

        SpecialItemType.Attribute[] aList = type.getAttributes();

        int n = 0;

        for (SpecialItemType.Attribute a : aList) {
            String name = a.getLabel();
            Label label = new Label(name + ":", false);
            aTable.setWidget(n, 0, label);

            double s = a.getScalar();

            if (s > 100) {
                DoubleSpinner spinner = new DoubleSpinner();
                spinner.setIncrement(0.1);
                spinner.setMin(a.getMin() / 10.0);
                spinner.setMax(a.getMax() / 10.0);
                spinner.setVisibleLength(6);
                aTable.setWidget(n, 1, spinner);
                attributeSpinners.get(slot).put(name, spinner);

                final SpecialItemType.Attribute thisAttribute = a;

                spinner.addChangeHandler(new ChangeHandler() {

                    @Override
                    public void onChange(ChangeEvent event) {
                        attributeValueChanged(slot, thisAttribute);
                    }
                });
            } else {
                NumberSpinner spinner = new NumberSpinner();
                spinner.setMin(a.getMin());
                spinner.setMax(a.getMax());
                spinner.setVisibleLength(6);
                aTable.setWidget(n, 1, spinner);
                attributeSpinners.get(slot).put(name, spinner);

                final SpecialItemType.Attribute thisAttribute = a;

                spinner.addChangeHandler(new ChangeHandler() {

                    @Override
                    public void onChange(ChangeEvent event) {
                        attributeValueChanged(slot, thisAttribute);
                    }
                });
            }

            n++;
        }

    }

    if (type != null) {
        SpecialItemType.Attribute[] aList = type.getAttributes();

        for (SpecialItemType.Attribute a : aList) {
            BaseSpinner<?> spinner = attributeSpinners.get(slot).get(a.getLabel());
            Integer value = (data != null) ? data.get(a.getLabel()) : null;

            if (value == null) {
                if (slot.isCube()) {
                    // TODO Get Min value for others that need min value as default for cube
                    if (type == SpecialItemType.MeticulousBolts)
                        value = a.getMin();
                    else
                        value = a.getMax();
                } else {
                    // TODO Get Min value for others that need max value as default 
                    if (type == SpecialItemType.MeticulousBolts)
                        value = a.getMax();
                    else
                        value = a.getMin();
                }
            }

            if (spinner instanceof NumberSpinner) {
                if (value != ((NumberSpinner) spinner).getValue()) {
                    ((NumberSpinner) spinner).setValue(value);
                    changed = true;
                }
            } else {
                if (value != (int) (((DoubleSpinner) spinner).getValue() * 10.0)) {
                    ((DoubleSpinner) spinner).setValue(value / 10.0);
                    changed = true;
                }
            }
        }
    }

    return changed;
}

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

License:Open Source License

public LeaderboardPanel(MainPanel mainPanel) {

    this.mainPanel = mainPanel;

    table = new FlexTable();
    initWidget(table);/*from  w w w . j a v a  2s.co m*/

    int row = 0;
    table.setWidget(row, 0, new Label("Season/Era:", false));
    table.setWidget(row, 1, seasonList);

    table.setWidget(row, 2, new Label("Hardcore:", false));
    table.setWidget(row, 3, hardcore);

    table.setWidget(row, 4, new Label("Leaderboard:", false));
    table.setWidget(row, 5, leaderboard);
    row++;

    Button button = new Button("Get Leaderboard");
    button.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            getLeaderboard();

        }
    });

    table.setWidget(row, 0, button);

    Anchor anchor = new Anchor("battle.net");
    anchor.setHref("javascript:void(0)");
    anchor.addClickHandler(new ClickHandler() {

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

    table.setWidget(row, 1, anchor);

    row++;

    for (LeaderboardType t : LeaderboardType.values()) {
        leaderboard.addItem(t.toString(), t.name());
    }

    leaderboard.setSelectedIndex(0);
    leaderboardRow = row;

}