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

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

Introduction

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

Prototype

public FlexCellFormatter getFlexCellFormatter() 

Source Link

Document

Explicitly gets the FlexCellFormatter .

Usage

From source file:at.ait.dme.yuma.client.colorpicker.ColorPicker.java

License:Artistic License

public ColorPicker() {
    // UI Drawing
    //------------------

    hue = 0;//from  w  w  w  .  j  a v  a 2s  .  c o m
    saturation = 100;
    brightness = 100;
    red = 255;
    green = 0;
    blue = 0;

    HorizontalPanel panel = new HorizontalPanel();
    FlexTable table = new FlexTable();

    // Add the large slider map
    slidermap = new SliderMap(this);
    panel.add(slidermap);
    panel.setCellWidth(slidermap, "258px");
    panel.setCellHeight(slidermap, "258px");

    // Add the small slider bar
    sliderbar = new SliderBar(this);
    panel.add(sliderbar);
    panel.setCellWidth(sliderbar, "40px");
    panel.setCellHeight(sliderbar, "258px");

    // Define the Flextable's content
    // Color preview at the top
    colorpreview = new HTML("");
    colorpreview.setWidth("50px");
    colorpreview.setHeight("50px");
    DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black");

    // Radio buttons
    rbHue = new RadioButton("color", "H:");
    rbHue.addClickHandler(this);
    rbSaturation = new RadioButton("color", "S:");
    rbSaturation.addClickHandler(this);
    rbBrightness = new RadioButton("color", "V:");
    rbBrightness.addClickHandler(this);
    rbRed = new RadioButton("color", "R:");
    rbRed.addClickHandler(this);
    rbGreen = new RadioButton("color", "G:");
    rbGreen.addClickHandler(this);
    rbBlue = new RadioButton("color", "B:");
    rbBlue.addClickHandler(this);

    // Textboxes
    tbHue = new TextBox();
    tbHue.setText(new Integer(hue).toString());
    tbHue.setMaxLength(3);
    tbHue.setVisibleLength(4);
    tbHue.addKeyPressHandler(this);
    tbHue.addChangeHandler(this);
    tbSaturation = new TextBox();
    tbSaturation.setText(new Integer(saturation).toString());
    tbSaturation.setMaxLength(3);
    tbSaturation.setVisibleLength(4);
    tbSaturation.addKeyPressHandler(this);
    tbSaturation.addChangeHandler(this);
    tbBrightness = new TextBox();
    tbBrightness.setText(new Integer(brightness).toString());
    tbBrightness.setMaxLength(3);
    tbBrightness.setVisibleLength(4);
    tbBrightness.addKeyPressHandler(this);
    tbBrightness.addChangeHandler(this);
    tbRed = new TextBox();
    tbRed.setText(new Integer(red).toString());
    tbRed.setMaxLength(3);
    tbRed.setVisibleLength(4);
    tbRed.addKeyPressHandler(this);
    tbRed.addChangeHandler(this);
    tbGreen = new TextBox();
    tbGreen.setText(new Integer(green).toString());
    tbGreen.setMaxLength(3);
    tbGreen.setVisibleLength(4);
    tbGreen.addKeyPressHandler(this);
    tbGreen.addChangeHandler(this);
    tbBlue = new TextBox();
    tbBlue.setText(new Integer(blue).toString());
    tbBlue.setMaxLength(3);
    tbBlue.setVisibleLength(4);
    tbBlue.addKeyPressHandler(this);
    tbBlue.addChangeHandler(this);
    tbHexColor = new TextBox();
    tbHexColor.setText("ff0000");
    tbHexColor.setMaxLength(6);
    tbHexColor.setVisibleLength(6);
    tbHexColor.addKeyPressHandler(this);
    tbHexColor.addChangeHandler(this);

    // Put together the FlexTable
    table.setWidget(0, 0, colorpreview);
    table.getFlexCellFormatter().setColSpan(0, 0, 3);
    table.setWidget(1, 0, rbHue);
    table.setWidget(1, 1, tbHue);
    table.setWidget(1, 2, new HTML("°"));
    table.setWidget(2, 0, rbSaturation);
    table.setWidget(2, 1, tbSaturation);
    table.setText(2, 2, "%");
    table.setWidget(3, 0, rbBrightness);
    table.setWidget(3, 1, tbBrightness);
    table.setText(3, 2, "%");
    table.setWidget(4, 0, rbRed);
    table.setWidget(4, 1, tbRed);
    table.setWidget(5, 0, rbGreen);
    table.setWidget(5, 1, tbGreen);
    table.setWidget(6, 0, rbBlue);
    table.setWidget(6, 1, tbBlue);
    table.setText(7, 0, "#:");
    table.setWidget(7, 1, tbHexColor);
    table.getFlexCellFormatter().setColSpan(7, 1, 2);

    // Final setup
    panel.add(table);
    rbSaturation.setValue(true);
    setPreview("ff0000");
    DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default");

    // First event
    onClick(rbSaturation);

    initWidget(panel);
}

