List of usage examples for com.google.gwt.core.client JavaScriptObject createObject
public static native JavaScriptObject createObject() ;
From source file:org.eclipse.che.ide.editor.orion.client.OrionEditorWidget.java
License:Open Source License
public void showErrors(AnnotationModelEvent event) { List<Annotation> addedAnnotations = event.getAddedAnnotations(); JsArray<OrionProblemOverlay> jsArray = JsArray.createArray().cast(); AnnotationModel annotationModel = event.getAnnotationModel(); for (Annotation annotation : addedAnnotations) { Position position = annotationModel.getPosition(annotation); OrionProblemOverlay problem = JavaScriptObject.createObject().cast(); problem.setDescription(annotation.getText()); problem.setStart(position.getOffset()); problem.setEnd(position.getOffset() + position.getLength()); problem.setId("che-annotation"); problem.setSeverity(getSeverity(annotation.getType())); jsArray.push(problem);/*from w w w . j a v a 2 s . co m*/ } editorOverlay.showProblems(jsArray); }
From source file:org.eclipse.che.ide.editor.orion.client.OrionUndoRedo.java
License:Open Source License
@Override public void beginCompoundChange() { this.undoStack.startCompoundChange(JavaScriptObject.createObject()); }
From source file:org.eurekastreams.web.client.ui.pages.master.ApplicationEntryPoint.java
License:Apache License
/** * Get the people from the server, convert them to JSON, and feed them back to the handler. * * @param ntids//from ww w. j av a 2 s . co m * the ntids. * @param callbackIndex * the callback index. */ public static void bulkGetPeople(final String[] ntids, final int callbackIndex) { Session.getInstance().getEventBus().addObserver(GotBulkEntityResponseEvent.class, new Observer<GotBulkEntityResponseEvent>() { public void update(final GotBulkEntityResponseEvent arg1) { List<String> ntidList = Arrays.asList(ntids); JsArray<JavaScriptObject> personJSONArray = (JsArray<JavaScriptObject>) JavaScriptObject .createArray(); int count = 0; if (ntidList.size() == arg1.getResponse().size()) { boolean notCorrectResponse = false; for (Serializable person : arg1.getResponse()) { PersonModelView personMV = (PersonModelView) person; if (ntidList.contains(personMV.getAccountId())) { AvatarUrlGenerator urlGen = new AvatarUrlGenerator(EntityType.PERSON); String imageUrl = urlGen.getSmallAvatarUrl(personMV.getAvatarId()); JsArrayString personJSON = (JsArrayString) JavaScriptObject.createObject(); personJSON.set(0, personMV.getAccountId()); personJSON.set(1, personMV.getDisplayName()); personJSON.set(2, imageUrl); personJSONArray.set(count, personJSON); count++; } else { notCorrectResponse = true; break; } } if (!notCorrectResponse) { callGotBulkPeopleCallback(personJSONArray, callbackIndex); } } } }); ArrayList<StreamEntityDTO> entities = new ArrayList<StreamEntityDTO>(); for (int i = 0; i < ntids.length; i++) { StreamEntityDTO dto = new StreamEntityDTO(); dto.setUniqueIdentifier(ntids[i]); dto.setType(EntityType.PERSON); entities.add(dto); } if (ntids.length == 0) { JsArray<JavaScriptObject> personJSONArray = (JsArray<JavaScriptObject>) JavaScriptObject.createArray(); callGotBulkPeopleCallback(personJSONArray, callbackIndex); } else { BulkEntityModel.getInstance().fetch(entities, false); } }
From source file:org.fornax.cartridges.sculptor.smartclient.client.DetailForm.java
License:Apache License
private void updateDataInDS() { DataSource ds = internalForm.getDataSource(); boolean isFileUpload = JSOHelper.getAttributeAsBoolean(ds.getJsObj(), "isFileUpload"); if (isFileUpload) { uploadFiles();//from ww w. j ava 2s .c o m } JavaScriptObject fieldNames = GuiUtil.getFieldNames(ds); for (int i = 0; i < JSOHelper.getArrayLength(fieldNames); i++) { String fieldName = JSOHelper.getArrayValue(fieldNames, i); String type = ds.getField(fieldName).getAttribute("type"); if (type == null) { // normal field - do nothing } else if (type.equals("AssociationToManyPicklist")) { } else if (type.equals("AssociationToMany")) { GWT.log("Save AssociationToMany for " + fieldName, null); // Iterate through recods in list ListGrid aggrList = (ListGrid) aggrSubForm.get(fieldName); ListGridRecord[] selRecords = aggrList.getSelection(); JavaScriptObject result = JavaScriptObject.createObject(); for (int j = 0; j < selRecords.length; j++) { JSOHelper.setAttribute(result, "f" + j, selRecords[j].getAttribute("id")); } JavaScriptObject values = getValues(internalForm); JSOHelper.setAttribute(values, fieldName, result); } else if (type.equals("AssociationToManyMap")) { } else if (type.equals("AggregationToOne")) { DynamicForm subForm = (DynamicForm) aggrSubForm.get(fieldName); JavaScriptObject values = getValues(subForm); internalForm.setValue(fieldName, values); } else if (type.equals("AggregationToMany")) { ListGrid subList = (ListGrid) aggrSubForm.get(fieldName); ListGridRecord[] records = subList.getRecords(); JavaScriptObject valArray = JavaScriptObject.createObject(); for (int j = 0; j < records.length; j++) { JSOHelper.setAttribute(valArray, "f" + j, records[j].getJsObj()); } JavaScriptObject values = getValues(internalForm); JSOHelper.setAttribute(values, fieldName, valArray); } } }
From source file:org.geomajas.codemirror.client.Config.java
License:Open Source License
/** * Creates a new empty configuration object, that can be used to create a codemirror editor. * * @see CodeMirrorWrapper */ @Api public Config() { container = JavaScriptObject.createObject(); }
From source file:org.gwt.dynamic.common.client.jso.ModuleInfo.java
License:MIT License
public static final ModuleInfo create() { return JavaScriptObject.createObject().cast(); }
From source file:org.gwtbootstrap3.extras.bootbox.client.options.AlertOptions.java
License:Apache License
/** * Creates a new {@link AlertOptions}.//from w w w . j a va2 s. com * * @param message * @return */ public static final AlertOptions newOptions(final String message) { AlertOptions options = JavaScriptObject.createObject().cast(); options.setMessage(message); return options; }
From source file:org.gwtbootstrap3.extras.bootbox.client.options.ConfirmOptions.java
License:Apache License
/** * Creates a new {@link ConfirmOptions}. * * @param message// ww w . j a va 2 s. c o m * @return */ public static final ConfirmOptions newOptions(final String message) { ConfirmOptions options = JavaScriptObject.createObject().cast(); options.setMessage(message); options.setCallback(ConfirmCallback.DEFAULT_CONFIRM_CALLBACK); return options; }
From source file:org.gwtbootstrap3.extras.bootbox.client.options.DialogOptions.java
License:Apache License
/** * Creates a new {@link DialogOptions}./*from w w w . j a v a2 s. c o m*/ * * @param message * @return */ public static DialogOptions newOptions(final String message) { DialogOptions options = JavaScriptObject.createObject().cast(); options.setMessage(message); return options; }
From source file:org.gwtbootstrap3.extras.bootbox.client.options.PromptOptions.java
License:Apache License
/** * Creates a new {@link PromptOptions}.//from ww w . j ava 2 s .c om * * @param message * @return */ public static final PromptOptions newOptions(final String message) { PromptOptions options = JavaScriptObject.createObject().cast(); options.setMessage(message); options.setCallback(PromptCallback.DEFAULT_PROMPT_CALLBACK); return options; }