List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE
VerticalAlignmentConstant ALIGN_MIDDLE
To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.
Click Source Link
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 ava 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.RCRPanel.java
License:Open Source License
public RCRPanel() { CaptionPanel cptnpnlResourceReduction = new CaptionPanel("Resource Cost Reduction"); initWidget(cptnpnlResourceReduction); FlexTable flexTable = new FlexTable(); flexTable.setCellPadding(2);/* www .jav a2 s . c om*/ 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.SkillData.java
License:Open Source License
public SkillData() { data.setDefaults();/*from w ww . j a v a 2s. co m*/ VerticalPanel panel = new VerticalPanel(); initWidget(panel); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setSpacing(5); panel.add(horizontalPanel); Label lblNewLabel = new Label("Skill:"); lblNewLabel.setStyleName("boldText"); horizontalPanel.add(lblNewLabel); skills = new ListBox(); horizontalPanel.add(skills); CaptionPanel cptnpnlNewPanel = new CaptionPanel("Skill Damage"); panel.add(cptnpnlNewPanel); table = new FlexTable(); cptnpnlNewPanel.setContentWidget(table); table.setSize("5cm", "3cm"); table.setStyleName("breakpointTable"); table.setCellPadding(5); table.setBorderWidth(1); table.getRowFormatter().addStyleName(0, "headerRow"); int col = 0; Label lblSkill = new Label("Skill"); lblSkill.setWordWrap(false); table.setWidget(0, col++, lblSkill); Label lblRune = new Label("Rune"); lblRune.setWordWrap(false); table.setWidget(0, col++, lblRune); Label lblType = new Label("Damage Type"); lblType.setWordWrap(false); table.setWidget(0, col++, lblType); Label lblMultiplier = new Label("Multiplier"); lblMultiplier.setWordWrap(false); table.setWidget(0, col++, lblMultiplier); Label frames = new Label("Frames"); frames.setWordWrap(false); table.setWidget(0, col++, frames); Label lblPrimary = new Label("Primary"); lblPrimary.setWordWrap(false); table.setWidget(0, col++, lblPrimary); Label lblAdditional = new Label("# Additional"); lblAdditional.setWordWrap(false); table.setWidget(0, col++, lblAdditional); Label lblProjectiles = new Label("# Projectiles"); lblProjectiles.setWordWrap(false); table.setWidget(0, col++, lblProjectiles); Label lblAoeRadius = new Label("AoE Radius"); lblAoeRadius.setWordWrap(false); table.setWidget(0, col++, lblAoeRadius); Label lblGrenades = new Label("Grenades"); lblGrenades.setWordWrap(false); table.setWidget(0, col++, lblGrenades); Label lblRockets = new Label("Rockets"); lblRockets.setWordWrap(false); table.setWidget(0, col++, lblRockets); Label lblDot = new Label(" DoT "); lblDot.setWordWrap(false); table.setWidget(0, col++, lblDot); Label lblNotes = new Label("Notes"); lblNotes.setWordWrap(false); lblNotes.addStyleName("notes"); table.setWidget(0, col++, lblNotes); List<Pair<String, String>> list = new Vector<Pair<String, String>>(); for (ActiveSkill s : ActiveSkill.values()) { if (DamageFunction.hasDamage(s)) list.add(new Pair<String, String>(s.getLongName(), s.name())); } for (GemSkill g : GemSkill.values()) { if (DamageFunction.hasDamage(g)) list.add(new Pair<String, String>(g.getDisplayName(), g.name())); } for (DamageProc p : DamageProc.values()) { list.add(new Pair<String, String>(p.getLongName(), p.name())); } Collections.sort(list, new Comparator<Pair<String, String>>() { @Override public int compare(Pair<String, String> o1, Pair<String, String> o2) { return o1.getA().toLowerCase().compareTo(o2.getA().toLowerCase()); } }); for (Pair<String, String> p : list) { skills.addItem(p.getA(), p.getB()); } skills.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { skillChanged(); } }); skills.setSelectedIndex(0); skillChanged(); }
From source file:com.dawg6.web.dhcalc.client.StatsPanel.java
License:Open Source License
public StatsPanel() { CaptionPanel cptnpnlNewPanel = new CaptionPanel("Statistics"); initWidget(cptnpnlNewPanel);//from w w w.ja v a2s . co 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.dgzt.html.ButtonFootballGameHtml.java
License:Open Source License
/** * The html configuration./*from ww w . java 2 s.c om*/ */ @Override public GwtApplicationConfiguration getConfig() { GwtApplicationConfiguration conf = new GwtApplicationConfiguration(WIDTH, HEIGHT); Element element = Document.get().getElementById("embed-html"); VerticalPanel panel = new VerticalPanel(); panel.setWidth("100%"); panel.setHeight("100%"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); element.appendChild(panel.getElement()); conf.rootPanel = panel; return conf; }
From source file:com.edgenius.wiki.gwt.client.portal.PortletCreateDialog.java
License:Open Source License
public PortletCreateDialog(final String key) { if (key == null) { this.setText(Msg.consts.create_widget()); } else {//from ww w . j av a 2 s . c o m this.setText(Msg.consts.edit_widget()); } this.setIcon(new Image(IconBundle.I.get().star())); FlexTable plinkerPanel = new FlexTable(); pTitle.addFocusHandler(new FocusHandler() { public void onFocus(FocusEvent event) { String spaceUname = StringUtil.trim(pSpace.getText()); if (!StringUtil.isBlank(spaceUname) && !StringUtil.equalsIgnoreCase(currSpaceUname, spaceUname)) { pTitle.request(spaceUname); currSpaceUname = spaceUname; } } }); Label l1 = new Label(Msg.consts.space_uname()); plinkerPanel.setWidget(0, 0, l1); plinkerPanel.setWidget(0, 1, pSpace); Label l2 = new Label(Msg.consts.page_title()); plinkerPanel.setWidget(1, 0, l2); plinkerPanel.setWidget(1, 1, pTitle); FlexTable markupPanel = new FlexTable(); Label l3 = new Label(Msg.consts.title()); markupPanel.setWidget(0, 0, l3); markupPanel.setWidget(0, 1, title); title.setStyleName(Css.LONG_INPUT); Label l4 = new Label(Msg.consts.content()); markupPanel.setWidget(1, 0, l4); markupPanel.setWidget(1, 1, markup); markup.setStyleName(Css.LONG_TEXTBOX); okBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { WidgetModel widget = new WidgetModel(); widget.key = key; widget.description = desc.getText(); widget.shared = !keepPrivate.getValue(); String error = null; String spaceUname = null; if (typeMarkup.getValue()) { widget.type = WidgetModel.TYPE_MARKUP_RENDER; widget.title = title.getText(); widget.content = markup.getText(); if (StringUtil.isBlank(widget.title)) { error = "Title "; } if (StringUtil.isBlank(widget.content)) { if (error != null) error += " or Content"; else error = "Content "; } } else { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //page link widget widget.type = WidgetModel.TYPE_PAGE_LINKER; spaceUname = StringUtil.trimToEmpty(pSpace.getText()); widget.title = StringUtil.trimToEmpty(pTitle.getText()); //build content - whatever spaceUname or title is correct as this widget object is saved into ValidPageAsync() and save immediately if no errors. widget.content = "{include:src=" + EscapeUtil.escapeMacroParam(widget.title) + "@" + EscapeUtil.escapeMacroParam(spaceUname) + "}"; //it is bad idea if title is blank, then point to home page: it need lots hack to get back Home title etc. and in exception case, widget even can be blank title //this cause user have no chance to delete it anymore --- left rubbish widget on DB. if (StringUtil.isBlank(widget.title)) { error = "Title "; } if (StringUtil.isBlank(spaceUname)) { if (error != null) error += " or Space"; else error = "Space "; } } if (error != null) { error += " can not be blank."; message.error(error); return; } okBtn.setEnabled(false); if (typeMarkup.getValue()) { //for markup content widget, create immediately PortalControllerAsync portalController = ControllerFactory.getPortalController(); portalController.saveOrUpdateWidget(widget, PortletCreateDialog.this); } else { //for pagelink widget, valid from server side first, then save //valid if page exist or not? Valid from server side rather than just use suggest box, this is more exactly PageControllerAsync pageController = ControllerFactory.getPageController(); pageController.exist(spaceUname, widget.title, new ValidPageAsync(widget)); } } }); Button cancelBtn = new Button(Msg.consts.cancel(), ButtonIconBundle.crossImage()); cancelBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { hidebox(); } }); typePageLinker.addClickHandler(typeChangeListener); typeMarkup.addClickHandler(typeChangeListener); getButtonBar().add(cancelBtn); getButtonBar().add(okBtn); deck.insert(plinkerPanel, PAGE_LINER_INDEX); deck.insert(markupPanel, MARKUP_RENDER_INDEX); fillPanel(); int row = 0; FlexTable main = new FlexTable(); main.getColumnFormatter().setWidth(0, "120px"); main.setWidget(row, 0, message); main.getFlexCellFormatter().setColSpan(row, 0, 4); row++; Label l6 = new Label(Msg.consts.introduction()); main.setWidget(row, 0, l6); main.setWidget(row, 1, desc); desc.setMaxLength(250); desc.setStyleName(Css.LONG_INPUT); Label l5 = new Label(Msg.consts.keep_private()); main.setWidget(row, 2, l5); main.getFlexCellFormatter().setAlignment(row, 2, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE); main.setWidget(row, 3, keepPrivate); row++; HorizontalPanel chooser = new HorizontalPanel(); Label l7 = new Label(Msg.consts.page_linker()); Label l8 = new Label(Msg.consts.markup_render()); chooser.add(typePageLinker); chooser.add(l7); chooser.add(new HTML(" ")); chooser.add(typeMarkup); chooser.add(l8); chooser.setCellWidth(typePageLinker, "20px"); chooser.setCellWidth(typeMarkup, "20px"); main.setWidget(row, 0, chooser); main.getFlexCellFormatter().setColSpan(row, 0, 4); main.getFlexCellFormatter().setAlignment(row, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); row++; main.getFlexCellFormatter().setColSpan(row, 0, 4); main.getFlexCellFormatter().setHeight(row, 0, "3px"); row++; main.setWidget(row, 0, deck); main.getFlexCellFormatter().setColSpan(row, 0, 4); row++; main.setStyleName(Css.FORM); title.setStyleName(Css.FORM_INPUT); desc.setStyleName(Css.FORM_INPUT); pTitle.setStyleName(Css.FORM_INPUT); pSpace.setStyleName(Css.FORM_INPUT); l1.setStyleName(Css.FORM_LABEL); l2.setStyleName(Css.FORM_LABEL); l3.setStyleName(Css.FORM_LABEL); l4.setStyleName(Css.FORM_LABEL); // l5.setStyleName(Css.FORM_LABEL); l6.setStyleName(Css.FORM_LABEL); l7.setStyleName(Css.FORM_LABEL); DOM.setElementAttribute(l7.getElement(), "style", "text-align:left"); l8.setStyleName(Css.FORM_LABEL); DOM.setElementAttribute(l8.getElement(), "style", "text-align:left"); main.setSize("100%", "100%"); deck.setSize("100%", "100%"); VerticalPanel busyPanel = new VerticalPanel(); busyPanel.add(busyMessage); busyPanel.add(busyImg); mainDeck.insert(main, DECK_MAIN); mainDeck.insert(busyPanel, DECK_BUSY); if (key == null) mainDeck.showWidget(DECK_MAIN); else { //edit, loading widget info mainDeck.showWidget(DECK_BUSY); PortalControllerAsync portalController = ControllerFactory.getPortalController(); portalController.getWidget(key, new LoadingAsync()); } this.setWidget(mainDeck); }
From source file:com.edgenius.wiki.gwt.client.render.SearchRenderWidget.java
License:Open Source License
public void initContentPanel() { pagination.addPaginationListener(this); pagination.setPageSize(SharedConstants.PAGE_SIZE); deck.insert(loadingPanel, LOADING_PANEL); deck.insert(resultPanel, RESULT_PANEL); deck.showWidget(LOADING_PANEL);/*from www . j a va 2 s . co m*/ HorizontalPanel sumPanel = new HorizontalPanel(); sumPanel.add(pagination); sumPanel.add(summary); VerticalPanel leftPanel = new VerticalPanel(); leftPanel.add(message); leftPanel.add(deck); leftPanel.add(new HTML("<br>")); leftPanel.add(sumPanel); FlowPanel rightPanel = new FlowPanel(); rightPanel.add(advSearchPanel); HorizontalPanel mainPanel = new HorizontalPanel(); mainPanel.add(leftPanel); mainPanel.add(rightPanel); mainPanel.setCellWidth(rightPanel, AdvSearchPanel.WIDTH); mainPanel.setWidth("100%"); sumPanel.setWidth("100%"); leftPanel.setWidth("100%"); deck.setWidth("98%"); sumPanel.setWidth("98%"); sumPanel.setCellHorizontalAlignment(summary, HasHorizontalAlignment.ALIGN_RIGHT); sumPanel.setCellVerticalAlignment(summary, HasVerticalAlignment.ALIGN_MIDDLE); sumPanel.setCellVerticalAlignment(pagination, HasVerticalAlignment.ALIGN_MIDDLE); sumPanel.setStyleName(Css.SUMMARY); mainPanel.setStyleName(Css.SEARCH_RESULT); advSearchPanel.setKeyword(this.keyword); this.setWidget(mainPanel); }
From source file:com.edgenius.wiki.gwt.client.render.TemplateListRenderWidget.java
License:Open Source License
public void onSuccess(TemplateListModel list) { if (!GwtClientUtils.preSuccessCheck(list, message)) { listener.onFailedLoad(componentKey, ErrorCode.getMessageText(list.errorCode, list.errorMsg)); return;// w ww . j av a2 s . c om } contentPanel.clear(); if (list.templates != null && list.templates.size() > 0) { final TemplateControllerAsync templateController = ControllerFactory.getTemplateController(); final String spaceUname = list.spaceUname; ZebraTable listPanel = new ZebraTable(ZebraTable.STYLE_LIST, true); contentPanel.add(listPanel); int row = 0; listPanel.setWidget(row, 0, new Label(Msg.consts.name())); listPanel.setWidget(row, 1, new Label(Msg.consts.description())); listPanel.setWidget(row, 2, new Label(Msg.consts.creator())); listPanel.setWidget(row, 3, new Label(Msg.consts.shared())); listPanel.setWidget(row, 4, new Label(Msg.consts.actions())); listPanel.getColumnFormatter().setWidth(0, "15%"); listPanel.getColumnFormatter().setWidth(1, "55%"); listPanel.getCellFormatter().setAlignment(row, 4, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); row++; for (final TemplateModel model : list.templates) { listPanel.setWidget(row, 0, new Label(model.name)); listPanel.setWidget(row, 1, new Label(model.desc)); UserProfileLink creator = new UserProfileLink(model.author.getFullname(), spaceUname, model.author.getLoginname(), model.author.getPortrait()); listPanel.setWidget(row, 2, creator); listPanel.setWidget(row, 3, new Label(model.shared ? Msg.consts.yes() : Msg.consts.no())); FlowPanel actionP = new FlowPanel(); actionP.setStyleName(Css.NOWRAP); ClickLink delLink = new ClickLink(Msg.consts.delete()); delLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (Window.confirm(Msg.consts.confirm_delete_templ())) { templateController.deleteTemplate(spaceUname, model.id, TemplateListRenderWidget.this); } } }); Hyperlink editLink = new Hyperlink(Msg.consts.edit(), GwtUtils.buildToken(PageMain.TOKEN_EDIT_TEMPLATE, spaceUname, String.valueOf(model.id))); actionP.add(delLink); actionP.add(new Label(" | ")); actionP.add(editLink); listPanel.setWidget(row, 4, actionP); row++; } } else { Label no = new Label(Msg.consts.no_template()); no.setStyleName(Css.BLANK_MSG); contentPanel.add(no); } listener.onSuccessLoad(componentKey, "templateListLoad"); }
From source file:com.edgenius.wiki.gwt.client.render.UserProfileRenderWidget.java
License:Open Source License
/** * /*from w ww. j av a 2s.co m*/ */ private void showLoading(ZebraTable table) { listP.setHeight("180px"); table.removeAllRows(); table.setWidget(0, 0, loadingBar); table.getFlexCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); table.getFlexCellFormatter().setHeight(0, 0, "55px"); }
From source file:com.edgenius.wiki.gwt.client.widgets.AdvSearchPanel.java
License:Open Source License
public AdvSearchPanel(SearchRenderWidget widget) { this.widget = widget; keyword.addFocusHandler(KeyCaptureListener.instance()); spaceBox.addFocusHandler(KeyCaptureListener.instance()); modifiedDate.getTextBox().addFocusHandler(KeyCaptureListener.instance()); keyword.addBlurHandler(KeyCaptureListener.instance()); spaceBox.addBlurHandler(KeyCaptureListener.instance()); modifiedDate.getTextBox().addBlurHandler(KeyCaptureListener.instance()); //so far only keyword can submit if users click enter keyword.addKeyDownHandler(submitKeyboardListener); modifiedDate.setFormat(new DateBox.DefaultFormat(DateTimeFormat.getFormat("yyyy/MM/dd"))); FlexTable main = new FlexTable(); FlowPanel t1 = new FlowPanel(); t1.add(new Label(Msg.consts.filter())); FlowPanel t2 = new FlowPanel(); t2.add(new Label(Msg.consts.type())); FlowPanel t3 = new FlowPanel(); t3.add(new Label(Msg.consts.from_space())); FlowPanel t4 = new FlowPanel(); t4.add(new Label(Msg.consts.sortby())); FlowPanel t5 = new FlowPanel(); t5.add(new Label(Msg.consts.modified_date())); FlowPanel t6 = new FlowPanel(); // Hr sep = new Hr(); // sep.setStyleName(Css.SEPARATOR); t6.add(new HTML("<br>")); FlexTable filterPanel = new FlexTable(); FlexTable typePanel = new FlexTable(); FlexTable spacePanel = new FlexTable(); FlexTable sortbyPanel = new FlexTable(); FlexTable modifiedPanel = new FlexTable(); filterPanel.setWidget(0, 0, keyword); filterPanel.setWidget(1, 0, anyWords); filterPanel.setWidget(2, 0, allWords); filterPanel.setWidget(3, 0, exactWords); anyWords.setValue(true);//from ww w . jav a2s .c o m final ClickLink toggleNoneType = new ClickLink(Msg.consts.none_upper()); toggleNoneType.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { pageType.setEnable(false); spaceType.setEnable(false); attachmentType.setEnable(false); commentType.setEnable(false); pTagType.setEnable(false); sTagType.setEnable(false); userType.setEnable(false); widgetType.setEnable(false); } }); final ClickLink toggleAllType = new ClickLink(Msg.consts.all()); toggleAllType.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { pageType.setEnable(true); spaceType.setEnable(true); attachmentType.setEnable(true); commentType.setEnable(true); pTagType.setEnable(true); sTagType.setEnable(true); userType.setEnable(true); widgetType.setEnable(true); } }); typePanel.setWidget(0, 0, pageType); typePanel.setWidget(0, 1, spaceType); typePanel.setWidget(1, 0, attachmentType); typePanel.setWidget(1, 1, commentType); typePanel.setWidget(2, 0, pTagType); typePanel.setWidget(2, 1, sTagType); typePanel.setWidget(3, 0, userType); typePanel.setWidget(3, 1, widgetType); FlowPanel togglePanel = new FlowPanel(); togglePanel.add(toggleAllType); togglePanel.add(new Label("/")); togglePanel.add(toggleNoneType); typePanel.setWidget(4, 0, togglePanel); typePanel.getFlexCellFormatter().setColSpan(4, 0, 2); typePanel.getCellFormatter().setAlignment(4, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); spacePanel.setWidget(0, 0, new Label(Msg.consts.space())); spacePanel.setWidget(0, 1, spaceBox); sortbyPanel.setWidget(0, 0, defaultSort); sortbyPanel.setWidget(0, 1, typeSort); sortbyPanel.setWidget(0, 2, spaceSort); defaultSort.addClickHandler(sortClickHandler); typeSort.addClickHandler(sortClickHandler); spaceSort.addClickHandler(sortClickHandler); defaultSort.setEnable(true); spaceSort.setEnable(false); typeSort.setEnable(false); modifiedPanel.setWidget(0, 0, new Label(Msg.consts.from())); modifiedPanel.setWidget(0, 1, modifiedDate); Button filterBtn = new Button(Msg.consts.search()); filterBtn.addClickHandler(this); int row = 0; main.setWidget(row++, 0, t1); main.setWidget(row++, 0, filterPanel); main.setWidget(row++, 0, t2); main.setWidget(row++, 0, typePanel); main.setWidget(row++, 0, t3); main.setWidget(row++, 0, spacePanel); main.setWidget(row++, 0, t4); main.setWidget(row++, 0, sortbyPanel); main.setWidget(row++, 0, t5); main.setWidget(row++, 0, modifiedPanel); main.setWidget(row++, 0, t6); main.setWidget(row, 0, filterBtn); main.getCellFormatter().setAlignment(row++, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_BOTTOM); t1.setStyleName(Css.HEADER); t2.setStyleName(Css.HEADER); t3.setStyleName(Css.HEADER); t4.setStyleName(Css.HEADER); t5.setStyleName(Css.HEADER); //t6.setStyleName(Css.HEADER); main.setStyleName(Css.ADV_SEARCH); spaceBox.setStyleName(Css.FORM_INPUT); keyword.setStyleName(Css.FORM_INPUT); modifiedDate.setStyleName(Css.FORM_INPUT); main.setWidth(WIDTH); filterPanel.setCellSpacing(4); typePanel.setCellSpacing(4); spacePanel.setCellSpacing(4); sortbyPanel.setCellSpacing(4); modifiedPanel.setCellSpacing(4); main.setCellPadding(0); main.setCellSpacing(0); this.setWidget(main); }