From source file:ca.qc.cegepoutaouais.tge.pige.client.ui.dialog.MyAccountDialog.java

License:Open Source License

private void createTagManagementTab() {

    TabItem tabItem = new TabItem(messages.myTags());
    tabItem.setStyleAttribute("padding", "3px");
    tabPanel.add(tabItem);/*from ww  w  . j  a  v  a2 s.c om*/

    tagFactory = BeanModelLookup.get().getFactory(Tag.class);
    tagStore = new ListStore<BeanModel>();

    addTagTF = new TextField<String>();
    addTagTF.setWidth(362);
    addTagTF.addKeyListener(new KeyListener() {

        @Override
        public void componentKeyUp(ComponentEvent event) {
            if (event.getKeyCode() == KeyCodes.KEY_ENTER) {
                addNewTag();
            }
        }
    });

    addTagBtn = new Button(messages.add());
    addTagBtn.setWidth("100px");
    addTagBtn.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.addIcon()));
    addTagBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent event) {
            addNewTag();
        }
    });

    tagLst = new ListField();
    tagLst.setHeight(300);
    tagLst.setWidth(466);
    tagLst.setStore(tagStore);
    tagLst.getListView().getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    tagLst.setDisplayField("name");
    tagLst.addKeyListener(new KeyListener() {

        @Override
        public void componentKeyUp(ComponentEvent event) {
            if (event.getKeyCode() == KeyCodes.KEY_DELETE) {
                deleteTag();
            }
        }
    });

    Menu contextMenu = new Menu();
    contextMenu.add(new HeaderMenuItem(messages.tagMenu()));
    MenuItem deleteTagBtn = new MenuItem(messages.delete());
    deleteTagBtn.addSelectionListener(new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent event) {
            deleteTag();
        }
    });
    contextMenu.add(deleteTagBtn);
    tagLst.setContextMenu(contextMenu);

    UserServiceAsync rpcService = Registry.get(PIGE.USER_SERVICE);
    rpcService.getAllTag(new AsyncCallback<Set<Tag>>() {

        @Override
        public void onSuccess(Set<Tag> tagSet) {
            for (Tag t : tagSet) {
                tagStore.add(tagFactory.createModel(t));
            }
        }

        @Override
        public void onFailure(Throwable caught) {
            PIGE.handleException(caught);
        }
    });

    FlexTable table = new FlexTable();
    table.setWidget(0, 0, addTagTF);
    table.setWidget(0, 1, addTagBtn);
    table.setWidget(1, 0, tagLst);
    table.getFlexCellFormatter().setColSpan(1, 0, 2);
    table.setWidth("466px");
    table.getFlexCellFormatter().setWidth(0, 0, "100%");
    tabItem.add(table);

}

From source file:client.richedit.RichTextToolbar.java

License:Apache License

protected void showPanelColorsPopup() {
    final BorderedPopup popup = new BorderedPopup();
    FlexTable contents = new FlexTable();
    contents.setCellSpacing(5);/*w  ww.  j  a  v  a2 s.c o m*/
    contents.setCellPadding(0);
    contents.setText(0, 0, "Enter panel colors (in hex ASCII format, e.g. #FFCC99):");
    contents.getFlexCellFormatter().setColSpan(0, 0, 2);

    contents.setText(1, 0, "Text color:");
    final TextBox tcolor = MsoyUI.createTextBox(_tcolor, 7, 7);
    contents.setWidget(1, 1, tcolor);

    contents.setText(2, 0, "Background color:");
    final TextBox bgcolor = MsoyUI.createTextBox(_bgcolor, 7, 7);
    contents.setWidget(2, 1, bgcolor);

    HorizontalPanel buttons = new HorizontalPanel();
    buttons.add(new Button(_cmsgs.cancel(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            popup.hide();
        }
    }));
    buttons.add(WidgetUtil.makeShim(5, 5));
    buttons.add(new Button(_cmsgs.update(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            setPanelColors(tcolor.getText().trim().toLowerCase(), bgcolor.getText().trim().toLowerCase());
            popup.hide();
        }
    }));
    contents.setWidget(3, 0, buttons);
    contents.getFlexCellFormatter().setColSpan(3, 0, 2);
    contents.getFlexCellFormatter().setHorizontalAlignment(3, 0, HasAlignment.ALIGN_RIGHT);

    popup.setWidget(contents);
    popup.show();
}

