final String namespaceString) {
this.gbc.gridx = 0;
this.gbc.gridy++;
final JTextFieldResizing prefixTF = new JTextFieldResizing(
prefixString, this.parent.getFONT(), this);
final JTextFieldResizing namespaceTF = new JTextFieldResizing(
namespaceString, this.parent.getFONT(), this);
namespaceTF.setPreferredSize(new Dimension(prefixTF
.getPreferredSize().width + 10, prefixTF
.getPreferredSize().height));
prefixTF.setPreferredSize(new Dimension(prefixTF
.getPreferredSize().width + 150, prefixTF
.getPreferredSize().height));
if(!namespaceString.equals("")){
namespaceTF.setFocusable(false);
prefixTF.setFocusable(false);
}
prefixTF.addFocusListener(new FocusAdapter() {
private String oldValue = prefixString;
public void focusLost(final FocusEvent fe) {
}});
namespaceTF.addFocusListener(new FocusAdapter() {
private String oldValue = namespaceString;
public void focusGained(final FocusEvent fe){
}
public void focusLost(final FocusEvent fe) {
}
});
namespaceTF.addKeyListener( new KeyListener()
{
public void keyTyped( KeyEvent e ) {
}
public void keyPressed( KeyEvent e ) {
}
public void keyReleased( KeyEvent e ) {
if(e.getKeyCode()==10){
int i = checkTheCase(prefixTF.getText(),namespaceTF.getText());
switch(i){
case 0: break;
case 1: addEntry(prefixTF.getText(),namespaceTF.getText());
prefixTF.setEditable(false);
namespaceTF.setEditable(false);
namespaceTF.setFocusable(false);
prefixTF.setFocusable(false);
prefix.setPrefixRowCnt(prefix.getPrefixRowCnt()+1);
break;
case 2: prefixTF.selectAll();
prefixTF.grabFocus();
showPrefixAlreadyExistsDialog();
break;
case 3: prefixTF.selectAll();
prefixTF.grabFocus();
showNamespaceIsAlreadyInUseDialog();
break;
case 4: prefixTF.selectAll();
prefixTF.grabFocus();
showNoNamespaceDialog();
break;
default: break;
}
// System.out.println(prefix.getPrefixCount()+" "+prefix.getPrefixRowCnt());
}
}
});
final JLabel prefixLabel = new JLabel("Prefix:");
prefixLabel.setFont(parent.getFONT());
final JLabel iriLabel = new JLabel("IRI:");
iriLabel.setFont(parent.getFONT());
// Button
Dimension buttonDimension = new Dimension();
buttonDimension.setSize(30d, 24d);
final JIconButton deleteButton = new JIconButton("icons/001_02.png");
deleteButton.setPreferredSize(buttonDimension);
deleteButton.setMaximumSize(buttonDimension);
deleteButton.setMinimumSize(buttonDimension);
deleteButton.setFont(parent.getFONT());
deleteButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
if (!namespaceTF.getText().equals("")) {
final int choice = showPrefixRemovedOptionDialog();
if (choice == JOptionPane.YES_OPTION) { // remove prefix and
// notify
// operators...
prefix.removeEntry(namespaceTF.getText(), true);
removeRow(prefixLabel, prefixTF, iriLabel, namespaceTF, deleteButton);
} else if (choice == JOptionPane.NO_OPTION) { // remove
// prefix
// but don't
// notify
// operators
// ...
prefix.removeEntry(namespaceTF.getText(), false);
removeRow(prefixLabel, prefixTF, iriLabel, namespaceTF, deleteButton);
}
} else {
removeRow(prefixLabel, prefixTF, iriLabel, namespaceTF, deleteButton);