List of usage examples for com.vaadin.ui TextArea getValue
@Override
public String getValue()
From source file:edu.kit.dama.ui.admin.utils.UIComponentTools.java
License:Apache License
/** * * @param area/*w w w . j a va2 s. com*/ * @return */ public static boolean isEmpty(TextArea area) { return area.getValue().trim().isEmpty(); }
From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper.java
License:Open Source License
private void _postGameEvent(String title, final GameEvent.EventType typ, String buttName, boolean doWarning, MenuBar mbar) {// w ww .j a v a 2 s. c om // Create the window... final Window bcastWindow = new Window(title); bcastWindow.setModal(true); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setWidth("99%"); bcastWindow.setContent(layout); layout.addComponent(new Label("Compose message (255 char limit):")); final TextArea ta = new TextArea(); ta.setRows(5); ta.setWidth("99%"); layout.addComponent(ta); HorizontalLayout buttHl = new HorizontalLayout(); final Button bcancelButt = new Button("Cancel"); buttHl.addComponent(bcancelButt); Button bokButt = new Button(buttName); bokButt.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); buttHl.addComponent(bokButt); layout.addComponent(buttHl); layout.setComponentAlignment(buttHl, Alignment.TOP_RIGHT); if (doWarning) layout.addComponent(new Label("Use with great deliberation!")); bcastWindow.setWidth("320px"); UI.getCurrent().addWindow(bcastWindow); bcastWindow.setPositionX(0); bcastWindow.setPositionY(0); ta.focus(); @SuppressWarnings("serial") ClickListener lis = new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { if (event.getButton() == bcancelButt) ; // nothin else { // This check is now done in GameEvent.java, but should ideally prompt the user. String msg = ta.getValue().toString().trim(); if (msg.length() > 0) { HSess.init(); if (msg.length() > 255) // clamp to 255 to avoid db exception msg = msg.substring(0, 254); User u = Mmowgli2UI.getGlobals().getUserTL(); if (typ == GameEvent.EventType.GAMEMASTERNOTE) GameEventLogger.logGameMasterCommentTL(msg, u); else GameEventLogger.logGameMasterBroadcastTL(typ, msg, u); HSess.close(); } } bcastWindow.close(); } }; bcancelButt.addClickListener(lis); bokButt.addClickListener(lis); }
From source file:edu.nps.moves.mmowgli.export.BaseExporter.java
License:Open Source License
protected void getMetaStringOrCancel(final MetaListener lis, String title, final Map<String, String> params) { final Window dialog = new Window(title); final TextField[] parameterFields; dialog.setModal(true);/*w ww .j a va 2s .c o m*/ VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); dialog.setContent(layout); final TextArea ta = new TextArea(); ta.setWidth("100%"); ta.setInputPrompt("Type a description of this data, or the game which generated this data (optional)"); ta.setImmediate(true); layout.addComponent(ta); Set<String> keySet = params.keySet(); parameterFields = new TextField[keySet.size()]; int i = 0; GridLayout pGL = new GridLayout(); pGL.addStyleName("m-greyborder"); pGL.setColumns(2); Label hdr = new HtmlLabel("<b>Parameters</b>"); hdr.addStyleName("m-textaligncenter"); pGL.addComponent(hdr, 0, 0, 1, 0); // top row pGL.setComponentAlignment(hdr, Alignment.MIDDLE_CENTER); pGL.setSpacing(false); for (String key : keySet) { pGL.addComponent(new HtmlLabel(" " + key + " ")); pGL.addComponent(parameterFields[i] = new TextField()); parameterFields[i++].setValue(params.get(key)); } if (i > 0) { layout.addComponent(pGL); layout.setComponentAlignment(pGL, Alignment.TOP_CENTER); } HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); @SuppressWarnings("serial") Button cancelButt = new Button("Cancel", new Button.ClickListener() { public void buttonClick(ClickEvent event) { dialog.close(); lis.continueOrCancel(null); } }); @SuppressWarnings("serial") Button exportButt = new Button("Export", new Button.ClickListener() { public void buttonClick(ClickEvent event) { dialog.close(); Set<String> keySet = params.keySet(); int i = 0; for (String key : keySet) params.put(key, parameterFields[i++].getValue().toString()); lis.continueOrCancel(ta.getValue().toString()); } }); hl.addComponent(cancelButt); hl.addComponent(exportButt); hl.setComponentAlignment(cancelButt, Alignment.MIDDLE_RIGHT); hl.setExpandRatio(cancelButt, 1.0f); // The components added to the window are actually added to the window's // layout; you can use either. Alignments are set using the layout layout.addComponent(hl); dialog.setWidth("385px"); dialog.setHeight("310px"); hl.setWidth("100%"); ta.setWidth("100%"); ta.setHeight("100%"); layout.setExpandRatio(ta, 1.0f); UI.getCurrent().addWindow(dialog); }
From source file:edu.nps.moves.mmowgli.MmowgliMessageBroadcaster.java
License:Open Source License
private static void _postGameEvent(String title, final GameEvent.EventType typ, String buttName, boolean doWarning) { // Create the window... final Window bcastWindow = new Window(title); bcastWindow.setModal(true);//from ww w . j av a 2s . com VerticalLayout layout = new VerticalLayout(); bcastWindow.setContent(layout); layout.setMargin(true); layout.setSpacing(true); layout.setWidth("99%"); layout.addComponent(new Label("Compose message (255 char limit):")); final TextArea ta = new TextArea(); ta.setRows(5); ta.setWidth("99%"); layout.addComponent(ta); HorizontalLayout buttHl = new HorizontalLayout(); final Button bcancelButt = new Button("Cancel"); buttHl.addComponent(bcancelButt); Button bokButt = new Button(buttName); buttHl.addComponent(bokButt); layout.addComponent(buttHl); layout.setComponentAlignment(buttHl, Alignment.TOP_RIGHT); if (doWarning) layout.addComponent(new Label("Use with great deliberation!")); bcastWindow.setWidth("320px"); UI.getCurrent().addWindow(bcastWindow); bcastWindow.setPositionX(0); bcastWindow.setPositionY(0); ta.focus(); @SuppressWarnings("serial") ClickListener lis = new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed @HibernateUserRead public void buttonClick(ClickEvent event) { if (event.getButton() == bcancelButt) ; // nothin else { // This check is now done in GameEvent.java, but should ideally prompt the user. HSess.init(); String msg = ta.getValue().toString().trim(); if (msg.length() > 0) { if (msg.length() > 255) // clamp to 255 to avoid db exception msg = msg.substring(0, 254); Serializable uid = Mmowgli2UI.getGlobals().getUserID(); User u = User.getTL(uid); if (typ == GameEvent.EventType.GAMEMASTERNOTE) GameEventLogger.logGameMasterCommentTL(msg, u); else GameEventLogger.logGameMasterBroadcastTL(typ, msg, u); // GameEvent.save(new GameEvent(typ,msg)); HSess.close(); } } bcastWindow.close(); } }; bcancelButt.addClickListener(lis); bokButt.addClickListener(lis); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.HelpWantedDialog.java
License:Open Source License
@SuppressWarnings("serial") @HibernateSessionThreadLocalConstructor/* w ww . j a v a 2 s. c o m*/ public HelpWantedDialog(final Object aplnId, boolean interested) { setCaption(interested ? "Express Interest in Action Plan" : "Offer Assistance with Action Plan"); setModal(true); setSizeUndefined(); setWidth("500px"); setHeight("550px"); VerticalLayout vLay = new VerticalLayout(); setContent(vLay); vLay.setMargin(true); vLay.setSpacing(true); vLay.setSizeFull(); StringBuilder sb = new StringBuilder(); ActionPlan ap = ActionPlan.getTL(aplnId); String s = ap.getHelpWanted(); if (s != null) { vLay.addComponent(new Label(msg1)); Label helpWantedLab = new Label(s); helpWantedLab.addStyleName("m-helpWantedLabel"); helpWantedLab.setWidth("100%"); vLay.addComponent(helpWantedLab); } vLay.addComponent(new Label(msg2)); final TextArea toTA = new TextArea("To"); toTA.addStyleName("m-textareaboldcaption"); toTA.setWidth("100%"); toTA.setRows(1); toTA.setNullRepresentation(""); toTA.setValue(getAuthors(sb, ap)); vLay.addComponent(toTA); final TextArea ccTA = new TextArea("CC"); ccTA.addStyleName("m-textareaboldcaption"); ccTA.setWidth("100%"); ccTA.setRows(1); ccTA.setNullRepresentation(""); PagesData pd = new PagesData(); ccTA.setValue(pd.gettroubleMailto()); vLay.addComponent(ccTA); final TextArea subjTA = new TextArea("Subject"); subjTA.addStyleName("m-textareaboldcaption"); subjTA.setWidth("100%"); subjTA.setRows(2); subjTA.setNullRepresentation(""); sb.setLength(0); sb.append("My interest in Action Plan "); sb.append(ap.getId()); sb.append(", \""); sb.append(ap.getTitle()); sb.append('"'); subjTA.setValue(sb.toString()); vLay.addComponent(subjTA); final TextArea msgTA = new TextArea("Message"); msgTA.addStyleName("m-textareaboldcaption"); msgTA.setWidth("100%"); msgTA.setHeight("100%"); msgTA.setNullRepresentation(""); vLay.addComponent(msgTA); vLay.setExpandRatio(msgTA, 1.0f); HorizontalLayout buttLay = new HorizontalLayout(); vLay.addComponent(buttLay); buttLay.setSpacing(true); buttLay.setWidth("100%"); Label sp; buttLay.addComponent(sp = new Label()); sp.setHeight("1px"); buttLay.setExpandRatio(sp, 1.0f); Button canButt = new Button("Cancel"); buttLay.addComponent(canButt); Button sendButt = new Button("Send to authors"); buttLay.addComponent(sendButt); canButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(HelpWantedDialog.this); } }); sendButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { Object tos = toTA.getValue(); if (tos == null || tos.toString().length() <= 0) { Notification.show("No recipients", Notification.Type.ERROR_MESSAGE); return; } Object cc = ccTA.getValue(); if (cc == null || cc.toString().length() <= 0) cc = null; Object msg = msgTA.getValue(); if (msg == null || msg.toString().length() <= 0) { Notification.show("No Message", Notification.Type.ERROR_MESSAGE); return; } Object subj = subjTA.getValue(); if (subj == null) subj = ""; HSess.init(); List<User> authors = parseAuthorsTL(tos.toString().trim()); MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); MailManager mmgr = AppMaster.instance().getMailManager(); User me = globs.getUserTL(); for (User u : authors) { mmgr.mailToUserTL(me.getId(), u.getId(), subj.toString(), msg.toString()); } if (cc == null) mmgr.mailToUserTL(me.getId(), me.getId(), "(CC:)" + subj.toString(), msg.toString()); else mmgr.mailToUserTL(me.getId(), me.getId(), subj.toString(), msg.toString(), cc.toString(), MailManager.Channel.BOTH); // the cc is an email, not a user name UI.getCurrent().removeWindow(HelpWantedDialog.this); Notification.show("Message(s) sent", Notification.Type.HUMANIZED_MESSAGE); // fixed 21 Jan 2015 HSess.close(); } }); }
From source file:edu.nps.moves.mmowgli.modules.administration.VipListManager.java
License:Open Source License
private void showAddDialogOrCancel(final DoneListener lis) { dialog = new Window("Add to VIP list"); dialog.setModal(true);/*from w w w . j a v a 2 s. c o m*/ dialog.setWidth("400px"); dialog.setHeight("350px"); VerticalLayout layout = new VerticalLayout(); dialog.setContent(layout); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); List<String> rtypes = Arrays.asList(new String[] { EMAILTYPE, DOMAINTYPE }); radios = new OptionGroup("Select type", rtypes); radios.setNullSelectionAllowed(false); // user can not 'unselect' radios.select("Emails"); // select this by default radios.setImmediate(false); // don't send the change to the server at once layout.addComponent(radios); final TextArea ta = new TextArea(); //ta.setColumns(40); ta.setSizeFull(); ta.setInputPrompt( "Type or paste a tab-, comma- or space-separated list of emails or domains. For domains, " + "use forms such as \"army.mil\", \"nmci.navy.mil\", \"ucla.edu\", \"gov\", etc."); layout.addComponent(ta); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); @SuppressWarnings("serial") Button cancelButt = new Button("Cancel", new Button.ClickListener() { public void buttonClick(ClickEvent event) { dialog.close(); lis.continueOrCancel(null); } }); @SuppressWarnings("serial") Button addButt = new Button("Add", new Button.ClickListener() { public void buttonClick(ClickEvent event) { String[] returnArr = null; String result = ta.getValue().toString(); if (result == null || result.length() <= 0) returnArr = null; else if ((returnArr = parseIt(result)) == null) return; dialog.close(); lis.continueOrCancel(returnArr); } }); hl.addComponent(cancelButt); hl.addComponent(addButt); hl.setComponentAlignment(cancelButt, Alignment.MIDDLE_RIGHT); hl.setExpandRatio(cancelButt, 1.0f); // The components added to the window are actually added to the window's // layout; you can use either. Alignments are set using the layout layout.addComponent(hl); hl.setWidth("100%"); ta.setWidth("100%"); ta.setHeight("100%"); layout.setExpandRatio(ta, 1.0f); UI.getCurrent().addWindow(dialog); dialog.center(); }
From source file:facs.components.Settings.java
License:Open Source License
private void addNewDevice() { final Window subWindow = new Window("Add Device"); FormLayout form = new FormLayout(); form.setMargin(true);//ww w . ja v a2 s . c o m final TextField name = new TextField(); name.setImmediate(true); name.addValidator(new StringLengthValidator("The name must be 1-85 letters long (Was {0}).", 1, 85, true)); name.setCaption("Name of new device"); form.addComponent(name); final TextArea description = new TextArea(); description.setImmediate(true); description.addValidator( new StringLengthValidator("The name must be 1-255 letters long (Was {0}).", 1, 255, true)); description.setCaption("Description"); form.addComponent(description); final OptionGroup restricted = new OptionGroup("Is Device restricted by operators?"); restricted.addItem("yes"); restricted.setMultiSelect(true); form.addComponent(restricted); HorizontalLayout buttons = new HorizontalLayout(); Button save = new Button("save"); buttons.addComponent(save); Button discard = new Button("discard"); discard.setDescription("discarding will abort the process of adding a new device into the databse."); buttons.addComponent(discard); buttons.setSpacing(true); form.addComponent(buttons); subWindow.setContent(form); form.setMargin(true); form.setSpacing(true); buttons.setMargin(true); buttons.setSpacing(true); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setWidth("50%"); // Open it in the UI UI.getCurrent().addWindow(subWindow); discard.addClickListener(new ClickListener() { /** * */ private static final long serialVersionUID = -5808910314649620731L; @Override public void buttonClick(ClickEvent event) { subWindow.close(); } }); save.addClickListener(new ClickListener() { /** * */ private static final long serialVersionUID = 3748395242651585005L; @Override public void buttonClick(ClickEvent event) { if (name.isValid() && description.isValid()) { Set<String> restr = (Set<String>) restricted.getValue(); int deviceId = DBManager.getDatabaseInstance().addDevice(name.getValue(), description.getValue(), (restr.size() == 1)); DeviceBean bean = new DeviceBean(deviceId, name.getValue(), description.getValue(), (restr.size() == 1)); devicesGrid.addRow(bean); } else { Notification.show("Failed to add device to database."); } } }); // DeviceBean db = new DeviceBean(0, "Device 1","some description1", false); // TODO // add to database /* * boolean added = false;//DBManager.getDatabaseInstance().addDevice(db); //TODO test //add to * grid if(added){ devicesGrid.addRow(db); }else{ //TODO log failed operation * Notification.show("Failed to add device to database.", Type.ERROR_MESSAGE); } */ }
From source file:fi.semantum.strategia.Utils.java
License:Open Source License
public static void editTextAndId(final Main main, String title, final Base container) { final Database database = main.getDatabase(); final Window subwindow = new Window(title, new VerticalLayout()); subwindow.setModal(true);/*from www .jav a 2 s .c o m*/ subwindow.setWidth("400px"); subwindow.setHeight("500px"); subwindow.setResizable(false); VerticalLayout winLayout = (VerticalLayout) subwindow.getContent(); winLayout.setMargin(true); winLayout.setSpacing(true); final TextField tf = new TextField(); tf.setCaption("Lyhytnimi:"); tf.addStyleName(ValoTheme.TEXTFIELD_SMALL); tf.setValue(container.getId(database)); tf.setWidth("100%"); winLayout.addComponent(tf); final TextArea ta = new TextArea(); ta.setCaption("Teksti:"); ta.setValue(container.getText(database)); ta.setWidth("100%"); ta.setHeight("290px"); winLayout.addComponent(ta); Button save = new Button("Tallenna", new Button.ClickListener() { private static final long serialVersionUID = 6641880870005364983L; public void buttonClick(ClickEvent event) { String idValue = tf.getValue(); String value = ta.getValue(); main.removeWindow(subwindow); container.modifyId(main, idValue); container.modifyText(main, value); Collection<String> tags = Tag.extractTags(value); database.assertTags(tags); ArrayList<Tag> tagObjects = new ArrayList<Tag>(); for (String s : tags) tagObjects.add(database.getOrCreateTag(s)); container.assertRelatedTags(database, tagObjects); Updates.update(main, true); Property emails = Property.find(database, Property.EMAIL); String addr = emails.getPropertyValue(container); if (addr != null && !addr.isEmpty()) { String[] addrs = addr.split(","); if (addrs.length > 0) { try { Email.send(addrs, "Muutos strategiakartassa: " + container.getId(database), "Kyttj " + main.account.getId(database) + " on muuttanut strategiakarttaa.<br/><br/>Lyhytnimi: " + container.getId(database) + "<br/><br/>Teksti: " + container.getText(database)); } catch (MessagingException e) { e.printStackTrace(); } } } } }); Button discard = new Button("Peru muutokset", new Button.ClickListener() { private static final long serialVersionUID = -784522457615993823L; public void buttonClick(ClickEvent event) { Updates.update(main, true); main.removeWindow(subwindow); } }); HorizontalLayout hl2 = new HorizontalLayout(); hl2.setSpacing(true); hl2.addComponent(save); hl2.addComponent(discard); winLayout.addComponent(hl2); winLayout.setComponentAlignment(hl2, Alignment.MIDDLE_CENTER); main.addWindow(subwindow); ta.setCursorPosition(ta.getValue().length()); }
From source file:fi.semantum.strategia.widget.Indicator.java
License:Open Source License
public static void editIndicator(final Main main, final Base base, final Indicator indicator) { final Database database = main.getDatabase(); VerticalLayout content = new VerticalLayout(); content.setSizeFull();/* ww w. j a v a 2 s. c o m*/ content.setHeightUndefined(); content.setSpacing(true); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.setWidth("100%"); content.addComponent(hl); content.setExpandRatio(hl, 0.0f); final TextField tf = new TextField("Tunniste"); tf.setValue(indicator.getId(database)); tf.setWidth("100%"); tf.addStyleName(ValoTheme.TEXTFIELD_SMALL); hl.addComponent(tf); hl.setComponentAlignment(tf, Alignment.MIDDLE_CENTER); hl.setExpandRatio(tf, 2.0f); final TextField tf1 = new TextField("Teksti"); tf1.setValue(indicator.getText(database)); tf1.setWidth("100%"); tf1.addStyleName(ValoTheme.TEXTFIELD_SMALL); hl.addComponent(tf1); hl.setComponentAlignment(tf1, Alignment.MIDDLE_CENTER); hl.setExpandRatio(tf1, 2.0f); final TextField unit = makeUnit(database, hl, indicator); final TextField tf2 = new TextField(); tf2.setCaption("Voimassaolo"); tf2.setValue(Utils.getValidity(database, indicator)); tf2.addStyleName(ValoTheme.TEXTFIELD_TINY); tf2.setWidth("100%"); hl.addComponent(tf2); hl.setComponentAlignment(tf2, Alignment.MIDDLE_CENTER); hl.setExpandRatio(tf2, 1.0f); final TextArea ta = new TextArea("Mritys"); ta.setValue(indicator.getText(database)); ta.setWidth("100%"); ta.setHeight("100px"); content.addComponent(ta); content.setComponentAlignment(ta, Alignment.MIDDLE_CENTER); content.setExpandRatio(ta, 0.0f); final Label ta2 = makeHistory(database, indicator, main.getUIState().forecastMeters); content.addComponent(ta2); content.setComponentAlignment(ta2, Alignment.MIDDLE_CENTER); content.setExpandRatio(ta2, 1.0f); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setMargin(false); Button ok = new Button("Tallenna", new Button.ClickListener() { private static final long serialVersionUID = 1992235622970234624L; public void buttonClick(ClickEvent event) { indicator.modifyId(main, tf.getValue()); Utils.modifyValidity(main, indicator, tf2.getValue()); indicator.modifyText(main, tf1.getValue()); indicator.modifyDescription(main, ta.getValue()); if (unit != null) { indicator.modifyUnit(main, unit.getValue()); } Updates.update(main, true); manageIndicators(main, main.getUIState().currentItem); } }); buttons.addComponent(ok); Button close = new Button("Sulje"); buttons.addComponent(close); final Window dialog = Dialogs.makeDialog(main, "650px", "800px", "Muokkaa indikaattoria", null, content, buttons); close.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1992235622970234624L; public void buttonClick(ClickEvent event) { main.removeWindow(dialog); manageIndicators(main, main.getUIState().currentItem); } }); }
From source file:fi.semantum.strategia.widget.Meter.java
License:Open Source License
public static void editMeter(final Main main, final Base base, final Meter meter) { Database database = main.getDatabase(); final VerticalLayout content = new VerticalLayout(); content.setSizeFull();//from ww w. j ava 2 s . c o m content.setHeightUndefined(); content.setSpacing(true); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); hl.setSpacing(true); hl.setMargin(false); final TextField tf = new TextField(); tf.setCaption("Lyhytnimi"); tf.setValue(meter.getId(database)); tf.addStyleName(ValoTheme.TEXTFIELD_TINY); tf.setWidth("100%"); hl.addComponent(tf); hl.setComponentAlignment(tf, Alignment.TOP_CENTER); hl.setExpandRatio(tf, 1.0f); final TextField tf1 = new TextField(); tf1.setCaption("Teksti"); tf1.setValue(meter.getText(database)); tf1.addStyleName(ValoTheme.TEXTFIELD_TINY); tf1.setWidth("100%"); hl.addComponent(tf1); hl.setComponentAlignment(tf1, Alignment.TOP_CENTER); hl.setExpandRatio(tf1, 2.0f); content.addComponent(hl); content.setComponentAlignment(hl, Alignment.TOP_CENTER); content.setExpandRatio(hl, 0.0f); final TextField tf2 = new TextField(); tf2.setCaption("Voimassaolo"); tf2.setValue(Utils.getValidity(database, meter)); tf2.addStyleName(ValoTheme.TEXTFIELD_TINY); tf2.setWidth("100%"); content.addComponent(tf2); content.setComponentAlignment(tf2, Alignment.TOP_CENTER); content.setExpandRatio(tf2, 0.0f); final TextArea ta = new TextArea(); ta.setCaption("Mritys"); ta.setValue(meter.getText(database)); ta.addStyleName(ValoTheme.TEXTAREA_TINY); ta.setHeight("100%"); ta.setWidth("100%"); content.addComponent(ta); content.setComponentAlignment(ta, Alignment.TOP_CENTER); content.setExpandRatio(ta, 1.0f); final TrafficValuation valuation = meter.trafficValuation; final Runnable onOK = valuation != null ? valuation.getEditor(content, main, meter) : null; Indicator indicator = meter.getPossibleIndicator(database); if (indicator != null) { final Label ta2 = Indicator.makeHistory(database, indicator, main.getUIState().forecastMeters); content.addComponent(ta2); content.setComponentAlignment(ta2, Alignment.MIDDLE_CENTER); content.setExpandRatio(ta2, 1.0f); } HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setMargin(false); Button ok = new Button("Tallenna", new Button.ClickListener() { private static final long serialVersionUID = 1992235622970234624L; public void buttonClick(ClickEvent event) { if (onOK != null) onOK.run(); meter.modifyId(main, tf.getValue()); meter.modifyText(main, tf1.getValue()); Utils.modifyValidity(main, meter, tf2.getValue()); meter.modifyDescription(main, ta.getValue()); Updates.update(main, true); manageMeters(main, main.getUIState().currentItem); } }); buttons.addComponent(ok); Button close = new Button("Sulje"); buttons.addComponent(close); final Window dialog = Dialogs.makeDialog(main, "500px", "800px", "Mrit mittaria", null, content, buttons); close.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -8065367213523520602L; public void buttonClick(ClickEvent event) { main.removeWindow(dialog); manageMeters(main, main.getUIState().currentItem); } }); }