Java Code Examples for com.google.gwt.core.client.GWT#create()
The following examples show how to use
com.google.gwt.core.client.GWT#create() .
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: ItemIdClientCriterionTest.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
@Test @Description("Verifies that drag source is valid for the configured id (prefix mode)") public void matchInPrefixMode() { final ItemIdClientCriterion cut = new ItemIdClientCriterion(); // prepare drag-event: final String testId = "thisId"; final VDragEvent dragEvent = CriterionTestHelper.createMockedVDragEvent(testId); // prepare configuration: final UIDL uidl = GWT.create(UIDL.class); final String configuredId = "component0"; final String prefix = "this"; when(uidl.getStringAttribute(configuredId)).thenReturn(prefix); final String configuredMode = "m"; final String prefixMode = "p"; when(uidl.getStringAttribute(configuredMode)).thenReturn(prefixMode); final String count = "c"; when(uidl.getIntAttribute(count)).thenReturn(1); // act final boolean result = cut.accept(dragEvent, uidl); // verify that in strict mode: [thisId startsWith this] assertThat(result).as("Expected: [" + testId + " startsWith " + prefix + "].").isTrue(); }
Example 2
Source File: DatasetTreeLoader.java From EasyML with Apache License 2.0 | 6 votes |
/** * TODO: query the programs by users * * @param userEmail used to filter myDatasets */ public static DatasetTree load(final String userEmail) { final DatasetTree tree = new DatasetTree(); DatasetServiceAsync svc = GWT.create(DatasetService.class); svc.load(new AsyncCallback<List<Dataset>>() { @Override public void onFailure(Throwable caught) { logger.info("Failed to load data component:" + caught.getMessage()); } @Override public void onSuccess(List<Dataset> result) { for (Dataset m : result) { if (!m.getDeprecated()) { DatasetLeaf node = new DatasetLeaf(m); addDatasetLeaf(tree, node, userEmail); addContextMenu(tree,node); } } } }); return tree; }
Example 3
Source File: VertexStyleComboBox.java From geowe-core with GNU General Public License v3.0 | 6 votes |
public VertexStyleComboBox(String width) { super(new ListStore<VertexStyleDef>( ((VertexStyleDefProperties)GWT.create(VertexStyleDefProperties.class)).key()), ((VertexStyleDefProperties)GWT.create(VertexStyleDefProperties.class)).name(), new AbstractSafeHtmlRenderer<VertexStyleDef>() { final VertexStyleComboTemplates comboBoxTemplates = GWT .create(VertexStyleComboTemplates.class); public SafeHtml render(VertexStyleDef item) { return comboBoxTemplates.vertexStyle(item.getImage() .getSafeUri(), item.getName()); } }); setWidth(width); setTypeAhead(true); setEmptyText(UIMessages.INSTANCE.sbLayerComboEmptyText()); setTriggerAction(TriggerAction.ALL); setForceSelection(true); setEditable(false); enableEvents(); getStore().addAll(VertexStyles.getAll()); }
Example 4
Source File: DropboxService.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static DropboxServiceAsync get() { if (instance == null) { instance = GWT.create(DropboxService.class); ((ServiceDefTarget) instance).setRpcRequestBuilder(new LDRpcRequestBuilder()); } return instance; }
Example 5
Source File: ProxyAndAnonymousClassSerializationGwtTest.java From gwt-jackson with Apache License 2.0 | 5 votes |
public void testSerializationAnonymousClass() { AbstractBeanWriter writer = GWT.create( AbstractBeanWriter.class ); String json = writer.write( new AbstractBean() { @Override public int getId() { return 54; } @Override public String getName() { return "Toto"; } } ); assertEquals( "{\"id\":54,\"name\":\"Toto\"}", json ); }
Example 6
Source File: ProgramDeprecateMenu.java From EasyML with Apache License 2.0 | 5 votes |
public static MenuItem create(final ProgramLeaf node) { Command command = new MenuItemCommand(node) { @Override public void execute() { String id = node.getModule().getId(); boolean y = Window.confirm("Are you ready to deprecate " + node.getModule().getName() + "?"); if (y) { ProgramServiceAsync svc = GWT.create(ProgramService.class); svc.deprecate(id, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } @Override public void onSuccess(Void result) { node.delete(); } }); } this.component.getContextMenu().hide(); } }; MenuItem item = new MenuItem("deprecate", command); return item; }
Example 7
Source File: AuditService.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static AuditServiceAsync get() { if (instance == null) { instance = GWT.create(AuditService.class); ((ServiceDefTarget) instance).setRpcRequestBuilder(new LDRpcRequestBuilder()); } return instance; }
Example 8
Source File: ViewClientCriterionTest.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
@Test @Description("Exception occures when processing serialized config for hiding the drop hints.") public void exceptionWhenProcessingDropTargetHintsDataStructure() { final ViewClientCriterion cut = new ViewClientCriterion(); // prepare configuration: final Document document = Document.get(); final UIDL uidl = GWT.create(UIDL.class); when(uidl.getIntAttribute("cdac")).thenReturn(2); when(uidl.getStringAttribute("dac0")).thenReturn("no-problem"); when(uidl.getStringAttribute("dac1")).thenReturn("problem-bear"); doThrow(new RuntimeException()).when(uidl).getStringAttribute("dac1"); // act try { cut.hideDropTargetHints(uidl); // assure that no-problem was invoked anyway verify(document).getElementById("no-problem"); // cross-check that problem-bear was never invoked verify(document, Mockito.never()).getElementById("problem-bear"); } catch (final RuntimeException re) { fail("Exception is not re-thrown in order to continue with the loop"); } finally { reset(Document.get()); } }
Example 9
Source File: AceEditorConnector.java From cuba with Apache License 2.0 | 5 votes |
@Override protected Widget createWidget() { AceEditorWidget widget = GWT.create(AceEditorWidget.class); widget.addTextChangeListener(this); widget.addSelectionChangeListener(this); widget.setFocusChangeListener(this); return widget; }
Example 10
Source File: UTCTimeBox.java From gwt-traction with Apache License 2.0 | 5 votes |
/** * Allows a UTCTimeBox to be created with a specified format. */ public UTCTimeBox(DateTimeFormat timeFormat) { // used deferred binding for the implementation impl = GWT.create(UTCTimeBoxImpl.class); impl.setTimeFormat(timeFormat); initWidget(impl.asWidget()); }
Example 11
Source File: TemplateService.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static TemplateServiceAsync get() { if (instance == null) { instance = GWT.create(TemplateService.class); ((ServiceDefTarget) instance).setRpcRequestBuilder(new LDRpcRequestBuilder()); } return instance; }
Example 12
Source File: PopupChromeFactory.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
/** * Returns the singleton popup chrome provider. */ public static PopupChromeProvider getProvider() { if (provider == null) { provider = GWT.create(PopupChromeProvider.class); } return provider; }
Example 13
Source File: Minimal.java From gwt-jackson with Apache License 2.0 | 5 votes |
@Override public void onModuleLoad() { PersonMapper mapper = GWT.create( PersonMapper.class ); String json = mapper.write( new Person( "John", "Doe" ) ); GWT.log( json ); // > {"firstName":"John","lastName":"Doe"} Person person = mapper.read( json ); GWT.log( person.getFirstName() + " " + person.getLastName() ); // > John Doe }
Example 14
Source File: GwtSerializerTest.java From auto with Apache License 2.0 | 4 votes |
@Override public void gwtSetUp() { testService = GWT.create(TestService.class); }
Example 15
Source File: WorkflowTaskDataSource.java From proarc with GNU General Public License v3.0 | 4 votes |
public WorkflowTaskDataSource() { setID(ID); setDataURL(RestConfig.URL_WORKFLOW_TASK); final ClientMessages i18n = GWT.create(ClientMessages.class); allTaskStates = new LinkedHashMap<String, String>() {{ put(State.WAITING.name(), i18n.WorkflowTask_State_Waiting_Title()); put(State.READY.name(), i18n.WorkflowTask_State_Ready_Title()); put(State.STARTED.name(), i18n.WorkflowTask_State_Started_Title()); put(State.FINISHED.name(), i18n.WorkflowTask_State_Finished_Title()); put(State.CANCELED.name(), i18n.WorkflowTask_State_Canceled_Title()); }}; DataSourceIntegerField fieldId = new DataSourceIntegerField(FIELD_ID); fieldId.setPrimaryKey(Boolean.TRUE); fieldId.setDetail(true); fieldId.setTitle(i18n.WorkflowTask_Field_Id_Title()); fieldId.setCanEdit(false); DataSourceTextField label = new DataSourceTextField(FIELD_LABEL); label.setTitle(i18n.WorkflowTask_Field_Label_Title()); label.setLength(255); label.setCanEdit(false); DataSourceTextField jobId = new DataSourceTextField(FIELD_JOB_ID); jobId.setTitle(i18n.WorkflowTask_Field_JobId_Title()); jobId.setDetail(true); jobId.setCanEdit(false); DataSourceTextField jobLabel = new DataSourceTextField(FIELD_JOB_LABEL); jobLabel.setTitle(i18n.WorkflowTask_Field_JobLabel_Title()); jobLabel.setDetail(true); jobLabel.setCanEdit(false); DataSourceEnumField state = new DataSourceEnumField(FIELD_STATE); state.setTitle(i18n.WorkflowTask_Field_State_Title()); state.setValueMap(allTaskStates); state.setRequired(true); DataSourceTextField owner = new DataSourceTextField(FIELD_OWNER); owner.setTitle(i18n.WorkflowTask_Field_Owner_Title()); owner.setDisplayField(WorkflowModelConsts.TASK_OWNERNAME); DataSourceTextField note = new DataSourceTextField(FIELD_NOTE); note.setTitle(i18n.WorkflowTask_Field_Note_Title()); note.setDetail(true); DataSourceTextField type = new DataSourceTextField(FIELD_TYPE); type.setTitle(i18n.WorkflowTask_Field_Profile_Title()); type.setDetail(true); type.setCanEdit(false); DataSourceEnumField priority = new DataSourceEnumField(FIELD_PRIORITY); priority.setTitle(i18n.WorkflowTask_Field_Priority_Title()); priority.setDetail(true); priority.setValueMap(new LinkedHashMap() {{ put("1", i18n.Workflow_Priority_1_Title()); put("2", i18n.Workflow_Priority_2_Title()); put("3", i18n.Workflow_Priority_3_Title()); put("4", i18n.Workflow_Priority_4_Title()); }}); DataSourceDateTimeField created = new DataSourceDateTimeField(FIELD_CREATED); created.setTitle(i18n.WorkflowTask_Field_Created_Title()); created.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME); created.setCanEdit(false); created.setDetail(true); DataSourceDateTimeField modified = new DataSourceDateTimeField(FIELD_MODIFIED); modified.setTitle(i18n.WorkflowTask_Field_Modified_Title()); modified.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME); modified.setCanEdit(false); modified.setDetail(true); DataSourceField params = new DataSourceField(FIELD_PARAMETERS, FieldType.ANY); params.setHidden(true); DataSourceField materials = new DataSourceField(FIELD_MATERIALS, FieldType.ANY); materials.setHidden(true); setFields(label, type, state, priority, owner, created, modified, fieldId, note, jobId, jobLabel, params, materials); setRequestProperties(RestConfig.createRestRequest(getDataFormat())); setOperationBindings( RestConfig.createAddOperation(), // RestConfig.createDeleteOperation(), RestConfig.createUpdatePostOperation()); }
Example 16
Source File: UrlCodec.java From requestor with Apache License 2.0 | 4 votes |
public static UrlCodec getInstance() { if (INSTANCE == null) INSTANCE = GWT.create(UrlCodec.class); return INSTANCE; }
Example 17
Source File: ErrorManager.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 3 votes |
/** * Get the singleton. * <p> * The singleton is created thanks to GWT.create(ErrorManager.class). So you can use your own * implementation by overring it in your .gwt.xml * </p> * * <pre> * <replace-with class="{your instance}"> * <when-type-is class="fr.putnami.pwt.core.error.client.ErrorManager"> * </replace-with> * </pre> * * @return the error manager */ public static ErrorManager get() { if (ErrorManager.instance == null) { ErrorManager.instance = GWT.create(ErrorManager.class); } return ErrorManager.instance; }
Example 18
Source File: Profiler.java From flow with Apache License 2.0 | 2 votes |
/** * Checks whether the profiling gathering is enabled. * * @return <code>true</code> if the profiling is enabled, else * <code>false</code> */ public static boolean isEnabled() { // This will be fully inlined by the compiler Profiler create = GWT.create(Profiler.class); return create.isImplEnabled(); }
Example 19
Source File: JsonSerializationContext.java From gwt-jackson with Apache License 2.0 | 2 votes |
/** * <p>builder</p> * * @return a {@link com.github.nmorel.gwtjackson.client.JsonSerializationContext.Builder} object. */ public static Builder builder() { return GWT.create( Builder.class ); }
Example 20
Source File: MessageSender.java From flow with Apache License 2.0 | 2 votes |
/** * Creates a new instance connected to the given registry. * * @param registry * the global registry */ public MessageSender(Registry registry) { this.registry = registry; this.pushConnectionFactory = GWT.create(PushConnectionFactory.class); }