private JPanel createDynamicCenterPanel(PrimitiveForm primitiveForm, DOTProperty property) {
    final JTable theTable = new JTable();
    PrimitiveFormPropertyPair pfpPair =
        new PrimitiveFormPropertyPair(primitiveForm.getName(), property);
    _dynamicTables.put(pfpPair, theTable);
    DOTPoint dotPoint = (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType();
    final DynamicDOTItemManager tableModel =
        (DynamicDOTItemManager) dotPoint.getTableModel(primitiveForm, property);
    theTable.setModel(tableModel);

    class NumberComparator implements Comparator<Number> {

      public int compare(Number o1, Number o2) {
        final double d1 = o1.doubleValue();
        final double d2 = o2.doubleValue();
        if (d1 < d2) {
          return -1;
        }
        if (d1 == d2) {
          return 0;
        }
        return 1;
      }
    }
    TableRowSorter<DynamicDOTItemManager> tableRowSorter =
        new TableRowSorter<DynamicDOTItemManager>();
    tableRowSorter.setModel(tableModel);
    tableRowSorter.setComparator(4, new NumberComparator());
    tableRowSorter.setComparator(5, new NumberComparator());
    theTable.setRowSorter(tableRowSorter);

    JButton newDOTItemButton = new JButton("Neue Zeile");
    newDOTItemButton.setEnabled(_dotDefinitionDialogFrame.isEditable());
    JButton deleteDOTItemButton = new JButton("Zeile löschen");
    deleteDOTItemButton.setEnabled(false);
    JButton showConflictsButton = new JButton("Zeige Konflikte");

    addButtonListeners(
        primitiveForm, property, newDOTItemButton, deleteDOTItemButton, showConflictsButton);
    addListSelectionListener(theTable, deleteDOTItemButton);

    JPanel dotButtonsPanel = new JPanel();
    dotButtonsPanel.setLayout(new SpringLayout());

    dotButtonsPanel.add(newDOTItemButton);
    dotButtonsPanel.add(deleteDOTItemButton);
    dotButtonsPanel.add(showConflictsButton);

    dotButtonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
    SpringUtilities.makeCompactGrid(dotButtonsPanel, 1, 5, 20);

    JPanel thePanel = new JPanel();
    thePanel.setLayout(new SpringLayout());
    thePanel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK));
    thePanel.add(new JScrollPane(theTable));
    thePanel.add(dotButtonsPanel);
    SpringUtilities.makeCompactGrid(thePanel, 2, 20, 5);

    return thePanel;
  }
 public void saveDisplayObjectType() {
   DOTPoint newDOTPoint =
       (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType().getCopy(null);
   final String name = _dotDefinitionDialogFrame.getNameText();
   if ((name == null) || (name.length() == 0)) {
     JOptionPane.showMessageDialog(
         new JFrame(), "Bitte geben Sie einen Namen an!", "Fehler", JOptionPane.ERROR_MESSAGE);
     return;
   }
   if (!_dotDefinitionDialogFrame.isReviseOnly()) {
     if (_dotDefinitionDialogFrame.getDotManager().containsDisplayObjectType(name)) {
       JOptionPane.showMessageDialog(
           new JFrame(),
           "Ein Darstellungstyp mit diesem Namen existiert bereits!",
           "Fehler",
           JOptionPane.ERROR_MESSAGE);
       return;
     }
   }
   newDOTPoint.setName(name);
   newDOTPoint.setInfo(_dotDefinitionDialogFrame.getInfoText());
   final Object value = _translationFactorSpinner.getValue();
   if (value instanceof Number) {
     final Number number = (Number) value;
     newDOTPoint.setTranslationFactor(number.doubleValue());
   }
   newDOTPoint.setJoinByLine(_joinByLineCheckBox.isSelected());
   _dotDefinitionDialogFrame.getDotManager().saveDisplayObjectType(newDOTPoint);
   _dotDefinitionDialogFrame.setDisplayObjectType(newDOTPoint, true);
 }
 private void setValue(final JComponent component) {
   final String primitiveFormName = _primitiveForm.getName();
   if (_dotDefinitionDialogFrame.isPropertyStatic(primitiveFormName, _property)) {
     Object object =
         _dotDefinitionDialogFrame.getValueOfStaticProperty(primitiveFormName, _property);
     if (component instanceof JComboBox) {
       final String currentValue;
       if (object instanceof Color) {
         currentValue = ColorManager.getInstance().getColorName((Color) object);
       } else if (object instanceof Integer) {
         Integer i = (Integer) object;
         if (i.equals(Font.PLAIN)) {
           currentValue = STANDARD_FONT;
         } else if (i.equals(Font.BOLD)) {
           currentValue = BOLD_FONT;
         } else if (i.equals(Font.ITALIC)) {
           currentValue = ITALIC_FONT;
         } else {
           currentValue = "Unbekannter Font";
         }
       } else {
         currentValue = (String) object;
       }
       JComboBox comboBox = (JComboBox) component;
       comboBox.setSelectedItem(currentValue);
     } else if (component instanceof JSpinner) {
       JSpinner spinner = (JSpinner) component;
       if (object instanceof Integer) {
         spinner.setValue((Integer) object);
       } else {
         spinner.setValue((Double) object);
       }
     }
   } else {
     if (component instanceof JComboBox) {
       JComboBox comboBox = (JComboBox) component;
       comboBox.setSelectedItem(DOTPoint.getDefaultValue(_property));
     } else if (component instanceof JSpinner) {
       JSpinner spinner = (JSpinner) component;
       spinner.setValue(DOTPoint.getDefaultValue(_property));
     }
   }
 }
  public JPanel getAdditionalCharacteristicsPanel(final DisplayObjectType displayObjectType) {
    JLabel translationFactorLabel = new JLabel("Verschiebungsfaktor: ");
    SpinnerModel spinnerModel = new SpinnerNumberModel(100, 0, 5000, 1);
    _translationFactorSpinner.setModel(spinnerModel);
    _translationFactorSpinner.setMaximumSize(new Dimension(60, 30));
    _translationFactorSpinner.setEnabled(_dotDefinitionDialogFrame.isEditable());
    JPanel translationPanel = new JPanel();
    translationPanel.setLayout(new BoxLayout(translationPanel, BoxLayout.X_AXIS));
    translationPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 10));
    translationPanel.add(translationFactorLabel);
    translationPanel.add(_translationFactorSpinner);

    JLabel joinByLineLabel = new JLabel("Verbindungslinie: ");
    _joinByLineCheckBox.setSelected(false);
    _joinByLineCheckBox.setEnabled(_dotDefinitionDialogFrame.isEditable());
    JPanel joinByLinePanel = new JPanel();
    joinByLinePanel.setLayout(new BoxLayout(joinByLinePanel, BoxLayout.X_AXIS));
    joinByLinePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    joinByLinePanel.add(joinByLineLabel);
    joinByLinePanel.add(_joinByLineCheckBox);

    JPanel invisiblePanel = new JPanel();
    invisiblePanel.add(new JTextField());
    invisiblePanel.setVisible(false);

    JPanel thePanel = new JPanel();
    thePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
    thePanel.setLayout(new SpringLayout());
    thePanel.add(translationPanel);
    thePanel.add(joinByLinePanel);
    thePanel.add(invisiblePanel);
    SpringUtilities.makeCompactGrid(thePanel, 3, 5, 5);

    if (displayObjectType != null) {
      DOTPoint dotPoint = (DOTPoint) displayObjectType;
      _translationFactorSpinner.setValue(dotPoint.getTranslationFactor());
      _joinByLineCheckBox.setSelected(dotPoint.isJoinByLine());
    }
    addChangeListeners(); // Erst jetzt, denn sonst werden die Setzungen von
                          // _translationFactorSpinner und _joinByLineCheckBox schon verarbeitet!

    return thePanel;
  }
 public JPanel getDOTItemDefinitionPanel() {
   DOTPoint dotPoint = (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType();
   final PrimitiveForm primitiveForm =
       dotPoint.getPrimitiveForm(_dotDefinitionDialogFrame.getSelectedPrimitiveForm());
   final DOTProperty property = _dotDefinitionDialogFrame.getSelectedProperty();
   if ((primitiveForm == null) || (property == null)) {
     return null;
   }
   PrimitiveFormPropertyPair pfpPair =
       new PrimitiveFormPropertyPair(primitiveForm.getName(), property);
   final boolean isStatic = _dotDefinitionDialogFrame.getStaticCheckBoxState();
   if (isStatic) {
     if (!_staticPanels.containsKey(pfpPair)) {
       _staticPanels.put(pfpPair, createStaticCenterPanel(primitiveForm, property));
     }
     return _staticPanels.get(pfpPair);
   } else {
     if (!_dynamicPanels.containsKey(pfpPair)) {
       _dynamicPanels.put(pfpPair, createDynamicCenterPanel(primitiveForm, property));
     }
     return _dynamicPanels.get(pfpPair);
   }
 }