From source file:cmg.org.monitor.module.client.InviteUser.java

License:Open Source License

/**
 * Show dialog box./*from  w w  w.j  a va  2s . co m*/
 *
 * @param idUser the id user
 * @param actionType the action type
 * @param filter the filter
 */
static void showDialogBox(final String idUser, String actionType, String filter) {
    filterStatic = filter;
    ActionStatic = actionType;
    if (filter.equalsIgnoreCase(filter_Active)) {
        dialogFunction = new DialogBox();
        dialogFunction.setAnimationEnabled(true);
        VerticalPanel dialogVPanel = new VerticalPanel();
        //if filter is active so the idUser will be inactive or delete.we will do this in this
        String tempName = null;
        for (InvitedUser u : listUser3rds) {
            if (u.getEmail().toString().equals(idUser)) {
                tempName = u.getEmail();
            }
        }

        final Button closeButton = new Button("Cancel");
        closeButton.setStyleName("margin:6px;");
        closeButton.addStyleName("form-button");
        final Button okButton = new Button("OK");
        okButton.setStyleName("margin:6px;");
        okButton.addStyleName("form-button");
        final Button exitButton = new Button();
        exitButton.setStyleName("");
        exitButton.getElement().setId("closeButton");
        exitButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogFunction.hide();
            }
        });
        HTML popupContent = new HTML();
        popupContent.setHTML("<h4>Do you want to " + actionType + " user : " + tempName + "?</h4>");
        popupContent.setWidth("400px");
        FlexTable flexHTML = new FlexTable();
        flexHTML.setWidget(0, 0, popupContent);
        flexHTML.getCellFormatter().setWidth(0, 0, "400px");
        flexHTML.setStyleName("table-popup");
        FlexTable table = new FlexTable();
        table.setCellPadding(5);
        table.setCellSpacing(5);
        table.setWidget(0, 0, okButton);
        table.setWidget(0, 1, closeButton);
        table.getCellFormatter().setHorizontalAlignment(0, 0, VerticalPanel.ALIGN_RIGHT);
        table.getCellFormatter().setHorizontalAlignment(0, 1, VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.add(exitButton);
        dialogVPanel.add(flexHTML);
        dialogVPanel.add(table);
        dialogVPanel.setCellHorizontalAlignment(exitButton, VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.setCellHorizontalAlignment(flexHTML, VerticalPanel.ALIGN_LEFT);
        dialogVPanel.setCellHorizontalAlignment(table, VerticalPanel.ALIGN_RIGHT);
        okButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                setVisibleWidget(HTMLControl.ID_BODY_CONTENT, false);
                setVisibleLoadingImage(true);
                popupAction(filterStatic, ActionStatic, idUser);
            }
        });
        closeButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogFunction.hide();
            }
        });
        dialogFunction.setWidget(dialogVPanel);
        dialogFunction.getCaption().asWidget().setStyleName("myCaption");
        dialogFunction.center();

    }
    if (filter.equalsIgnoreCase(filter_requesting)) {
        //if filter requesting,so they will action to active this user
        dialogFunction = new DialogBox();
        dialogFunction.setAnimationEnabled(true);
        VerticalPanel dialogVPanel = new VerticalPanel();
        //if filter is active so the idUser will be inactive.we will do this in this
        String tempName = null;
        for (InvitedUser u : listUser3rds) {
            if (u.getEmail().toString().equals(idUser)) {
                tempName = u.getEmail();
            }
        }
        final Button closeButton = new Button("Cancel");
        closeButton.setStyleName("margin:6px;");
        closeButton.addStyleName("form-button");
        final Button okButton = new Button("OK");
        okButton.setStyleName("margin:6px;");
        okButton.addStyleName("form-button");
        final Button exitButton = new Button();
        exitButton.setStyleName("");
        exitButton.getElement().setId("closeButton");
        exitButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogFunction.hide();
            }
        });
        HTML popupContent = new HTML();
        popupContent.setHTML("<h4>Assgin this" + " user : " + tempName + " to group</h4>");
        popupContent.setWidth("400px");
        listTemp = new ListBox();
        listTemp.setMultipleSelect(true);
        listTemp.setWidth("300px");
        listTemp.setHeight("80px");
        listTemp.addItem(DefaulValueOfListTemp);
        listAll = new ListBox();
        listAll.setWidth("150px");
        for (SystemGroup s : listGroup) {
            listAll.addItem(s.getName());
        }
        btt_MappingGroup = new Button("Mapping");
        btt_MappingGroup.addClickHandler(new MappingGroup());
        btt_UnMappingGroup = new Button("UnMapping");
        btt_UnMappingGroup.addClickHandler(new UnMappingGroup());
        panelValidateGroups = new AbsolutePanel();
        FlexTable flexHTML = new FlexTable();
        flexHTML.getCellFormatter().setWidth(1, 0, "100px");
        flexHTML.getCellFormatter().setWidth(1, 1, "100px");
        flexHTML.getCellFormatter().setWidth(1, 2, "100px");
        flexHTML.getCellFormatter().setWidth(1, 3, "200px");
        flexHTML.getCellFormatter().setWidth(1, 4, "400px");
        flexHTML.getFlexCellFormatter().setColSpan(0, 0, 5);
        flexHTML.setWidget(0, 0, popupContent);
        flexHTML.setWidget(1, 0, listAll);
        flexHTML.setWidget(1, 1, btt_MappingGroup);
        flexHTML.setWidget(1, 2, btt_UnMappingGroup);
        flexHTML.setWidget(1, 3, listTemp);
        flexHTML.setStyleName("table-popup");
        FlexTable table = new FlexTable();
        table.setCellPadding(5);
        table.setCellSpacing(5);
        table.setWidget(0, 0, okButton);
        table.setWidget(0, 1, closeButton);
        table.getCellFormatter().setHorizontalAlignment(0, 0, VerticalPanel.ALIGN_RIGHT);
        table.getCellFormatter().setHorizontalAlignment(0, 1, VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.add(exitButton);
        dialogVPanel.add(flexHTML);
        dialogVPanel.add(table);
        dialogVPanel.setCellHorizontalAlignment(exitButton, VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.setCellHorizontalAlignment(flexHTML, VerticalPanel.ALIGN_LEFT);
        dialogVPanel.setCellHorizontalAlignment(table, VerticalPanel.ALIGN_RIGHT);
        okButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                //send to server
                if (listTemp.getValue(0).equalsIgnoreCase(DefaulValueOfListTemp)) {
                    listTemp.setFocus(true);
                    return;
                } else {
                    setVisibleWidget(HTMLControl.ID_BODY_CONTENT, false);
                    setVisibleLoadingImage(true);
                    popupAction(filterStatic, ActionStatic, idUser);
                }

            }
        });
        closeButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogFunction.hide();
            }
        });
        dialogFunction.setWidget(dialogVPanel);
        dialogFunction.getCaption().asWidget().setStyleName("myCaption");
        dialogFunction.center();
    }
    if (filter.equalsIgnoreCase(filter_pending)) {
        dialogFunction = new DialogBox();
        dialogFunction.setAnimationEnabled(true);
        VerticalPanel dialogVPanel = new VerticalPanel();
        //if filter is pending so the idUser will be delete.we will do this in this
        String tempName = null;
        for (InvitedUser u : listUser3rds) {
            if (u.getEmail().toString().equals(idUser)) {
                tempName = u.getEmail();
            }
        }

        final Button closeButton = new Button("Cancel");
        closeButton.setStyleName("margin:6px;");
        closeButton.addStyleName("form-button");
        final Button okButton = new Button("OK");
        okButton.setStyleName("margin:6px;");
        okButton.addStyleName("form-button");
        final Button exitButton = new Button();
        exitButton.setStyleName("");
        exitButton.getElement().setId("closeButton");
        exitButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogFunction.hide();
            }
        });
        HTML popupContent = new HTML();
        popupContent.setHTML("<h4>Do you want to " + actionType + " user : " + tempName + "?</h4>");
        popupContent.setWidth("400px");
        FlexTable flexHTML = new FlexTable();
        flexHTML.setWidget(0, 0, popupContent);
        flexHTML.getCellFormatter().setWidth(0, 0, "400px");
        flexHTML.setStyleName("table-popup");
        FlexTable table = new FlexTable();
        table.setCellPadding(5);
        table.setCellSpacing(5);
        table.setWidget(0, 0, okButton);
        table.setWidget(0, 1, closeButton);
        table.getCellFormatter().setHorizontalAlignment(0, 0, VerticalPanel.ALIGN_RIGHT);
        table.getCellFormatter().setHorizontalAlignment(0, 1, VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.add(exitButton);
        dialogVPanel.add(flexHTML);
        dialogVPanel.add(table);
        dialogVPanel.setCellHorizontalAlignment(exitButton, VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.setCellHorizontalAlignment(flexHTML, VerticalPanel.ALIGN_LEFT);
        dialogVPanel.setCellHorizontalAlignment(table, VerticalPanel.ALIGN_RIGHT);
        okButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                setVisibleWidget(HTMLControl.ID_BODY_CONTENT, false);
                setVisibleLoadingImage(true);
                popupAction(filterStatic, ActionStatic, idUser);
            }
        });
        closeButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogFunction.hide();
            }
        });
        dialogFunction.setWidget(dialogVPanel);
        dialogFunction.getCaption().asWidget().setStyleName("myCaption");
        dialogFunction.center();
    }
}

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

