@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column); setForeground(table.getForeground()); LinearNode linearNode = linearDefinition.getNodesByListNames().get(value); if (linearNode != null) { GazetteerList gazetteerList = linearDefinition.getListsByNode().get(linearNode); if (gazetteerList != null && gazetteerList.isModified()) { setForeground(Color.RED); } } return this; } });
} else { GazetteerList gazetteerList = linearDefinition.getListsByNode().get(selectedLinearNode); boolean found = false; for (Object object : gazetteerList) {
GazetteerList theList = null; Iterator<GazetteerList> theListsIter = gazetteer.getLinearDefinition().getListsByNode().values() .iterator(); while(theListsIter.hasNext() && listName.equals("")) {
LinearDefinition ld = gazetter.getLinearDefinition(); //add .lst record LinearNode ln = new LinearNode("glossary.lst", "minor", "major", "en", "AnnotType"); ld.add(ln); //add Lookup record Map<String, Object> features = new HashMap<>(); features.put("someFeatureName", "some value"); GazetteerNode gn = new GazetteerNode("string to be found", features); gn.setSeparator("@"); GazetteerList theList = ld.getListsByNode().get(ln); theList.add(gn); //save updated files theList.store(); ld.store(); //optionally re-init the gazetteer to make changes to work gazetter.reInit();
gazetteer.getLinearDefinition().getListsByNode(); Iterator<LinearNode> iter1 = theLists.keySet().iterator(); while(iter1.hasNext()) {
int row = e.getFirstRow(); int column = e.getColumn(); GazetteerList gazetteerList = linearDefinition.getListsByNode().get(selectedLinearNode); switch (e.getType()) { case TableModelEvent.UPDATE: linearDefinition.getListsByNode().remove(selectedLinearNode); linearDefinition.getListsByNode() .put(selectedLinearNode, gazetteerList); linearDefinition.getNodesByListNames().remove(oldListFileName); if (oldMajorType != null && oldMajorType.equals(newMajorType)) { return; } linearDefinition.getListsByNode().remove(selectedLinearNode); selectedLinearNode.setMajorType(newMajorType); linearDefinition.getListsByNode() .put(selectedLinearNode, gazetteerList); linearDefinition.getNodesByListNames() if (oldMinorType != null && oldMinorType.equals(newMinorType)) { return; } linearDefinition.getListsByNode().remove(selectedLinearNode); selectedLinearNode.setMinorType(newMinorType); linearDefinition.getListsByNode() .put(selectedLinearNode, gazetteerList); linearDefinition.getNodesByListNames() if (oldLanguage != null
selectedLinearNode = linearDefinition.getNodesByListNames().get(listName); if (selectedLinearNode != null) { listTableModel.setGazetteerList(linearDefinition.getListsByNode().get(selectedLinearNode));
@Override public void actionPerformed(ActionEvent e) { if (selectedLinearNode == null) { return; } GazetteerList gazetteerList = linearDefinition.getListsByNode().get(selectedLinearNode); gazetteerList.clear(); try { gazetteerList.load(true); } catch (ResourceInstantiationException rie) { rie.printStackTrace(); return; } // reselect the row to redisplay the list int row = definitionTable.getSelectedRow(); definitionTable.clearSelection(); definitionTable.getSelectionModel().setSelectionInterval(row, row); } }
return; linearDefinition.getListsByNode().put(linearNode, gazetteerList);
linearDefinition.store(); linearDefinition.setURL(previousURL); for (Object object : linearDefinition.getListsByNode().values()) { GazetteerList gazetteerList = (GazetteerList) object; previousURL = gazetteerList.getURL();
@Override public void actionPerformed(ActionEvent e) { try { if (linearDefinition.isModified()) { linearDefinition.store(); } for (Object object : linearDefinition.getListsByNode().values()) { GazetteerList gazetteerList = (GazetteerList) object; if (gazetteerList.isModified()) { gazetteerList.store(); } } gazetteer.reInit(); MainFrame.getInstance().statusChanged("Gazetteer saved in " + linearDefinition.getURL().getPath()); definitionTable.repaint(); } catch (ResourceInstantiationException re) { MainFrame.getInstance().statusChanged( "Unable to save the Gazetteer."); Err.prln("Unable to save the Gazetteer.\n" + re.getMessage()); } } }