public void addEmptyFeatureColumns() { // find the first row fully filled with value if (getColumnCount() == 1) { GazetteerNode node = gazetteerListFiltered.get(0); Map<String, Object> map = new HashMap<String, Object>(); // add a couple of rows map.put("", ""); node.setFeatureMap(map); } else { for (Object object : gazetteerListFiltered) { GazetteerNode node = (GazetteerNode) object; Map<String,Object> map = node.getFeatureMap(); if (map != null && (2*map.size()+1) == getColumnCount()) { map.put("", ""); break; } } } for (Object object : gazetteerList) { GazetteerNode node = (GazetteerNode) object; node.setSeparator(linearDefinition.getSeparator()); } }
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();
newGazetteerNode.setSeparator(listTableModel.gazetteerList .getSeparator());