/** * Get the double value associated with a key. * * @param key * A key string. * @return The numeric value. * @throws JSONException * if the key is not found or if the value is not a Number * object and cannot be converted to a number. */ public double getDouble(String key) throws JSONException { return this.getNumber(key).doubleValue(); }
/** * Get the long value associated with a key. * * @param key * A key string. * @return The long value. * @throws JSONException * if the key is not found or if the value cannot be converted * to a long. */ public long getLong(String key) throws JSONException { return this.getNumber(key).longValue(); }
/** * Get the int value associated with a key. * * @param key * A key string. * @return The integer value. * @throws JSONException * if the key is not found or if the value cannot be converted * to an integer. */ public int getInt(String key) throws JSONException { return this.getNumber(key).intValue(); }
/** * Get the float value associated with a key. * * @param key * A key string. * @return The numeric value. * @throws JSONException * if the key is not found or if the value is not a Number * object and cannot be converted to a number. */ public float getFloat(String key) throws JSONException { return this.getNumber(key).floatValue(); }
/** * Get the double value associated with a key. * * @param key * A key string. * @return The numeric value. * @throws JSONException * if the key is not found or if the value is not a Number * object and cannot be converted to a number. */ public double getDouble(String key) throws JSONException { return this.getNumber(key).doubleValue(); }
/** * Get the float value associated with a key. * * @param key * A key string. * @return The numeric value. * @throws JSONException * if the key is not found or if the value is not a Number * object and cannot be converted to a number. */ public float getFloat(String key) throws JSONException { return this.getNumber(key).floatValue(); }
/** * Get the int value associated with a key. * * @param key * A key string. * @return The integer value. * @throws JSONException * if the key is not found or if the value cannot be converted * to an integer. */ public int getInt(String key) throws JSONException { return this.getNumber(key).intValue(); }
/** * Get the long value associated with a key. * * @param key * A key string. * @return The long value. * @throws JSONException * if the key is not found or if the value cannot be converted * to a long. */ public long getLong(String key) throws JSONException { return this.getNumber(key).longValue(); }
@Override @Nullable public MindMap doImport(@Nonnull final MindMapPanel panel, @Nonnull final DialogProvider dialogProvider, @Nullable final Topic actionTopic, @Nonnull @MustNotContainNull final Topic[] selectedTopics) throws Exception { final File file = this.selectFileForExtension(panel, Texts.getString("MMDImporters.Mindmup2MindMap.openDialogTitle"), "mup", "Mindmup files (.MUP)", Texts.getString("MMDImporters.ApproveImport")); if (file == null) { return null; } final JSONObject parsedJson; parsedJson = new JSONObject(FileUtils.readFileToString(file, "UTF-8")); MindMap resultedMap = null; final Number formatVersion = parsedJson.getNumber("formatVersion"); if (formatVersion == null) { dialogProvider.msgError(null, Texts.getString("MMDImporters.Mindmup2MindMap.Error.WrongFormat")); } else { resultedMap = new MindMap(null, true); resultedMap.setAttribute(MindMapPanel.ATTR_SHOW_JUMPS, "true"); final Topic mindMapRoot = Assertions.assertNotNull(resultedMap.getRoot()); final Map<Long, Topic> mapTopicId = new HashMap<Long, Topic>(); parseTopic(resultedMap, null, mindMapRoot, parsedJson, mapTopicId); if (!mindMapRoot.getExtras().containsKey(Extra.ExtraType.FILE)) { mindMapRoot.setExtra(new ExtraFile(new MMapURI(null, file, null))); } if (parsedJson.has("links")) { final JSONArray links = parsedJson.getJSONArray("links"); processLinks(resultedMap, links, mapTopicId); } } return resultedMap; }