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:com.dawg6.web.dhcalc.client.MainPanel.java

License:Open Source License

protected void compareBuilds() {
    int count = 0;
    List<CompareData> list = new Vector<CompareData>();

    for (int i = 0; i < compareData.length; i++) {
        CompareData data = compareData[i];

        if (data != null) {
            count++;/*w ww . j a va 2  s  .  c o  m*/
            list.add(data);
        }
    }

    if (count == 0) {
        ApplicationPanel.showErrorDialog("Please select at least 2 builds to compare");
        return;
    }

    int numDiff = 0;

    FlexTable table = new FlexTable();
    table.setCellPadding(2);
    table.setBorderWidth(1);
    table.addStyleName("breakpointTable");
    ScrollPanel panel = new ScrollPanel();
    panel.setWidget(table);

    for (int i = 0; i < count; i++) {
        Label label = new Label("Build #" + (i + 1));
        label.setWordWrap(false);
        table.setWidget(0, i + 1, label);
        table.getFlexCellFormatter().setHorizontalAlignment(0, i + 1, HasHorizontalAlignment.ALIGN_CENTER);
    }

    Label l1 = new Label("Input Field");
    l1.setWordWrap(false);
    table.setWidget(0, 0, l1);
    table.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);

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

    int row = 1;

    List<Map<String, String>> formData = new Vector<Map<String, String>>();

    for (int i = 0; i < count; i++) {
        Map<String, String> map = new TreeMap<String, String>();
        map.putAll(list.get(i).formData.main);

        Util.putAll(map, "passives.", list.get(i).formData.passives);
        Util.putAll(map, "gems.", list.get(i).formData.gems);
        Util.putAll(map, "specialItems.", list.get(i).formData.specialItems);
        Util.putAll(map, "skills.", list.get(i).formData.skills);
        Util.putAll(map, "elementalDamages.", list.get(i).formData.elementalDamage);
        Util.putAll(map, "skillDamages.", list.get(i).formData.skillDamage);

        for (Map.Entry<String, String> e : list.get(i).formData.calculator.entrySet()) {
            String key = e.getKey();
            String value = e.getValue();

            if (key.startsWith("calc.")) {
                String k = key.substring(5);
                String old = map.get(k);

                if (old == null) {
                    map.put(k, value);
                } else if (!old.equals(value)) {
                    map.put(key, value);
                }
            } else {
                map.put(key, value);
            }
        }

        formData.add(map);
    }

    Set<String> keys = new TreeSet<String>();

    for (Map<String, String> map : formData) {
        keys.addAll(map.keySet());
    }

    for (String key : keys) {
        List<String> values = new Vector<String>();
        String first = formData.get(0).get(key);
        values.add(first);
        boolean diff = false;

        for (int i = 1; i < count; i++) {
            String value = formData.get(i).get(key);
            values.add(value);
            if (!diff && ((value == null) || !value.equals(first)))
                diff = true;
        }

        if (diff) {
            numDiff++;

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

            Label keyLabel = new Label(key);
            keyLabel.setWordWrap(false);
            keyLabel.addStyleName("boldText");
            table.setWidget(row, 0, keyLabel);
            table.getFlexCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_LEFT);

            for (int i = 0; i < count; i++) {
                String value = values.get(i);

                if (value == null)
                    value = "N/A";

                Label label = new Label(value);
                label.setWordWrap(false);
                table.setWidget(row, i + 1, label);
                table.getFlexCellFormatter().setHorizontalAlignment(row, i + 1,
                        HasHorizontalAlignment.ALIGN_CENTER);
            }

            row++;
        }
    }

    if (numDiff == 0) {
        ApplicationPanel.showErrorDialog("There were no differences in the builds");
        return;
    } else {
        ApplicationPanel.showDialogBox("Compare Builds", panel, ApplicationPanel.OK, null);
    }
}

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

License:Open Source License

