final String profileString) {
this.gbc.gridx = 0;
this.gbc.gridy++;
final JTextFieldResizing locatorTF = new JTextFieldResizing(
locatorString, this.parent.getFONT(), this);
final JTextFieldResizing profileTF = new JTextFieldResizing(
profileString, this.parent.getFONT(), this);
profileTF.setPreferredSize(new Dimension(locatorTF
.getPreferredSize().width + 150, locatorTF
.getPreferredSize().height));
locatorTF.setPreferredSize(new Dimension(locatorTF
.getPreferredSize().width + 150, locatorTF
.getPreferredSize().height));
if(!profileString.equals("")){
profileTF.setFocusable(false);
locatorTF.setFocusable(false);
}
locatorTF.addFocusListener(new FocusAdapter() {
private String oldValue = locatorString;
public void focusLost(final FocusEvent fe) {
}});
profileTF.addFocusListener(new FocusAdapter() {
private String oldValue = profileString;
public void focusGained(final FocusEvent fe){
}
public void focusLost(final FocusEvent fe) {
}
});
profileTF.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(locatorTF.getText(),profileTF.getText());
switch(i){
case 0: break;
case 1: addEntry(locatorTF.getText(),profileTF.getText());
locatorTF.setEditable(false);
profileTF.setEditable(false);
profileTF.setFocusable(false);
locatorTF.setFocusable(false);
importOperator.setImportRowCnt(importOperator.getImportRowCnt()+1);
break;
case 2: locatorTF.selectAll();
locatorTF.grabFocus();
showPrefixAlreadyExistsDialog();
break;
case 3: locatorTF.selectAll();
locatorTF.grabFocus();
showNamespaceIsAlreadyInUseDialog();
break;
case 4: locatorTF.selectAll();
locatorTF.grabFocus();
showNoNamespaceDialog();
break;
default: break;
}
// System.out.println(prefix.getPrefixCount()+" "+prefix.getPrefixRowCnt());
}
}
});
final JLabel prefixLabel = new JLabel("Locator:");
prefixLabel.setFont(parent.getFONT());
final JLabel iriLabel = new JLabel("Profile:");
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 (!profileTF.getText().equals("")) {
final int choice = showPrefixRemovedOptionDialog();
if (choice == JOptionPane.YES_OPTION) { // remove prefix and
// notify
// operators...
importOperator.removeEntry(profileTF.getText(), true);
removeRow(prefixLabel, locatorTF, iriLabel, profileTF, deleteButton);
} else if (choice == JOptionPane.NO_OPTION) { // remove
// prefix
// but don't
// notify
// operators
// ...
importOperator.removeEntry(profileTF.getText(), false);
removeRow(prefixLabel, locatorTF, iriLabel, profileTF, deleteButton);
}
} else {
removeRow(prefixLabel, locatorTF, iriLabel, profileTF, deleteButton);