List of usage examples for com.google.gwt.user.client.ui Label Label
protected Label(Element element)
From source file:com.databasepreservation.visualization.shared.client.widgets.Toast.java
/** * Create a new message popup/*w w w .java2s . co m*/ * * @param type * @param title * @param message */ public Toast(MessagePopupType type, String title, String message) { super(false); this.type = type; slotNumber = getNextSlot(this); layout = new FlowPanel(); focus = new AccessibleFocusPanel(layout); titleLabel = new Label(title); messageLabel = new Label(message); if (type.equals(MessagePopupType.ERROR_MESSAGE)) { layout.addStyleName("toast-error"); } else if (type.equals(MessagePopupType.INFO)) { layout.addStyleName("toast-info"); } layout.add(titleLabel); layout.add(messageLabel); setWidget(focus); focus.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); hideTimer = new Timer() { public void run() { hide(); } }; layout.addStyleName("wui-toast"); titleLabel.addStyleName("toast-title"); messageLabel.addStyleName("toast-message"); }
From source file:com.dawg6.gwt.client.ApplicationPanel.java
License:Open Source License
public static DialogBox showDialogBox(String title, String message, int buttons, final DialogBoxResultHandler handler) { Label label = new Label(message); return showDialogBox(title, label, buttons, handler); }
From source file:com.dawg6.gwt.client.ApplicationPanel.java
License:Open Source License
public static AsyncTaskHandler showWaitDialogBox(String title, String message) { VerticalPanel panel = new VerticalPanel(); HorizontalPanel row = new HorizontalPanel(); row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); row.setSpacing(5);/* ww w .ja va 2 s . c om*/ panel.add(row); Image image = new Image("images/Progressbar.gif"); image.setSize("64px", "16px"); row.add(image); if (message != null) { Label label = new Label(message); row.add(label); } final DialogBox dialogBox = showDialogBox(title, panel, -1, null); return new AsyncTaskHandler() { @Override public void taskCompleted() { dialogBox.hide(); } }; }
From source file:com.dawg6.gwt.client.widgets.AbstractSearchable.java
License:Open Source License
protected AbstractSearchable(ValueFactory<T> factory, Comparator<T> sorter) { captionPanel = new CaptionPanel("Caption"); initWidget(captionPanel);/*from w w w. ja v a 2 s.com*/ VerticalPanel verticalPanel_5 = new VerticalPanel(); captionPanel.setContentWidget(verticalPanel_5); verticalPanel_5.setSize("5cm", "3cm"); HorizontalPanel row = new HorizontalPanel(); row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); row.setSpacing(5); verticalPanel_5.add(row); Label label = new Label("Filter:"); row.add(label); suggestBox = new TextBox(); row.add(suggestBox); suggestBox.setVisibleLength(20); suggestBox.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { setFilter(); } }); Button button = new Button("Clear"); row.add(button); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { suggestBox.setText(""); setFilter(); } }); listBox = new CellList<T>(getCell()); scroll = new ScrollPanel(); scroll.setWidget(listBox); this.list = new Vector<T>(); this.dataProvider = new ListDataProvider<T>(); this.dataProvider.addDataDisplay(listBox); verticalPanel_5.add(scroll); listBox.setPageSize(Integer.MAX_VALUE); listBox.setSize("300px", "300px"); selectionModel = new SingleSelectionModel<T>(); listBox.setSelectionModel(selectionModel); selectionModel.addSelectionChangeHandler(new Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { selectionChanged(getSelectedValue()); } }); this.factory = factory; this.sorter = sorter; }
From source file:com.dawg6.web.dhcalc.client.AboutDialog.java
License:Open Source License
public AboutDialog() { flexTable = new FlexTable(); flexTable.setBorderWidth(0);//from w w w. j ava 2 s . c o m flexTable.setCellPadding(5); initWidget(flexTable); Label lblNewLabel = new Label("DH DPS Calculator"); lblNewLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); lblNewLabel.setStyleName("boldText"); lblNewLabel.setWordWrap(false); flexTable.setWidget(0, 0, lblNewLabel); flexTable.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); flexTable.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setSpacing(5); horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); flexTable.setWidget(1, 0, horizontalPanel); Label lblNewLabel_1 = new Label("Version:"); horizontalPanel.add(lblNewLabel_1); versionLabel = new Label(Version.getVersionString()); horizontalPanel.add(versionLabel); flexTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel horizontalPanel_1 = new HorizontalPanel(); horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_1.setSpacing(5); horizontalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); flexTable.setWidget(3, 0, horizontalPanel_1); Label lblWritteByDawg = new Label("Written By:"); horizontalPanel_1.add(lblWritteByDawg); Anchor label_1 = new Anchor("New label"); label_1.setTarget("_blank"); label_1.setText("dawg6"); label_1.setHref("http://us.battle.net/d3/en/profile/Dawg6-1416/"); horizontalPanel_1.add(label_1); Label lblNewLabel_2 = new Label("("); horizontalPanel_1.add(lblNewLabel_2); Anchor anchor_1 = new Anchor("New label"); anchor_1.setText("scott@dawg6.com"); anchor_1.setTarget("_blank"); anchor_1.setHref("mailto:scott@dawg6.com"); horizontalPanel_1.add(anchor_1); Label lblNewLabel_3 = new Label(")"); horizontalPanel_1.add(lblNewLabel_3); flexTable.getCellFormatter().setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel horizontalPanel_2 = new HorizontalPanel(); horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_2.setSpacing(5); horizontalPanel_2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); flexTable.setWidget(5, 0, horizontalPanel_2); Label lblRedditThread = new Label("Reddit Thread:"); horizontalPanel_2.add(lblRedditThread); Anchor anchor = new Anchor("New label"); anchor.setTarget("_blank"); anchor.setText("http://redd.it/2jiynj"); anchor.setHref("http://redd.it/2jiynj"); horizontalPanel_2.add(anchor); flexTable.getCellFormatter().setHorizontalAlignment(5, 0, HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel horizontalPanel_3 = new HorizontalPanel(); horizontalPanel_3.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_3.setSpacing(5); horizontalPanel_3.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); flexTable.setWidget(6, 0, horizontalPanel_3); Label lblBlizzardThread = new Label("Blizzard Thread:"); horizontalPanel_3.add(lblBlizzardThread); Anchor anchor_2 = new Anchor("New label"); anchor_2.setText("http://us.battle.net/d3/en/forum/topic/18706673688"); anchor_2.setTarget("_blank"); anchor_2.setHref("http://us.battle.net/d3/en/forum/topic/18706673688"); horizontalPanel_3.add(anchor_2); flexTable.getCellFormatter().setHorizontalAlignment(6, 0, HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel horizontalPanel_4 = new HorizontalPanel(); horizontalPanel_4.setSpacing(5); horizontalPanel_4.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); flexTable.setWidget(7, 0, horizontalPanel_4); Anchor anchor_3 = new Anchor("New label"); anchor_3.setText("Change Log"); anchor_3.setTarget("_blank"); anchor_3.setHref("changeLog.txt?v2"); horizontalPanel_4.add(anchor_3); Anchor anchor_4 = new Anchor("New label"); anchor_4.setText("To-do List"); anchor_4.setTarget("_blank"); anchor_4.setHref("https://github.com/dawg6/dhcalc/issues"); horizontalPanel_4.add(anchor_4); flexTable.getCellFormatter().setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_CENTER); Anchor anchor_5 = new Anchor("Source Code"); anchor_5.setTarget("_blank"); anchor_5.setHref("https://github.com/dawg6/dhcalc"); horizontalPanel_4.add(anchor_5); flexTable.getCellFormatter().setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_CENTER); }
From source file:com.dawg6.web.dhcalc.client.BPData.java
License:Open Source License
public BPData() { VerticalPanel panel = new VerticalPanel(); initWidget(panel);/*from w w w . j a v a2 s . c om*/ HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setSpacing(5); panel.add(horizontalPanel); Label lblNewLabel = new Label("Skill:"); lblNewLabel.setStyleName("boldText"); horizontalPanel.add(lblNewLabel); skills = new ListBox(); horizontalPanel.add(skills); Label lblNewLabel2 = new Label("Weapon Type:"); lblNewLabel2.setStyleName("boldText"); horizontalPanel.add(lblNewLabel2); weaponType = new ListBox(); horizontalPanel.add(weaponType); for (WeaponType t : WeaponType.values()) { weaponType.addItem(t.getName(), t.name()); } CaptionPanel cptnpnlNewPanel = new CaptionPanel("Skill Break Point Data"); panel.add(cptnpnlNewPanel); table = new FlexTable(); cptnpnlNewPanel.setContentWidget(table); table.setSize("5cm", "3cm"); table.setStyleName("breakpointTable"); table.setCellPadding(5); table.setBorderWidth(1); table.getRowFormatter().addStyleName(0, "headerRow"); int col = 0; Label bp = new Label("BP"); bp.setWordWrap(false); table.setWidget(0, col++, bp); Label fpa = new Label("FPA"); fpa.setWordWrap(false); table.setWidget(0, col++, fpa); Label minAps = new Label("Min APS"); minAps.setWordWrap(false); table.setWidget(0, col++, minAps); Label actualAps = new Label("Actual APS"); actualAps.setWordWrap(false); table.setWidget(0, col++, actualAps); List<Pair<String, String>> list = new Vector<Pair<String, String>>(); for (ActiveSkill s : ActiveSkill.values()) { if (DamageFunction.hasDamage(s) && (s.getFrames() != 0)) list.add(new Pair<String, String>(s.getLongName(), s.name())); } Collections.sort(list, new Comparator<Pair<String, String>>() { @Override public int compare(Pair<String, String> o1, Pair<String, String> o2) { return o1.getA().toLowerCase().compareTo(o2.getA().toLowerCase()); } }); for (Pair<String, String> p : list) { skills.addItem(p.getA(), p.getB()); } skills.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { skillChanged(); } }); weaponType.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { skillChanged(); } }); skills.setSelectedIndex(0); weaponType.setSelectedIndex(0); skillChanged(); }
From source file:com.dawg6.web.dhcalc.client.BPData.java
License:Open Source License
private void addLabel(int row, int col, String text, String... styles) { Label label = new Label(text); label.setWordWrap(false);/*from w ww.j a va2 s .co m*/ if (styles != null) for (String s : styles) label.addStyleName(s); table.setWidget(row, col, label); }
From source file:com.dawg6.web.dhcalc.client.BuffPanel.java
License:Open Source License
public BuffPanel() { CaptionPanel cptnpnlNewPanel = new CaptionPanel("Follower Buffs"); initWidget(cptnpnlNewPanel);/*from ww w. j a v a2 s. co m*/ FlexTable flexTable = new FlexTable(); cptnpnlNewPanel.setContentWidget(flexTable); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setSpacing(5); flexTable.setWidget(0, 0, horizontalPanel); Label lblNewLabel = new Label("Enchantress"); horizontalPanel.add(lblNewLabel); Anchor anchor = new Anchor("Focused Mind:"); anchor.setTarget("_blank"); anchor.setHref("http://us.battle.net/d3/en/follower/enchantress/skill/focused-mind"); horizontalPanel.add(anchor); Label lblNewLabel_1 = new Label((String) null); horizontalPanel.add(lblNewLabel_1); focusedMind = new SimpleCheckBox(); flexTable.setWidget(0, 1, focusedMind); HorizontalPanel horizontalPanel_1 = new HorizontalPanel(); horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_1.setSpacing(5); flexTable.setWidget(1, 0, horizontalPanel_1); Label lblScoundrel = new Label("Scoundrel"); horizontalPanel_1.add(lblScoundrel); Anchor anchor_1 = new Anchor("Anatomy:"); anchor_1.setTarget("_blank"); anchor_1.setHref("http://us.battle.net/d3/en/follower/scoundrel/skill/anatomy"); horizontalPanel_1.add(anchor_1); anatomy = new SimpleCheckBox(); flexTable.setWidget(1, 1, anatomy); HorizontalPanel horizontalPanel_2 = new HorizontalPanel(); horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_2.setSpacing(5); flexTable.setWidget(2, 0, horizontalPanel_2); Label label = new Label("Scoundrel"); horizontalPanel_2.add(label); Anchor anchor_2 = new Anchor("Hysteria:"); anchor_2.setTarget("_blank"); anchor_2.setHref("http://us.battle.net/d3/en/follower/scoundrel/skill/hysteria"); horizontalPanel_2.add(anchor_2); hysteria = new SimpleCheckBox(); flexTable.setWidget(2, 1, hysteria); HorizontalPanel horizontalPanel_3 = new HorizontalPanel(); horizontalPanel_3.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_3.setSpacing(5); flexTable.setWidget(3, 0, horizontalPanel_3); Label lblTemplar = new Label("Templar"); horizontalPanel_3.add(lblTemplar); Anchor anchor_3 = new Anchor("Hysteria:"); anchor_3.setHTML("Inspire:"); anchor_3.setText("Inspire:"); anchor_3.setTarget("_blank"); anchor_3.setHref("http://us.battle.net/d3/en/follower/templar/skill/inspire"); horizontalPanel_3.add(anchor_3); inspire = new SimpleCheckBox(); flexTable.setWidget(3, 1, inspire); }
From source file:com.dawg6.web.dhcalc.client.CDRPanel.java
License:Open Source License
public CDRPanel() { CaptionPanel cptnpnlCooldownReduction = new CaptionPanel("Cooldown Reduction"); initWidget(cptnpnlCooldownReduction); flexTable = new FlexTable(); flexTable.setCellPadding(2);//from w ww . j a va 2s .c om cptnpnlCooldownReduction.setContentWidget(flexTable); Label lblNewLabel = new Label("Helm (Diamond):"); lblNewLabel.setStyleName("boldText"); lblNewLabel.setWordWrap(false); flexTable.setWidget(0, 0, lblNewLabel); diamond = new ListBox(); flexTable.setWidget(0, 2, diamond); HorizontalPanel row = new HorizontalPanel(); row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); row.setSpacing(5); flexTable.setWidget(1, 0, row); Label lblShoulders = new Label("Shoulders (%):"); lblShoulders.setWordWrap(false); lblShoulders.setStyleName("boldText"); flexTable.setWidget(2, 0, lblShoulders); shoulders = new NumberSpinner(); shoulders.setVisibleLength(4); flexTable.setWidget(2, 2, shoulders); Label lblGloves = new Label("Gloves (%):"); lblGloves.setWordWrap(false); lblGloves.setStyleName("boldText"); flexTable.setWidget(3, 0, lblGloves); gloves = new NumberSpinner(); gloves.setVisibleLength(4); flexTable.setWidget(3, 2, gloves); Label lblAmulet = new Label("Amulet (%):"); lblAmulet.setWordWrap(false); lblAmulet.setStyleName("boldText"); flexTable.setWidget(4, 0, lblAmulet); amulet = new NumberSpinner(); amulet.setVisibleLength(4); flexTable.setWidget(4, 2, amulet); Label lblRing = new Label("Ring 1 (%):"); lblRing.setWordWrap(false); lblRing.setStyleName("boldText"); flexTable.setWidget(5, 0, lblRing); ring1 = new NumberSpinner(); ring1.setVisibleLength(4); flexTable.setWidget(5, 2, ring1); Label lblRing_1 = new Label("Ring 2 (%):"); lblRing_1.setWordWrap(false); lblRing_1.setStyleName("boldText"); flexTable.setWidget(6, 0, lblRing_1); ring2 = new NumberSpinner(); ring2.setVisibleLength(4); flexTable.setWidget(6, 2, ring2); Label lblBelt = new Label("Belt (%):"); lblBelt.setWordWrap(false); lblBelt.setStyleName("boldText"); flexTable.setWidget(7, 0, lblBelt); belt = new NumberSpinner(); belt.setVisibleLength(4); flexTable.setWidget(7, 2, belt); Label lblWeapon = new Label("Main Hand (%):"); lblWeapon.setWordWrap(false); lblWeapon.setStyleName("boldText"); flexTable.setWidget(8, 0, lblWeapon); weapon = new NumberSpinner(); weapon.setVisibleLength(4); flexTable.setWidget(8, 2, weapon); Label lblQuiver = new Label("Off Hand (%):"); lblQuiver.setWordWrap(false); lblQuiver.setStyleName("boldText"); flexTable.setWidget(9, 0, lblQuiver); quiver = new NumberSpinner(); quiver.setVisibleLength(4); flexTable.setWidget(9, 2, quiver); for (GemLevel l : GemLevel.values()) { this.diamond.addItem(l.getDisplayName(), l.name()); } diamond.setSelectedIndex(0); this.shoulders.setMax(8); this.gloves.setMax(8); this.ring1.setMax(8); this.ring2.setMax(8); this.belt.setMax(8); this.weapon.setMax(10); this.quiver.setMax(10); this.amulet.setMax(8); Label l10 = new Label("Effective CDR:"); l10.addStyleName("boldText"); l10.setWordWrap(false); flexTable.setWidget(10, 0, l10); this.effCDR = new Label("0.0%"); this.effCDR.addStyleName("boldText"); flexTable.setWidget(10, 2, effCDR); this.skills = new TreeMap<ActiveSkill, Rune>(); this.items = new TreeMap<Slot, ItemHolder>(); this.cdr = 0.0; updateSkills(); }
From source file:com.dawg6.web.dhcalc.client.CDRPanel.java
License:Open Source License
private void updateSkills() { while (flexTable.getRowCount() > this.skillRow) { flexTable.removeRow(this.skillRow); }/* ww w . ja v a 2s. c o m*/ int row = skillRow; for (Map.Entry<ActiveSkill, Rune> e : skills.entrySet()) { ActiveSkill skill = e.getKey(); Rune rune = e.getValue(); if ((skill == ActiveSkill.Companion) && (rune != Rune.Wolf) && (this.getSetCount(ItemSet.Marauders.getSlug()) >= 2)) rune = Rune.Wolf; double cd = skill.getCooldown(rune); if (cd > 0) { double duration = skill.getDuration(rune); Anchor a = new Anchor(skill.getLongName() + "/" + rune.getLongName()); a.setHref(skill.getUrl(rune)); flexTable.setWidget(row, 0, a); cd = cd * (1.0 - this.cdr); if ((skill == ActiveSkill.Vengeance) && this.isItem(SpecialItemType.Dawn)) { double d = this.getItemAttribute(SpecialItemType.Dawn, SpecialItemType.PERCENT); cd = cd * (1.0 - d); } double uptime; if (cd <= duration) uptime = 1.0; else uptime = duration / cd; Label l = new Label("Cooldown " + Util.format(Math.round(cd * 100.0) / 100.0) + "s"); flexTable.setWidget(row, 2, l); Label l2 = new Label("Uptime " + Util.format(Math.round(uptime * 10000.0) / 100.0) + "%"); flexTable.setWidget(row, 3, l2); row++; } } }