当前位置: 首页>>代码示例>>Java>>正文


Java Json.createObject方法代码示例

本文整理汇总了Java中elemental.json.Json.createObject方法的典型用法代码示例。如果您正苦于以下问题:Java Json.createObject方法的具体用法?Java Json.createObject怎么用?Java Json.createObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在elemental.json.Json的用法示例。


在下文中一共展示了Json.createObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showRoute

import elemental.json.Json; //导入方法依赖的package包/类
private void showRoute(String start, String end, boolean debounce) {
    JsonObject properties = Json.createObject();
    properties.put("start", start);
    properties.put("end", end);
    properties.put("debounce", debounce);
    getElement().callFunction("setProperties", properties);
}
 
开发者ID:vaadin,项目名称:trippy,代码行数:8,代码来源:TripMap.java

示例2: buildJson

import elemental.json.Json; //导入方法依赖的package包/类
@Override
public JsonObject buildJson() {
    JsonObject map = Json.createObject();
    JUtils.putNotNull(map, "type", type);
    JUtils.putNotNullBuilders(map, "data", data);
    JUtils.putNotNull(map, "label", label);
    JUtils.putNotNull(map, "hidden", hidden);
    JUtils.putNotNullStringListOrSingle(map, "backgroundColor", backgroundColor);
    JUtils.putNotNullStringListOrSingle(map, "borderColor", borderColor);
    JUtils.putNotNullIntListOrSingle(map, "borderWidth", borderWidth);
    JUtils.putNotNullStringListOrSingle(map, "hoverBackgroundColor", hoverBackgroundColor);
    JUtils.putNotNullStringListOrSingle(map, "hoverBorderColor", hoverBorderColor);
    JUtils.putNotNullIntListOrSingle(map, "hoverBorderWidth", hoverBorderWidth);
    JUtils.putNotNullIntListOrSingle(map, "hoverRadius", hoverRadius);
    return map;
}
 
开发者ID:moberwasserlechner,项目名称:vaadin-chartjs,代码行数:17,代码来源:BubbleDataset.java

示例3: buildJson

import elemental.json.Json; //导入方法依赖的package包/类
@Override
public JsonValue buildJson() {
    JsonObject map = Json.createObject();
    putNotNull(map, "allowMultiParagraphSelection", allowMultiParagraphSelection);
    if (buttons != null) {
        JsonArray btnList = Json.createArray();
        for (ToolbarButtonBuilder tbb : buttons) {
            btnList.set(btnList.length(), tbb.buildJson());
        }
        map.put("buttons", btnList);
    }
    putNotNull(map, "diffLeft", diffLeft);
    putNotNull(map, "diffTop", diffLeft);
    putNotNull(map, "firstButtonClass", firstButtonClass);
    putNotNull(map, "lastButtonClass", lastButtonClass);
    putNotNull(map, "standardizeSelectionStart", standardizeSelectionStart);
    putNotNull(map, "static", staticToolbar);
    // TODO relativeContainer // Toolbar is appended relative to a given DOM-Node instead of appending it to the body and position it absolute.
    //      map.put("relativeContainer", null);
    putNotNull(map, "align", align);
    putNotNull(map, "sticky", sticky);
    putNotNull(map, "stickyTopOffset", stickyTopOffset);
    putNotNull(map, "updateOnEmptySelection", updateOnEmptySelection);
    return map;
}
 
开发者ID:moberwasserlechner,项目名称:vaadin-medium-editor,代码行数:26,代码来源:Toolbar.java

示例4: buildJson

import elemental.json.Json; //导入方法依赖的package包/类
@Override
public JsonObject buildJson() {
    JsonObject map = Json.createObject();
    JUtils.putNotNull(map, "display", display);
    if (position != null) {
        JUtils.putNotNull(map, "position", position.name().toLowerCase());
    }
    JUtils.putNotNull(map, "text", text);
    JUtils.putNotNull(map, "fullWidth", fullWidth);
    JUtils.putNotNull(map, "fontSize", fontSize);
    JUtils.putNotNull(map, "fontFamily", fontFamily);
    JUtils.putNotNull(map, "fontColor", fontColor);
    JUtils.putNotNull(map, "fontStyle", fontStyle);
    JUtils.putNotNull(map, "padding", padding);
    return map;
}
 
开发者ID:moberwasserlechner,项目名称:vaadin-chartjs,代码行数:17,代码来源:Title.java

示例5: buildJson