public ParagonPanel() {

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

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

    lblNewLabel = new Label(
            "Note: Paragon points other than Dexterity must be entered manually (they are not available via the battle.net API)");
    lblNewLabel.setWordWrap(true);
    lblNewLabel.addStyleName("boldText");
    flexTable.setWidget(0, 0, lblNewLabel);
    lblNewLabel.setWidth("300px");

    lblParagonDexteritypoints = new Label("Paragon Dexterity (points):");
    lblParagonDexteritypoints.setWordWrap(false);
    flexTable.setWidget(1, 0, lblParagonDexteritypoints);

    paragonDexterity = new NumberSpinner();
    paragonDexterity.setVisibleLength(6);
    paragonDexterity.setTitle("Each paragon Dexterity point adds 5 Dexterity");
    flexTable.setWidget(1, 1, paragonDexterity);
    paragonDexterity.setMax(10000);

    paragonDexterity.addChangeHandler(new ChangeHandler() {

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

    dexLabel = new Label("(0)");
    dexLabel.setStyleName("boldText");
    flexTable.setWidget(1, 2, dexLabel);

    lblParagonHatredpoints = new Label("Paragon Hatred (points):");
    lblParagonHatredpoints.setWordWrap(false);
    flexTable.setWidget(2, 0, lblParagonHatredpoints);

    paragonHatred = new NumberSpinner();
    paragonHatred.setVisibleLength(6);
    paragonHatred.setTitle("Each paragon Hatred point adds 0.5 Max Hatred");
    paragonHatred.setText("0");
    flexTable.setWidget(2, 1, paragonHatred);
    paragonHatred.setMax(50);

    paragonHatred.addChangeHandler(new ChangeHandler() {

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

    hatredLabel = new Label("(0)");
    hatredLabel.setStyleName("boldText");
    flexTable.setWidget(2, 2, hatredLabel);

    lblParagonRcrpoints = new Label("Paragon RCR (points):");
    lblParagonRcrpoints.setWordWrap(false);
    flexTable.setWidget(3, 0, lblParagonRcrpoints);

    paragonRCR = new NumberSpinner();
    paragonRCR.setVisibleLength(6);
    paragonRCR.setTitle("Each paragon RCR point adds 0.1% Resource Cost Reduction");
    paragonRCR.setText("0");
    flexTable.setWidget(3, 1, paragonRCR);
    paragonRCR.setMax(50);

    paragonRCR.addChangeHandler(new ChangeHandler() {

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

    rcrLabel = new Label("(0%)");
    rcrLabel.setStyleName("boldText");
    flexTable.setWidget(3, 2, rcrLabel);

    label_4 = new Label("Paragon Area Damage (points):");
    label_4.setWordWrap(false);
    flexTable.setWidget(4, 0, label_4);

    paragonAD = new NumberSpinner();
    paragonAD.setVisibleLength(6);
    paragonAD.setTitle("Each paragon AD point adds 1% Area Damage");
    paragonAD.setText("0");
    flexTable.setWidget(4, 1, paragonAD);

    paragonAD.addChangeHandler(new ChangeHandler() {

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

    adLabel = new Label("(0%)");
    adLabel.setStyleName("boldText");
    flexTable.setWidget(4, 2, adLabel);

    lblOffensePoints = new Label("Offense Points:");
    lblOffensePoints.setWordWrap(false);
    lblOffensePoints.addStyleName("boldText");
    flexTable.setWidget(5, 0, lblOffensePoints);

    Label label = new Label("Paragon IAS (points):");
    label.setWordWrap(false);
    flexTable.setWidget(6, 0, label);

    paragonIAS = new NumberSpinner();
    paragonIAS.setTitle("Each paragon IAS point adds .2% IAS");
    paragonIAS.setVisibleLength(6);
    flexTable.setWidget(6, 1, paragonIAS);

    paragonIAS.addChangeHandler(new ChangeHandler() {

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

    iasLabel = new Label("(0%)");
    iasLabel.setStyleName("boldText");
    flexTable.setWidget(6, 2, iasLabel);

    Label paragonCDRlabel = new Label("Paragon CDR (points):");
    paragonCDRlabel.setWordWrap(false);
    flexTable.setWidget(7, 0, paragonCDRlabel);

    paragonCDR = new NumberSpinner();
    paragonCDR.setTitle("Each paragon CDR point adds .2% Cooldown Reduction");
    paragonCDR.setVisibleLength(6);
    flexTable.setWidget(7, 1, paragonCDR);

    paragonCDR.addChangeHandler(new ChangeHandler() {

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

    cdrLabel = new Label("(0%)");
    cdrLabel.setStyleName("boldText");
    flexTable.setWidget(7, 2, cdrLabel);

    Label label_1 = new Label("Paragon CC  (points):");
    label_1.setWordWrap(false);
    flexTable.setWidget(8, 0, label_1);

    paragonCC = new NumberSpinner();
    paragonCC.setTitle("Each paragon CC point adds .1 % Crit Chance");
    paragonCC.setVisibleLength(6);
    paragonCC.setText("0");
    flexTable.setWidget(8, 1, paragonCC);

    paragonCC.addChangeHandler(new ChangeHandler() {

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

    ccLabel = new Label("(0%)");
    ccLabel.setStyleName("boldText");
    flexTable.setWidget(8, 2, ccLabel);

    Label label_2 = new Label("Paragon CHD (points):");
    label_2.setWordWrap(false);
    flexTable.setWidget(9, 0, label_2);

    paragonCHD = new NumberSpinner();
    paragonCHD.setTitle("Each paragon CHD point add 1% Crit Hit Damage");
    paragonCHD.setVisibleLength(6);
    paragonCHD.setText("0");
    flexTable.setWidget(9, 1, paragonCHD);

    paragonCHD.addChangeHandler(new ChangeHandler() {

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

    chdLabel = new Label("(0%)");
    chdLabel.setStyleName("boldText");
    flexTable.setWidget(9, 2, chdLabel);

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

    lblTotal = new Label("Total Offense Points:");
    horizontalPanel.add(lblTotal);
    lblTotal.setWordWrap(false);

    total = new Label("0");
    horizontalPanel.add(total);
    total.setStyleName("boldText");

    lblRequiredParagonLevel = new Label(" (Requires paragon level");
    horizontalPanel.add(lblRequiredParagonLevel);
    lblRequiredParagonLevel.setWordWrap(false);

    level = new Label("0");
    horizontalPanel.add(level);
    level.setStyleName("boldText");

    label_3 = new Label(")");
    label_3.setWordWrap(false);
    horizontalPanel.add(label_3);
    flexTable.getCellFormatter().setHorizontalAlignment(10, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    flexTable.getFlexCellFormatter().setColSpan(10, 0, 3);
    flexTable.getFlexCellFormatter().setColSpan(0, 0, 3);
    flexTable.getFlexCellFormatter().setColSpan(5, 0, 3);

    paragonIAS.setMax(50);
    paragonCC.setMax(50);
    paragonCHD.setMax(50);
    paragonCDR.setMax(50);
    paragonAD.setMax(50);
}

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

License:Open Source License

public SavePanel() {

    CaptionPanel captionPanel = new CaptionPanel("Save/Load");
    initWidget(captionPanel);/*from   ww  w.j av a2 s  .c  o  m*/

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

    tabPanel = new TabPanel();
    flexTable_3.setWidget(0, 0, tabPanel);

    browserPanel = new FlexTable();
    browserPanel.setCellPadding(2);

    if (Storage.isLocalStorageSupported()) {
        tabPanel.add(browserPanel, "Browser Storage", false);
    }

    storageList = new ListBox();
    browserPanel.setWidget(0, 0, storageList);
    storageList.setWidth("100%");
    storageList.setVisibleItemCount(5);

    nameField = new TextBox();
    nameField.setVisibleLength(30);
    nameField.setText("Enter a Name");
    browserPanel.setWidget(1, 0, nameField);

    Button btnNewButton = new Button("New button");
    browserPanel.setWidget(1, 1, btnNewButton);
    btnNewButton.setText("Add");

    btnNewButton.addClickHandler(new ClickHandler() {

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

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(5);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    browserPanel.setWidget(2, 0, horizontalPanel);

    Button button_6 = new Button("New button");
    button_6.setText("Save");
    horizontalPanel.add(button_6);

    button_6.addClickHandler(new ClickHandler() {

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

    Button button_5 = new Button("New button");
    horizontalPanel.add(button_5);
    button_5.setText("Restore");

    button_5.addClickHandler(new ClickHandler() {

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

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

    button_2.addClickHandler(new ClickHandler() {

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

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

    btnNewButton_1.addClickHandler(new ClickHandler() {

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

    browserPanel.getFlexCellFormatter().setColSpan(0, 0, 1);
    browserPanel.getFlexCellFormatter().setColSpan(2, 0, 1);
    browserPanel.getFlexCellFormatter().setColSpan(0, 0, 2);
    browserPanel.getFlexCellFormatter().setColSpan(2, 0, 2);
    browserPanel.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER);

    filePanel = new FlexTable();
    filePanel.setCellPadding(2);
    tabPanel.add(filePanel, "Local File", false);

    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    filePanel.setWidget(0, 0, horizontalPanel_1);

    loadPanel = new FormPanel();
    loadPanel.setMethod(FormPanel.METHOD_POST);
    loadPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    loadPanel.setAction("loadData");
    horizontalPanel_1.add(loadPanel);

    HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    loadPanel.setWidget(horizontalPanel_2);
    horizontalPanel_2.setSize("100%", "100%");

    fileUpload = new FileUpload();
    fileUpload.setName("file");
    horizontalPanel_2.add(fileUpload);

    clientKey = new Hidden("client");
    horizontalPanel_2.add(clientKey);
    filePanel.getFlexCellFormatter().setColSpan(0, 0, 1);

    Button button = new Button("Save Data...");
    filePanel.setWidget(1, 0, button);
    button.setText("Save File");

    Button button_1 = new Button("Load Data...");
    filePanel.setWidget(1, 1, button_1);
    button_1.setText("Load File");
    filePanel.getFlexCellFormatter().setColSpan(0, 0, 2);
    filePanel.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);
    filePanel.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER);

    button_1.addClickHandler(new ClickHandler() {

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

        }
    });

    button.addClickHandler(new ClickHandler() {

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

        }
    });

    textPanel = new FlexTable();
    textPanel.setCellPadding(2);
    tabPanel.add(textPanel, "Copy/Paste", false);

    textArea = new TextArea();
    textArea.setText(
            "Paste previously saved form data here and click \"Restore.\" Or press \"Current\" to paste current Form data.");
    textArea.setVisibleLines(5);
    textPanel.setWidget(0, 0, textArea);
    textArea.setSize("100%", "");

    Button button_3 = new Button("Save Data...");
    button_3.setText("Current");
    textPanel.setWidget(1, 0, button_3);

    textArea.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            textArea.selectAll();
        }
    });

    nameField.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            nameField.selectAll();
        }
    });

    button_3.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

            if (listener != null) {

                FormData data = listener.getFormData();

                JSONObject obj = JsonUtil.toJSONObject(data);
                textArea.setText(JsonUtil.formatJsonText(obj.toString()));
                textArea.selectAll();
            }

        }
    });

    Button button_4 = new Button("Load Data...");
    button_4.setText("Restore");

    button_4.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (listener != null) {
                String text = textArea.getText();

                FormData data = JsonUtil.parseFormData(text);

                listener.setFormData(data);
                textArea.setText("");
            }

        }
    });

    textPanel.setWidget(1, 1, button_4);
    textPanel.getFlexCellFormatter().setColSpan(0, 0, 2);
    textPanel.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);
    textPanel.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER);

    flexTable_3.getFlexCellFormatter().setColSpan(0, 0, 1);

    storageList.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            int i = storageList.getSelectedIndex();

            if (i >= 0) {
                String name = storageList.getItemText(i);

                if (name != null)
                    nameField.setText(name);
            }

        }
    });
}

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

License:Open Source License

public SkillsPanel() {

    CaptionPanel captionPanel = new CaptionPanel("Active Skills");
    initWidget(captionPanel);/*  w ww.  j a v  a 2s  .  c  om*/

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

    int row = 0;

    List<ActiveSkill> skills = new Vector<ActiveSkill>();

    for (ActiveSkill s : ActiveSkill.values()) {
        if (s.getSkillType() != SkillType.NA)
            skills.add(s);
    }
    Collections.sort(skills, new Comparator<ActiveSkill>() {

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

    for (int i = 0; i < NUM_SKILLS; i++) {
        final Anchor anchor = new Anchor("Skill " + (i + 1) + ":");
        anchor.setHref("javascript:void(0)");
        anchor.setTarget("_blank");
        anchor.setWordWrap(false);
        skillAnchors.add(anchor);
        flexTable.setWidget(row, 0, anchor);

        final ListBox list = new ListBox();

        list.addItem("None", "");

        for (ActiveSkill s : skills) {
            list.addItem(s.getLongName(), s.name());
        }

        list.setSelectedIndex(0);
        skillBoxes.add(list);
        list.setWidth("100%");
        flexTable.setWidget(row, 1, list);

        final Anchor anchor2 = new Anchor("Rune:");
        anchor2.setHref("javascript:void(0)");
        anchor2.setTarget("_blank");
        anchor2.setWordWrap(false);
        runeAnchors.add(anchor2);
        flexTable.setWidget(row, 2, anchor2);

        final ListBox list2 = new ListBox();

        list2.addItem("None", Rune.None.name());
        list2.setSelectedIndex(0);
        list2.setWidth("100%");
        flexTable.setWidget(row, 3, list2);
        runeBoxes.add(list2);

        list.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {

                if (!disableListeners) {
                    skillChanged(anchor, list, anchor2, list2);
                }
            }
        });

        list2.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {

                if (!disableListeners) {
                    runeChanged(list, anchor2, list2);
                }
            }
        });

        row++;
    }

    Label label = new Label("Caltrops Uptime:");
    label.setWordWrap(false);
    flexTable.setWidget(row, 0, label);
    flexTable.getFlexCellFormatter().setColSpan(row, 0, 2);
    flexTable.getFlexCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    caltropsUptime = new NumberSpinner();
    caltropsUptime.setVisibleLength(3);
    caltropsUptime.setTitle("Percent of the time primary target will have active Caltrops applied.");
    flexTable.setWidget(row, 1, caltropsUptime);
    flexTable.getFlexCellFormatter().setColSpan(row, 1, 2);
    caltropsUptime.setMax(100);

    row++;

    Label lblUptime = new Label("Primary Target MfD Uptime:");
    lblUptime.setWordWrap(false);
    flexTable.setWidget(row, 0, lblUptime);
    flexTable.getFlexCellFormatter().setColSpan(row, 0, 2);
    flexTable.getFlexCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    mfdUptime = new NumberSpinner();
    mfdUptime.setTitle("Percent of the time primary target will have active MfD applied.");
    mfdUptime.setVisibleLength(3);
    flexTable.setWidget(row, 1, mfdUptime);
    flexTable.getFlexCellFormatter().setColSpan(row, 1, 2);

    row++;

    Label lblAdditionalTargetsUptime = new Label("Additional Targets MfD Uptime:");
    lblAdditionalTargetsUptime.setWordWrap(false);
    flexTable.setWidget(row, 0, lblAdditionalTargetsUptime);
    flexTable.getFlexCellFormatter().setColSpan(row, 0, 2);
    flexTable.getFlexCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    mfdAddUptime = new NumberSpinner();
    mfdAddUptime.setVisibleLength(3);
    mfdAddUptime.setTitle("Percent of the time additional targets will have active MfD applied.");
    flexTable.setWidget(row, 1, mfdAddUptime);
    flexTable.getFlexCellFormatter().setColSpan(row, 1, 2);

    row++;

    Label lblNoteThisStacks = new Label("Note: This stacks with Calamity's MfD");
    lblNoteThisStacks.setWordWrap(false);
    lblNoteThisStacks.setStyleName("boldText");
    flexTable.setWidget(row, 0, lblNoteThisStacks);
    flexTable.getFlexCellFormatter().setColSpan(row, 0, 4);

    row++;

    mfdUptime.setMax(100);
    mfdAddUptime.setMax(100);
    caltropsUptime.setMax(100);

}

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

License:Open Source License

public StatsPanel() {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    filterTable = new FlexTable();

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

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

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

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

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

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

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

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

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

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

    button.addClickHandler(new ClickHandler() {

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

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

    btnNewButton.addClickHandler(new ClickHandler() {

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

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

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

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

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

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

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

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

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

    lblSentryRune.addClickHandler(new ClickHandler() {

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

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

    lblSkill_3.addClickHandler(new ClickHandler() {

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

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

    lblCount.addClickHandler(new ClickHandler() {

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

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

    disableListeners = true;

    int row = 1;
    int col = 3;

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

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

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

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

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

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

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

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

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

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

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

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

        final StatCategory cat = c;

        avg.addClickHandler(new ClickHandler() {

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

        max.addClickHandler(new ClickHandler() {

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

        col++;
    }

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

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

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

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

            }
        });

    }

    disableListeners = false;
}

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

License:Open Source License

public WeaponPanel(String title, boolean offHand) {
    this.offHand = offHand;
    captionPanel = new CaptionPanel(title);
    initWidget(captionPanel);/*from  ww  w . j av a2  s.c  o  m*/

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

    Label label = new Label("Weapon Type:");
    label.setWordWrap(false);
    flexTable.setWidget(0, 0, label);

    weaponType = new ListBox();
    weaponType.setSelectedIndex(0);
    flexTable.setWidget(0, 1, weaponType);

    Label label_1 = new Label("Base (Physical) Damage:");
    label_1.setWordWrap(false);
    flexTable.setWidget(1, 0, label_1);

    baseMin = new DoubleSpinner();
    baseMin.box.setTitle("This number is not displayed in-game. It is imported from hero import.");
    baseMin.setVisibleLength(8);
    baseMin.setText("0");
    flexTable.setWidget(1, 1, baseMin);

    Label label_2 = new Label(" to ");
    label_2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.setWidget(1, 2, label_2);

    baseMax = new DoubleSpinner();
    baseMax.box.setTitle("This number is not displayed in-game. It is imported from hero import.");
    baseMax.setVisibleLength(8);
    baseMax.setText("0");
    flexTable.setWidget(1, 3, baseMax);

    Label label_3 = new Label("Tooltip Damage:");
    label_3.setWordWrap(false);
    label_3.setStyleName("boldText");
    flexTable.setWidget(1, 4, label_3);

    tooltipMin = new Label();
    tooltipMin.setTitle("Shown as \"white\" damage on weapon tooltip.");
    tooltipMin.setText("0");
    tooltipMin.setStyleName("boldText");
    flexTable.setWidget(1, 5, tooltipMin);

    Label label_5 = new Label(" to ");
    label_5.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.setWidget(1, 6, label_5);

    tooltipMax = new Label();
    tooltipMax.setTitle("Shown as \"white\" damage on weapon tooltip.");
    tooltipMax.setText("0");
    tooltipMax.setStyleName("boldText");
    flexTable.setWidget(1, 7, tooltipMax);

    Label label_7 = new Label("Added (Elemental) Damage:");
    label_7.setWordWrap(false);
    flexTable.setWidget(2, 0, label_7);

    addMin = new DoubleSpinner();
    addMin.box.setTitle("Shown as primary stat on weapon.");
    addMin.setVisibleLength(8);
    addMin.setText("0");
    flexTable.setWidget(2, 1, addMin);

    Label label_8 = new Label(" to ");
    label_8.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.setWidget(2, 2, label_8);

    addMax = new DoubleSpinner();
    addMax.box.setTitle("Shown as primary stat on weapon.");
    addMax.setVisibleLength(8);
    addMax.setText("0");
    flexTable.setWidget(2, 3, addMax);

    Label label_9 = new Label("Average Weapon Damage:");
    label_9.setWordWrap(false);
    label_9.setStyleName("boldText");
    flexTable.setWidget(2, 4, label_9);

    averageWeaponDamage = new Label("0.0");
    averageWeaponDamage.setTitle("Average weapon damage used for Skill calculations");
    averageWeaponDamage.setStyleName("boldText");
    flexTable.setWidget(2, 5, averageWeaponDamage);
    flexTable.getFlexCellFormatter().setColSpan(2, 5, 3);

    Label label_11 = new Label("Weapon IAS (%):");
    label_11.setWordWrap(false);
    flexTable.setWidget(3, 0, label_11);

    weaponIAS = new NumberSpinner();
    weaponIAS.box.setTitle("Increased attack speed as a primary attribute on the weapon.");
    weaponIAS.setVisibleLength(6);
    flexTable.setWidget(3, 1, weaponIAS);

    Label label_12 = new Label("Weapon DPS:");
    label_12.setWordWrap(false);
    label_12.setStyleName("boldText");
    flexTable.setWidget(3, 4, label_12);

    weaponDpsLabel = new Label("0.0");
    weaponDpsLabel.setTitle("Shown as dps on weapon tooltip.");
    weaponDpsLabel.setStyleName("boldText");
    flexTable.setWidget(3, 5, weaponDpsLabel);
    flexTable.getFlexCellFormatter().setColSpan(3, 5, 3);

    Label label_14 = new Label("Weapon Increased Damage (%):");
    label_14.setWordWrap(false);
    flexTable.setWidget(4, 0, label_14);

    weaponDamage = new NumberSpinner();
    weaponDamage.box.setTitle("Increased damage as a primary attribute on the weapon.");
    weaponDamage.setVisibleLength(6);
    flexTable.setWidget(4, 1, weaponDamage);

    Label label_15 = new Label("Weapon APS:");
    label_15.setWordWrap(false);
    label_15.setStyleName("boldText");
    flexTable.setWidget(4, 4, label_15);

    weaponApsLabel = new Label("0.0");
    weaponApsLabel.setTitle("As shown on weapon tooltip");
    weaponApsLabel.setStyleName("boldText");
    flexTable.setWidget(4, 5, weaponApsLabel);
    flexTable.getFlexCellFormatter().setColSpan(4, 5, 3);

    this.weaponIAS.setMax(7);
    this.weaponDamage.setMax(10);

    weaponType.addItem("None", "");

    for (WeaponType wt : WeaponType.values()) {

        if (!offHand || (wt == WeaponType.HandCrossbow))
            weaponType.addItem(wt.getName(), wt.name());
    }

    weaponType.setSelectedIndex(0);

    ChangeHandler handler = new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {

            if (!disableUpdates) {
                calculate();
            }
        }
    };

    weaponType.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {

            disableUpdates = true;

            WeaponType type = getWeaponTypeEnum();

            if (type == null) {
                baseMin.setValue(0.0);
                baseMax.setMax(0.0);
            } else {
                baseMin.setValue((double) type.getMin());
                baseMax.setValue((double) type.getMax());
            }

            disableUpdates = false;

            calculate();
        }
    });

    baseMin.addChangeHandler(handler);
    baseMax.addChangeHandler(handler);
    addMin.addChangeHandler(handler);
    addMax.addChangeHandler(handler);
    weaponIAS.addChangeHandler(handler);
    weaponDamage.addChangeHandler(handler);
}

From source file:com.dimdim.conference.ui.dialogues.client.common.AboutCommonDialog.java

License:Open Source License

private AboutCommonDialog(String title, Widget content, Vector footerButtons, String dialogName) {
    super(title);
    this.content = content;
    this.footerButtons = footerButtons;
    this.dialogName = dialogName;
    this.closeButtonText = UIStrings.getOKLabel();
    UIResources uiResources = UIResources.getUIResources();
    FlexTable productInfo = new FlexTable();
    String productVersion = getProductVersion();
    String premiumCatalogue = getPremiumCatalogue();
    String premiumCatalogueLogo = UIStrings.getAboutPoweredLogo();
    //      Window.alert(premiumCatalogueLogo);
    productInfo.setWidget(0, 0, createTextHTML(productVersion));
    productInfo.getFlexCellFormatter().setColSpan(0, 0, 3);
    //Window.alert(getProductVersion());
    //      Window.alert(premiumCatalogue);
    //Window.alert(uiResources.getConferenceInfo("dimdim.premiumCatalogue"));
    if (premiumCatalogue.equalsIgnoreCase("1")) {
        //         Window.alert("comes here 1");
        Image logo = new Image();
        logo.setUrl(premiumCatalogueLogo);
        productInfo.setWidget(0, 3, logo);
        //         Window.alert("comes here 2");
        productInfo.setWidget(0, 4, createTextHTML(
                "<div style=\"color: #1b61da;\">Powered By <a href=\"http://www.dimdim.com\" target=\"_blank\"><u>Dimdim"));
        productInfo.getFlexCellFormatter().setColSpan(0, 4, 9);
        //         Window.alert("comes here 3");
        //productInfo.setWidth("2px");            
    }/*from   w w w.j a v  a 2 s.  c o  m*/
    productInfo.setStyleName("common-text");
    //      Window.alert("comes here 4");
    buttonPanel.add(productInfo, DockPanel.WEST);
    //      Window.alert("comes here 5");
}

From source file:com.edgenius.wiki.gwt.client.editor.MCEInsertTableDialog.java

License:Open Source License

/**
 * @param tiny//from w  w  w.ja v a 2s  .  co m
 */
public MCEInsertTableDialog(TinyMCE tiny, boolean update) {
    super(tiny);
    this.update = update;
    this.setText(Msg.consts.insert_table());

    FlexTable options = new FlexTable();

    options.setWidget(0, 0, asTable);
    options.setWidget(0, 1, asGrid);
    asTable.setValue(true);
    asTable.addClickHandler(this);
    asGrid.addClickHandler(this);
    options.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    options.getFlexCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);
    options.setStyleName(Css.OPTIONS);

    FlexTable tableParamLayout = new FlexTable();
    tableParamLayout.setWidget(0, 0, new Label(Msg.consts.rows()));
    tableParamLayout.setWidget(0, 1, rows);

    tableParamLayout.setWidget(0, 2, new Label(Msg.consts.cols()));
    tableParamLayout.setWidget(0, 3, cols);

    tableParamLayout.setWidget(1, 0, new Label(Msg.consts.bk_color()));
    tableParamLayout.setWidget(1, 1, bkPicker);

    tableParamLayout.setWidget(1, 2, new Label(Msg.consts.border_color()));
    tableParamLayout.setWidget(1, 3, borderPicker);

    tableParamLayout.setWidget(2, 0, new Label(Msg.consts.border()));
    tableParamLayout.setWidget(2, 1, border);

    tableParamLayout.setWidget(2, 2, hasTitle);
    tableParamLayout.getFlexCellFormatter().setColSpan(2, 2, 2);

    tableParamLayout.getColumnFormatter().setWidth(0, "120px");
    tableParamLayout.getColumnFormatter().setWidth(2, "120px");
    rows.setStyleName(Css.TINY_TEXT_BOX);
    cols.setStyleName(Css.TINY_TEXT_BOX);
    border.setStyleName(Css.TINY_TEXT_BOX);

    FlexTable gridParamLayout = new FlexTable();
    gridParamLayout.setWidget(0, 0, new Label(Msg.consts.rows()));
    gridParamLayout.setWidget(0, 1, gridRows);

    gridParamLayout.setWidget(0, 2, new Label(Msg.consts.cols()));
    gridParamLayout.setWidget(0, 3, gridCols);
    gridRows.setStyleName(Css.TINY_TEXT_BOX);
    gridCols.setStyleName(Css.TINY_TEXT_BOX);

    tableParamLayout.setWidth("100%");
    tableParamLayout.setCellSpacing(5);
    gridParamLayout.setWidth("100%");
    gridParamLayout.setCellSpacing(5);
    options.setWidth("100%");
    options.setCellSpacing(5);
    deck.setWidth("100%");

    deck.insert(tableParamLayout, 0);
    deck.insert(gridParamLayout, 1);

    if (update) {
        JsArrayString list = getProperties();
        if (list.get(8).toLowerCase().indexOf("macrogrid") != -1) {
            asGrid.setValue(true);
            gridRows.setText(list.get(0));
            gridCols.setText(list.get(1));
            //set it to same value for switch back
            rows.setText(list.get(0));
            cols.setText(list.get(1));
            //disable some unable to change attributes
            gridRows.setEnabled(false);
            gridCols.setEnabled(false);
            deck.showWidget(1);
        } else {
            asTable.setValue(true);
            deck.showWidget(0);
            //this sequence is according to method getProperties() on  table.js in TinyMCE table plugin
            rows.setText(list.get(0));
            cols.setText(list.get(1));
            gridRows.setText(list.get(0));
            gridCols.setText(list.get(1));

            final String color = StringUtil.isBlank(list.get(2)) ? SharedConstants.TABLE_BG_DEFAULT_COLOR
                    : list.get(2);
            if (GwtClientUtils.isIE()) {
                Scheduler.get().scheduleDeferred(new ScheduledCommand() {
                    public void execute() {
                        //stupid IE need this deferred set
                        bkPicker.setColor(color);
                    }
                });
            } else
                bkPicker.setColor(color);
            final String bcolor = StringUtil.isBlank(list.get(3)) ? SharedConstants.TABLE_BORDER_DEFAULT_COLOR
                    : list.get(3);
            if (GwtClientUtils.isIE()) {
                Scheduler.get().scheduleDeferred(new ScheduledCommand() {
                    public void execute() {
                        //stupid IE need this deferred set
                        borderPicker.setColor(bcolor);
                    }
                });
            } else
                borderPicker.setColor(bcolor);

            hasTitle.setValue(BooleanUtil.toBoolean(list.get(4)));
            width = GwtUtils.removeUnit(list.get(5));
            height = GwtUtils.removeUnit(list.get(6));
            String borderS = GwtUtils.removeUnit(list.get(7));
            border.setText(StringUtil.isBlank(borderS) ? DEFAULT_BORDER_SIZE + "" : borderS);

            //disable some unable to change attributes
            rows.setEnabled(false);
            cols.setEnabled(false);
        }
    } else {
        //initial values
        gridRows.setText("1");
        gridCols.setText("3");

        rows.setText("2");
        cols.setText("2");
        border.setText("1");
        hasTitle.setValue(true);
        deck.showWidget(0);

        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            public void execute() {
                rows.setFocus(true);
            }
        });
    }

    VerticalPanel form = new VerticalPanel();
    form.setWidth("100%");
    form.add(options);
    form.add(deck);
    this.setWidget(form);

}

From source file:com.edgenius.wiki.gwt.client.editor.MCELinkDialog.java

License:Open Source License

public MCELinkDialog(final TinyMCE tiny) {
    super(tiny);//from ww  w  .  j av a2  s .co m
    request.addCallback(this);

    this.setText(Msg.consts.insert_link());
    Label l1 = new Label(Msg.consts.link_url());
    Label l2 = new Label(Msg.consts.space());
    Label l3 = new Label(Msg.consts.page());

    FlexTable layout = new FlexTable();
    layout.setWidget(0, 0, l2);
    layout.setWidget(0, 1, spaceBox);

    layout.setWidget(1, 0, l3);
    layout.setWidget(1, 1, pageBox);

    Hr sep = new Hr();
    layout.setWidget(2, 0, sep);
    layout.getFlexCellFormatter().setColSpan(2, 0, 2);

    layout.setWidget(3, 0, l1);
    layout.setWidget(3, 1, extLinkBox);

    VerticalPanel panel = new VerticalPanel();
    panel.add(message);
    panel.add(layout);

    panel.setSize("100%", "100%");
    layout.setSize("100%", "100%");
    l1.setStyleName(Css.FORM_LABEL);
    l2.setStyleName(Css.FORM_LABEL);
    l3.setStyleName(Css.FORM_LABEL);
    sep.setStyleName(Css.SEPARATOR);
    extLinkBox.setStyleName(Css.FORM_INPUT);
    spaceBox.setStyleName(Css.FORM_INPUT);
    pageBox.setStyleName(Css.FORM_INPUT);
    this.setWidget(panel);

    //can not use spaceBox.onLostFocus() to decide when get PageList, as spaceBox is suggest box, a popup suggest box
    //will trigger the focus event, but at the moment, the space input not finish yet...
    pageBox.addFocusHandler(new FocusHandler() {
        public void onFocus(FocusEvent event) {
            String spaceUname = StringUtil.trim(spaceBox.getText());

            if (!StringUtil.equalsIgnoreCase(spaceUname, currSpaceUname)) {
                pageBox.request(spaceUname);
                currSpaceUname = spaceUname;
            }
        }

    });

    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        public void execute() {
            pageBox.setFocus(true);
        }
    });

    //initial request for current space
    //just put it as blank so that comparing with spaceBox.getText()
    currSpaceUname = "";
    pageBox.request(StringUtil.trim(tiny.getSpaceUname()));
}

From source file:com.edgenius.wiki.gwt.client.page.EditTemplatePanel.java

License:Open Source License

public EditTemplatePanel(PageMain main) {
    this.main = main;
    main.addPanelSwitchListener(this);
    contentArea = new Editor(main, false);
    main.editorRegistry.register(contentArea);

    ContentChangeListener changeListener = new ContentChangeListener();
    contentArea.addKeyPressHandler(changeListener);
    contentArea.addChangeHandler(changeListener);

    functionBtnBar = new FunctionWidget(main);
    functionBtnBarPreview = new FunctionWidget(main);
    title.addKeyPressHandler(new KeyPressHandler() {
        public void onKeyPress(KeyPressEvent event) {
            String text = title.getText();
            if (text.length() > TITLE_MAX_LEN) {
                title.setText(text.substring(0, TITLE_MAX_LEN));
                status.setText(Msg.params.title_length("" + TITLE_MAX_LEN));
            }//from  w ww . ja v a 2  s  .  co  m
            if (validSave()) {
                status.removeStyleName(Css.ERROR);
                title.removeStyleName(Css.ERROR);
                status.setText("");
            }
        }
    });
    FlexTable headerPanel = new FlexTable();
    FlowPanel f1 = new FlowPanel();
    f1.add(title);
    f1.add(status);
    headerPanel.setWidget(0, 0, f1);
    headerPanel.setWidget(0, 1, functionBtnBar);
    title.setStyleName(Css.TITLE_BOX);

    FlowPanel f2 = new FlowPanel();
    f2.add(desc);
    f2.add(shared);
    headerPanel.setWidget(1, 0, f2);
    headerPanel.getFlexCellFormatter().setColSpan(1, 0, 2);
    desc.setStyleName(Css.DESC);

    headerPanel.setStyleName(Css.TEMPLATE_HEADER);
    headerPanel.getRowFormatter().setStyleName(0, Css.EDIT_TITLE_PANEL);
    headerPanel.getRowFormatter().setStyleName(1, Css.EDIT_TAG_PANEL);

    //main
    VerticalPanel panel = new VerticalPanel();
    headerPanel.setWidth("100%");
    panel.setWidth("100%");

    VerticalPanel editPanel = new VerticalPanel();
    editPanel.add(headerPanel);
    editPanel.add(contentArea);
    editPanel.setWidth("100%");

    VerticalPanel previewPanel = new VerticalPanel();
    FlexTable previewHeaderPanel = new FlexTable();
    previewHeaderPanel.setWidget(0, 0, previewTitle);
    previewHeaderPanel.setWidget(0, 1, functionBtnBarPreview);
    //      previewHeaderPanel.setWidget(1, 0, previewDesc);
    //      previewHeaderPanel.getFlexCellFormatter().setColSpan(1, 0, 2);
    previewHeaderPanel.setWidth("100%");
    previewPanel.setWidth("100%");

    previewPanel.add(previewHeaderPanel);
    previewPanel.add(previewContent);

    previewPanel.setStyleName(Css.PREVIEW);
    previewTitle.setStyleName(Css.RENDER_TITLE);
    //      previewDesc.setStyleName(Css.HEADING3);

    deck.insert(editPanel, 0);
    deck.insert(previewPanel, 1);
    deck.showWidget(0);

    panel.add(message);
    panel.add(deck);
    this.setWidget(panel);

}