List of usage examples for com.vaadin.ui GridLayout setRows
public void setRows(int rows)
From source file:com.mymita.vaadlets.VaadletsBuilder.java
License:Apache License
private static void setLayoutAttributes(final com.vaadin.ui.Component vaadinComponent, final com.mymita.vaadlets.core.Component vaadletsComponent) { if (vaadletsComponent instanceof com.mymita.vaadlets.layout.AbstractLayout) { final Boolean margin = ((com.mymita.vaadlets.layout.AbstractLayout) vaadletsComponent).isMargin(); if (margin != null) { ((com.vaadin.ui.AbstractLayout) vaadinComponent).setMargin(margin); }/* ww w.ja va 2s . c o m*/ final Boolean marginTop = ((com.mymita.vaadlets.layout.AbstractLayout) vaadletsComponent).isMarginTop(); final Boolean marginRight = ((com.mymita.vaadlets.layout.AbstractLayout) vaadletsComponent) .isMarginRight(); final Boolean marginBottom = ((com.mymita.vaadlets.layout.AbstractLayout) vaadletsComponent) .isMarginBottom(); final Boolean marginLeft = ((com.mymita.vaadlets.layout.AbstractLayout) vaadletsComponent) .isMarginLeft(); if (marginTop != null || marginRight != null || marginBottom != null || marginLeft != null) { ((com.vaadin.ui.AbstractLayout) vaadinComponent).setMargin( firstNonNull(marginTop, firstNonNull(margin, FALSE)), firstNonNull(marginRight, firstNonNull(margin, FALSE)), firstNonNull(marginBottom, firstNonNull(margin, FALSE)), firstNonNull(marginLeft, firstNonNull(margin, FALSE))); } } if (vaadletsComponent instanceof com.mymita.vaadlets.layout.OrderedLayout) { final Boolean spacing = ((com.mymita.vaadlets.layout.OrderedLayout) vaadletsComponent).isSpacing(); if (spacing != null) { ((com.vaadin.ui.AbstractOrderedLayout) vaadinComponent).setSpacing(spacing); } } if (vaadletsComponent instanceof com.mymita.vaadlets.layout.GridLayout) { final com.vaadin.ui.GridLayout vaadinGridLayout = (com.vaadin.ui.GridLayout) vaadinComponent; final com.mymita.vaadlets.layout.GridLayout vaadletsGridLayout = (com.mymita.vaadlets.layout.GridLayout) vaadletsComponent; vaadinGridLayout.setColumns(vaadletsGridLayout.getColumns()); vaadinGridLayout.setRows(vaadletsGridLayout.getRows()); for (final Object object : vaadletsGridLayout.getColumnExpandRatioOrRowExpandRatio()) { if (object instanceof GridLayoutColumExpandRatio) { final GridLayoutColumExpandRatio cr = (GridLayoutColumExpandRatio) object; vaadinGridLayout.setColumnExpandRatio(cr.getColumnIndex(), cr.getRatio()); } if (object instanceof GridLayoutRowExpandRatio) { final GridLayoutRowExpandRatio rr = (GridLayoutRowExpandRatio) object; vaadinGridLayout.setRowExpandRatio(rr.getRowIndex(), rr.getRatio()); } } final Boolean spacing = ((com.mymita.vaadlets.layout.GridLayout) vaadletsComponent).isSpacing(); if (spacing != null) { ((com.vaadin.ui.GridLayout) vaadinComponent).setSpacing(spacing); } } }
From source file:de.metas.ui.web.vaadin.window.editor.FieldEditorsContainer.java
License:Open Source License
private void addChildEditor(final Label label, final Component editorComp, final PropertyLayoutInfo layoutInfo) { final GridLayout content = getContent(); int labelColumn = contentNextColumn * 2; int labelRow = contentNextRow; if (layoutInfo.isNextColumn()) { labelColumn = content.getColumns(); labelRow = 0;/*www .j a v a 2 s.c om*/ } final int editorRowsSpan = layoutInfo.getRowsSpan(); final int editorColumnFrom = labelColumn + 1; final int editorColumnTo = editorColumnFrom; final int editorRowFrom = labelRow; final int editorRowTo = editorRowFrom + (editorRowsSpan - 1); if (editorColumnTo >= content.getColumns()) { content.setColumns(editorColumnTo + 1); } if (editorRowTo >= content.getRows()) { content.setRows(editorRowTo + 1); } // // if (label != null) { content.addComponent(label, labelColumn, labelRow); content.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); } content.addComponent(editorComp, editorColumnFrom, editorRowFrom, editorColumnTo, editorRowTo); content.setComponentAlignment(editorComp, Alignment.MIDDLE_LEFT); editorComp.setSizeFull(); // // // contentNextColumn; contentNextRow = editorRowTo + 1; }
From source file:dhbw.clippinggorilla.userinterface.views.DocumentsView.java
public DocumentsView() { for (int i = 1; i < 12; i++) { setWidth("55%"); GridLayout layout = new GridLayout(3, 1); layout.setMargin(true);//from ww w .ja v a 2 s. c o m layout.setSpacing(true); try { List<Path> files = FileUtils.listFiles("docs/week" + i); layout.setRows(files.size() > 0 ? files.size() : 1); files.stream().sorted(Comparator.naturalOrder()).forEach(f -> { generateLine(f, layout); }); } catch (IOException ex) { Logger.getLogger(DocumentsView.class.getName()).log(Level.SEVERE, null, ex); } addTab(layout, Language.get(Word.WEEK) + " " + i); } Language.setCustom(Word.WEEK, t -> t + " 1", v -> getTab(0).setCaption(v)); Language.setCustom(Word.WEEK, t -> t + " 2", v -> getTab(1).setCaption(v)); Language.setCustom(Word.WEEK, t -> t + " 3", v -> getTab(2).setCaption(v)); Language.setCustom(Word.WEEK, t -> t + " 4", v -> getTab(3).setCaption(v)); Language.setCustom(Word.WEEK, t -> t + " 5", v -> getTab(4).setCaption(v)); Language.setCustom(Word.WEEK, t -> t + " 6", v -> getTab(5).setCaption(v)); Language.setCustom(Word.WEEK, t -> t + " 7", v -> getTab(6).setCaption(v)); Language.setCustom(Word.WEEK, t -> t + " 8", v -> getTab(7).setCaption(v)); Language.setCustom(Word.WEEK, t -> t + " 9", v -> getTab(8).setCaption(v)); Language.setCustom(Word.WEEK, t -> t + " 10", v -> getTab(9).setCaption(v)); Language.setCustom(Word.WEEK, t -> t + " 11", v -> getTab(10).setCaption(v)); SESSIONS.put(VaadinSession.getCurrent(), this); }
From source file:edu.nps.moves.mmowgliMobile.ui.UserRenderer2.java
License:Open Source License
public void setMessage(FullEntryView2 mView, ListEntry message, ListView2 messageList, AbstractOrderedLayout layout) {//from w ww. j a v a2 s.c om // messageList can be null if coming in from ActionPlan Object key = HSess.checkInit(); UserListEntry wu = (UserListEntry) message; User u = wu.getUser(); layout.removeAllComponents(); HorizontalLayout hlay = new HorizontalLayout(); layout.addComponent(hlay); hlay.addStyleName("m-userview-top"); hlay.setWidth("100%"); hlay.setMargin(true); hlay.setSpacing(true); Image img = new Image(); img.addStyleName("m-ridgeborder"); img.setSource(mediaLocator.locate(u.getAvatar().getMedia())); img.setWidth("90px"); img.setHeight("90px"); hlay.addComponent(img); hlay.setComponentAlignment(img, Alignment.MIDDLE_CENTER); Label lab; hlay.addComponent(lab = new Label()); lab.setWidth("5px"); VerticalLayout vlay = new VerticalLayout(); vlay.setSpacing(true); hlay.addComponent(vlay); hlay.setComponentAlignment(vlay, Alignment.MIDDLE_LEFT); vlay.setWidth("100%"); hlay.setExpandRatio(vlay, 1.0f); HorizontalLayout horl = new HorizontalLayout(); horl.setSpacing(false); vlay.addComponent(horl); vlay.setComponentAlignment(horl, Alignment.BOTTOM_LEFT); horl.addComponent(lab = new Label("name")); lab.addStyleName("m-user-top-label"); //light-text"); horl.addComponent(lab = new HtmlLabel(" " + u.getUserName())); lab.addStyleName("m-user-top-value"); horl = new HorizontalLayout(); horl.setSpacing(false); vlay.addComponent(horl); vlay.setComponentAlignment(horl, Alignment.TOP_LEFT); horl.addComponent(lab = new Label("level")); lab.addStyleName("m-user-top-label"); //light-text"); Level lev = u.getLevel(); if (u.isGameMaster()) { Level l = Level.getLevelByOrdinal(Level.GAME_MASTER_ORDINAL, HSess.get()); if (l != null) lev = l; } horl.addComponent(lab = new HtmlLabel(" " + lev.getDescription())); lab.addStyleName("m-user-top-value"); GridLayout gLay = new GridLayout(); // gLay.setHeight("155px"); // won't size properly gLay.setMargin(true); gLay.addStyleName("m-userview-mid"); gLay.setColumns(2); gLay.setRows(11); gLay.setSpacing(true); gLay.setWidth("100%"); gLay.setColumnExpandRatio(1, 1.0f); layout.addComponent(gLay); addRow(gLay, "user ID:", "" + getPojoId(message)); addRow(gLay, "location:", u.getLocation()); addRow(gLay, "expertise:", u.getExpertise()); addRow(gLay, "affiliation:", u.getAffiliation()); addRow(gLay, "date registered:", formatter.format(u.getRegisterDate())); gLay.addComponent(new Hr(), 0, 5, 1, 5); Container cntr = new CardsByUserContainer<Card>(u); // expects ThreadLocal session to be setup numCards = cntr.size(); addRow(gLay, "cards played:", "" + numCards); cntr = new ActionPlansByUserContainer<Card>(u); // expects ThreadLocal session to be setup numAps = cntr.size(); addRow(gLay, "action plans:", "" + numAps); gLay.addComponent(new Hr(), 0, 8, 1, 8); addRow(gLay, "exploration points:", "" + u.getBasicScore()); addRow(gLay, "innovation points:", "" + u.getInnovationScore()); cardListener = new CardLis(u, mView); apListener = new AppLis(u, mView); layout.addComponent(makeButtons()); HSess.checkClose(key); }
From source file:org.agocontrol.site.viewlet.dashboard.BuildingControlPanel.java
License:Apache License
/** * Invoked when view is entered.// www. j a va 2s.c om * @param parameters the parameters */ public final synchronized void enter(final String parameters) { if (recordReaderThread != null) { recordReaderExitRequested = true; recordReaderThread.interrupt(); try { recordReaderThread.join(); } catch (final InterruptedException e) { LOGGER.debug("Record reader thread death wait interrupted."); } } elementLayout.removeAllComponents(); recordsLayouts.clear(); recordsQueue.clear(); recordReaderExitRequested = false; final Company company = siteContext.getObject(Company.class); if (company == null || parameters == null || parameters.length() == 0) { return; } final String buildingId = parameters; final List<Element> elements = ElementDao.getElements(entityManager, company); boolean started = false; for (final Element element : elements) { if (element.getElementId().equals(buildingId)) { started = true; continue; } if (!started) { continue; } if (element.getTreeDepth() == 0) { break; } final HorizontalLayout elementLayout = new HorizontalLayout(); this.elementLayout.addComponent(elementLayout); elementLayout.setSpacing(true); final Resource elementIcon; switch (element.getType()) { case ROOM: elementIcon = roomIcon; break; case DEVICE: elementIcon = deviceIcon; break; default: elementIcon = deviceIcon; break; } final Embedded embedded = new Embedded(null, elementIcon); elementLayout.addComponent(embedded); elementLayout.setExpandRatio(embedded, 0.1f); embedded.setWidth(32, Unit.PIXELS); embedded.setHeight(32, Unit.PIXELS); final Label label = new Label(); elementLayout.addComponent(label); elementLayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT); label.setValue(element.toString()); final GridLayout recordLayout = new GridLayout(); recordLayout.setSpacing(true); recordLayout.setColumns(4); recordLayout.setRows(1); this.elementLayout.addComponent(recordLayout); recordsLayouts.put(element.getElementId(), recordLayout); } recordReaderThread = new Thread(new Runnable() { @Override public void run() { try { final EntityManager threadEntityManager = ((EntityManagerFactory) getSite().getSiteContext() .getObject(EntityManagerFactory.class)).createEntityManager(); for (final Element element : elements) { final List<RecordSet> recordSets = RecordSetDao.getRecordSets(threadEntityManager, element); if (recordsLayouts.containsKey(element.getElementId())) { for (final RecordSet recordSet : recordSets) { recordsQueue.put(RecordDao.getRecords(threadEntityManager, recordSet, 1)); if (recordReaderExitRequested) { break; } } } } Thread.sleep(10); } catch (InterruptedException e) { } } }); recordReaderThread.start(); }
From source file:org.agocontrol.site.viewlet.dashboard.DashboardViewlet.java
License:Apache License
/** * Default constructor which constructs component hierarchy. *///w w w . java2 s . c o m public DashboardViewlet() { site = ((AgoControlSiteUI) UI.getCurrent()).getSite(); siteContext = getSite().getSiteContext(); entityManager = siteContext.getObject(EntityManager.class); final GridLayout gridLayout = new GridLayout(); gridLayout.setSizeFull(); gridLayout.setRows(3); gridLayout.setColumns(2); gridLayout.setSpacing(true); gridLayout.setColumnExpandRatio(0, 1); gridLayout.setColumnExpandRatio(1, 0); gridLayout.setRowExpandRatio(0, 0); gridLayout.setRowExpandRatio(1, 0); gridLayout.setRowExpandRatio(2, 1); buildingSelectPanel = new BuildingSelectPanel(); //buildingSelectPanel.setCaption("Building Selection"); //buildingSelectPanel.setSizeFull(); gridLayout.addComponent(buildingSelectPanel, 0, 0, 1, 0); buildingControlPanel = new BuildingControlPanel(); //buildingControlPanel.setCaption("Control Panel"); //buildingControlPanel.setHeight(200, Unit.PIXELS); buildingControlPanel.setSizeFull(); gridLayout.addComponent(buildingControlPanel, 0, 1, 0, 2); chartPanel = new ChartPanel(); chartPanel.setSizeFull(); chartPanel.setWidth(700, Unit.PIXELS); chartPanel.setHeight(400, Unit.PIXELS); gridLayout.addComponent(chartPanel, 1, 1); eventPanel = new EventPanel(); //eventPanel.setCaption("Bus Events"); //ventPanel.setHeight(200, Unit.PIXELS); eventPanel.setSizeFull(); gridLayout.addComponent(eventPanel, 1, 2); setCompositionRoot(gridLayout); }
From source file:org.balisunrise.vaadin.components.user.UserPanel.java
License:Open Source License
private void init() { model = new CreateUserModel(); BeanItem<CreateUserModel> item = new BeanItem<>(model); FieldGroup fg = new FieldGroup(item); nome = new TextField("Nome"); nome.setWidth("100%"); nome.setMaxLength(50);/* w ww . j a v a 2 s . co m*/ fg.bind(nome, "nome"); login = new TextField("Login"); login.setWidth("100%"); login.setMaxLength(32); fg.bind(login, "login"); senha = new PasswordField("Senha"); senha.setWidth("100%"); senha.setMaxLength(32); fg.bind(senha, "senha"); repita = new PasswordField("Repita a senha"); repita.setWidth("100%"); repita.setMaxLength(32); fg.bind(repita, "repita"); GridLayout grid = new GridLayout(20, 1); grid.setWidth("100%"); grid.setHeightUndefined(); grid.setSpacing(true); grid.addComponent(nome, 0, 0, 9, 0); grid.addComponent(login, 10, 0, 19, 0); grid.setRows(2); grid.addComponent(senha, 0, 1, 9, 1); grid.addComponent(repita, 10, 1, 19, 1); addComponent(grid); setSpacing(true); repita.addBlurListener((e) -> { try { fg.commit(); Notification.show("Changes committed!\n" + model.toString(), Notification.Type.TRAY_NOTIFICATION); } catch (final FieldGroup.CommitException ex) { Notification.show("Commit failed: " + ex.getCause().getMessage(), Notification.Type.TRAY_NOTIFICATION); } }); }
From source file:org.eclipse.hawkbit.ui.rollout.rollout.AddUpdateRolloutWindowLayout.java
License:Open Source License
private GridLayout createSimpleGroupDefinitionTab() { final GridLayout layout = new GridLayout(); layout.setSpacing(true);/*from w w w.j av a2s. c o m*/ layout.setColumns(3); layout.setRows(4); layout.setStyleName("marginTop"); layout.addComponent(getLabel("caption.rollout.generate.groups"), 0, 0, 2, 0); layout.addComponent(getMandatoryLabel("prompt.number.of.groups"), 0, 1); layout.addComponent(noOfGroups, 1, 1); noOfGroups.addValidator(nullValidator); layout.addComponent(groupSizeLabel, 2, 1); layout.addComponent(getMandatoryLabel("prompt.tigger.threshold"), 0, 2); layout.addComponent(triggerThreshold, 1, 2); triggerThreshold.addValidator(nullValidator); layout.addComponent(getPercentHintLabel(), 2, 2); layout.addComponent(getMandatoryLabel("prompt.error.threshold"), 0, 3); layout.addComponent(errorThreshold, 1, 3); errorThreshold.addValidator(nullValidator); layout.addComponent(errorThresholdOptionGroup, 2, 3); return layout; }
From source file:org.hoot.HootView.java
License:Apache License
/** * {@inheritDoc}/*from ww w.jav a2s.c o m*/ */ @Override protected void initializeComponents() { final int columnCount = 5; final int rowCount = 3; final GridLayout layout = this; layout.setMargin(true); layout.setSpacing(true); layout.setColumns(columnCount); layout.setRows(rowCount); //layout.setColumnExpandRatio(0, MARGIN_COLUMN_EXPAND_RATIO); //layout.setColumnExpandRatio(MARGIN_COLUMN_RIGTH_INDEX, MARGIN_COLUMN_EXPAND_RATIO); layout.setRowExpandRatio(1, 1.0f); layout.setColumnExpandRatio(2, 1.0f); layout.setSizeFull(); final AbstractComponent logoComponent = getComponent("logo"); logoComponent.setWidth(NAVIGATION_COLUMN_WIDTH, Unit.PIXELS); layout.addComponent(logoComponent, 1, 0); final AbstractComponent navigationComponent = getComponent("navigation"); navigationComponent.setWidth(NAVIGATION_COLUMN_WIDTH, Unit.PIXELS); navigationComponent.setHeight(NAVIGATION_HEIGHT, Unit.PIXELS); layout.addComponent(navigationComponent, 1, 1); //final AbstractComponent headerComponent = getComponent("header"); //headerComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS); //headerComponent.setSizeFull(); //layout.addComponent(headerComponent, 2, 0); final AbstractComponent contentComponent = getComponent("content"); //contentComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS); contentComponent.setSizeFull(); layout.addComponent(contentComponent, 2, 0, 2, 2); //final AbstractComponent footerComponent = getComponent("footer"); //headerComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS); //layout.addComponent(footerComponent, 2, 2); }
From source file:org.opennms.features.vaadin.dashboard.config.ui.DashletSpecEditor.java
License:Open Source License
/** * Constructor for the DashletSpecEditor. * * @param wallboardEditor the {@link WallboardEditor} wallboard editor this editor belongs to * @param dashletSelector the {@link DashletSelector} used to query available {@link DashletFactory} instances * @param dashletSpec the associated {@link DashletSpec} instance */// w w w .j a va2 s . c om public DashletSpecEditor(WallboardEditor wallboardEditor, DashletSelector dashletSelector, DashletSpec dashletSpec) { /** * Setting the member fields */ this.m_wallboardEditor = wallboardEditor; this.m_dashletSpec = dashletSpec; this.m_dashletSelector = dashletSelector; /** * Setting defaults */ DashletFactory dashletFactory = dashletSelector.getDashletFactoryForName(dashletSpec.getDashletName()); final Map<String, String> requiredParameters = dashletFactory.getRequiredParameters(); for (Map.Entry<String, String> entry : requiredParameters.entrySet()) { if (!dashletSpec.getParameters().containsKey(entry.getKey())) { dashletSpec.getParameters().put(entry.getKey(), requiredParameters.get(entry.getKey())); } } /** * Setting up this component with size and layout */ setWidth(100.0f, Unit.PERCENTAGE); GridLayout gridLayout = new GridLayout(); gridLayout.setColumns(6); gridLayout.setRows(1); gridLayout.setMargin(true); /** * Priority field setup, layout and adding listener and validator */ final TextField priorityField = new TextField(); priorityField.setValue(String.valueOf(dashletSpec.getPriority())); priorityField.setImmediate(true); priorityField.setCaption("Priority"); priorityField.setDescription("Priority of this dashlet"); priorityField.addValidator(new AbstractStringValidator("Only numbers allowed here") { @Override protected boolean isValidValue(String s) { try { Integer.parseInt(s); } catch (NumberFormatException numberFormatException) { return false; } return true; } }); priorityField.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent valueChangeEvent) { if (priorityField.isValid()) { m_dashletSpec.setPriority(Integer.valueOf((String) valueChangeEvent.getProperty().getValue())); WallboardProvider.getInstance().save(); ((WallboardConfigUI) getUI()).notifyMessage("Data saved", "Priority"); } } }); /** * Boost priority field setup, layout and adding listener and validator */ final TextField boostPriorityField = new TextField(); boostPriorityField.setValue(String.valueOf(dashletSpec.getBoostPriority())); boostPriorityField.setImmediate(true); boostPriorityField.setCaption("Boost-Priority"); boostPriorityField.setDescription("Boost priority of this dashlet"); boostPriorityField.addValidator(new AbstractStringValidator("Only numbers allowed here") { @Override protected boolean isValidValue(String s) { try { Integer.parseInt(s); } catch (NumberFormatException numberFormatException) { return false; } return true; } }); boostPriorityField.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent valueChangeEvent) { if (boostPriorityField.isValid()) { m_dashletSpec .setBoostPriority(Integer.valueOf((String) valueChangeEvent.getProperty().getValue())); WallboardProvider.getInstance().save(); ((WallboardConfigUI) getUI()).notifyMessage("Data saved", "Priority"); } } }); /** * Duration field setup, layout and adding listener and validator */ final TextField durationField = new TextField(); durationField.setValue(String.valueOf(dashletSpec.getDuration())); durationField.setImmediate(true); durationField.setCaption("Duration"); durationField.setDescription("Duration for this dashlet"); durationField.addValidator(new AbstractStringValidator("Only numbers allowed here") { @Override protected boolean isValidValue(String s) { try { Integer.parseInt(s); } catch (NumberFormatException numberFormatException) { return false; } return true; } }); durationField.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent valueChangeEvent) { if (durationField.isValid()) { m_dashletSpec.setDuration(Integer.valueOf((String) valueChangeEvent.getProperty().getValue())); WallboardProvider.getInstance().save(); ((WallboardConfigUI) getUI()).notifyMessage("Data saved", "Duration"); } } }); /** * Boost duration field setup, layout and adding listener and validator */ final TextField boostDurationField = new TextField(); boostDurationField.setValue(String.valueOf(dashletSpec.getBoostDuration())); boostDurationField.setImmediate(true); boostDurationField.setCaption("Boost-Duration"); boostDurationField.setDescription("Boost duration for this dashlet"); boostDurationField.addValidator(new AbstractStringValidator("Only numbers allowed here") { @Override protected boolean isValidValue(String s) { try { Integer.parseInt(s); } catch (NumberFormatException numberFormatException) { return false; } return true; } }); boostDurationField.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent valueChangeEvent) { if (boostDurationField.isValid()) { m_dashletSpec .setBoostDuration(Integer.valueOf((String) valueChangeEvent.getProperty().getValue())); WallboardProvider.getInstance().save(); ((WallboardConfigUI) getUI()).notifyMessage("Data saved", "Duration"); } } }); boolean boostable = m_dashletSelector.getDashletFactoryForName(m_dashletSpec.getDashletName()) .isBoostable(); boostPriorityField.setEnabled(boostable); boostDurationField.setEnabled(boostable); /** * Setting up the dashlet selection */ m_dashletSelect = new NativeSelect(); m_dashletSelect.setCaption("Dashlet"); updateDashletSelection(dashletSelector.getDashletFactoryList()); m_dashletSelect.setImmediate(true); m_dashletSelect.setNewItemsAllowed(false); m_dashletSelect.setNullSelectionItemId("Undefined"); m_dashletSelect.setNullSelectionAllowed(false); m_dashletSelect.select(dashletSpec.getDashletName()); m_dashletSelect.setDescription("Dashlet selection"); m_dashletSelect.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent valueChangeEvent) { if (m_savingDisabled) { return; } if (valueChangeEvent.getProperty().getValue() == null) { m_dashletSpec.setDashletName("Undefined"); } else { m_dashletSpec.setDashletName(valueChangeEvent.getProperty().getValue().toString()); m_dashletSelect.removeItem("Undefined"); } m_dashletSpec.getParameters().clear(); Map<String, String> requiredParameters = m_dashletSelector .getDashletFactoryForName(m_dashletSpec.getDashletName()).getRequiredParameters(); for (Map.Entry<String, String> entry : requiredParameters.entrySet()) { m_dashletSpec.getParameters().put(entry.getKey(), entry.getValue()); } m_propertiesButton.setEnabled(requiredParameters.size() > 0); boolean boostable = m_dashletSelector.getDashletFactoryForName(m_dashletSpec.getDashletName()) .isBoostable(); boostPriorityField.setEnabled(boostable); boostDurationField.setEnabled(boostable); WallboardProvider.getInstance().save(); ((WallboardConfigUI) getUI()).notifyMessage("Data saved", "Dashlet"); } }); m_titleField = new TextField(); m_titleField.setValue(dashletSpec.getTitle()); m_titleField.setImmediate(true); m_titleField.setCaption("Title"); m_titleField.setDescription("Title for this dashlet instance"); m_titleField.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent valueChangeEvent) { m_dashletSpec.setTitle((String) valueChangeEvent.getProperty().getValue()); WallboardProvider.getInstance().save(); ((WallboardConfigUI) getUI()).notifyMessage("Data saved", "Title"); } }); FormLayout f1 = new FormLayout(); f1.addComponent(m_dashletSelect); f1.addComponent(m_titleField); /** * Adding the required input fields and buttons to several {@link FormLayout} instances for better layout. */ FormLayout f2 = new FormLayout(); f2.addComponent(priorityField); f2.addComponent(durationField); FormLayout f3 = new FormLayout(); f3.addComponent(boostPriorityField); f3.addComponent(boostDurationField); /** * Adding the properties button... */ m_propertiesButton = new Button("Properties"); m_propertiesButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { DashletConfigurationWindow configurationWindow = m_dashletSelector .getDashletFactoryForName(m_dashletSpec.getDashletName()) .configurationWindow(m_dashletSpec); getUI().addWindow(configurationWindow); } }); m_propertiesButton.setEnabled(m_dashletSelector.getDashletFactoryForName(m_dashletSpec.getDashletName()) .getRequiredParameters().size() > 0); m_propertiesButton.setStyleName("small"); m_propertiesButton.setDescription("Open properties dialog for this dashlet"); /** * ...and the remove button */ Button removeButton = new Button("Remove"); removeButton.setDescription("Remove this dashlet entry"); FormLayout f4 = new FormLayout(); f4.addComponent(m_propertiesButton); f4.addComponent(removeButton); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent clickEvent) { m_wallboardEditor.removeDashletSpecEditor(DashletSpecEditor.this); } }); removeButton.setStyleName("small"); Button upButton = new Button(); upButton.setStyleName("small"); upButton.setIcon(new ThemeResource("../runo/icons/16/arrow-up.png")); upButton.setDescription("Move this a dashlet entry one position up"); Button downButton = new Button(); downButton.setStyleName("small"); downButton.setIcon(new ThemeResource("../runo/icons/16/arrow-down.png")); downButton.setDescription("Move this a dashlet entry one position down"); FormLayout f5 = new FormLayout(); f5.addComponent(upButton); f5.addComponent(downButton); Button previewButton = new Button("Preview"); previewButton.setStyleName("small"); previewButton.setDescription("Preview this single dashlet entry"); Wallboard wallboard = new Wallboard(); wallboard.getDashletSpecs().add(m_dashletSpec); previewButton.addClickListener(new PreviewClickListener(this, wallboard)); FormLayout f6 = new FormLayout(); f6.addComponent(previewButton); upButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { m_wallboardEditor.swapDashletSpec(m_dashletSpec, -1); } }); downButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { m_wallboardEditor.swapDashletSpec(m_dashletSpec, +1); } }); /** * Adding the different {@link FormLayout} instances to a {@link GridLayout} */ f1.setMargin(true); f2.setMargin(true); f3.setMargin(true); f4.setMargin(true); f5.setMargin(true); f6.setMargin(true); gridLayout.addComponent(f1); gridLayout.addComponent(f2); gridLayout.addComponent(f3); gridLayout.addComponent(f4); gridLayout.addComponent(f5); gridLayout.addComponent(f6); setContent(gridLayout); }