Example usage for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE

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

Introduction

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

Prototype

VerticalAlignmentConstant ALIGN_MIDDLE

To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.

Click Source Link

Document

Specifies that the widget's contents should be aligned in the middle.

Usage

From source file:com.dawg6.gwt.client.ApplicationPanel.java

License:Open Source License

public static AsyncTaskHandler showWaitDialogBox(String title, String message) {

    VerticalPanel panel = new VerticalPanel();
    HorizontalPanel row = new HorizontalPanel();
    row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    row.setSpacing(5);//from  w  ww .  jav  a  2  s.c  o m
    panel.add(row);

    Image image = new Image("images/Progressbar.gif");
    image.setSize("64px", "16px");
    row.add(image);

    if (message != null) {
        Label label = new Label(message);
        row.add(label);
    }

    final DialogBox dialogBox = showDialogBox(title, panel, -1, null);

    return new AsyncTaskHandler() {

        @Override
        public void taskCompleted() {
            dialogBox.hide();
        }
    };

}

From source file:com.dawg6.gwt.client.widgets.AbstractSearchable.java

License:Open Source License

protected AbstractSearchable(ValueFactory<T> factory, Comparator<T> sorter) {

    captionPanel = new CaptionPanel("Caption");
    initWidget(captionPanel);//from  www  .  j a v a  2  s .  co  m

    VerticalPanel verticalPanel_5 = new VerticalPanel();
    captionPanel.setContentWidget(verticalPanel_5);
    verticalPanel_5.setSize("5cm", "3cm");

    HorizontalPanel row = new HorizontalPanel();
    row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    row.setSpacing(5);
    verticalPanel_5.add(row);

    Label label = new Label("Filter:");
    row.add(label);

    suggestBox = new TextBox();
    row.add(suggestBox);
    suggestBox.setVisibleLength(20);

    suggestBox.addKeyUpHandler(new KeyUpHandler() {

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

    Button button = new Button("Clear");
    row.add(button);
    button.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            suggestBox.setText("");
            setFilter();
        }
    });

    listBox = new CellList<T>(getCell());

    scroll = new ScrollPanel();
    scroll.setWidget(listBox);

    this.list = new Vector<T>();
    this.dataProvider = new ListDataProvider<T>();
    this.dataProvider.addDataDisplay(listBox);
    verticalPanel_5.add(scroll);
    listBox.setPageSize(Integer.MAX_VALUE);

    listBox.setSize("300px", "300px");
    selectionModel = new SingleSelectionModel<T>();
    listBox.setSelectionModel(selectionModel);

    selectionModel.addSelectionChangeHandler(new Handler() {

        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            selectionChanged(getSelectedValue());

        }
    });

    this.factory = factory;
    this.sorter = sorter;
}

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

License:Open Source License

public AboutDialog() {

    flexTable = new FlexTable();
    flexTable.setBorderWidth(0);//from www. ja v  a  2s. co  m
    flexTable.setCellPadding(5);
    initWidget(flexTable);

    Label lblNewLabel = new Label("DH DPS Calculator");
    lblNewLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    lblNewLabel.setStyleName("boldText");
    lblNewLabel.setWordWrap(false);
    flexTable.setWidget(0, 0, lblNewLabel);
    flexTable.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
    flexTable.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);

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

    Label lblNewLabel_1 = new Label("Version:");
    horizontalPanel.add(lblNewLabel_1);

    versionLabel = new Label(Version.getVersionString());
    horizontalPanel.add(versionLabel);
    flexTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);

    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_1.setSpacing(5);
    horizontalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.setWidget(3, 0, horizontalPanel_1);

    Label lblWritteByDawg = new Label("Written By:");
    horizontalPanel_1.add(lblWritteByDawg);

    Anchor label_1 = new Anchor("New label");
    label_1.setTarget("_blank");
    label_1.setText("dawg6");
    label_1.setHref("http://us.battle.net/d3/en/profile/Dawg6-1416/");
    horizontalPanel_1.add(label_1);

    Label lblNewLabel_2 = new Label("(");
    horizontalPanel_1.add(lblNewLabel_2);

    Anchor anchor_1 = new Anchor("New label");
    anchor_1.setText("scott@dawg6.com");
    anchor_1.setTarget("_blank");
    anchor_1.setHref("mailto:scott@dawg6.com");
    horizontalPanel_1.add(anchor_1);

    Label lblNewLabel_3 = new Label(")");
    horizontalPanel_1.add(lblNewLabel_3);
    flexTable.getCellFormatter().setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER);

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

    Label lblRedditThread = new Label("Reddit Thread:");
    horizontalPanel_2.add(lblRedditThread);

    Anchor anchor = new Anchor("New label");
    anchor.setTarget("_blank");
    anchor.setText("http://redd.it/2jiynj");
    anchor.setHref("http://redd.it/2jiynj");
    horizontalPanel_2.add(anchor);
    flexTable.getCellFormatter().setHorizontalAlignment(5, 0, HasHorizontalAlignment.ALIGN_CENTER);

    HorizontalPanel horizontalPanel_3 = new HorizontalPanel();
    horizontalPanel_3.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_3.setSpacing(5);
    horizontalPanel_3.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.setWidget(6, 0, horizontalPanel_3);

    Label lblBlizzardThread = new Label("Blizzard Thread:");
    horizontalPanel_3.add(lblBlizzardThread);

    Anchor anchor_2 = new Anchor("New label");
    anchor_2.setText("http://us.battle.net/d3/en/forum/topic/18706673688");
    anchor_2.setTarget("_blank");
    anchor_2.setHref("http://us.battle.net/d3/en/forum/topic/18706673688");
    horizontalPanel_3.add(anchor_2);
    flexTable.getCellFormatter().setHorizontalAlignment(6, 0, HasHorizontalAlignment.ALIGN_CENTER);

    HorizontalPanel horizontalPanel_4 = new HorizontalPanel();
    horizontalPanel_4.setSpacing(5);
    horizontalPanel_4.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.setWidget(7, 0, horizontalPanel_4);

    Anchor anchor_3 = new Anchor("New label");
    anchor_3.setText("Change Log");
    anchor_3.setTarget("_blank");
    anchor_3.setHref("changeLog.txt?v2");
    horizontalPanel_4.add(anchor_3);

    Anchor anchor_4 = new Anchor("New label");
    anchor_4.setText("To-do List");
    anchor_4.setTarget("_blank");
    anchor_4.setHref("https://github.com/dawg6/dhcalc/issues");
    horizontalPanel_4.add(anchor_4);
    flexTable.getCellFormatter().setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_CENTER);

    Anchor anchor_5 = new Anchor("Source Code");
    anchor_5.setTarget("_blank");
    anchor_5.setHref("https://github.com/dawg6/dhcalc");
    horizontalPanel_4.add(anchor_5);
    flexTable.getCellFormatter().setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_CENTER);

}

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

License:Open Source License

/**
 * @wbp.parser.constructor//from w  w  w  . j  a  v a 2 s.  c o  m
 */
