} else if (linearDefinition.getSeparator() != null && linearDefinition.getSeparator().length() > 0 && value.contains(linearDefinition.getSeparator())) { newEntryButton.setEnabled(false); newEntryButton.setText("Char Forbidden: " + linearDefinition.getSeparator()); filterListButton.setEnabled(false); } else {
@Override public void actionPerformed(ActionEvent e) { if (linearDefinition.getSeparator() == null || linearDefinition.getSeparator().length() == 0) { String separator = JOptionPane.showInputDialog( MainFrame.getInstance(), "Type a character separator to separate" + "\nfeatures in the gazetteers lists.", "Feature Separator", JOptionPane.QUESTION_MESSAGE); if (separator == null || separator.equals("")) { return; } linearDefinition.setSeparator(separator); } listTableModel.addEmptyFeatureColumns(); // cancel filtering and redisplay the table listEntryTextField.setText(""); listTableModel.setFilterText(""); listTableModel.fireTableStructureChanged(); } });
SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (!listTable.isShowing()) { return; } JToolTip toolTip = listTable.createToolTip(); toolTip.setTipText("No separator character allowed: [" + linearDefinition.getSeparator() + "]"); PopupFactory popupFactory = PopupFactory.getSharedInstance(); final Popup popup = popupFactory.getPopup( listTable, toolTip, point.x, point.y - 20); popup.show(); Date timeToRun = new Date(System.currentTimeMillis() + 3000); timer.schedule(new TimerTask() { @Override public void run() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { popup.hide(); // hide the tooltip after some time }}); }}, timeToRun); }}); value = ((String)value).replaceAll(
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()); } }
if (linearDefinition.getSeparator() != null && linearDefinition.getSeparator().length() > 0 && ((String)value).contains(linearDefinition.getSeparator())) { final Point point = listTable.getCellRect(listTable.getSelectedRow(), listTable.getSelectedColumn(), true).getLocation(); }}); value = ((String)value).replaceAll( "\\Q"+linearDefinition.getSeparator()+"\\E", "");
if (linearDefinition.getSeparator() != null && linearDefinition.getSeparator().length() > 0) { linearDefinition.loadLists(true);