License:Open Source License

private Widget createAdvancedForm() {
    iJabConstants constants = (iJabConstants) GWT.create(iJabConstants.class);
    // Create a table to layout the form options
    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);/*from www  .  j a v a2  s. c o  m*/
    layout.setWidth("300px");
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();

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

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

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

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

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

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

        }

    });

    serverConfig.setChecked(false);

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

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

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

    advancedOptions.setWidget(4, 0, authCheck);

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

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

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

    });

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

    cellFormatter.setColSpan(3, 0, 2);

    return layout;
}

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

License:Open Source License

public DPSCalculator(MainPanel main) {

    this.main = main;

    ChangeHandler handler = new ChangeHandler() {

        @Override//  w w w .  ja  v a 2  s  .  co 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.FlexTableHelper.java

License:Open Source License

/**
 * Fixes problem with {@link FlexCellFormatter#setRowSpan(int, int, int)}, see comment for
 * {@link #FlexTableHelper}./*ww  w .  j  av a  2 s .c om*/
 */
public static void fixRowSpan(final FlexTable flexTable) {
    Set<Element> tdToRemove = new HashSet<Element>();
    {
        int rowCount = flexTable.getRowCount();
        for (int row = 0; row < rowCount; row++) {
            int cellCount = flexTable.getCellCount(row);
            //System.out.println("\tcellCount: " + row + " " + cellCount);
            for (int cell = 0; cell < cellCount; cell++) {
                int colSpan = flexTable.getFlexCellFormatter().getColSpan(row, cell);
                int rowSpan = flexTable.getFlexCellFormatter().getRowSpan(row, cell);
                if (rowSpan != 1) {
                    int column = getColumnOfCell(flexTable, row, cell);
                    for (int row2 = row + 1; row2 < row + rowSpan; row2++) {
                        int baseCell2 = getCellOfColumn(flexTable, row2, column);
                        for (int cell2 = baseCell2; cell2 < baseCell2 + colSpan; cell2++) {
                            if (cell2 != -1) {
                                /*System.out.println("remove (row,cell,column): "
                                   + row2
                                   + " "
                                   + cell2
                                   + " "
                                   + column);*/
                                Element td = flexTable.getCellFormatter().getElement(row2, cell2);
                                tdToRemove.add(td);
                            }
                        }
                    }
                }
            }
        }
    }
    // remove TD elements
    for (Element td : tdToRemove) {
        Element tr = DOM.getParent(td);
        DOM.removeChild(tr, td);
    }
}

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

License:Open Source License

private static int getColSpan(FlexTable flexTable, int row, int cell) {
    return flexTable.getFlexCellFormatter().getColSpan(row, cell);
}

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 .java 2 s.c  o 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.MainPanel.java

License:Open Source License

public MainPanel() {
    VerticalPanel panel = new VerticalPanel();
    initWidget(panel);/*from www .j  a va  2s  .co  m*/
    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);
        }
    });
}