protected boolean supportsHtmlTemplate() { return displayer.getDisplayerConstraints().getSupportedAttributes().contains(DisplayerAttributeDef.HTML_TEMPLATE); }
protected boolean supportsHtmlTemplate() { return displayer.getDisplayerConstraints().getSupportedAttributes().contains(DisplayerAttributeDef.HTML_TEMPLATE); }
public void initSourceCodeItems() { view.clearSourceCodeItems(); Set<DisplayerAttributeDef> attrs = displayer.getDisplayerConstraints().getSupportedAttributes(); for (SourceCodeItem sourceCodeItem : sourceCodeItems) { if (attrs.contains(sourceCodeItem.attributeDef)) { view.addSourceCodeItem(sourceCodeItem.name); } } }
public void initSourceCodeItems() { view.clearSourceCodeItems(); Set<DisplayerAttributeDef> attrs = displayer.getDisplayerConstraints().getSupportedAttributes(); for (SourceCodeItem sourceCodeItem : sourceCodeItems) { if (attrs.contains(sourceCodeItem.attributeDef)) { view.addSourceCodeItem(sourceCodeItem.name); } } }
public void save() { // Clear settings before return DisplayerConstraints displayerConstraints = displayer.getDisplayerConstraints(); displayerConstraints.removeUnsupportedAttributes(displayerSettings); // Dispose the displayer if (displayer != null) { displayer.close(); } // Notify event onSaveCommand.execute(); saveEvent.fire(new DisplayerEditorSavedEvent(displayerSettings)); }
public void save() { // Clear settings before return DisplayerConstraints displayerConstraints = displayer.getDisplayerConstraints(); displayerConstraints.removeUnsupportedAttributes(displayerSettings); // Dispose the displayer if (displayer != null) { displayer.close(); } // Notify event onSaveCommand.execute(); saveEvent.fire(new DisplayerEditorSavedEvent(displayerSettings)); }
protected void initLookupEditor() { DataSetLookupConstraints lookupConstraints = displayer.getDisplayerConstraints().getDataSetLookupConstraints(); lookupEditor.init(lookupConstraints, displayerSettings.getDataSetLookup()); }
protected void initLookupEditor() { DataSetLookupConstraints lookupConstraints = displayer.getDisplayerConstraints().getDataSetLookupConstraints(); lookupEditor.init(lookupConstraints, displayerSettings.getDataSetLookup()); }
@Before public void init() throws Exception { Set<DisplayerAttributeDef> supportedAttrs = new HashSet<>(); supportedAttrs.add(DisplayerAttributeDef.HTML_TEMPLATE); supportedAttrs.add(DisplayerAttributeDef.JS_TEMPLATE); when(constraints.getSupportedAttributes()).thenReturn(supportedAttrs); when(displayer.getDisplayerConstraints()).thenReturn(constraints); presenter = new DisplayerHtmlEditor(view, codeEditor); presenter.setDisplayer(displayer); }
@Before public void init() throws Exception { when(displayerPrototypes.getProto(any(DisplayerType.class), any(DisplayerSubType.class))).thenReturn(displayerSettings); when(displayerSettings.cloneInstance()).thenReturn(tableSettings); when(displayerLocator.lookupDisplayer(displayerSettings)).thenReturn(displayer); when(displayerLocator.lookupDisplayer(tableSettings)).thenReturn(tableDisplayer); when(displayer.getDisplayerConstraints()).thenReturn(displayerConstraints); when(displayerConstraints.getDataSetLookupConstraints()).thenReturn(lookupConstraints); presenter = new DisplayerEditor(view, clientServices, displayerLocator, displayerPrototypes, typeSelector, lookupEditor, settingsEditor, editorStatus, displayerHtmlEditor, saveEvent, closeEvent); }
@Before public void init() throws Exception { Set<DisplayerAttributeDef> supportedAttrs = new HashSet<>(); supportedAttrs.add(DisplayerAttributeDef.HTML_TEMPLATE); supportedAttrs.add(DisplayerAttributeDef.JS_TEMPLATE); when(constraints.getSupportedAttributes()).thenReturn(supportedAttrs); when(displayer.getDisplayerConstraints()).thenReturn(constraints); presenter = new DisplayerHtmlEditor(view, codeEditor); presenter.setDisplayer(displayer); }
@Before public void init() throws Exception { when(displayerPrototypes.getProto(any(DisplayerType.class), any(DisplayerSubType.class))).thenReturn(displayerSettings); when(displayerSettings.cloneInstance()).thenReturn(tableSettings); when(displayerLocator.lookupDisplayer(displayerSettings)).thenReturn(displayer); when(displayerLocator.lookupDisplayer(tableSettings)).thenReturn(tableDisplayer); when(displayer.getDisplayerConstraints()).thenReturn(displayerConstraints); when(displayerConstraints.getDataSetLookupConstraints()).thenReturn(lookupConstraints); presenter = new DisplayerEditor(view, clientServices, displayerLocator, displayerPrototypes, typeSelector, lookupEditor, settingsEditor, editorStatus, displayerHtmlEditor, saveEvent, closeEvent); }
public void init(Displayer displayer) { try { this.displayer = displayer; this.displayerSettings = displayer.getDisplayerSettings(); this.displayerContraints = displayer.getDisplayerConstraints(); this.supportedAttributes = displayerContraints.getSupportedAttributes(); displayer.getDataSetHandler().lookupDataSet(new DataSetReadyCallback() { @Override public void callback(DataSet dataSet) { show(); } @Override public void notFound() { view.dataSetNotFound(); } @Override public boolean onError(final ClientRuntimeError error) { view.error(error.getMessage()); return false; } }); } catch (Exception e) { view.error(e.toString()); } }
public void init(Displayer displayer) { try { this.displayer = displayer; this.displayerSettings = displayer.getDisplayerSettings(); this.displayerContraints = displayer.getDisplayerConstraints(); this.supportedAttributes = displayerContraints.getSupportedAttributes(); displayer.getDataSetHandler().lookupDataSet(new DataSetReadyCallback() { @Override public void callback(DataSet dataSet) { show(); } @Override public void notFound() { view.dataSetNotFound(); } @Override public boolean onError(final ClientRuntimeError error) { view.error(error.getMessage()); return false; } }); } catch (Exception e) { view.error(e.toString()); } }
@Test public void testMeterSettings() { when(displayer.getDisplayerConstraints()).thenReturn( new DisplayerConstraints(null) .supportsAttribute(METER_GROUP)); when(displayer.getDisplayerSettings()).thenReturn(DisplayerSettingsFactory.newMeterChartSettings() .meter(0, 100, 500, 900) .buildSettings()); presenter.init(displayer); verify(view).clear(); verify(view).addTextProperty(eq(METER_START), eq("0"), any(DisplayerSettingsEditor.LongValidator.class)); verify(view).addTextProperty(eq(METER_WARNING), eq("100"), any(DisplayerSettingsEditor.LongValidator.class)); verify(view).addTextProperty(eq(METER_CRITICAL), eq("500"), any(DisplayerSettingsEditor.LongValidator.class)); verify(view).addTextProperty(eq(METER_END), eq("900"), any(DisplayerSettingsEditor.LongValidator.class)); verify(view).show(); }
@Test public void testMeterSettings() { when(displayer.getDisplayerConstraints()).thenReturn( new DisplayerConstraints(null) .supportsAttribute(METER_GROUP)); when(displayer.getDisplayerSettings()).thenReturn(DisplayerSettingsFactory.newMeterChartSettings() .meter(0, 100, 500, 900) .buildSettings()); presenter.init(displayer); verify(view).clear(); verify(view).addTextProperty(eq(METER_START), eq("0"), any(DisplayerSettingsEditor.LongValidator.class)); verify(view).addTextProperty(eq(METER_WARNING), eq("100"), any(DisplayerSettingsEditor.LongValidator.class)); verify(view).addTextProperty(eq(METER_CRITICAL), eq("500"), any(DisplayerSettingsEditor.LongValidator.class)); verify(view).addTextProperty(eq(METER_END), eq("900"), any(DisplayerSettingsEditor.LongValidator.class)); verify(view).show(); }
@Test public void testRenderer() { DisplayerSettings settings = DisplayerSettingsFactory.newBarChartSettings() .renderer("rendererB") .buildSettings(); when(rendererManager.getRendererForDisplayer(settings)).thenReturn(rendererB); when(displayer.getDisplayerConstraints()).thenReturn( new DisplayerConstraints(null) .supportsAttribute(RENDERER)); when(displayer.getDisplayerSettings()).thenReturn(settings); presenter.init(displayer); verify(view).clear(); verify(view).addListProperty(RENDERER, Arrays.asList("rendererA", "rendererB"), "rendererB"); verify(view).show(); }
@Test public void testRenderer() { DisplayerSettings settings = DisplayerSettingsFactory.newBarChartSettings() .renderer("rendererB") .buildSettings(); when(rendererManager.getRendererForDisplayer(settings)).thenReturn(rendererB); when(displayer.getDisplayerConstraints()).thenReturn( new DisplayerConstraints(null) .supportsAttribute(RENDERER)); when(displayer.getDisplayerSettings()).thenReturn(settings); presenter.init(displayer); verify(view).clear(); verify(view).addListProperty(RENDERER, Arrays.asList("rendererA", "rendererB"), "rendererB"); verify(view).show(); }
@Test public void testSupportedAttrs() { when(displayer.getDisplayerConstraints()).thenReturn(new DisplayerConstraints(null) .supportsAttribute(TYPE) .supportsAttribute(SUBTYPE) .supportsAttribute(TITLE) .supportsAttribute(FILTER_GROUP)); when(displayer.getDisplayerSettings()).thenReturn(DisplayerSettingsFactory.newBarChartSettings().buildSettings()); presenter.init(displayer); assertEquals(presenter.isSupported(TYPE), true); assertEquals(presenter.isSupported(SUBTYPE), true); assertEquals(presenter.isSupported(TITLE), true); assertEquals(presenter.isSupported(TITLE_VISIBLE), false); assertEquals(presenter.isSupported(RENDERER), false); assertEquals(presenter.isSupported(FILTER_ENABLED), true); assertEquals(presenter.isSupported(FILTER_LISTENING_ENABLED), true); assertEquals(presenter.isSupported(FILTER_NOTIFICATION_ENABLED), true); assertEquals(presenter.isSupported(FILTER_SELFAPPLY_ENABLED), true); }
@Test public void testSupportedAttrs() { when(displayer.getDisplayerConstraints()).thenReturn(new DisplayerConstraints(null) .supportsAttribute(TYPE) .supportsAttribute(SUBTYPE) .supportsAttribute(TITLE) .supportsAttribute(FILTER_GROUP)); when(displayer.getDisplayerSettings()).thenReturn(DisplayerSettingsFactory.newBarChartSettings().buildSettings()); presenter.init(displayer); assertEquals(presenter.isSupported(TYPE), true); assertEquals(presenter.isSupported(SUBTYPE), true); assertEquals(presenter.isSupported(TITLE), true); assertEquals(presenter.isSupported(TITLE_VISIBLE), false); assertEquals(presenter.isSupported(RENDERER), false); assertEquals(presenter.isSupported(FILTER_ENABLED), true); assertEquals(presenter.isSupported(FILTER_LISTENING_ENABLED), true); assertEquals(presenter.isSupported(FILTER_NOTIFICATION_ENABLED), true); assertEquals(presenter.isSupported(FILTER_SELFAPPLY_ENABLED), true); }