/** Creates a JList of files and sets and makes it non-selectable. */ private static JList<String> createFileList(List<String> fileNames) { JList<String> fileList = new JList<String>(fileNames.toArray(new String[0])); fileList.setVisibleRowCount(5); fileList.setCellRenderer(new FileNameListCellRenderer()); // fileList.setSelectionForeground(fileList.getForeground()); // fileList.setSelectionBackground(fileList.getBackground()); fileList.setFocusable(false); return fileList; }
/** * Dem Konstruktor können Filter für den {@link PreselectionDialog Änderndialog} übergeben werden. * * @param listsFilter ein Objekt, welches die Listen des Änderndialogs filtert * @param filterTypes Typen der Objekte, die zur Auswahl angeboten werden sollen */ public DataIdentificationChoice( final PreselectionListsFilter listsFilter, final List filterTypes) { _gridBagLayout = new GridBagLayout(); setLayout(_gridBagLayout); setBorder(BorderFactory.createTitledBorder("Datenidentifikation")); // Tooltip vergeben // _simLabel.setToolTipText("Simulationsvariante"); wird nicht mehr benötigt // zuordnen der Label zu den Feldern _atgLabel.setLabelFor(_atgTextField); _aspLabel.setLabelFor(_aspTextField); _simLabel.setLabelFor(_simTextField); _objLabel.setLabelFor(_objList); // Felder sind nicht editierbar _atgTextField.setEditable(false); _atgTextField.setFocusable(false); _aspTextField.setEditable(false); _aspTextField.setFocusable(false); _simTextField.setEditable(false); _simTextField.setFocusable(false); _objList.setFocusable(false); // Ändern - Button implementieren _changeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (_preselectionDialog == null) { if (_treeNodes == null || _connection == null) { _preselectionDialog = new PreselectionDialog( "Datenidentifikationsauswahl", _changeButton, listsFilter, filterTypes); } else { _preselectionDialog = new PreselectionDialog( "Datenidentifikationsauswahl", _changeButton, listsFilter, filterTypes, _treeNodes, _connection); _preselectionDialog.setSelectedPath(_treePath); } _preselectionDialog.setMaximumSelectedAttributeGroups(1); _preselectionDialog.setMinimumSelectedAttributeGroups(1); if (_simulationVariant != -1) { _preselectionDialog.showSimulationVariant(); _preselectionDialog.setSimulationVariant(_simulationVariant); } _preselectionDialog.setMaximumSelectedAspects(_numberOfSelectedAspects); _preselectionDialog.setMinimumSelectedAspects(_numberOfSelectedAspects); _preselectionDialog.setMinimumSelectedAttributeGroups( _numberOfSelectedAttributeGroups); _preselectionDialog.setMaximumSelectedObjects(_maximumSelectedObjects); _preselectionDialog.setMinimumSelectedObjects(_minimumSelectedObjects); } _preselectionDialog.setSelectedObjectTypes(_objectTypes); _preselectionDialog.setSelectedAttributeGroups(_attributeGroups); _preselectionDialog.setSelectedAspects(_aspects); _preselectionDialog.setSelectedObjects(_objects); if (_preselectionDialog.show()) { // OK-Button wurde gedrückt // Werte übernehmen setObjectTypes(_preselectionDialog.getSelectedObjectTypes()); setAttributeGroups(_preselectionDialog.getSelectedAttributeGroups()); setAspects(_preselectionDialog.getSelectedAspects()); setObjects(_preselectionDialog.getSelectedObjects()); setSimulationVariant(_preselectionDialog.getSimulationVariant()); _treePath = _preselectionDialog.getSelectedTreePath(); } } }); createAndShowGui(); }