import elemental.json.Json; //导入方法依赖的package包/类
@Override
public JsonValue buildJson() {
    JsonObject map = Json.createObject();
    if (icon != null) {
        String contentFA = icon.getHtml();
        if (iconText != null) {
            contentFA += iconText;
        }
        putNotNull(map, "contentFA", contentFA);
    }
    putNotNull(map, "contentDefault", iconFallback);
    if (customTranslation) {
        putNotNull(map, "aria", aria);
    } else {
        // get buildin translations
        putNotNull(map, "aria", toolbarBuilder.getOptionsBuilder().getTranslation(aria));
    }
    putNotNull(map, "name", name);
    putNotNull(map, "action", action == null ? name : action);
    putNotNull(map, "tagNames", tagNames);
    putNotNull(map, "style", style);
    putNotNull(map, "useQueryState", useQueryState);
    putNotNull(map, "classList", classList);
    putNotNull(map, "attrs", attrs);
    return map;
}
 
开发者ID:moberwasserlechner,项目名称:vaadin-medium-editor,代码行数:27,代码来源:ToolbarButton.java

示例6: restoreShouldCallLoadState

import elemental.json.Json; //导入方法依赖的package包/类
@Test
public void restoreShouldCallLoadState() throws Exception {
  JsonObject ws = Json.createObject();
  pref.put(WS_ID, ws);
  JsonObject workspace = Json.createObject();
  ws.put("workspace", workspace);
  JsonObject comp1 = Json.createObject();
  workspace.put("component1", comp1);
  comp1.put("key1", "value1");

  when(promiseProvider.resolve(nullable(Void.class))).thenReturn(sequentialRestore);

  appStateManager.restoreWorkspaceState();

  verify(sequentialRestore).thenPromise(sequentialRestoreThenFunction.capture());
  sequentialRestoreThenFunction.getValue().apply(null);

  ArgumentCaptor<JsonObject> stateCaptor = ArgumentCaptor.forClass(JsonObject.class);
  verify(component1).loadState(stateCaptor.capture());

  JsonObject jsonObject = stateCaptor.getValue();
  assertThat(jsonObject.hasKey("key1")).isTrue();
  assertThat(jsonObject.getString("key1")).isEqualTo("value1");
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:AppStateManagerTest.java

示例7: getState

import elemental.json.Json; //导入方法依赖的package包/类
@Override
public JsonObject getState() {
  JsonObject state = Json.createObject();
  JsonArray array = Json.createArray();
  state.put(PATH_PARAM_ID, array);

  List<String> rawPaths =
      projectExplorer
          .getTree()
          .getNodeStorage()
          .getAll()
          .stream()
          .filter(node -> projectExplorer.getTree().isExpanded(node))
          .filter(node -> node instanceof ResourceNode)
          .map(node -> ((ResourceNode) node).getData().getLocation().toString())
          .collect(Collectors.toList());

  int i = 0;
  for (String path : rawPaths) {
    array.set(i++, path);
  }

  state.put(SHOW_HIDDEN_FILES, projectExplorer.isShowHiddenFiles());

  return state;
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:ProjectExplorerStateComponent.java

示例8: shouldSaveStateInFile

import elemental.json.Json; //导入方法依赖的package包/类
@Test
public void shouldSaveStateInFile() throws Exception {
  JsonObject object = Json.createObject();
  object.put("key1", "value1");
  when(component1.getState()).thenReturn(object);

  appStateManager.persistWorkspaceState();

  verify(component1).getState();
  verify(preferencesManager).setValue(anyString(), jsonArgumentCaptor.capture());
  assertThat(jsonArgumentCaptor.getValue()).isNotNull().isNotEmpty();

  String value = jsonArgumentCaptor.getValue();
  JsonObject jsonObject = Json.parse(value).getObject(WS_ID);
  JsonObject workspace = jsonObject.getObject("workspace");
  assertThat(workspace).isNotNull();

  JsonObject jsonObject1 = workspace.getObject("component1");
  assertThat(jsonObject1.jsEquals(object)).isTrue();
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:AppStateManagerTest.java

示例9: getPartStackState

import elemental.json.Json; //导入方法依赖的package包/类
private JsonObject getPartStackState(
    PartStack partStack, WorkBenchPartController partController) {
  JsonObject state = Json.createObject();
  state.put("SIZE", partController.getSize());
  state.put("STATE", partStack.getPartStackState().name());

  if (partStack.getParts().isEmpty()) {
    state.put("HIDDEN", true);
  } else {
    if (partStack.getActivePart() != null) {
      state.put("ACTIVE_PART", partStack.getActivePart().getClass().getName());
    }

    state.put("HIDDEN", partController.isHidden());

    JsonArray parts = Json.createArray();
    state.put("PARTS", parts);
    int i = 0;
    for (PartPresenter entry : partStack.getParts()) {
      JsonObject presenterState = Json.createObject();
      presenterState.put("CLASS", entry.getClass().getName());
      parts.set(i++, presenterState);
    }
  }
  return state;
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:AbstractPerspective.java

示例10: persistWorkspaceState

import elemental.json.Json; //导入方法依赖的package包/类
public Promise<Void> persistWorkspaceState() {
  String wsId = appContext.getWorkspace().getId();
  JsonObject settings = Json.createObject();
  JsonObject workspace = Json.createObject();
  settings.put(WORKSPACE, workspace);

  for (StateComponent entry : stateComponentRegistry.get().getComponents()) {
    try {
      Log.debug(getClass(), "Persist state for the component ID: " + entry.getId());
      workspace.put(entry.getId(), entry.getState());
    } catch (Exception e) {
      Log.error(getClass(), e);
    }
  }
  JsonObject oldSettings = allWsState.getObject(wsId);
  if (oldSettings == null || !oldSettings.toJson().equals(settings.toJson())) {
    allWsState.put(wsId, settings);
    return writeStateToPreferences(allWsState);
  } else {
    return promises.resolve(null);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:AppStateManager.java

示例11: getState

import elemental.json.Json; //导入方法依赖的package包/类
@Override
public JsonObject getState() {
  JsonObject state = Json.createObject();

  EditorMultiPartStackState stacks = null;
  try {
    stacks = editorMultiPartStack.getState();
  } catch (IllegalStateException ignore) {
  }
  if (stacks != null) {
    state.put("FILES", storeEditors(stacks));
  }
  EditorPartPresenter activeEditor = getActiveEditor();
  if (activeEditor != null) {
    state.put("ACTIVE_EDITOR", activeEditor.getEditorInput().getFile().getLocation().toString());
  }
  return state;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:EditorAgentImpl.java

示例12: storeEditors

import elemental.json.Json; //导入方法依赖的package包/类
private JsonArray storeEditors(EditorPartStack partStack) {
  JsonArray result = Json.createArray();
  int i = 0;
  List<EditorPartPresenter> parts = partStack.getParts();
  for (EditorPartPresenter part : parts) {
    JsonObject file = Json.createObject();
    file.put("PATH", part.getEditorInput().getFile().getLocation().toString());
    file.put("EDITOR_PROVIDER", openedEditorsToProviders.get(part));
    if (part instanceof TextEditor) {
      file.put("CURSOR_OFFSET", ((TextEditor) part).getCursorOffset());
      file.put("TOP_VISIBLE_LINE", ((TextEditor) part).getTopVisibleLine());
    }
    if (partStack.getActivePart().equals(part)) {
      file.put("ACTIVE", true);
    }
    result.set(i++, file);
  }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:EditorAgentImpl.java

示例13: Message

import elemental.json.Json; //导入方法依赖的package包/类
public Message(String uid, Long senderId) {
	json = Json.createObject();

	json.put(MESSAGE_CLASS, this.getClass().getName());
	json.put(MESSAGE_UID, uid);
	if (senderId != null) {
		json.put(MESSAGE_SENDER, senderId);
	} else {
		json.put(MESSAGE_SENDER, Json.createNull());
	}

	defs = Json.createObject();
	json.put(MESSAGE_DEFINITIONS, defs);

	data = Json.createObject();
	json.put(MESSAGE_DATA, data);
}
 
开发者ID:tilioteo,项目名称:hypothesis,代码行数:18,代码来源:Message.java

示例14: buildJson

import elemental.json.Json; //导入方法依赖的package包/类
@Override
public JsonValue buildJson() {
    JsonObject map = Json.createObject();
    putNotNull(map, "hideDelay", hideDelay);
    putNotNull(map, "previewValueSelector", previewValueSelector);
    putNotNull(map, "showOnEmptyLinks", showOnEmptyLinks);
    putNotNull(map, "showWhenToolbarIsVisible", showWhenToolbarIsVisible);
    return map;
}
 
开发者ID:moberwasserlechner,项目名称:vaadin-medium-editor,代码行数:10,代码来源:AnchorPreview.java

示例15: buildJson

import elemental.json.Json; //导入方法依赖的package包/类
@Override
public JsonValue buildJson() {
    JsonObject map = Json.createObject();
    putNotNull(map, "forcePlainText", forcePlainText);
    putNotNull(map, "cleanPastedHTML", cleanPastedHTML);
    putNotNull(map, "cleanAttrs", cleanAttrs);
    putNotNull(map, "cleanTags", cleanTags);
    putNotNull(map, "unwrapTags", unwrapTags);
    return map;
}
 
开发者ID:moberwasserlechner,项目名称:vaadin-medium-editor,代码行数:11,代码来源:PasteHandler.java


注:本文中的elemental.json.Json.createObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。