List of usage examples for com.google.gwt.user.client.ui Label Label
public Label()
From source file:ch.heftix.mailxel.client.MailOverviewCellTable.java
License:Open Source License
/** * create a label. Shorten text for normal display and unshortened text for * setTitle, i.e. mouse-over tool-tip./*from www .j a v a 2 s. c o m*/ * * @param shortenTo * avoid shortening if <0 */ public Label createLabel(final String text, final int shortenTo) { Label label = new Label(); if (shortenTo >= 0 && null != text && text.length() > shortenTo) { label.setText(UIUtil.shorten(text, shortenTo, "..")); label.setTitle(text); } else { label.setText(text); } return label; }
From source file:ch.heftix.mailxel.client.MailOverviewCellTable.java
License:Open Source License
/** * create a label, display date, add time as tool tip *///from w w w .j av a2 s. c om public Label dateTimeLabel(final String date, final String time) { Label label = new Label(); label.setText(date); label.setTitle(time); return label; }
From source file:cl.uai.client.rubric.RubricPanel.java
License:Open Source License
/** * Creates the rubric panel/*from w w w. ja v a 2 s .c om*/ */ public RubricPanel(boolean isPopup) { this.popupInterface = isPopup; mainPanel = new VerticalPanel(); mainPanel.addStyleName(Resources.INSTANCE.css().rubricpanel()); // Adds the title rubricTitle = new Label(); rubricTitle.addStyleName(Resources.INSTANCE.css().rubrictitle()); // Adds the checkbox rubricFilter = new ListBox(); rubricFilter.addItem(MarkingInterface.messages.ShowAll(), "all"); rubricFilter.addItem(MarkingInterface.messages.ShowMarkingPending(), "unmarked"); rubricFilter.addItem(MarkingInterface.messages.ShowRegradePending(), "regrade"); // rubricFilter.addItem(MarkingInterface.messages.HideRubric(), "hide"); rubricFilter.addStyleName(Resources.INSTANCE.css().rubricfilterselect()); rubricFilter.setSelectedIndex(0); String cookieFilter = Cookies.getCookie("emarking_rubricfilter"); if (cookieFilter != null) { if (cookieFilter.equals("unmarked")) { rubricFilter.setSelectedIndex(1); } else if (cookieFilter.equals("regrade")) { rubricFilter.setSelectedIndex(2); } } rubricFilter.addChangeHandler(new RubricFilterListBoxValueChangeHandler()); // An horizontal panel holds title and checkbox hpanelTitle = new HorizontalPanel(); hpanelTitle.addStyleName(Resources.INSTANCE.css().rubrictitlepanel()); hpanelTitle.add(rubricTitle); hpanelTitle.setCellHorizontalAlignment(rubricTitle, HasHorizontalAlignment.ALIGN_LEFT); hpanelTitle.add(rubricFilter); hpanelTitle.setCellHorizontalAlignment(rubricFilter, HasHorizontalAlignment.ALIGN_RIGHT); hpanelTitle.setCellVerticalAlignment(rubricFilter, HasVerticalAlignment.ALIGN_MIDDLE); mainPanel.add(hpanelTitle); generalFeedbackInterface = new GeneralFeedbackInterface(); // Adds the scroll panel containing the rubric table rubricTable = new VerticalPanel(); rubricTable.addStyleName(Resources.INSTANCE.css().rubrictable()); scrollRubric = new ScrollPanel(); if (isPopupInterface()) { scrollRubric.add(rubricTable); mainPanel.add(scrollRubric); } else { mainPanel.add(rubricTable); } initWidget(mainPanel); }
From source file:cl.uai.client.toolbar.buttons.MarkingButtons.java
License:Open Source License
private void loadButtonsFromConfiguration() { // Initialize the array buttons = new ArrayList<EmarkingToggleButton>(); buttonsStats = new HashMap<Integer, Label>(); // Creates all buttons and adds a general value change handler // First creates all buttonstats as they have to be referenced by buttons for (EmarkingToggleButton button : availableButtons.values()) { if (EMarkingConfiguration.getMarkingButtonsEnabled().contains(button.getFormat())) { Label lblstat = new Label(); lblstat.addStyleName(Resources.INSTANCE.css().rubricbuttonjewel()); buttonsStats.put(button.getFormat(), lblstat); addToggleButton(button);/*from w ww .jav a2 s.co m*/ } } if (EMarkingConfiguration.getMarkingType() == EMarkingConfiguration.EMARKING_TYPE_PRINT_SCAN) { selectedIndex = 1; buttons.get(0).setEnabled(false); } if (buttons.size() > selectedIndex) { buttons.get(selectedIndex).setValue(true); buttons.get(selectedIndex).setDown(true); } }
From source file:cl.uai.client.toolbar.buttons.MarkingButtons.java
License:Open Source License
/** * Loads a set of custom buttoms based on a newline separated string * in which each line defines a button in another string which is also * separated by a hash #/*from ww w . j a va2 s. c om*/ * @param customMarks */ private void loadCustomMarksButtons(String customMarks) { // If no info just return if (customMarks == null || customMarks.trim().length() == 0 || customButtonIndex.keySet().size() > 0) return; // Split by newline to get each button String[] lines = customMarks.replaceAll("\r\n", "\n").split("\n"); String customButtons = ""; String customButtonsTitles = ""; for (int i = 0; i < lines.length; i++) { // Separate mark fro title by hash String[] lineparts = lines[i].split("#"); if (lineparts.length != 2) continue; customButtons += lineparts[0] + ","; customButtonsTitles += lineparts[1] + ","; } String[] partsButtonLabels = customButtons.split(","); String[] partsButtonTitles = customButtonsTitles.split(","); if (partsButtonLabels.length != partsButtonTitles.length) { logger.severe("Invalid parameters loading custom buttons"); return; } for (int j = 0; j < partsButtonLabels.length; j++) { if (partsButtonLabels[j].trim().length() > 0) { int currentButtonIndex = 1000 + j; Label lblstat = buttonsStats.get(currentButtonIndex); if (lblstat == null) { lblstat = new Label(); lblstat.addStyleName(Resources.INSTANCE.css().rubricbuttonjewel()); buttonsStats.put(currentButtonIndex, lblstat); } EmarkingToggleButton btn = new EmarkingToggleButton(currentButtonIndex, ButtonFormat.BUTTON_CUSTOM, partsButtonLabels[j], partsButtonTitles[j]); addToggleButton(btn); customButtonIndex.put(partsButtonLabels[j] + ": " + partsButtonTitles[j], currentButtonIndex); } } }
From source file:client.argon.page.ArgonEndpointCreatePage.java
License:Open Source License
private final Widget getEditPanel() { final VerticalPanel outerPanel = new VerticalPanel(); final FlexTable table = new FlexTable(); outerPanel.setSpacing(5);/*from www. j a v a 2s. co m*/ final Label labelSource = new Label(); labelSource.setText("SourceNode: "); table.setWidget(0, 0, labelSource); table.setWidget(0, 1, this.sourceNode); final Label labelDestination = new Label(); labelDestination.setText("DestinationNode: "); table.setWidget(1, 0, labelDestination); table.setWidget(1, 1, this.destinationNode); final Label labelOutgoing = new Label(); labelOutgoing.setText("Outgoing Interface: "); table.setWidget(2, 0, labelOutgoing); table.setWidget(2, 1, this.outgoingInterface); final Label labelIngoing = new Label(); labelIngoing.setText("Ingoing Interface: "); table.setWidget(3, 0, labelIngoing); table.setWidget(3, 1, this.ingoingInterface); final Label labelBw = new Label(); labelBw.setText("Bandwidth: "); this.bandwidth.setText("0"); table.setWidget(4, 0, labelBw); table.setWidget(4, 1, this.bandwidth); final Label labelValidFrom = new Label(); labelValidFrom.setText("Valid From: "); table.setWidget(5, 0, labelValidFrom); this.validFrom.setText(this.dateTimeFormat.format(new Date())); table.setWidget(5, 1, this.validFrom); final Label labelValidTo = new Label(); labelValidTo.setText("Valid To: "); this.validTo.setText(this.dateTimeFormat.format(new Date())); table.setWidget(6, 0, labelValidTo); table.setWidget(6, 1, this.validTo); final Label labelLinkUp = new Label(); labelLinkUp.setText("Link Up: "); table.setWidget(7, 0, labelLinkUp); this.linkUp.addItem("true"); this.linkUp.addItem("false"); table.setWidget(7, 1, this.linkUp); final Label labelDelay = new Label(); labelDelay.setText("Delay: "); this.delay.setText("0"); table.setWidget(8, 0, labelDelay); table.setWidget(8, 1, this.delay); this.button.addClickListener(this); this.button.setText("Create"); table.setWidget(9, 0, this.button); table.setWidget(9, 1, this.activity); // table.getFlexCellFormatter().setColSpan(3, 1, 3); return table; }
From source file:client.argon.page.ArgonRouterCreatePage.java
License:Open Source License
private final Widget getEditPanel() { final VerticalPanel outerPanel = new VerticalPanel(); final FlexTable table = new FlexTable(); outerPanel.setSpacing(5);/*w ww .j av a 2s.c om*/ final Label labelLoopB = new Label(); labelLoopB.setText("LoopBack: "); table.setWidget(0, 0, labelLoopB); table.setWidget(0, 1, this.loopBackAd); // final Label labelConfig = new Label(); labelConfig.setText("Configuration: "); table.setWidget(1, 0, labelConfig); table.setWidget(1, 1, this.configAd); // final Label labelType = new Label(); labelType.setText("Type: "); table.setWidget(2, 0, labelType); table.setWidget(2, 1, this.type); this.button.addClickListener(this); this.button.setText("Create"); table.setWidget(3, 0, this.button); table.setWidget(3, 1, this.activity); // table.getFlexCellFormatter().setColSpan(3, 1, 3); return table; }
From source file:client.reservation.panel.NspFixedReservationCreatePanel.java
License:Open Source License
/** * /*from w w w. j ava2 s .c om*/ */ public NspFixedReservationCreatePanel(final String epr) { super(epr); final Label labelStart = new Label(); labelStart.setText("Start: "); this.start.setText(this.dateTimeFormat.format(new Date())); this.table.setWidget(2, 0, labelStart); this.table.setWidget(2, 1, this.start); final Label labelDuration = new Label(); labelDuration.setText("Duration: "); this.duration.setText(800 + ""); this.table.setWidget(2, 2, labelDuration); this.table.setWidget(2, 3, this.duration); }
From source file:client.reservation.panel.NspMalleableReservationCreatePanel.java
License:Open Source License
public NspMalleableReservationCreatePanel(final String epr) { super(epr);// w w w . j a v a 2s . co m final Label labelStart = new Label(); labelStart.setText("Start: "); this.start.setText(this.dateTimeFormat.format(new Date())); this.table.setWidget(2, 0, labelStart); this.table.setWidget(2, 1, this.start); final Label labelDuration = new Label(); labelDuration.setText("Deadline: "); this.table.setWidget(2, 2, labelDuration); this.table.setWidget(2, 3, this.deadline); final Label labelAmount = new Label(); labelAmount.setText("Amount: "); this.table.setWidget(2, 4, labelAmount); this.table.setWidget(2, 5, this.amount); }
From source file:client.reservation.panel.NspReservationCreatePanel.java
License:Open Source License
/** * //w ww. j a v a2 s . co m */ public NspReservationCreatePanel(final String epr) { this.add(this.table); this.epr = epr; this.activity.setVisible(false); final Label labelSrc = new Label(); labelSrc.setText("Src: "); this.table.setWidget(0, 0, labelSrc); this.table.setWidget(0, 1, this.src); final Label labelDst = new Label(); labelDst.setText("Dst: "); this.table.setWidget(0, 2, labelDst); this.table.setWidget(0, 3, this.dst); final HorizontalPanel buttonPanel = new HorizontalPanel(); this.button.addClickListener(this.getClickListener()); this.button.setText("Create"); buttonPanel.add(this.button); buttonPanel.add(this.activity); final Label labelBw = new Label(); labelBw.setText("minBW: "); this.minBW.setText(800 + ""); this.table.setWidget(1, 0, labelBw); this.table.setWidget(1, 1, this.minBW); final Label labelMaxBw = new Label(); labelMaxBw.setText("maxBW (leave 0 for unset): "); this.maxBW.setText(800 + ""); this.table.setWidget(1, 2, labelMaxBw); this.table.setWidget(1, 3, this.maxBW); final Label labelDelay = new Label(); labelDelay.setText("Delay: "); this.delay.setText(8000 + ""); this.table.setWidget(1, 4, labelDelay); this.table.setWidget(1, 5, this.delay); this.add(buttonPanel); }