List of usage examples for com.google.gwt.user.client.ui FlexTable FlexTable
public FlexTable()
From source file:com.dawg6.web.dhcalc.client.Legend.java
License:Open Source License
public Legend() { SimplePanel panel = new SimplePanel(); initWidget(panel);//from w ww. ja v a 2s. c o m flexTable = new FlexTable(); flexTable.setStyleName("outputTable"); flexTable.setBorderWidth(1); flexTable.setCellPadding(5); flexTable.getRowFormatter().addStyleName(0, "headerRow"); ScrollPanel scroll = new ScrollPanel(); scroll.setWidth("800px"); scroll.setHeight("400px"); scroll.add(flexTable); panel.add(scroll); Label lblNewLabel = new Label("Key"); lblNewLabel.setWordWrap(false); flexTable.setWidget(0, 0, lblNewLabel); Label lblAccumulator = new Label("How Calculated"); lblAccumulator.setWordWrap(false); flexTable.setWidget(0, 1, lblAccumulator); Label lblDescription = new Label("Description"); lblDescription.setWordWrap(false); flexTable.setWidget(0, 2, lblDescription); int row = 1; List<DamageMultiplier> sortedList = new Vector<DamageMultiplier>(); for (DamageMultiplier d : DamageMultiplier.values()) { sortedList.add(d); } Collections.sort(sortedList, new Comparator<DamageMultiplier>() { @Override public int compare(DamageMultiplier o1, DamageMultiplier o2) { return o1.getAbbreviation().toLowerCase().compareTo(o2.getAbbreviation().toLowerCase()); } }); for (DamageMultiplier d : sortedList) { if ((row % 2) == 0) flexTable.getRowFormatter().addStyleName(row, "evenRow"); else flexTable.getRowFormatter().addStyleName(row, "oddRow"); addLabel(row, 0, d.getAbbreviation()); addLabel(row, 1, d.getAccumulator().getDescription()); addLabel(row, 2, d.getDescription()); row++; } }
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 v a 2 s.c o 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); } }); }
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++;/*from w w w. ja v a 2 s . co 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);/* w w w . j av a 2s . c o 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.PassivesPanel.java
License:Open Source License
public PassivesPanel() { CaptionPanel captionPanel = new CaptionPanel("Passives"); initWidget(captionPanel);//w w w. j a v a2s . c om FlexTable flexTable = new FlexTable(); flexTable.setCellPadding(2); captionPanel.setContentWidget(flexTable); List<Passive> list = new Vector<Passive>(); for (Passive p : Passive.values()) list.add(p); Collections.sort(list, new Comparator<Passive>() { @Override public int compare(Passive a, Passive b) { return a.getLongName().compareTo(b.getLongName()); } }); for (int i = 0; i < NUM_PASSIVES; i++) { final ListBox lb = new ListBox(); lb.setWidth("100%"); flexTable.setWidget(i, 1, lb); final Anchor anchor = new Anchor("passive " + (i + 1)); anchor.setWordWrap(false); anchor.setTarget("_blank"); anchor.setHref("javascript:void(0)"); flexTable.setWidget(i, 0, anchor); lb.addItem("None", ""); for (Passive p : list) { lb.addItem(p.getLongName(), p.name()); } lb.setSelectedIndex(0); lb.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { setTooltip(lb, anchor); checkDuplicate(lb); passivesChanged(event); } }); listBoxes.add(lb); anchors.add(anchor); } }
From source file:com.dawg6.web.dhcalc.client.PlayerBuffPanel.java
License:Open Source License
public PlayerBuffPanel() { disableListeners = true;//w w w. java 2 s . c o m CaptionPanel cptnpnlNewPanel = new CaptionPanel("Other Player Buffs"); initWidget(cptnpnlNewPanel); FlexTable flexTable = new FlexTable(); cptnpnlNewPanel.setContentWidget(flexTable); int row = 0; Anchor anchor = new Anchor("Companion/Wolf (from other DH):"); anchor.setWordWrap(false); flexTable.setWidget(row, 0, anchor); anchor.setTarget("_blank"); anchor.setHref("http://us.battle.net/d3/en/class/demon-hunter/active/companion#c"); wolf = new SimpleCheckBox(); flexTable.setWidget(row, 1, wolf); Label lblNewLabel = new Label("% Uptime:"); lblNewLabel.setWordWrap(false); flexTable.setWidget(row, 2, lblNewLabel); wolfUptime = new DoubleSpinner(); wolfUptime.setVisibleLength(5); wolfUptime.setValue(33.33); flexTable.setWidget(row, 3, wolfUptime); wolfUptime.setTitle("% of time that another player's Wolf will be active"); calcWolfButton = new Button("Calculate"); calcWolfButton.setTitle("Calculate Wolf uptime based on your effective Cooldown Reduction"); flexTable.setWidget(row, 4, calcWolfButton); row++; Anchor anchor_1 = new Anchor("Big Bad Voodoo:"); anchor_1.setWordWrap(false); anchor_1.setTarget("_blank"); anchor_1.setHref("http://us.battle.net/d3/en/class/witch-doctor/active/big-bad-voodoo"); flexTable.setWidget(row, 0, anchor_1); bbv = new SimpleCheckBox(); flexTable.setWidget(row, 1, bbv); Label label = new Label("% Uptime:"); label.setWordWrap(false); flexTable.setWidget(row, 2, label); bbvUptime = new DoubleSpinner(); bbvUptime.setValue(17.67); bbvUptime.setVisibleLength(5); flexTable.setWidget(row, 3, bbvUptime); Anchor anchor_10 = new Anchor("Slam Dance:"); anchor_10.setWordWrap(false); anchor_10.setTarget("_blank"); anchor_10.setHref("http://us.battle.net/d3/en/class/witch-doctor/active/big-bad-voodoo#a+"); flexTable.setWidget(row, 4, anchor_10); slamDance = new SimpleCheckBox(); flexTable.setWidget(row, 5, slamDance); slamDance.setTitle("Check this box if the Witch Doctor is using the Slam Dance rune"); row++; Anchor anchor_1a = new Anchor("Slow Time/Stretch Time:"); anchor_1a.setWordWrap(false); anchor_1a.setTarget("_blank"); anchor_1a.setHref("http://us.battle.net/d3/en/class/wizard/active/slow-time#e+"); flexTable.setWidget(row, 0, anchor_1a); stretchTime = new SimpleCheckBox(); flexTable.setWidget(row, 1, stretchTime); Label labela = new Label("% Uptime:"); labela.setWordWrap(false); flexTable.setWidget(row, 2, labela); stretchTimeUptime = new NumberSpinner(); stretchTimeUptime.setValue(0); stretchTimeUptime.setVisibleLength(5); flexTable.setWidget(row, 3, stretchTimeUptime); row++; Anchor anchor_1b = new Anchor("Slow Time/Time Warp:"); anchor_1b.setWordWrap(false); anchor_1b.setTarget("_blank"); anchor_1b.setHref("http://us.battle.net/d3/en/class/wizard/active/slow-time#a+"); flexTable.setWidget(row, 0, anchor_1b); timeWarp = new SimpleCheckBox(); flexTable.setWidget(row, 1, timeWarp); Label labelb = new Label("% Uptime:"); labelb.setWordWrap(false); flexTable.setWidget(row, 2, labelb); timeWarpUptime = new NumberSpinner(); timeWarpUptime.setValue(0); timeWarpUptime.setVisibleLength(5); flexTable.setWidget(row, 3, timeWarpUptime); row++; Anchor anchor_2 = new Anchor("Mass Confusion/Paranoia:"); anchor_2.setWordWrap(false); anchor_2.setTarget("_blank"); anchor_2.setHref("http://us.battle.net/d3/en/class/witch-doctor/active/mass-confusion#a+"); flexTable.setWidget(row, 0, anchor_2); massConfusion = new SimpleCheckBox(); flexTable.setWidget(row, 1, massConfusion); Label label_1 = new Label("% Uptime:"); label_1.setWordWrap(false); flexTable.setWidget(row, 2, label_1); massConfusionUptime = new DoubleSpinner(); massConfusionUptime.setVisibleLength(5); flexTable.setWidget(row, 3, massConfusionUptime); row++; Anchor anchor_6 = new Anchor("Piranhas:"); anchor_6.setWordWrap(false); anchor_6.setTarget("_blank"); anchor_6.setHref("http://us.battle.net/d3/en/class/witch-doctor/active/piranhas"); flexTable.setWidget(row, 0, anchor_6); piranhas = new SimpleCheckBox(); flexTable.setWidget(row, 1, piranhas); Label label_5 = new Label("% Uptime:"); label_5.setWordWrap(false); flexTable.setWidget(row, 2, label_5); piranhasUptime = new DoubleSpinner(); piranhasUptime.setVisibleLength(5); flexTable.setWidget(row, 3, piranhasUptime); row++; Anchor anchor_8 = new Anchor("Laws of Valor:"); anchor_8.setWordWrap(false); anchor_8.setTarget("_blank"); anchor_8.setHref("http://us.battle.net/d3/en/class/crusader/active/laws-of-valor"); flexTable.setWidget(row, 0, anchor_8); valor = new SimpleCheckBox(); flexTable.setWidget(row, 1, valor); Label label_4 = new Label("% Active:"); label_4.setWordWrap(false); flexTable.setWidget(row, 2, label_4); valorActiveUptime = new DoubleSpinner(); valorActiveUptime.setVisibleLength(5); flexTable.setWidget(row, 3, valorActiveUptime); valorActiveUptime.setTitle("Percent of the time that Laws of Valor's Active buff (only) applies"); row++; Label label_4a = new Label("% Passive:"); label_4a.setWordWrap(false); flexTable.setWidget(row, 2, label_4a); valorPassiveUptime = new DoubleSpinner(); valorPassiveUptime.setVisibleLength(5); flexTable.setWidget(row, 3, valorPassiveUptime); valorPassiveUptime.setTitle("Percent of the time that Laws of Valor's Passive buff (only) applies"); row++; Anchor anchor_3 = new Anchor("Inner Sanctuary/Forbidden Palace:"); anchor_3.setWordWrap(false); anchor_3.setTarget("_blank"); anchor_3.setHref("http://us.battle.net/d3/en/class/monk/active/inner-sanctuary#e+"); flexTable.setWidget(row, 0, anchor_3); innerSanctuary = new SimpleCheckBox(); flexTable.setWidget(row, 1, innerSanctuary); Label label_2 = new Label("% Uptime:"); label_2.setWordWrap(false); flexTable.setWidget(row, 2, label_2); innerSanctuaryUptime = new DoubleSpinner(); innerSanctuaryUptime.setVisibleLength(5); flexTable.setWidget(row, 3, innerSanctuaryUptime); row++; Anchor anchor_4 = new Anchor("Crippling Wave/Breaking Wave:"); anchor_4.setWordWrap(false); anchor_4.setTarget("_blank"); anchor_4.setHref("http://us.battle.net/d3/en/class/monk/active/crippling-wave#e+"); flexTable.setWidget(row, 0, anchor_4); cripplingWave = new SimpleCheckBox(); flexTable.setWidget(row, 1, cripplingWave); Label label_3 = new Label("% Uptime:"); label_3.setWordWrap(false); flexTable.setWidget(row, 2, label_3); cripplingWaveUptime = new DoubleSpinner(); cripplingWaveUptime.setVisibleLength(5); flexTable.setWidget(row, 3, cripplingWaveUptime); row++; Anchor anchor_9 = new Anchor("Mantra of Retribution/Transgression:"); anchor_9.setWordWrap(false); anchor_9.setTarget("_blank"); anchor_9.setHref("http://us.battle.net/d3/en/class/monk/active/mantra-of-retribution#b+"); flexTable.setWidget(row, 0, anchor_9); retribution = new SimpleCheckBox(); flexTable.setWidget(row, 1, retribution); Label label_6 = new Label("% Uptime:"); label_6.setWordWrap(false); flexTable.setWidget(row, 2, label_6); retributionUptime = new DoubleSpinner(); retributionUptime.setVisibleLength(5); flexTable.setWidget(row, 3, retributionUptime); row++; Anchor anchor_5 = new Anchor("Mantra of Conviction:"); anchor_5.setWordWrap(false); anchor_5.setTarget("_blank"); anchor_5.setHref("http://us.battle.net/d3/en/class/monk/active/mantra-of-conviction"); flexTable.setWidget(row, 0, anchor_5); conviction = new SimpleCheckBox(); flexTable.setWidget(row, 1, conviction); Label lblPassiveUptime = new Label("% Passive:"); lblPassiveUptime.setWordWrap(false); flexTable.setWidget(row, 2, lblPassiveUptime); convictionPassiveUptime = new DoubleSpinner(); convictionPassiveUptime.setVisibleLength(5); convictionPassiveUptime .setTitle("Percent of time that Mantra of Conviction's passive bonus [only] applies"); flexTable.setWidget(row, 3, convictionPassiveUptime); Anchor anchor_7 = new Anchor("Overawe:"); anchor_7.setWordWrap(false); anchor_7.setTarget("_blank"); anchor_7.setHref("http://us.battle.net/d3/en/class/monk/active/mantra-of-conviction#a"); flexTable.setWidget(row, 4, anchor_7); overawe = new SimpleCheckBox(); overawe.setTitle("Check this box if the monk is using the Overawe rune."); flexTable.setWidget(row, 5, overawe); row++; Label lblActiveUptime = new Label("% Active:"); lblActiveUptime.setWordWrap(false); flexTable.setWidget(row, 2, lblActiveUptime); convictionActiveUptime = new DoubleSpinner(); convictionActiveUptime.setTitle("Percent of time that Matra of Conviction's active bonus [only] applies"); convictionActiveUptime.setVisibleLength(5); flexTable.setWidget(row, 3, convictionActiveUptime); row++; wolfUptime.setMax(100.0); bbvUptime.setMax(100.0); massConfusionUptime.setMax(100.0); piranhasUptime.setMax(100.0); cripplingWaveUptime.setMax(100.0); innerSanctuaryUptime.setMax(100.0); convictionPassiveUptime.setMax(100.0); convictionActiveUptime.setMax(100.0); valorActiveUptime.setMax(100.0); valorPassiveUptime.setMax(100.0); retributionUptime.setMax(100.0); stretchTimeUptime.setMax(100); timeWarpUptime.setMax(100); convictionPassiveUptime.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if (!disableListeners) { disableListeners = true; double a = convictionPassiveUptime.getValue(); double b = convictionActiveUptime.getValue(); convictionActiveUptime.setValue(Math.min(100.0 - a, b)); disableListeners = false; } } }); convictionActiveUptime.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if (!disableListeners) { disableListeners = true; double a = convictionPassiveUptime.getValue(); double b = convictionActiveUptime.getValue(); convictionPassiveUptime.setValue(Math.min(100.0 - b, a)); disableListeners = false; } } }); valorPassiveUptime.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if (!disableListeners) { disableListeners = true; double a = valorPassiveUptime.getValue(); double b = valorActiveUptime.getValue(); valorActiveUptime.setValue(Math.min(100.0 - a, b)); disableListeners = false; } } }); valorActiveUptime.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if (!disableListeners) { disableListeners = true; double a = valorPassiveUptime.getValue(); double b = valorActiveUptime.getValue(); valorPassiveUptime.setValue(Math.min(100.0 - b, a)); disableListeners = false; } } }); disableListeners = false; }
From source file:com.dawg6.web.dhcalc.client.RCRPanel.java
License:Open Source License
public RCRPanel() { CaptionPanel cptnpnlResourceReduction = new CaptionPanel("Resource Cost Reduction"); initWidget(cptnpnlResourceReduction); FlexTable flexTable = new FlexTable(); flexTable.setCellPadding(2);//from w ww . j a v a2 s . co m cptnpnlResourceReduction.setContentWidget(flexTable); HorizontalPanel horizontalPanel_1 = new HorizontalPanel(); horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_1.setSpacing(5); flexTable.setWidget(0, 0, horizontalPanel_1); Label lblShoulders = new Label("Shoulders (%):"); lblShoulders.setWordWrap(false); lblShoulders.setStyleName("boldText"); flexTable.setWidget(1, 0, lblShoulders); shoulders = new NumberSpinner(); shoulders.setVisibleLength(4); flexTable.setWidget(1, 1, shoulders); Label lblGloves = new Label("Gloves (%):"); lblGloves.setWordWrap(false); lblGloves.setStyleName("boldText"); flexTable.setWidget(2, 0, lblGloves); gloves = new NumberSpinner(); gloves.setVisibleLength(4); flexTable.setWidget(2, 1, gloves); Label lblAmulet = new Label("Amulet (%):"); lblAmulet.setWordWrap(false); lblAmulet.setStyleName("boldText"); flexTable.setWidget(3, 0, lblAmulet); amulet = new NumberSpinner(); amulet.setVisibleLength(4); flexTable.setWidget(3, 1, amulet); Label lblRing = new Label("Ring 1 (%):"); lblRing.setWordWrap(false); lblRing.setStyleName("boldText"); flexTable.setWidget(4, 0, lblRing); ring1 = new NumberSpinner(); ring1.setVisibleLength(4); flexTable.setWidget(4, 1, ring1); Label lblRing_1 = new Label("Ring 2 (%):"); lblRing_1.setWordWrap(false); lblRing_1.setStyleName("boldText"); flexTable.setWidget(5, 0, lblRing_1); ring2 = new NumberSpinner(); ring2.setVisibleLength(4); flexTable.setWidget(5, 1, ring2); Label lblBelt = new Label("Belt (%):"); lblBelt.setWordWrap(false); lblBelt.setStyleName("boldText"); flexTable.setWidget(6, 0, lblBelt); belt = new NumberSpinner(); belt.setVisibleLength(4); flexTable.setWidget(6, 1, belt); Label lblWeapon = new Label("Main Hand (%):"); lblWeapon.setWordWrap(false); lblWeapon.setStyleName("boldText"); flexTable.setWidget(7, 0, lblWeapon); weapon = new NumberSpinner(); weapon.setVisibleLength(4); flexTable.setWidget(7, 1, weapon); Label lblQuiver = new Label("Off Hand(%):"); lblQuiver.setWordWrap(false); lblQuiver.setStyleName("boldText"); flexTable.setWidget(8, 0, lblQuiver); quiver = new NumberSpinner(); quiver.setVisibleLength(4); flexTable.setWidget(8, 1, quiver); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setSpacing(5); flexTable.setWidget(9, 0, horizontalPanel); this.shoulders.setMax(10); this.gloves.setMax(10); this.ring1.setMax(10); this.ring2.setMax(10); this.belt.setMax(10); this.weapon.setMax(60); // yang's 50% + 10% this.quiver.setMax(10); this.amulet.setMax(10); Label l10 = new Label("Effective RCR:"); l10.addStyleName("boldText"); l10.setWordWrap(false); flexTable.setWidget(10, 0, l10); this.effRCR = new Label("0.0%"); this.effRCR.addStyleName("boldText"); flexTable.setWidget(10, 1, effRCR); this.skillTable = new FlexTable(); }
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 w ww . jav a2 s. c om 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.SituationalPanel.java
License:Open Source License
public SituationalPanel() { CaptionPanel captionPanel = new CaptionPanel("Situational"); initWidget(captionPanel);/*from w w w . j a v a 2 s . c o m*/ FlexTable flexTable = new FlexTable(); flexTable.setCellPadding(2); captionPanel.setContentWidget(flexTable); int row = 0; Label lblGreaterRiftLevel = new Label("Greater Rift Level:"); lblGreaterRiftLevel.setWordWrap(false); flexTable.setWidget(row, 0, lblGreaterRiftLevel); riftLevel = new NumberSpinner(); riftLevel.setVisibleLength(4); riftLevel.setTitle("Greater Rift Level"); riftLevel.setText("1"); riftLevel.setMin(1); riftLevel.setMax(100); flexTable.setWidget(row++, 1, riftLevel); Label lblNumberOfPlayers = new Label("Number of Players:"); lblNumberOfPlayers.setWordWrap(false); flexTable.setWidget(row, 0, lblNumberOfPlayers); numPlayers = new NumberSpinner(); numPlayers.setVisibleLength(4); numPlayers.setTitle("# of players in rift (used to calculate monster health)"); numPlayers.setText("1"); numPlayers.setMin(1); numPlayers.setMax(4); flexTable.setWidget(row++, 1, numPlayers); Label lblPrimaryTargetType = new Label("Primary Target Type:"); lblPrimaryTargetType.setWordWrap(false); flexTable.setWidget(row, 0, lblPrimaryTargetType); primaryTargetType = new ListBox(); flexTable.setWidget(row++, 1, primaryTargetType); primaryTargetType.setWidth("100%"); Label lblPrimaryTargetHealth = new Label("Primary Target Health:"); lblPrimaryTargetHealth.setWordWrap(false); flexTable.setWidget(row, 0, lblPrimaryTargetHealth); primaryTargetHealth = new LongSpinner(); primaryTargetHealth.setVisibleLength(20); primaryTargetHealth.setTitle("Number of additional targets to account for."); primaryTargetHealth.setText("0"); flexTable.setWidget(row++, 1, primaryTargetHealth); Label lblAdditionalTargetsType = new Label("Additional Targets Type:"); lblAdditionalTargetsType.setWordWrap(false); flexTable.setWidget(row, 0, lblAdditionalTargetsType); additionalTargetType = new ListBox(); flexTable.setWidget(row++, 1, additionalTargetType); additionalTargetType.setWidth("100%"); Label lblOfadditional = new Label("# of Additional targets:"); lblOfadditional.setWordWrap(false); flexTable.setWidget(row, 0, lblOfadditional); additional = new NumberSpinner(); additional.setVisibleLength(4); additional.setTitle("Number of additional targets to account for."); additional.setText("0"); flexTable.setWidget(row++, 1, additional); this.additional.setMax(10); Label lblAdditionalTargetsHealth = new Label("Additional Targets Health:"); lblAdditionalTargetsHealth.setWordWrap(false); flexTable.setWidget(row, 0, lblAdditionalTargetsHealth); additionalTargetsHealth = new LongSpinner(); additionalTargetsHealth.setVisibleLength(20); additionalTargetsHealth.setTitle("Number of additional targets to account for."); additionalTargetsHealth.setText("0"); flexTable.setWidget(row++, 1, additionalTargetsHealth); Label lblPercentOfTargets = new Label("Percent of targets slowed/chilled?"); lblPercentOfTargets.setWordWrap(false); flexTable.setWidget(row, 0, lblPercentOfTargets); percentSlowedChilled = new NumberSpinner(); percentSlowedChilled.setVisibleLength(4); percentSlowedChilled.setTitle("Percent of targets slowed or chilled (apply Cull the Weak)."); percentSlowedChilled.setText("0"); flexTable.setWidget(row++, 1, percentSlowedChilled); Label lblPercentOfTargets_1 = new Label("Percent of targets control impaired?"); lblPercentOfTargets_1.setWordWrap(false); flexTable.setWidget(row, 0, lblPercentOfTargets_1); percentControlled = new NumberSpinner(); percentControlled.setVisibleLength(4); percentControlled.setTitle("Percent of targets control impaired (apply Bane of the Trapped)."); percentControlled.setText("0"); flexTable.setWidget(row++, 1, percentControlled); Label lblPercentOfTargets_2 = new Label("Percent of targets at least 10 yards away?"); lblPercentOfTargets_2.setWordWrap(false); flexTable.setWidget(row, 0, lblPercentOfTargets_2); percentAtLeast10Yards = new NumberSpinner(); percentAtLeast10Yards.setVisibleLength(4); percentAtLeast10Yards.setTitle("Percent of targets at least 10 yards away (apply Steady Aim/UE4)."); percentAtLeast10Yards.setText("0"); flexTable.setWidget(row++, 1, percentAtLeast10Yards); Label label_8 = new Label("Distance to target(s) (yards)"); label_8.setWordWrap(false); flexTable.setWidget(row, 0, label_8); distance = new NumberSpinner(); distance.setVisibleLength(4); distance.setTitle("Average distance (in yards) to target(s) (for Zei's Stone of Vengeance)."); distance.setText("0"); flexTable.setWidget(row++, 1, distance); Label lblSpacingBetweenTargets = new Label("Spacing between targets (yards):"); lblSpacingBetweenTargets.setWordWrap(false); flexTable.setWidget(row, 0, lblSpacingBetweenTargets); targetSpacing = new NumberSpinner(); targetSpacing.setVisibleLength(4); targetSpacing.setTitle( "Average distance (in yards) between target(s) (for Grenades, certain Marked for Death runes and Single Out)."); targetSpacing.setText("0"); flexTable.setWidget(row++, 1, targetSpacing); Label moving = new Label("% of time Moving:"); moving.setWordWrap(false); flexTable.setWidget(row, 0, moving); percentMoving = new NumberSpinner(); percentMoving.setVisibleLength(4); percentMoving.setTitle("Percent of the time that the player is moving (vs standing still)"); percentMoving.setMin(0); percentMoving.setMax(100); percentMoving.setText("50"); flexTable.setWidget(row++, 1, percentMoving); Label lblTargetSizefor = new Label("Target Size (for Ball Lightning):"); lblTargetSizefor.setWordWrap(false); flexTable.setWidget(row, 0, lblTargetSizefor); targetSize = new ListBox(); targetSize.setTitle("Target Size"); flexTable.setWidget(row++, 1, targetSize); targetSize.setWidth("100%"); Label label = new Label("# Health Globes:"); flexTable.setWidget(row, 0, label); numHealthGlobes = new NumberSpinner(); numHealthGlobes.setVisibleLength(4); numHealthGlobes.setTitle("# of Health Globes picked up during fight"); flexTable.setWidget(row++, 1, numHealthGlobes); Label label_1 = new Label("Average Firing Delay (ms):"); label_1.setWordWrap(false); flexTable.setWidget(row, 0, label_1); firingDelay = new NumberSpinner(); firingDelay.setVisibleLength(4); firingDelay.setTitle("Average delay (in milliseconds) of player actions."); flexTable.setWidget(row++, 1, firingDelay); this.distance.setMax(100); this.targetSpacing.setMax(100); this.percentAtLeast10Yards.setMax(100); this.percentControlled.setMax(100); this.percentSlowedChilled.setMax(100); this.numHealthGlobes.setMin(0); this.firingDelay.setMin(0); this.firingDelay.setMax(1000); for (TargetSize t : TargetSize.values()) { targetSize.addItem(t.getDisplayName(), t.name()); } ChangeHandler primaryHandler = new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if (!disableListeners) updatePrimaryMonsterHealth(); } }; ChangeHandler additionalHandler = new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if (!disableListeners) updateAdditionalMonsterHealth(); } }; for (MonsterType m : MonsterType.values()) { this.primaryTargetType.addItem(m.toString(), m.name()); this.additionalTargetType.addItem(m.toString(), m.name()); } this.primaryTargetType.setSelectedIndex(0); this.additionalTargetType.setSelectedIndex(0); this.riftLevel.addChangeHandler(primaryHandler); this.riftLevel.addChangeHandler(additionalHandler); this.primaryTargetType.addChangeHandler(primaryHandler); this.additionalTargetType.addChangeHandler(additionalHandler); this.numPlayers.addChangeHandler(primaryHandler); this.numPlayers.addChangeHandler(additionalHandler); }
From source file:com.dawg6.web.dhcalc.client.SkillDamagePanel.java
License:Open Source License
public SkillDamagePanel() { CaptionPanel captionPanel = new CaptionPanel("Skill Damage Modifiers"); initWidget(captionPanel);/*from w w w . j a v a2 s .co m*/ flexTable = new FlexTable(); captionPanel.setContentWidget(flexTable); List<ActiveSkill> list = new Vector<ActiveSkill>(ActiveSkill.values().length); listBox = new ListBox(); for (ActiveSkill skill : ActiveSkill.values()) { if (skill.doesDamage() && (skill != ActiveSkill.BOLT) && (skill.getSkillType() != SkillType.NA)) { list.add(skill); } } Collections.sort(list, new Comparator<ActiveSkill>() { @Override public int compare(ActiveSkill o1, ActiveSkill o2) { return o1.getLongName().compareTo(o2.getLongName()); } }); for (ActiveSkill s : list) { listBox.addItem(s.getLongName(), s.name()); } listBox.setSelectedIndex(0); addButton = new Button("Add"); addButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { addSkill(); } }); flexTable.setWidget(0, 0, new Label("Skill:", false)); flexTable.setWidget(0, 1, listBox); flexTable.getFlexCellFormatter().setColSpan(0, 1, 2); flexTable.setWidget(0, 2, addButton); }