com.google.gwt.user.client.ui.IsWidget Java Examples
The following examples show how to use
com.google.gwt.user.client.ui.IsWidget.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FormGroup.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
private void addIfNotNull(Editor e, int size, int offset, boolean wrap) { if (e instanceof IsWidget) { boolean wrapInCol = wrap; wrapInCol &= this.type == Layout.HORIZONTAL; Widget toAdd = Widget.asWidgetOrNull((IsWidget) e); if (wrapInCol) { GridColumn column = new GridColumn(); column.add(toAdd); column.setSize(size); column.setOffset(offset); toAdd = column; } if (this.type == Layout.HORIZONTAL) { if (size > 0) { StyleUtils.addStyle(toAdd, new GridColumn.SizeStyle(GridColumn.PREFIX_SIZE_MD, size)); } if (offset > 0) { StyleUtils.addStyle(toAdd, new GridColumn.OffsetStyle(GridColumn.PREFIX_OFFSET_MD, offset)); } } this.append(toAdd); } }
Example #2
Source File: Panel.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void redraw() { this.clear(); this.append(this.header); this.append(this.collapsePanel); this.collapsePanel.clear(); this.collapsePanel.append(this.bodyPanel); this.collapsePanel.append(this.table); this.collapsePanel.append(this.footer); if (this.header != null && !this.commands.isEmpty()) { if (this.commandsContainer == null) { this.commandsContainer = new Container(); StyleUtils.addStyle(this.commandsContainer, Panel.STYLE_COMMANDS); this.header.add(this.commandsContainer); } for (IsWidget command : this.commands) { this.commandsContainer.add(command); } } this.ensureCollapseHelper(); }
Example #3
Source File: CSVDataSetDefAttributesEditorTest.java From dashbuilder with Apache License 2.0 | 6 votes |
@Test public void testInit() { presenter.init(); verify(view, times(1)).init(presenter); verify(view, times(1)).initWidgets(any(ValueBoxEditor.View.class), any(IsWidget.class),any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class)); verify(fileURL, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(filePath, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(separatorChar, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(quoteChar, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(escapeChar, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(datePattern, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(numberPattern, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(filePath, times(1)).configure(anyString(), any(FileUploadEditor.FileUploadEditorCallback.class)); verify(view, times(1)).showFilePathInput(); verify(view, times(0)).showFileURLInput(); }
Example #4
Source File: DataSetEditorWorkflowTest.java From dashbuilder with Apache License 2.0 | 6 votes |
@Test public void testFlushDriver() { final Collection violations = mock(Collection.class); when(violations.isEmpty()).thenReturn(true); presenter.violations = violations; final Command c = mock(Command.class); presenter.stepValidator = c; presenter.flush(driver); verify(driver, times(1)).flush(); verify(c, times(1)).execute(); assertFalse(presenter.hasErrors()); verify(view, times(0)).clearButtons(); verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class)); verify(view, times(0)).add(any(IsWidget.class)); verify(view, times(0)).init(presenter); verify(view, times(0)).clearView(); }
Example #5
Source File: DataSetEditorWorkflowTest.java From dashbuilder with Apache License 2.0 | 6 votes |
@Test public void testClear() { presenter.dataSetDef = this.dataSetDef; final Command c = mock(Command.class); presenter.flushCommand = c; presenter.stepValidator = c; presenter.clear(); assertNull(presenter.getDataSetDef()); assertNull(presenter.flushCommand); assertNull(presenter.stepValidator); assertTrue(presenter.violations.isEmpty()); verify(view, times(1)).clearView(); verify(view, times(0)).init(presenter); verify(view, times(0)).add(any(IsWidget.class)); verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class)); verify(view, times(0)).clearButtons(); }
Example #6
Source File: DataSetDefRefreshAttributesEditorTest.java From dashbuilder with Apache License 2.0 | 6 votes |
@Test public void testSetValueEnabled() { final DataSetDef dataSetDef = mock(DataSetDef.class); when(dataSetDef.getUUID()).thenReturn("uuid1"); when(dataSetDef.getName()).thenReturn("name1"); when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL); when(dataSetDef.getRefreshTime()).thenReturn("1 second"); presenter.setValue(dataSetDef); assertEquals(true, presenter.isRefreshEnabled()); verify(refreshTime, times(1)).setEnabled(true); verify(refreshAlways, times(1)).setEnabled(true); verify(view, times(1)).setEnabled(true); verify(view, times(0)).init(presenter); verify(view, times(0)).initWidgets(any(IsWidget.class), any(DataSetDefRefreshIntervalEditor.View.class)); verify(view, times(0)).addRefreshEnabledButtonHandler(any(Command.class)); }
Example #7
Source File: CSVDataSetDefAttributesEditorTest.java From dashbuilder with Apache License 2.0 | 6 votes |
@Test public void testSetValueUsingFileUrl() { final CSVDataSetDef dataSetDef = mock(CSVDataSetDef.class); when(dataSetDef.getUUID()).thenReturn("uuid1"); when(dataSetDef.getName()).thenReturn("name1"); when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.CSV); when(dataSetDef.getFileURL()).thenReturn("fileUrl"); when(dataSetDef.getFilePath()).thenReturn(null); presenter.setValue(dataSetDef); assertEquals(false, presenter.isUsingFilePath()); verify(view, times(0)).init(presenter); verify(view, times(0)).initWidgets(any(ValueBoxEditor.View.class), any(IsWidget.class),any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class)); verify(view, times(1)).showFileURLInput(); verify(view, times(0)).showFilePathInput(); }
Example #8
Source File: TableColumn.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void add(IsWidget w) { if (w instanceof AbstractTableColumnAspect) { this.addAspect((AbstractTableColumnAspect<T>) w); } if (w instanceof OutputFactory) { assert this.outputFactory == null : "outputFactory may only be set once"; this.outputFactory = (OutputFactory) w; } if (w instanceof InputFactory) { assert this.inputFactory == null : "inputFactory may only be set once"; this.inputFactory = (InputFactory) w; } if (this.inputFactory == null && this.outputFactory == null && w instanceof CloneableWidget) { this.widgetFactory = (CloneableWidget) w; } }
Example #9
Source File: DataSetEditorTest.java From dashbuilder with Apache License 2.0 | 6 votes |
protected void assertViewNotUsed() { verify(view, times(0)).init(any(DataSetEditor.class)); verify(view, times(0)).initWidgets( any(DataSetDefBasicAttributesEditor.View.class), any(IsWidget.class), any(DataSetDefColumnsFilterEditor.View.class), any(DataSetDefPreviewTable.View.class), any(DataSetDefCacheAttributesEditorView.class), any(DataSetDefCacheAttributesEditorView.class), any(DataSetDefRefreshAttributesEditor.View.class) ); verify(view, times(0)).addConfigurationTabItemClickHandler(any(Command.class)); verify(view, times(0)).addPreviewTabItemClickHandler(any(Command.class)); verify(view, times(0)).addAdvancedTabItemClickHandler(any(Command.class)); verify(view, times(0)).showConfigurationTab(); verify(view, times(0)).showPreviewTab(); verify(view, times(0)).showAdvancedTab(); verify(view, times(0)).openColumnsFilterPanel(anyString()); verify(view, times(0)).closeColumnsFilterPanel(anyString()); verify(view, times(0)).showErrorNotification(any(SafeHtml.class)); verify(view, times(0)).clearErrorNotification(); }
Example #10
Source File: NavTabListDragComponent.java From dashbuilder with Apache License 2.0 | 5 votes |
@Override public IsWidget getPreviewWidget(RenderingContext ctx) { IsWidget widget = super.getPreviewWidget(ctx); widget.asWidget().getElement().getStyle().setPosition(Style.Position.ABSOLUTE); widget.asWidget().getElement().getStyle().setWidth(96, Style.Unit.PCT); return widget; }
Example #11
Source File: TableEditorBody.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void add(IsWidget w) { super.add(w); if (w instanceof AbstractTableColumn) { this.addColumn((AbstractTableColumn) w); } }
Example #12
Source File: PageDecorator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void setWidget(IsWidget w) { if (w == null) { return; } viewContainer.setWidget(w); }
Example #13
Source File: ColumnHostView.java From core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void setInSlot(Object slot, IsWidget content) { this.locked = true; if (slot == HostMgmtPresenter.TYPE_MainContent) { if(content!=null) { contentCanvas.getElement().setAttribute("presenter-view", "true"); setContent(content); } else contentCanvas.clear(); } this.locked = false; }
Example #14
Source File: TooltipEditorFactory.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <A, B extends Editor> EditorLabel newTooltip(IsWidget target, String tooltipMessage) { Tooltip tooltip = new Tooltip(); tooltip.setText(tooltipMessage); tooltip.setWidget(target); return tooltip; }
Example #15
Source File: SampleDecorator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void setWidget(IsWidget w) { this.sampleContent.setWidget(w); if (w instanceof HasSources) { this.addSources(((HasSources) w).getSourcesMap()); } }
Example #16
Source File: JavaKeywordAssistHandler.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public String getQueryText(IsWidget textInput) { CodeInput codeInput = (CodeInput) textInput; String currentText = codeInput.getText(); int cursorPos = codeInput.getCursorPosition(); return currentText.substring( this.getCurrentTokenStartIndex(currentText, cursorPos), cursorPos).trim(); }
Example #17
Source File: DataSetEditWorkflowTest.java From dashbuilder with Apache License 2.0 | 5 votes |
@Test public void testShowAdvancedTab() { presenter.editor = editor; presenter.showAdvancedTab(); verify( editor, times( 1 ) ).showAdvancedTab(); verify( editor, times( 0 ) ).showPreviewTab(); verify( editor, times( 0 ) ).showConfigurationTab(); verify( view, times( 0 ) ).clearView(); verify( view, times( 0 ) ).add( any( IsWidget.class ) ); verify( view, times( 0 ) ).init( presenter ); verify( view, times( 0 ) ).addButton( anyString(), anyString(), anyBoolean(), any( Command.class ) ); verify( view, times( 0 ) ).clearButtons(); }
Example #18
Source File: DataSetDefFilterEditorTest.java From dashbuilder with Apache License 2.0 | 5 votes |
@Test public void testInitFilterEditor() throws Exception { tested.value = filter1; tested.init(dataSetMetadata); verify(view).setWidget(any(IsWidget.class)); verify(dataSetFilterEditor).init(eq(filter2), eq(dataSetMetadata)); }
Example #19
Source File: MainLayoutViewImpl.java From core with GNU Lesser General Public License v2.1 | 5 votes |
public void setMainContent(IsWidget content) { mainContentPanel.clear(); if (content != null) { mainContentPanel.add(content); } }
Example #20
Source File: DataSetDefRefreshAttributesEditorTest.java From dashbuilder with Apache License 2.0 | 5 votes |
@Test public void testRefreshEnabledButtonHandlerDisabled() { presenter.isRefreshEnabled = false; presenter.refreshEnabledButtonHandler.execute(); assertEquals(true, presenter.isRefreshEnabled()); verify(refreshTime, times(1)).setEnabled(true); verify(refreshAlways, times(1)).setEnabled(true); verify(view, times(1)).setEnabled(true); verify(view, times(0)).init(presenter); verify(view, times(0)).initWidgets(any(IsWidget.class), any(DataSetDefRefreshIntervalEditor.View.class)); verify(view, times(0)).addRefreshEnabledButtonHandler(any(Command.class)); }
Example #21
Source File: DataSetDefPreviewTableTest.java From dashbuilder with Apache License 2.0 | 5 votes |
@Test public void testDraw() throws Exception { tested.tableDisplayer = displayer; tested.draw(displayerListener); verify(displayer, times(1)).addListener(displayerListener); verify(displayer, times(1)).draw(); verify(view, times(1)).setDisplayer(any(IsWidget.class)); verify(view, times(0)).init(tested); verify(view, times(0)).clear(); }
Example #22
Source File: DataSetDefRefreshAttributesEditorTest.java From dashbuilder with Apache License 2.0 | 5 votes |
@Test public void testInit() { presenter.init(); verify(refreshTime, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(view, times(1)).init(presenter); verify(view, times(1)).initWidgets(any(IsWidget.class), any(DataSetDefRefreshIntervalEditor.View.class)); verify(view, times(1)).addRefreshEnabledButtonHandler(any(Command.class)); verify(view, times(0)).setEnabled(anyBoolean()); }
Example #23
Source File: DataSetBasicAttributesWorkflowTest.java From dashbuilder with Apache License 2.0 | 5 votes |
@Test public void testBasicAttributesEdition() { DataSetDef def = mock( DataSetDef.class ); presenter.edit( def ).basicAttributesEdition(); verify( beanManager, times( 2 ) ).lookupBean( DataSetDefBasicAttributesDriver.class ); verify( dataSetDefBasicAttributesDriver, times( 2 ) ).initialize( basicAttributesEditor ); verify( dataSetDefBasicAttributesDriver, times( 2 ) ).edit( def ); verify( view, times( 2 ) ).clearView(); verify( view, times( 2 ) ).add( any( IsWidget.class ) ); verify( view, times( 0 ) ).init( presenter ); verify( view, times( 0 ) ).addButton( anyString(), anyString(), anyBoolean(), any( Command.class ) ); verify( view, times( 0 ) ).clearButtons(); }
Example #24
Source File: DataSetDefPreviewTableTest.java From dashbuilder with Apache License 2.0 | 5 votes |
@Test public void testInit() throws Exception { tested.init(); verify(view, times(1)).init(tested); verify(view, times(0)).setDisplayer(any(IsWidget.class)); verify(view, times(0)).clear(); }
Example #25
Source File: ColumnServerView.java From core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void setInSlot(Object slot, IsWidget content) { if (slot == ServerMgmtApplicationPresenter.TYPE_MainContent) { if(content!=null) { Widget w = content.asWidget(); w.getElement().setAttribute("presenter-view", "true"); setContent(w); } else contentCanvas.clear(); } }
Example #26
Source File: DataSetEditorWorkflowTest.java From dashbuilder with Apache License 2.0 | 5 votes |
@Test public void testCancelButtonCommand() { presenter.cancelButtonCommand.execute(); verify(cancelRequestEvent, times(1)).fire(any(CancelRequestEvent.class)); verify(saveRequestEvent, times(0)).fire(any(SaveRequestEvent.class)); verify(testDataSetEvent, times(0)).fire(any(TestDataSetRequestEvent.class)); verify(view, times(0)).clearButtons(); verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class)); verify(view, times(0)).add(any(IsWidget.class)); verify(view, times(0)).init(presenter); verify(view, times(0)).clearView(); }
Example #27
Source File: DataSetDefClientCacheAttributesEditorTest.java From dashbuilder with Apache License 2.0 | 5 votes |
@Test public void testSetRange() { presenter.setRange(1d, 2d); verify(view, times(1)).setRange(1d, 2d); verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class)); verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class)); verify(view, times(0)).setValue(anyDouble()); verify(view, times(0)).setEnabled(anyBoolean()); }
Example #28
Source File: SelectPatchStep.java From core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected IsWidget body(final ApplyContext context) { FormPanel form = new FormPanel(); FlowPanel panel = new FlowPanel(); form.setWidget(panel); panel.add(new Label(Console.CONSTANTS.patch_manager_select_patch_body())); if (!context.standalone) { info = new HTML(""); info.getElement().getStyle().setMarginTop(2, Style.Unit.EM); panel.add(info); } FlowPanel uploadPanel = new FlowPanel(); uploadPanel.getElement().getStyle().setMarginTop(2, Style.Unit.EM); InlineLabel uploadLabel = new InlineLabel(Console.CONSTANTS.patch_manager_select_patch_upload()); uploadLabel.getElement().getStyle().setMarginRight(1, Style.Unit.EM); uploadPanel.add(uploadLabel); context.fileUpload = new FileUpload(); context.fileUpload.setName("patch_file"); context.fileUpload.getElement().setId(asId(PREFIX, getClass(), "_Upload")); uploadPanel.add(context.fileUpload); panel.add(uploadPanel); errorMessages = new HTML( "<i class=\"icon-exclamation-sign\"></i> " + Console.CONSTANTS.patch_manager_select_file()); errorMessages.addStyleName("error"); errorMessages.setVisible(false); panel.add(errorMessages); return form; }
Example #29
Source File: DataSetDefColumnsFilterEditorTest.java From dashbuilder with Apache License 2.0 | 5 votes |
@Test public void testInit() throws Exception { tested.init(); verify(view, times(1)).init(tested); verify(view, times(1)).initWidgets(any(IsWidget.class), any(DataSetDefFilterEditor.View.class)); verify(view, times(0)).setMaxHeight(anyString()); }
Example #30
Source File: DataSetDefEditorPresenterTest.java From dashbuilder with Apache License 2.0 | 5 votes |
@Test public void testOnErrorEvent() { ErrorEvent event = mock(ErrorEvent.class); when(event.getClientRuntimeError()).thenReturn(null); when(event.getMessage()).thenReturn("errorMessage"); presenter.onErrorEvent(event); verify(editWorkflow, times(0)).clear(); verify(editWorkflow, times(0)).clearButtons(); verify(editWorkflow, times(0)).showTestButton(); verify(editWorkflow, times(0)).showNextButton(); verify(editWorkflow, times(0)).showBackButton(); verify(editWorkflow, times(0)).edit(any(DataSetDef.class), any(List.class)); verify(errorPopupPresenter, times(1)).showMessage(anyString()); verify(view, times(0)).setWidget(any(IsWidget.class)); }