protected BaseSpinner(ValueBox<T> box, String text, T min, T max, T increment) {
    this.box = box;
    this.min = min;
    this.max = max;
    this.increment = increment;

    box.addKeyUpHandler(new KeyUpHandler() {

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

    box.addFocusHandler(new FocusHandler() {

        @Override
        public void onFocus(FocusEvent event) {
            normalize();
        }
    });

    box.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            normalize();
        }
    });

    box.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            normalize();
        }
    });

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setStyleName("spinner");
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    initWidget(horizontalPanel);

    down = new Button();
    down.setText("-");
    down.setStyleName("spinnerDownButton");
    horizontalPanel.add(down);

    down.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            increment(-1);
        }
    });

    box.setStyleName("spinnerBox");
    box.setText(text);
    horizontalPanel.add(box);

    box.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            BaseSpinner.this.box.selectAll();
        }
    });

    up = new Button();
    up.setText("+");
    up.setStyleName("spinnerUpButton");
    horizontalPanel.add(up);

    up.addClickHandler(new ClickHandler() {

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

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

License:Open Source License

public BPData() {

    VerticalPanel panel = new VerticalPanel();
    initWidget(panel);/*w w w  . ja  v a2 s .c o m*/

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setSpacing(5);
    panel.add(horizontalPanel);

    Label lblNewLabel = new Label("Skill:");
    lblNewLabel.setStyleName("boldText");
    horizontalPanel.add(lblNewLabel);

    skills = new ListBox();
    horizontalPanel.add(skills);

    Label lblNewLabel2 = new Label("Weapon Type:");
    lblNewLabel2.setStyleName("boldText");
    horizontalPanel.add(lblNewLabel2);

    weaponType = new ListBox();
    horizontalPanel.add(weaponType);

    for (WeaponType t : WeaponType.values()) {
        weaponType.addItem(t.getName(), t.name());
    }

    CaptionPanel cptnpnlNewPanel = new CaptionPanel("Skill Break Point Data");
    panel.add(cptnpnlNewPanel);

    table = new FlexTable();
    cptnpnlNewPanel.setContentWidget(table);
    table.setSize("5cm", "3cm");
    table.setStyleName("breakpointTable");
    table.setCellPadding(5);
    table.setBorderWidth(1);

    table.getRowFormatter().addStyleName(0, "headerRow");

    int col = 0;

    Label bp = new Label("BP");
    bp.setWordWrap(false);
    table.setWidget(0, col++, bp);

    Label fpa = new Label("FPA");
    fpa.setWordWrap(false);
    table.setWidget(0, col++, fpa);

    Label minAps = new Label("Min APS");
    minAps.setWordWrap(false);
    table.setWidget(0, col++, minAps);

    Label actualAps = new Label("Actual APS");
    actualAps.setWordWrap(false);
    table.setWidget(0, col++, actualAps);

    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) {
        skills.addItem(p.getA(), p.getB());
    }

    skills.addChangeHandler(new ChangeHandler() {

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

    weaponType.addChangeHandler(new ChangeHandler() {

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

    skills.setSelectedIndex(0);
    weaponType.setSelectedIndex(0);

    skillChanged();
}

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  ww .  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);//ww  w  . j av a 2  s. co  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.LeaderboardPanel.java

License:Open Source License

protected void populateLeaders(Leaderboard result) {
    leaders = new ListBox();

    for (LeaderboardRow row : result.rows) {
        Long rift = null;//from w  ww. j a  va  2  s . c om
        Long time = null;
        Long rank = null;

        for (LeaderboardData d : row.data) {
            if (d.id.equals("Rank")) {
                rank = d.number;
            } else if (d.id.equals("RiftLevel")) {
                rift = d.number;
            } else if (d.id.equals("RiftTime")) {
                time = d.timestamp;
            }

            if ((rift != null) && (time != null) && (rank != null)) {
                break;
            }
        }

        if ((rift != null) && (time != null) && (rank != null)) {

            for (Account pl : row.players) {
                String btag = null;
                Long heroId = null;
                boolean isDh = false;

                for (LeaderboardData d : pl.data) {
                    if (d.id.equals("HeroClass")) {
                        if (d.string.equals("demon hunter")) {
                            isDh = true;
                        } else {
                            break;
                        }
                    } else if (d.id.equals("HeroBattleTag")) {
                        btag = d.string;
                    } else if (d.id.equals("HeroId")) {
                        heroId = d.number;
                    }

                    if (isDh && (btag != null) && (heroId != null))
                        break;
                }

                if (isDh && (btag != null) && (heroId != null)) {
                    long minutes = time / 60000L;
                    long seconds = (time - (minutes * 60000)) / 1000L;
                    String ts = NumberFormat.getFormat("00").format(minutes) + ":"
                            + NumberFormat.getFormat("00").format(seconds);
                    String label = rank + ") Level " + rift + ": " + ts + " - " + btag;
                    leaders.addItem(label, btag + "#" + heroId);
                }
            }
        }
    }

    HorizontalPanel row = new HorizontalPanel();
    row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    row.setSpacing(5);

    row.add(leaders);

    this.table.setWidget(this.leaderboardRow, 0, row);
    this.table.getFlexCellFormatter().setColSpan(this.leaderboardRow, 0, 6);

    Anchor career = new Anchor("profile");
    career.setHref("javascript:void(0)");
    row.add(career);

    career.addClickHandler(new ClickHandler() {

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

    Anchor hero = new Anchor("hero");
    hero.setHref("javascript:void(0)");
    row.add(hero);

    hero.addClickHandler(new ClickHandler() {

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

    hero.addClickHandler(new ClickHandler() {

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

    Anchor paperdoll = new Anchor("paperdoll");
    paperdoll.setHref("javascript:void(0)");
    row.add(paperdoll);

    paperdoll.addClickHandler(new ClickHandler() {

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

    Button button = new Button("Import Profile");
    row.add(button);

    button.addClickHandler(new ClickHandler() {

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

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

License:Open Source License

public MainPanel() {
    VerticalPanel panel = new VerticalPanel();
    initWidget(panel);/*from  www  .  ja va 2  s .  com*/
    panel.setWidth("");

    newsPanel = new HorizontalPanel();
    panel.add(newsPanel);

    HorizontalPanel horizontalPanel_4 = new HorizontalPanel();
    panel.add(horizontalPanel_4);

    VerticalPanel verticalPanel_2 = new VerticalPanel();
    horizontalPanel_4.add(verticalPanel_2);

    CaptionPanel cptnpnlNewPanel_7 = new CaptionPanel("Battle.Net Import");
    verticalPanel_2.add(cptnpnlNewPanel_7);

    VerticalPanel verticalPanel_6 = new VerticalPanel();
    verticalPanel_6.setSpacing(5);
    verticalPanel_6.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    cptnpnlNewPanel_7.setContentWidget(verticalPanel_6);

    HorizontalPanel horizontalPanel_5 = new HorizontalPanel();
    horizontalPanel_5.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_5.setSpacing(5);
    verticalPanel_6.add(horizontalPanel_5);

    Label lblNewLabel_18 = new Label("Realm:");
    horizontalPanel_5.add(lblNewLabel_18);

    realms = new ListBox();
    horizontalPanel_5.add(realms);

    Button ldrButton = new Button("Leaderboards...");
    horizontalPanel_5.add(ldrButton);

    ldrButton.addClickHandler(new ClickHandler() {

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

    Button helpButton = new Button("Help...");
    horizontalPanel_5.add(helpButton);

    helpButton.addClickHandler(new ClickHandler() {

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

    HorizontalPanel horizontalPanel_7 = new HorizontalPanel();
    horizontalPanel_7.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_7.setSpacing(5);
    verticalPanel_6.add(horizontalPanel_7);

    Label lblNewLabel_19 = new Label("Battle Tag:");
    lblNewLabel_19.setWordWrap(false);
    horizontalPanel_7.add(lblNewLabel_19);

    battleTag = new TextBox();
    battleTag.setText("BnetName");
    battleTag.setVisibleLength(15);
    horizontalPanel_7.add(battleTag);

    Label lblNewLabel_20 = new Label("#");
    horizontalPanel_7.add(lblNewLabel_20);

    tagNumber = new TextBox();
    tagNumber.setText("1234");
    tagNumber.setVisibleLength(8);
    horizontalPanel_7.add(tagNumber);

    Button fetchButton = new Button("Get Hero List");
    fetchButton.setWidth("100px");
    horizontalPanel_7.add(fetchButton);
    fetchButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

            fetchHeros(null);

        }
    });

    HorizontalPanel horizontalPanel_8 = new HorizontalPanel();
    horizontalPanel_8.setSpacing(5);
    horizontalPanel_8.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel_6.add(horizontalPanel_8);

    Label lblNewLabel_21 = new Label("Hero:");
    horizontalPanel_8.add(lblNewLabel_21);

    heroList = new ListBox();
    horizontalPanel_8.add(heroList);
    heroList.addItem("Enter BattleTag and Fetch", "");
    heroList.setSelectedIndex(0);

    Button importButton = new Button("New button");
    importButton.setText("Import");
    horizontalPanel_8.add(importButton);

    profileLinks = new HorizontalPanel();
    profileLinks.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    profileLinks.setSpacing(5);
    verticalPanel_6.add(profileLinks);

    profileLink = new Anchor("battle.net profile");
    profileLinks.add(profileLink);
    profileLink.setText("battle.net profile");
    profileLink.setHref("javascript:void(0)");
    profileLink.addClickHandler(new ClickHandler() {

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

    Anchor anchor = new Anchor("paperdoll");
    anchor.setText("paperdoll");
    anchor.setHref("javascript:void(0)");
    profileLinks.add(anchor);

    anchor.addClickHandler(new ClickHandler() {

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

    Button itemsButton = new Button("Items...");
    profileLinks.add(itemsButton);

    itemsButton.addClickHandler(new ClickHandler() {

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

    paragonPanel = new ParagonPanel();
    verticalPanel_2.add(paragonPanel);

    this.paragonPanel.getParagonIAS().addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {

            if (!disableListeners)
                updateDps();
        }
    });

    this.paragonPanel.getParagonDexterity().addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {

            if (!disableListeners)
                updateDps();
        }
    });

    this.paragonPanel.getParagonCDR().addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {

            if (!disableListeners)
                updateDps();
        }
    });

    this.paragonPanel.getParagonRCR().addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {

            if (!disableListeners)
                updateDps();
        }
    });

    savePanel = new SavePanel();
    verticalPanel_2.add(savePanel);

    savePanel.setFormListener(new FormListener() {

        @Override
        public FormData getFormData() {
            return MainPanel.this.getFormData();
        }

        @Override
        public void setFormData(FormData data) {
            MainPanel.this.restoreData(data);
        }
    });

    CaptionPanel cptnpnlNewPanel_4 = new CaptionPanel("Character Data");
    verticalPanel_2.add(cptnpnlNewPanel_4);

    FlexTable grid_1 = new FlexTable();
    grid_1.setCellPadding(5);
    cptnpnlNewPanel_4.setContentWidget(grid_1);
    Label label = new Label("Sheet DPS: ");
    label.setWordWrap(false);
    grid_1.setWidget(0, 0, label);
    label.setWidth("");

    sheetDps = new Label("0.0", false);
    sheetDps.addStyleName("boldText");
    grid_1.setWidget(0, 1, sheetDps);

    Label lblWeaponDamage = new Label("Weapon Damage:");
    lblWeaponDamage.setWordWrap(false);
    grid_1.setWidget(0, 2, lblWeaponDamage);
    lblWeaponDamage.setWidth("");

    avgWeaponDamage = new Label("0.0", false);
    avgWeaponDamage.setStyleName("boldText");
    grid_1.setWidget(0, 3, avgWeaponDamage);

    Label lblNewLabel = new Label("Attacks Per Second:");
    lblNewLabel.setWordWrap(false);
    grid_1.setWidget(1, 0, lblNewLabel);

    aps = new Label("0.0", false);
    aps.addStyleName("boldText");
    grid_1.setWidget(1, 1, aps);

    Label lblCritChance = new Label("Crit Chance:");
    lblCritChance.setWordWrap(false);
    grid_1.setWidget(1, 2, lblCritChance);

    critChance = new Label("0.0", false);
    critChance.setStyleName("boldText");
    grid_1.setWidget(1, 3, critChance);

    Label lblDexterity = new Label("Dexterity:");
    lblDexterity.setWordWrap(false);
    grid_1.setWidget(2, 0, lblDexterity);

    dexterity = new Label("0.0", false);
    dexterity.setStyleName("boldText");
    grid_1.setWidget(2, 1, dexterity);

    Label lblCritHitDamage = new Label("Crit Hit Damage:");
    lblCritHitDamage.setWordWrap(false);
    grid_1.setWidget(2, 2, lblCritHitDamage);

    critDamage = new Label("0.0", false);
    critDamage.setStyleName("boldText");
    grid_1.setWidget(2, 3, critDamage);

    Button calcDps = new Button("DPS/Break Point Calculator...");
    grid_1.setWidget(3, 2, calcDps);
    grid_1.getFlexCellFormatter().setColSpan(3, 2, 2);
    grid_1.getCellFormatter().setHorizontalAlignment(3, 2, HasHorizontalAlignment.ALIGN_RIGHT);
    grid_1.getCellFormatter().setVerticalAlignment(3, 2, HasVerticalAlignment.ALIGN_MIDDLE);

    CaptionPanel captionPanel = new CaptionPanel("Compare Builds");
    verticalPanel_2.add(captionPanel);

    buffPanel = new BuffPanel();
    verticalPanel_2.add(buffPanel);

    CaptionPanel cptnpnlNewPanel2 = new CaptionPanel("Simulate");
    verticalPanel_2.add(cptnpnlNewPanel2);

    FlexTable simTable = new FlexTable();
    cptnpnlNewPanel2.add(simTable);

    Label l1 = new Label("Simulation Time Limit (seconds):", false);
    simTable.setWidget(0, 0, l1);

    timeLimit = new NumberSpinner();
    timeLimit.setMin(1);
    timeLimit.setMax(FiringData.MAX_DURATION);
    timeLimit.setVisibleLength(5);
    timeLimit.setTitle("Maximum time (in simulation seconds) to let the simulation run");
    simTable.setWidget(0, 1, timeLimit);

    Button calcButton = new Button("Simulate");
    calcButton.setTitle("Press to run damage simulation");
    simTable.setWidget(0, 2, calcButton);
    calcButton.addClickHandler(new ClickHandler() {

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

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

    Button button_6 = new Button("Compare...");
    compareTable.setWidget(0, 0, button_6);
    button_6.setTitle("Click to see differences between each build");
    compareTable.getFlexCellFormatter().setRowSpan(0, 0, 2);

    button_6.addClickHandler(new ClickHandler() {

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

    Label label_11 = new Label("APS:");
    label_11.setWordWrap(false);
    label_11.setStyleName("boldText");
    compareTable.setWidget(2, 0, label_11);

    Label label_8 = new Label("Weapon Damage:");
    label_8.setWordWrap(false);
    label_8.setStyleName("boldText");
    compareTable.setWidget(3, 0, label_8);

    Label label_14a = new Label("Time:");
    label_14a.setWordWrap(false);
    label_14a.setStyleName("boldText");
    compareTable.setWidget(5, 0, label_14a);

    Label label_14 = new Label("DPS:");
    label_14.setWordWrap(false);
    label_14.setStyleName("boldText");
    compareTable.setWidget(7, 0, label_14);

    for (int j = 0; j < 3; j++) {
        final int which = j;
        int col = (j * 2) + 1;

        Anchor button_3 = new Anchor("Set");
        button_3.setHref("javascript:void(0)");
        button_3.setTitle("Click to store the current build for comparison");
        compareTable.setWidget(0, col, button_3);
        compareTable.getFlexCellFormatter().setHorizontalAlignment(0, col, HasHorizontalAlignment.ALIGN_CENTER);

        button_3.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                Service.getInstance().checkVersion(null);
                storeBuild(which);
            }
        });

        Anchor button_4 = new Anchor("Restore");
        button_4.setHref("javascript:void(0)");
        button_4.setTitle("Click to retrieve this build");
        compareTable.setWidget(1, col - 1, button_4);
        compareTable.getFlexCellFormatter().setHorizontalAlignment(1, col - 1,
                HasHorizontalAlignment.ALIGN_CENTER);

        button_4.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                Service.getInstance().checkVersion(null);
                loadBuild(which);
            }
        });

        Anchor label_1 = new Anchor("Clear");
        label_1.setHref("javascript:void(0)");
        label_1.setTitle("Click to clear this build");
        compareTable.setWidget(9, col, label_1);
        compareTable.getFlexCellFormatter().setWidth(9, col + 1, "5px");
        compareTable.getFlexCellFormatter().setHorizontalAlignment(9, col, HasHorizontalAlignment.ALIGN_CENTER);

        label_1.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                Service.getInstance().checkVersion(null);
                clearBuild(which);
            }
        });

        for (int i = 0; i < 4; i++) {
            int row = 2 + ((i > 0) ? 1 + ((i - 1) * 2) : 0);

            Label l = new Label("No Data");
            l.setWordWrap(false);
            compareTable.setWidget(row, col, l);
            compareTable.getFlexCellFormatter().setHorizontalAlignment(row, col,
                    HasHorizontalAlignment.ALIGN_CENTER);

            if (j > 0) {
                Label pct = new Label("No Data");
                pct.setWordWrap(false);
                compareTable.setWidget(row + 1, col, pct);
                compareTable.getFlexCellFormatter().setHorizontalAlignment(row + 1, col,
                        HasHorizontalAlignment.ALIGN_CENTER);
            }
        }
    }

    calcDps.addClickHandler(new ClickHandler() {

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

    importButton.addClickHandler(new ClickHandler() {

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

    this.paragonPanel.getParagonCC().addChangeHandler(new ChangeHandler() {

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

    this.paragonPanel.getParagonCHD().addChangeHandler(new ChangeHandler() {

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

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

    skills = new SkillsPanel();
    verticalPanel_1.add(skills);

    passives = new PassivesPanel();
    verticalPanel_1.add(passives);

    situational = new SituationalPanel();
    verticalPanel_1.add(situational);

    gemPanel = new GemsPanel();
    verticalPanel_1.add(gemPanel);

    VerticalPanel verticalPanel_3 = new VerticalPanel();
    horizontalPanel_4.add(verticalPanel_3);

    skillDamage = new SkillDamagePanel();
    verticalPanel_3.add(skillDamage);

    typeDamage = new DamageTypePanel();
    verticalPanel_3.add(typeDamage);

    itemPanel = new ItemPanel();
    verticalPanel_3.add(itemPanel);

    hatredPanel = new HatredPanel();
    verticalPanel_3.add(hatredPanel);

    playerBuffPanel = new PlayerBuffPanel();
    verticalPanel_1.add(playerBuffPanel);

    playerBuffPanel.getCalcWolfButton().addClickHandler(new ClickHandler() {

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

    VerticalPanel vpanel = new VerticalPanel();
    horizontalPanel_4.add(vpanel);

    cdrPanel = new CDRPanel();
    vpanel.add(cdrPanel);

    rcrPanel = new RCRPanel();
    vpanel.add(rcrPanel);

    ClickHandler clickHandler3 = new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (!disableListeners) {
                Service.getInstance().checkVersion(null);
                calculator.calculate();
                updateDpsLabels();
            }
        }
    };

    ChangeHandler changeHandler = new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            if (!disableListeners) {
                disableListeners = true;
                calculator.calculate();
                updateDpsLabels();
                disableListeners = false;
            }
        }
    };

    itemPanel.addChangeHandler(changeHandler);

    playerBuffPanel.getBbv().addClickHandler(clickHandler3);
    playerBuffPanel.getBbvUptime().addChangeHandler(changeHandler);
    playerBuffPanel.getStretchTime().addClickHandler(clickHandler3);
    playerBuffPanel.getStretchTimeUptime().addChangeHandler(changeHandler);
    playerBuffPanel.getValor().addClickHandler(clickHandler3);
    playerBuffPanel.getValorActiveUptime().addChangeHandler(changeHandler);
    playerBuffPanel.getValorPassiveUptime().addChangeHandler(changeHandler);
    playerBuffPanel.getRetribution().addClickHandler(clickHandler3);
    playerBuffPanel.getRetributionUptime().addChangeHandler(changeHandler);

    buffPanel.getAnatomy().addClickHandler(clickHandler3);
    buffPanel.getFocusedMind().addClickHandler(clickHandler3);
    buffPanel.getHysteria().addClickHandler(clickHandler3);

    gemPanel.addChangeHandler(changeHandler);

    CaptionPanel cptnpnlNewPanel = new CaptionPanel("Simulation Output");
    panel.add(cptnpnlNewPanel);
    cptnpnlNewPanel.setWidth("");

    VerticalPanel verticalPanel_5 = new VerticalPanel();
    cptnpnlNewPanel.setContentWidget(verticalPanel_5);
    verticalPanel_5.setSize("100%", "3cm");

    HorizontalPanel horizontalPanel_19 = new HorizontalPanel();
    verticalPanel_5.add(horizontalPanel_19);
    horizontalPanel_19.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_19.setSpacing(5);

    Button legendButton = new Button("New button");
    legendButton.setText("Legend...");
    horizontalPanel_19.add(legendButton);

    outputHeader = new FlexTable();
    outputHeader.setCellPadding(2);
    verticalPanel_5.add(outputHeader);

    Label lblNewLabel_27 = new Label("Average Weapon Damage (Main Hand):");
    outputHeader.setWidget(0, 0, lblNewLabel_27);
    lblNewLabel_27.setWordWrap(false);

    weaponDamage = new Label("00000");
    outputHeader.setWidget(0, 1, weaponDamage);
    weaponDamage.setStyleName("boldText");

    Label lblNewLabel_27a = new Label("(Off Hand):");
    outputHeader.setWidget(0, 2, lblNewLabel_27a);
    lblNewLabel_27a.setWordWrap(false);

    offHand_weaponDamage = new Label("00000");
    outputHeader.setWidget(0, 3, offHand_weaponDamage);
    offHand_weaponDamage.setStyleName("boldText");

    Label lblNewLabel_27b = new Label("(Dual Wield):");
    outputHeader.setWidget(0, 4, lblNewLabel_27b);
    lblNewLabel_27b.setWordWrap(false);

    dw_weaponDamage = new Label("00000");
    outputHeader.setWidget(0, 5, dw_weaponDamage);
    dw_weaponDamage.setStyleName("boldText");

    Label lblNewLabel_6 = new Label("Total Damage:");
    outputHeader.setWidget(2, 0, lblNewLabel_6);
    lblNewLabel_6.setWordWrap(false);

    Label lblNewLabel_6a = new Label("Time Elapsed:");
    outputHeader.setWidget(3, 0, lblNewLabel_6a);
    lblNewLabel_6a.setWordWrap(false);

    totalDamage = new Label("00000");
    outputHeader.setWidget(2, 1, totalDamage);
    totalDamage.setStyleName("boldText");

    timeElapsed = new Label("00000");
    outputHeader.setWidget(3, 1, timeElapsed);
    timeElapsed.setStyleName("boldText");

    Label lblNewLabel_7 = new Label("DPS:");
    outputHeader.setWidget(2, 2, lblNewLabel_7);
    lblNewLabel_7.setWordWrap(false);

    dps = new Label("00000");
    outputHeader.setWidget(2, 3, dps);
    dps.setStyleName("boldText");

    Label lblNewLabel_29a = new Label("Max Sentries:");
    outputHeader.setWidget(2, 4, lblNewLabel_29a);

    Label lblNewLabel_7b = new Label("+% Elite Damage:");
    outputHeader.setWidget(3, 4, lblNewLabel_7b);
    lblNewLabel_7b.setWordWrap(false);

    eliteDamage = new Label("00000");
    outputHeader.setWidget(3, 5, eliteDamage);
    eliteDamage.setStyleName("boldText");

    Button bpButton = new Button("New button");
    bpButton.setText("Break Points...");
    horizontalPanel_19.add(bpButton);

    bpButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

            Service.getInstance().checkVersion(null);

            if (bpData == null)
                bpData = new BPData();

            ApplicationPanel.showDialogBox("Break Points", bpData, ApplicationPanel.OK, null);
        }
    });

    Button skillButton = new Button("New button");
    skillButton.setText("Skills...");
    horizontalPanel_19.add(skillButton);

    skillButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

            Service.getInstance().checkVersion(null);

            if (skillData == null)
                skillData = new SkillData();

            ApplicationPanel.showDialogBox("Skills", skillData, ApplicationPanel.OK, null);
        }
    });

    outputPanel = new VerticalPanel();
    verticalPanel_5.add(outputPanel);

    HorizontalPanel horizontalPanel_9 = new HorizontalPanel();
    outputPanel.add(horizontalPanel_9);

    statTableCaption = new CaptionPanel("Stat Calculator");
    horizontalPanel_9.add(statTableCaption);

    VerticalPanel panel_1 = new VerticalPanel();
    horizontalPanel_9.add(panel_1);

    captionPanelTypeSummary = new CaptionPanel("Damage Type Summary");
    panel_1.add(captionPanelTypeSummary);

    summary = new FlexTable();
    summary.setCellPadding(5);
    summary.setBorderWidth(1);
    summary.setStyleName("outputTable");
    summary.setWidth("100%");
    captionPanelTypeSummary.setContentWidget(summary);

    Label lblNewLabel_17 = new Label("Type");
    lblNewLabel_17.setWordWrap(false);
    summary.setWidget(0, 0, lblNewLabel_17);

    Label label_1 = new Label("# Attacks");
    label_1.setWordWrap(false);
    label_1.setStyleName("dpsHeader");
    summary.setWidget(0, 1, label_1);

    Label label_2 = new Label("Per Attack");
    label_2.setWordWrap(false);
    label_2.setStyleName("dpsHeader");
    summary.setWidget(0, 2, label_2);

    Label lblTotalDamage = new Label("Total");
    lblTotalDamage.setStyleName("dpsHeader");
    lblTotalDamage.setWordWrap(false);
    summary.setWidget(0, 3, lblTotalDamage);
    summary.getColumnFormatter().addStyleName(1, "dpsCol");

    Label lblDps_1 = new Label("DPS");
    lblDps_1.setStyleName("dpsHeader");
    lblDps_1.setWordWrap(false);
    summary.setWidget(0, 4, lblDps_1);
    summary.getColumnFormatter().addStyleName(2, "dpsCol");

    Label lblOfTotal = new Label("% of Total");
    lblOfTotal.setStyleName("dpsHeader");
    lblOfTotal.setWordWrap(false);
    summary.setWidget(0, 5, lblOfTotal);

    captionPanelSkillSummary = new CaptionPanel("Skill Damage Summary");
    panel_1.add(captionPanelSkillSummary);

    skillSummary = new FlexTable();
    skillSummary.setStyleName("outputTable");
    skillSummary.setCellPadding(5);
    skillSummary.setBorderWidth(1);
    skillSummary.setWidth("100%");

    captionPanelSkillSummary.setContentWidget(skillSummary);

    Label lblSkill_2 = new Label("Skill");
    lblSkill_2.setWordWrap(false);
    skillSummary.setWidget(0, 0, lblSkill_2);

    Label lblAttacks = new Label("# Attacks");
    lblAttacks.setWordWrap(false);
    lblAttacks.setStyleName("dpsHeader");
    skillSummary.setWidget(0, 1, lblAttacks);

    Label lblPerAttack = new Label("Per Attack");
    lblPerAttack.setWordWrap(false);
    lblPerAttack.setStyleName("dpsHeader");
    skillSummary.setWidget(0, 2, lblPerAttack);

    Label lblTotal = new Label("Total");
    lblTotal.setStyleName("dpsHeader");
    lblTotal.setWordWrap(false);
    skillSummary.setWidget(0, 3, lblTotal);
    skillSummary.getColumnFormatter().addStyleName(1, "dpsCol");

    Label label_5 = new Label("DPS");
    label_5.setStyleName("dpsHeader");
    label_5.setWordWrap(false);
    skillSummary.setWidget(0, 4, label_5);
    skillSummary.getColumnFormatter().addStyleName(2, "dpsCol");

    Label label_6 = new Label("% of Total");
    label_6.setStyleName("dpsHeader");
    label_6.setWordWrap(false);
    skillSummary.setWidget(0, 5, label_6);

    captionPanelShooterSummary = new CaptionPanel("Shooter Summary");
    panel_1.add(captionPanelShooterSummary);

    shooterSummary = new FlexTable();
    captionPanelShooterSummary.setContentWidget(shooterSummary);
    shooterSummary.setStyleName("outputTable");
    shooterSummary.setCellPadding(5);
    shooterSummary.setBorderWidth(1);
    shooterSummary.setWidth("100%");

    Label lblSkill_2a = new Label("Shooter");
    lblSkill_2a.setWordWrap(false);
    shooterSummary.setWidget(0, 0, lblSkill_2a);

    Label lblAttacksa = new Label("# Attacks");
    lblAttacksa.setWordWrap(false);
    lblAttacksa.setStyleName("dpsHeader");
    shooterSummary.setWidget(0, 1, lblAttacksa);

    Label lblPerAttacka = new Label("Per Attack");
    lblPerAttacka.setWordWrap(false);
    lblPerAttacka.setStyleName("dpsHeader");
    shooterSummary.setWidget(0, 2, lblPerAttacka);

    Label lblTotala = new Label("Total");
    lblTotala.setStyleName("dpsHeader");
    lblTotala.setWordWrap(false);
    shooterSummary.setWidget(0, 3, lblTotala);
    shooterSummary.getColumnFormatter().addStyleName(1, "dpsCol");

    Label label_5a = new Label("DPS");
    label_5a.setStyleName("dpsHeader");
    label_5a.setWordWrap(false);
    shooterSummary.setWidget(0, 4, label_5a);
    shooterSummary.getColumnFormatter().addStyleName(2, "dpsCol");

    Label label_6b = new Label("% of Total");
    label_6b.setStyleName("dpsHeader");
    label_6b.setWordWrap(false);
    shooterSummary.setWidget(0, 5, label_6b);

    skillSummary.getColumnFormatter().addStyleName(3, "dpsCol");
    skillSummary.getRowFormatter().addStyleName(0, "headerRow");
    summary.getColumnFormatter().addStyleName(3, "dpsCol");
    summary.getRowFormatter().addStyleName(0, "headerRow");
    shooterSummary.getColumnFormatter().addStyleName(3, "dpsCol");
    shooterSummary.getRowFormatter().addStyleName(0, "headerRow");

    HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    outputPanel.add(horizontalPanel_2);

    captionPanelDamageLog = new CaptionPanel("Damage Log");
    horizontalPanel_2.add(captionPanelDamageLog);

    damageLog = new FlexTable();
    damageLog.setCellPadding(5);
    damageLog.setBorderWidth(1);
    captionPanelDamageLog.setContentWidget(damageLog);

    int col = 0;

    Label lblNewLabel_11 = new Label("Time", false);
    lblNewLabel_11.setWordWrap(false);
    lblNewLabel_11.setStyleName("dpsHeader");
    damageLog.setWidget(0, col, lblNewLabel_11);
    damageLog.getColumnFormatter().addStyleName(col, "dpsCol");
    col++;

    Label lblNewLabel_8a = new Label("Shooter", false);
    lblNewLabel_8a.setWordWrap(false);
    damageLog.setWidget(0, col, lblNewLabel_8a);
    col++;

    Label lblNewLabel_8 = new Label("Skill", false);
    lblNewLabel_8.setWordWrap(false);
    damageLog.setWidget(0, col, lblNewLabel_8);
    col++;

    Label lblNewLabel_9 = new Label("Rune", false);
    lblNewLabel_9.setWordWrap(false);
    damageLog.setWidget(0, col, lblNewLabel_9);
    col++;

    Label lblNewLabel_10 = new Label("Type", false);
    lblNewLabel_10.setWordWrap(false);
    damageLog.setWidget(0, col, lblNewLabel_10);
    col++;

    Label lblNewLabel_12a = new Label("+/- Hatred", false);
    lblNewLabel_12a.setWordWrap(false);
    damageLog.setWidget(0, col, lblNewLabel_12a);
    damageLog.getColumnFormatter().addStyleName(col, "dpsCol");
    col++;

    Label lblNewLabel_12b = new Label("Hatred", false);
    lblNewLabel_12b.setWordWrap(false);
    damageLog.setWidget(0, col, lblNewLabel_12b);
    damageLog.getColumnFormatter().addStyleName(col, "dpsCol");
    col++;

    Label lblNewLabel_12c = new Label("+/- Disc", false);
    damageLog.setWidget(0, col, lblNewLabel_12c);
    damageLog.getColumnFormatter().addStyleName(col, "dpsCol");
    col++;

    Label lblNewLabel_12d = new Label("Disc", false);
    damageLog.setWidget(0, col, lblNewLabel_12d);
    damageLog.getColumnFormatter().addStyleName(col, "dpsCol");
    col++;

    Label lblNewLabel_13 = new Label("Damage", false);
    lblNewLabel_13.setStyleName("dpsHeader");
    lblNewLabel_13.setWordWrap(false);
    damageLog.setWidget(0, col, lblNewLabel_13);
    damageLog.getColumnFormatter().addStyleName(col, "dpsCol");
    col++;

    Label lblNewLabel_14 = new Label("Target HP", false);
    lblNewLabel_14.setStyleName("dpsHeader");
    lblNewLabel_14.setWordWrap(false);
    damageLog.setWidget(0, col, lblNewLabel_14);
    damageLog.getColumnFormatter().addStyleName(col, "dpsCol");
    col++;

    Label lblNewLabel_15 = new Label("% HP", false);
    lblNewLabel_15.setStyleName("dpsHeader");
    lblNewLabel_15.setWordWrap(false);
    damageLog.setWidget(0, col, lblNewLabel_15);
    damageLog.getColumnFormatter().addStyleName(col, "dpsCol");
    col++;

    Label lblNewLabel_15b = new Label("Target", false);
    lblNewLabel_15b.setWordWrap(false);
    damageLog.setWidget(0, col, lblNewLabel_15b);
    col++;

    Label lblNewLabel_16 = new Label("Notes", false);
    lblNewLabel_16.setWordWrap(false);
    damageLog.setWidget(0, col, lblNewLabel_16);
    col++;

    Label lblNewLabel_28 = new Label("Calculations", false);
    lblNewLabel_28.setWordWrap(false);
    damageLog.setWidget(0, col, lblNewLabel_28);
    col++;

    damageLog.addStyleName("outputTable");
    damageLog.getRowFormatter().addStyleName(0, "headerRow");

    calculator = new DPSCalculator(this);

    passives.addChangeHandler(changeHandler);

    ChangeHandler handler = new ChangeHandler() {

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

    ChangeHandler handler2 = new ChangeHandler() {

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

    ClickHandler clickHandler = new ClickHandler() {

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

    };

    ClickHandler clickHandler2 = new ClickHandler() {

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

    };

    statTable = new FlexTable();
    statTableCaption.setContentWidget(statTable);
    statTable.setCellPadding(5);
    statTable.setBorderWidth(1);
    statTable.setStyleName("outputTable");
    statTable.getRowFormatter().addStyleName(0, "headerRow");

    col = 0;

    Label l1a = new Label("Stat");
    l1a.setStyleName("dpsHeader");
    l1a.setWordWrap(false);
    statTable.setWidget(0, col++, l1a);

    Label l2b = new Label("Time");
    l2b.setStyleName("dpsHeader");
    l2b.setWordWrap(false);
    statTable.setWidget(0, col++, l2b);

    Label l2c = new Label("%");
    l2c.setStyleName("dpsHeader");
    l2c.setWordWrap(false);
    statTable.setWidget(0, col++, l2c);

    Label l4 = new Label("Damage");
    l4.setStyleName("dpsHeader");
    l4.setWordWrap(false);
    statTable.setWidget(0, col++, l4);

    Label l2 = new Label("DPS");
    l2.setStyleName("dpsHeader");
    l2.setWordWrap(false);
    statTable.setWidget(0, col++, l2);

    Label l2a = new Label("%");
    l2a.setStyleName("dpsHeader");
    l2a.setWordWrap(false);
    statTable.setWidget(0, col++, l2a);

    captionPanelDamageLog.setContentWidget(damageLog);

    paragonPanel.getParagonCDR().addChangeHandler(handler);
    gemPanel.addChangeHandler(handler);
    cdrPanel.getDiamond().addChangeHandler(handler);
    cdrPanel.getShoulders().addChangeHandler(handler);
    cdrPanel.getAmulet().addChangeHandler(handler);
    cdrPanel.getGloves().addChangeHandler(handler);
    cdrPanel.getRing1().addChangeHandler(handler);
    cdrPanel.getRing2().addChangeHandler(handler);
    cdrPanel.getBelt().addChangeHandler(handler);
    cdrPanel.getWeapon().addChangeHandler(handler);
    cdrPanel.getQuiver().addChangeHandler(handler);
    itemPanel.addChangeHandler(handler);

    paragonPanel.getParagonRCR().addChangeHandler(handler2);
    rcrPanel.getShoulders().addChangeHandler(handler2);
    rcrPanel.getAmulet().addChangeHandler(handler2);
    rcrPanel.getGloves().addChangeHandler(handler2);
    rcrPanel.getRing1().addChangeHandler(handler2);
    rcrPanel.getRing2().addChangeHandler(handler2);
    rcrPanel.getBelt().addChangeHandler(handler2);
    rcrPanel.getWeapon().addChangeHandler(handler2);
    rcrPanel.getQuiver().addChangeHandler(handler2);
    itemPanel.addChangeHandler(handler2);

    Button exportButton = new Button("New button");
    exportButton.setText("Export to Excel...");
    horizontalPanel_19.add(exportButton);

    exportButton.addClickHandler(new ClickHandler() {

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

    });

    Button statsButton = new Button("Statistics...");

    firstTimeStats = true;

    statsButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

            Service.getInstance().checkVersion(null);

            if (stats == null) {
                stats = new StatsPanel();

                stats.setActionListener(new StatsPanel.ActionListener() {

                    @Override
                    public void importEntry(DpsTableEntry entry) {
                        MainPanel.this.importEntry(entry);
                    }

                    @Override
                    public void closePanel() {
                        if (statsDialog != null) {
                            statsDialog.hide();
                            statsDialog = null;
                        }
                    }

                    @Override
                    public Build getBuild() {
                        return MainPanel.this.getBuild();
                    }

                    @Override
                    public void setBuild(Build build) {
                        MainPanel.this.setBuild(build);

                    }
                });

            }

            statsDialog = ApplicationPanel.showDialogBox("Statistics", stats, ApplicationPanel.OK, null);

            if (firstTimeStats) {
                firstTimeStats = false;
                stats.updateStats();
            }
        }
    });

    Button aboutButton = new Button("New button");
    aboutButton.setText("About...");
    horizontalPanel_19.add(aboutButton);

    aboutButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

            Service.getInstance().checkVersion(null);

            if (about == null)
                about = new AboutDialog();

            ApplicationPanel.showDialogBox("About", about, ApplicationPanel.OK, null);
        }
    });

    legendButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

            Service.getInstance().checkVersion(null);

            if (legend == null)
                legend = new Legend();

            ApplicationPanel.showDialogBox("Legend", legend, ApplicationPanel.OK, null);
        }
    });

    for (Realm r : Realm.values()) {
        realms.addItem(r.getDisplayName(), r.name());
    }

    Service.getInstance().addNewsHandler(new NewsHandler() {

        @Override
        public void newsChanged(List<NewsItem> news) {
            setNews(news);
        }
    });

    skills.addSkillsChangedListener(new SkillsChangedListener() {

        @Override
        public void skillsChanged(Map<ActiveSkill, Rune> skills) {
            cdrPanel.setSkills(skills, itemPanel.getItems(), itemPanel.getSetCounts());
        }
    });

    itemPanel.addItemsChangedListener(new ItemsChangedListener() {

        @Override
        public void itemsChanged(Map<Slot, ItemHolder> items) {
            cdrPanel.setSkills(skills.getSkills(), items, itemPanel.getSetCounts());
        }

        @Override
        public void setCountsChanged(Map<String, Integer> sets) {
            cdrPanel.setSkills(skills.getSkills(), itemPanel.getItems(), sets);
        }
    });
}

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

License:Open Source License

private void updateOutput() {

    Label ns = new Label("" + data.getNumSentries());
    ns.addStyleName("boldText");
    outputHeader.setWidget(2, 5, ns);//w  ww  .j  a v a  2 s . c om

    while (damageLog.getRowCount() > 1) {
        damageLog.removeRow(1);
    }

    for (int i = damageLog.getRowCount(); i > 1; --i) {
        damageLog.removeRow(i - 1);
    }

    for (int i = statTable.getRowCount(); i > 1; --i) {
        statTable.removeRow(i - 1);
    }

    for (int i = shooterSummary.getRowCount(); i > 1; --i) {
        shooterSummary.removeRow(i - 1);
    }

    this.captionPanelDamageLog.setCaptionHTML("Damage Log (" + damage.duration + " seconds)");

    for (int row = 0; row < damage.damages.length; row++) {
        if ((row % 2) == 0)
            damageLog.getRowFormatter().addStyleName(row + 1, "oddRow");
        else
            damageLog.getRowFormatter().addStyleName(row + 1, "evenRow");

        Damage d = damage.damages[row];

        int col = 0;

        Label timeLabel = new Label(Util.format(Math.round(d.time * 100.0) / 100.0), false);
        timeLabel.addStyleName("dpsCol");
        damageLog.setWidget(row + 1, col++, timeLabel);

        Label sLabel = new Label(d.shooter);
        sLabel.setWordWrap(false);
        damageLog.setWidget(row + 1, col++, sLabel);

        if (d.source != null) {
            ActiveSkill skill = d.source.skill;
            Anchor a = new Anchor(d.source.getName());
            a.setTarget("_blank");
            a.setWordWrap(false);
            String url = d.source.getUrl();
            a.setHref(url);

            damageLog.setWidget(row + 1, col++, a);

            if (skill != null) {
                Anchor b = new Anchor(d.source.rune.getLongName());
                b.setTarget("_blank");
                b.setWordWrap(false);

                if (d.source.skill == ActiveSkill.CR)
                    url = ActiveSkill.RoV.getUrl();

                if (d.source.rune != Rune.None)
                    url += ("#" + d.source.rune.getSlug() + "+");

                b.setHref(url);

                damageLog.setWidget(row + 1, col++, b);
            } else {
                Label b = new Label("N/A");
                damageLog.setWidget(row + 1, col++, b);
            }
        } else if (d.shooter.equals("Preparation")) {
            Anchor b = new Anchor("Preparation");
            b.setTarget("_blank");
            b.setWordWrap(false);
            b.setHref("http://us.battle.net/d3/en/class/demon-hunter/active/preparation");
            damageLog.setWidget(row + 1, col++, b);

            Anchor b2 = new Anchor("Punishment");
            b2.setTarget("_blank");
            b2.setWordWrap(false);
            b2.setHref("http://us.battle.net/d3/en/class/demon-hunter/active/preparation#a+");
            damageLog.setWidget(row + 1, col++, b2);
        } else if (d.shooter.equals("Companion") && d.hatred != 0) {
            Anchor b = new Anchor("Companion");
            b.setTarget("_blank");
            b.setWordWrap(false);
            b.setHref("http://us.battle.net/d3/en/class/demon-hunter/active/companion");
            damageLog.setWidget(row + 1, col++, b);

            Anchor b2 = new Anchor("Bat");
            b2.setTarget("_blank");
            b2.setWordWrap(false);
            b2.setHref("http://us.battle.net/d3/en/class/demon-hunter/active/companion#d+");
            damageLog.setWidget(row + 1, col++, b2);
        } else if (d.shooter.equals("MFD") && d.hatred != 0) {
            Anchor b = new Anchor("MfD");
            b.setTarget("_blank");
            b.setWordWrap(false);
            b.setHref("http://us.battle.net/d3/en/class/demon-hunter/active/marked-for-death");
            damageLog.setWidget(row + 1, col++, b);

            Anchor b2 = new Anchor("Mortal Enemy");
            b2.setTarget("_blank");
            b2.setWordWrap(false);
            b2.setHref("http://us.battle.net/d3/en/class/demon-hunter/active/marked-for-death#d+");
            damageLog.setWidget(row + 1, col++, b2);
        } else {
            col += 2;
        }

        if (d.type != null)
            damageLog.setWidget(row + 1, col++, new Label(d.type.name(), false));
        else
            col++;

        if (d.hatred != 0) {
            Label hatredLabel = new Label(
                    ((d.hatred > 0) ? "+" : "") + Util.format(Math.round(d.hatred * 10.0) / 10.0), false);
            hatredLabel.addStyleName("dpsCol");
            damageLog.setWidget(row + 1, col++, hatredLabel);
        } else {
            col++;
        }

        Label hatredLabel2 = new Label(Util.format(Math.round(d.currentHatred * 10.0) / 10.0), false);
        hatredLabel2.addStyleName("dpsCol");
        damageLog.setWidget(row + 1, col++, hatredLabel2);

        if (d.disc != 0) {
            Label discLabel = new Label(
                    ((d.disc > 0) ? "+" : "") + Util.format(Math.round(d.disc * 10.0) / 10.0), false);
            discLabel.addStyleName("dpsCol");
            damageLog.setWidget(row + 1, col++, discLabel);
        } else {
            col++;
        }

        Label discLabel2 = new Label(Util.format(Math.round(d.currentDisc * 10.0) / 10.0), false);
        discLabel2.addStyleName("dpsCol");
        damageLog.setWidget(row + 1, col++, discLabel2);

        if (d.damage > 0) {
            Label totalLabel = new Label(Util.format(Math.round(d.damage)), false);
            totalLabel.addStyleName("dpsCol");
            damageLog.setWidget(row + 1, col++, totalLabel);

            Label dpsLabel = new Label(Util.format(Math.round((d.targetHp))), false);
            dpsLabel.addStyleName("dpsCol");
            damageLog.setWidget(row + 1, col++, dpsLabel);
            double pct = Math.round(d.targetHpPercent * 1000.0) / 10.0;
            Label pctLabel = new Label(Util.format(pct) + "%", false);
            pctLabel.addStyleName("dpsCol");
            damageLog.setWidget(row + 1, col++, pctLabel);
        } else {
            col += 3;
        }

        if (d.target != null) {
            damageLog.setWidget(row + 1, col++, new Label(d.target.toString(), false));
        } else {
            damageLog.setWidget(row + 1, col++, new Label("", false));
        }

        if (d.note != null) {
            damageLog.setWidget(row + 1, col++, new Label(d.note, false));
        } else {
            damageLog.setWidget(row + 1, col++, new Label("", false));
        }

        if (d.log != null) {
            Label log = new Label(d.log);
            log.setWordWrap(false);
            damageLog.setWidget(row + 1, col++, log);
        } else {
            damageLog.setWidget(row + 1, col++, new Label("", false));
        }

    }

    for (int i = summary.getRowCount(); i > 1; --i) {
        summary.removeRow(i - 1);
    }

    int row = 1;
    for (Map.Entry<DamageType, DamageHolder> e : types.entrySet()) {
        if ((row % 2) == 0)
            summary.getRowFormatter().addStyleName(row, "evenRow");
        else
            summary.getRowFormatter().addStyleName(row, "oddRow");

        summary.setWidget(row, 0, new Label(e.getKey().name(), false));

        int attacks = e.getValue().attacks;
        double d = e.getValue().damage;
        double da = Math.round((d / attacks));

        Label label1 = new Label(String.valueOf(attacks), false);
        label1.addStyleName("dpsCol");
        summary.setWidget(row, 1, label1);

        Label label2 = new Label(Util.format(da), false);
        label2.addStyleName("dpsCol");
        summary.setWidget(row, 2, label2);

        Label damageLabel = new Label(Util.format(Math.round(d)), false);
        damageLabel.addStyleName("dpsCol");
        summary.setWidget(row, 3, damageLabel);

        Label dpsLabel = new Label(Util.format(Math.round((d) / damage.duration)), false);
        dpsLabel.addStyleName("dpsCol");
        summary.setWidget(row, 4, dpsLabel);

        double pct = Math.round((d / total) * 10000.0) / 100.0;
        Label pctLabel = new Label(String.valueOf(pct) + "%", false);
        pctLabel.addStyleName("dpsCol");
        summary.setWidget(row, 5, pctLabel);
        row++;
    }

    for (int i = skillSummary.getRowCount(); i > 1; --i) {
        skillSummary.removeRow(i - 1);
    }

    row = 1;
    for (Map.Entry<DamageSource, DamageHolder> e : skillDamages.entrySet()) {
        if ((row % 2) == 0)
            skillSummary.getRowFormatter().addStyleName(row, "evenRow");
        else
            skillSummary.getRowFormatter().addStyleName(row, "oddRow");

        DamageSource source = e.getKey();

        Anchor a = new Anchor(source.getName());
        a.setTarget("_blank");
        a.setWordWrap(false);
        String url = source.getUrl();
        a.setHref(url);
        skillSummary.setWidget(row, 0, a);

        int attacks = e.getValue().attacks;
        double d = e.getValue().damage;
        double da = Math.round((d / attacks));

        Label label1 = new Label(String.valueOf(attacks), false);
        label1.addStyleName("dpsCol");
        skillSummary.setWidget(row, 1, label1);

        Label label2 = new Label(Util.format(da), false);
        label2.addStyleName("dpsCol");
        skillSummary.setWidget(row, 2, label2);

        Label damageLabel = new Label(Util.format(Math.round(d)), false);
        damageLabel.addStyleName("dpsCol");
        skillSummary.setWidget(row, 3, damageLabel);

        Label dpsLabel = new Label(Util.format(Math.round((d) / damage.duration)), false);
        dpsLabel.addStyleName("dpsCol");
        skillSummary.setWidget(row, 4, dpsLabel);

        double pct = Math.round((d / total) * 10000.0) / 100.0;
        Label pctLabel = new Label(String.valueOf(pct) + "%", false);
        pctLabel.addStyleName("dpsCol");
        skillSummary.setWidget(row, 5, pctLabel);
        row++;
    }

    row = 1;
    for (Map.Entry<String, DamageHolder> e : shooterDamages.entrySet()) {
        if ((row % 2) == 0)
            shooterSummary.getRowFormatter().addStyleName(row, "evenRow");
        else
            shooterSummary.getRowFormatter().addStyleName(row, "oddRow");

        Label a = new Label(e.getKey());
        a.setWordWrap(false);
        shooterSummary.setWidget(row, 0, a);

        int attacks = e.getValue().attacks;
        double d = e.getValue().damage;
        double da = Math.round((d / attacks));

        Label label1 = new Label(String.valueOf(attacks), false);
        label1.addStyleName("dpsCol");
        shooterSummary.setWidget(row, 1, label1);

        Label label2 = new Label(Util.format(da), false);
        label2.addStyleName("dpsCol");
        shooterSummary.setWidget(row, 2, label2);

        Label damageLabel = new Label(Util.format(Math.round(d)), false);
        damageLabel.addStyleName("dpsCol");
        shooterSummary.setWidget(row, 3, damageLabel);

        Label dpsLabel = new Label(Util.format(Math.round((d) / damage.duration)), false);
        dpsLabel.addStyleName("dpsCol");
        shooterSummary.setWidget(row, 4, dpsLabel);

        double pct = Math.round((d / total) * 10000.0) / 100.0;
        Label pctLabel = new Label(String.valueOf(pct) + "%", false);
        pctLabel.addStyleName("dpsCol");
        shooterSummary.setWidget(row, 5, pctLabel);
        row++;
    }

    double dps = (damage.duration > 0) ? Math.round(total / damage.duration) : total;

    weaponDamage.setText(Util.format(Math.round(data.getWeaponDamage() * 100.0) / 100.0));

    if (data.getOffHand_weaponType() != null) {
        offHand_weaponDamage.setText(Util.format(Math.round(data.getOffHand_weaponDamage() * 100.0) / 100.0));
        double dwDamage = (data.getWeaponDamage() + data.getOffHand_weaponDamage()) / 2.0;
        dw_weaponDamage.setText(Util.format(Math.round(dwDamage * 100.0) / 100.0) + " sec");
    } else {
        offHand_weaponDamage.setText("N/A");
        dw_weaponDamage.setText("N/A");

    }

    row = 1;

    this.dps.setText(Util.format(Math.round(dps)));
    this.totalDamage.setText(Util.format(Math.round(total)));
    this.eliteDamage.setText(Math.round(data.getTotalEliteDamage() * 100.0) + "%");
    this.timeElapsed.setText(Util.format(Math.round(damage.duration * 100.0) / 100.0) + " secs");

    row = 1;

    final CharacterData savedData = data.copy();

    final double baseline = total;
    final double duration = damage.duration;

    for (Stat stat : Stat.values()) {

        final StatAdapter adapter = stat.getAdapter();

        if (adapter.test(data, types.keySet())) {

            if ((row % 2) == 0)
                statTable.getRowFormatter().addStyleName(row, "evenRow");
            else
                statTable.getRowFormatter().addStyleName(row, "oddRow");

            HorizontalPanel panel = new HorizontalPanel();
            panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            panel.setSpacing(0);

            panel.add(new Label("+", false));
            final DoubleSpinner spinner = new DoubleSpinner();
            double value = adapter.getDefaultValue();
            spinner.setMax(value * 100.0);
            spinner.setMin(value * -100.0);

            final String field = "Stat." + stat.getLabel();

            try {
                value = Double.parseDouble(this.getFieldValue(field, String.valueOf(value)));
            } catch (Exception e) {
                saveField(field, String.valueOf(value));
            }

            spinner.setValue(value);
            spinner.setVisibleLength(4);

            panel.add(spinner);

            String label = stat.getLabel();

            int col = 0;
            Label l1 = new Label(label);
            l1.setWordWrap(false);
            panel.add(l1);

            statTable.setWidget(row, col++, panel);

            final Label l2 = new Label("");
            l2.addStyleName("dpsCol");
            statTable.setWidget(row, col++, l2);

            final Label l2a = new Label("");
            l2a.addStyleName("dpsCol");
            statTable.setWidget(row, col++, l2a);

            final Label l2b = new Label("");
            l2b.addStyleName("dpsCol");
            statTable.setWidget(row, col++, l2b);

            final Label l3 = new Label("");
            l3.addStyleName("dpsCol");
            statTable.setWidget(row, col++, l3);

            final Label l4 = new Label("");
            l4.addStyleName("dpsCol");
            statTable.setWidget(row, col++, l4);

            updateStatTable(adapter, spinner, savedData, row, baseline, duration);

            final int r = row;

            spinner.addChangeHandler(new ChangeHandler() {

                @Override
                public void onChange(ChangeEvent event) {
                    saveField(field, String.valueOf(spinner.getValue()));
                    updateStatTable(adapter, spinner, savedData, r, baseline, duration);
                }
            });

            row++;
        }
    }
}