/** * Returns a JLabel displaying abstracts. */ @SuppressWarnings("rawtypes") public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel listCellRendererComponent = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); listCellRendererComponent.setText((((RcAbstractMetadata) value).getLanguage() != null ? "[" + ((RcAbstractMetadata) value).getLanguage().name() + "] " : "") + ((RcAbstractMetadata) value).getAbstract()); listCellRendererComponent.setIcon(this.abstractIcon); return listCellRendererComponent; } }
/** * Add a collection abstract */ private void addAbstract() { RcAbstractMetadata rcAbstractMd = new RcAbstractMetadata(this.getCollectionMetadata()); RcAbstractMetadataJDialog d = new RcAbstractMetadataJDialog(this.getWindow(), "Add Abstract", rcAbstractMd); d.setVisible(true); if (!d.getCanceled()) { this.getCollectionMetadata().getAbstracts().add(rcAbstractMd); this.rcRefreshAbstractsJList(); this.abstractsJList.setSelectedValue(rcAbstractMd, true); this.setChanged(); } }
private JSONArray getDescriptions(List<RcAbstractMetadata> rcAbstractMdList) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { JSONArray descriptions = new JSONArray(); JSONObject description; for (RcAbstractMetadata rcAbstractMd : rcAbstractMdList) { description = this.newOrderedJSONObject(); descriptions.put(description); description.put("@value", rcAbstractMd.getAbstract()); if (rcAbstractMd.getLanguage() != null) { description.put("@language", rcAbstractMd.getLanguage().getAlpha2() != null ? rcAbstractMd.getLanguage().getAlpha2() : rcAbstractMd.getLanguage().getAlpha3()); } } return descriptions; }