public AppSubscriptionsPanel(
     final ClientDavConnection connection,
     final ClientApplication clientApplication,
     final DavApplication dav) {
   super(new BorderLayout());
   _jSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
   ApplicationSubscriptionInfo subscriptionInfo;
   try {
     subscriptionInfo = connection.getSubscriptionInfo(dav, clientApplication);
   } catch (IOException e) {
     subscriptionInfo = null;
     e.printStackTrace();
     JOptionPane.showMessageDialog(
         this, "Konnte die Anmeldungen nicht auflisten. " + e.getMessage());
   }
   final TitledBorder sendBorder =
       BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Sende-Anmeldungen");
   final TitledBorder receiveBorder =
       BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Empfangs-Anmeldungen");
   final TitledBorder labelBorder = BorderFactory.createTitledBorder("Details");
   final JComponent paneSend = new JPanel(new BorderLayout());
   _senderList =
       new JList(
           new MyListModel(
               subscriptionInfo == null
                   ? Collections.emptyList()
                   : subscriptionInfo.getSenderSubscriptions()));
   paneSend.add(new JScrollPane(_senderList), BorderLayout.CENTER);
   final JComponent paneReceive = new JPanel(new BorderLayout());
   _receiverList =
       new JList(
           new MyListModel(
               subscriptionInfo == null
                   ? Collections.emptyList()
                   : subscriptionInfo.getReceiverSubscriptions()));
   paneReceive.add(new JScrollPane(_receiverList), BorderLayout.CENTER);
   paneSend.setBorder(sendBorder);
   paneReceive.setBorder(receiveBorder);
   _jSplitPane.setLeftComponent(paneSend);
   _jSplitPane.setRightComponent(paneReceive);
   _jSplitPane.setResizeWeight(0.5);
   _senderList.addMouseListener(new MyMouseListener(_senderList));
   _receiverList.addMouseListener(new MyMouseListener(_receiverList));
   _senderList.setFocusable(false);
   _receiverList.setFocusable(false);
   this.add(_jSplitPane, BorderLayout.CENTER);
   _label = new JEditorPane("text/html", "");
   _label.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
   _label.setFont(_label.getFont().deriveFont(Font.PLAIN));
   _label.setBorder(labelBorder);
   _label.setEditable(false);
   final JScrollPane pane = new JScrollPane(_label);
   pane.setBorder(BorderFactory.createEmptyBorder());
   pane.setPreferredSize(new Dimension(400, 160));
   this.add(pane, BorderLayout.SOUTH);
 }
 /** 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();
  }
Exemple #4
0
  public NavigatorGui(final Model model, IEngine engine, DropHandler dropHandler) {
    this.engine = engine;
    this.model = model;

    this.engine.addEngineListener(
        new EngineListenerAdapter() {
          public void uncompiled() {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    setEmptyMergedIndex();
                  }
                });
          }

          public void compiled() {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    setFinder(NavigatorGui.this.engine.getFinder());
                  }
                });
          }
        });

    this.model.addApplicationModelListener(
        new ModelAdapter() {
          public void initialize(Preferences preferences) {
            setFinder(NavigatorGui.this.engine.getFinder());

            /*
                            for ( int i = 0; i < NavigatorGui.this.engine.getFinder().size(); i++ ) {
                                IArticle article = NavigatorGui.this.engine.getFinder().find( i );
                                String body = article.getBody( 0 );
                                if ( body.contains( "develop" ) ) {
                                    System.out.println( "i = " + i + ", body = " + body );
                                }
                            }
            */
          }

          public void navigate(String title) {
            NavigatorGui.this.navigate(title);
          }

          public void navigateAndTranslate(String title) {
            NavigatorGui.this.navigateAndTranslate(title);
          }

          public void requestFocusInNavigator() {
            field.requestFocus();
          }
        });

    list = Components.list();
    list.setFocusable(false);
    list.setTransferHandler(dropHandler);

    field = Components.textField();
    SelectAllOnEscapeListener.register(field);

    scroll = Components.scrollVertical(list);

    gui = new JPanel(new BorderLayout(Gaps.GAP3, Gaps.GAP3));
    gui.add(field, BorderLayout.NORTH);
    gui.add(scroll, BorderLayout.CENTER);

    new ArticleListMenu(list, model, true, false);

    ActionBinder.bind(this);
  }