/** * Copy constructor. * * @param wallboard the {@link Wallboard} to be cloned */ public Wallboard(Wallboard wallboard) { m_title = wallboard.getTitle(); for (DashletSpec dashletSpec : wallboard.getDashletSpecs()) { this.m_dashletSpecs.add(dashletSpec.clone()); } }
public void swapDashletSpec(DashletSpec dashletSpec, int direction) { int index = m_wallboard.getDashletSpecs().indexOf(dashletSpec); if (index + direction >= 0 && index + direction < m_wallboard.getDashletSpecs().size()) { Collections.swap(m_wallboard.getDashletSpecs(), index, index + direction); updateDashletSpecs(); WallboardProvider.getInstance().save(); } }
previewButton.setDescription("Preview this single dashlet entry"); Wallboard wallboard = new Wallboard(); wallboard.getDashletSpecs().add(m_dashletSpec);
/** * Returns the {@link Wallboard} for the given title. * * @param title the title to search for * @return the {@link Wallboard} instance if found, null otherwise */ public synchronized Wallboard getWallboard(String title) { for (Wallboard wallboard : m_wallboards.getWallboards()) { if (wallboard.getTitle().equals(title)) { return wallboard; } } return null; }
public Object generateCell(Table source, final Object itemId, Object columnId) { CheckBox checkBox = new CheckBox(); checkBox.setImmediate(true); checkBox.setDescription("Make this Ops Board configuration the default"); final Wallboard wallboard = m_beanItemContainer.getItem(itemId).getBean(); checkBox.setValue(wallboard.isDefault()); checkBox.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { boolean newValue = ((Boolean) valueChangeEvent.getProperty().getValue()); if (newValue) { for (Wallboard wallboard1 : m_beanItemContainer.getItemIds()) { wallboard1.setDefault(false); } } wallboard.setDefault(newValue); m_table.refreshRowCache(); WallboardProvider.getInstance().save(); } }); return checkBox; } });
public void textChange(FieldEvents.TextChangeEvent textChangeEvent) { AbstractTextField source = (AbstractTextField) textChangeEvent.getSource(); source.setValue(textChangeEvent.getText()); if (source.isValid()) { m_tab.setCaption(textChangeEvent.getText()); m_wallboard.setTitle(textChangeEvent.getText()); WallboardProvider.getInstance().save(); ((WallboardConfigUI) getUI()).notifyMessage("Data saved", "Title"); } } });
/** * Updates the vertical layout to reflect ordering changes */ public void updateDashletSpecs() { m_verticalLayout.removeAllComponents(); for (DashletSpec dashletSpec : m_wallboard.getDashletSpecs()) { m_verticalLayout.addComponent(m_dashletSpecEditorMap.get(dashletSpec)); } }
/** * Checks whether this object contains {@link Wallboard} data concerning the given title. * * @param title the title to search for * @return true, if a {@link Wallboard} with the given title exists, false otherwise */ public synchronized boolean containsWallboard(String title) { for (Wallboard wallboard : m_wallboards.getWallboards()) { if (wallboard.getTitle().equals(title)) { return true; } } return false; }
if (wallboard.isDefault()) { headerLayout.gotoWallboard(wallboard); break;
for (DashletSpec dashletSpec : wallboard.getDashletSpecs()) { addDashletSpec(dashletSpec); titleField.setValue(wallboard.getTitle()); titleField.setImmediate(true); titleField.addValidator(new AbstractStringValidator("Title must be unique") {
/** * This method adds a given {@link DashletSpec}. * * @param dashletSpec the {@link DashletSpec} to be added */ private void addDashletSpec(DashletSpec dashletSpec) { DashletSpecEditor dashletSpecEditor = new DashletSpecEditor(this, m_dashletSelector, dashletSpec); m_dashletSpecEditorMap.put(dashletSpec, dashletSpecEditor); m_verticalLayout.addComponent(dashletSpecEditor); if (!m_wallboard.getDashletSpecs().contains(dashletSpec)) { m_wallboard.getDashletSpecs().add(dashletSpec); WallboardProvider.getInstance().save(); } } }
/** * This method opens a {@link WallboardEditor} for a given {@link Wallboard}. * * @param wallboard the wallboard to be edited */ public void openWallboardEditor(Wallboard wallboard) { if (m_wallboardEditorMap.containsKey(wallboard)) { m_tabSheet.setSelectedTab(m_wallboardEditorMap.get(wallboard)); } else { WallboardEditor wallboardEditor = new WallboardEditor(m_dashletSelector, wallboard); TabSheet.Tab tab = m_tabSheet.addTab(wallboardEditor, wallboard.getTitle(), null); wallboardEditor.setTab(tab); tab.setClosable(true); m_wallboardEditorMap.put(wallboard, tab); m_tabSheet.setSelectedTab(tab); } }
/** * This method removes the given {@link DashletSpecEditor}. * * @param dashletSpecEditor the {@link DashletSpecEditor} to be removed */ public void removeDashletSpecEditor(DashletSpecEditor dashletSpecEditor) { m_verticalLayout.removeComponent(dashletSpecEditor); m_dashletSpecEditorMap.remove(dashletSpecEditor.getDashletSpec()); m_wallboard.getDashletSpecs().remove(dashletSpecEditor.getDashletSpec()); WallboardProvider.getInstance().save(); }
public void gotoWallboard(Wallboard wallboard) { m_nativeSelect.setValue(wallboard); UI.getCurrent().getNavigator().navigateTo("wallboard/" + wallboard.getTitle()); }
/** * Method invoked when the view is entered. * * @param event the view change event */ @Override public void enter(ViewChangeListener.ViewChangeEvent event) { LoggerFactory.getLogger(DashboardView.class).warn("enter(): " + event.getParameters()); if (event.getParameters() != null) { Wallboard wallboard = WallboardProvider.getInstance().getWallboard(event.getParameters()); if (wallboard != null) { setDashletSpecs(wallboard.getDashletSpecs()); } } } }
@Override public void enter(ViewChangeListener.ViewChangeEvent event) { if (event.getParameters() != null) { Wallboard wallboard = WallboardProvider.getInstance().getWallboard(event.getParameters()); if (wallboard != null) { dashletBoardBody.setDashletSpecs(wallboard.getDashletSpecs()); } } }
wallboardBody.setDashletSpecs(m_wallboard.getDashletSpecs());