/** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user changed the service filter option
   if (e.getSource() == service_box) {
     service_list.setEnabled(service_box.isSelected());
     service_list.clearSelection();
     remove_service_button.setEnabled(false);
     add_service_field.setEnabled(service_box.isSelected());
     add_service_field.setText("");
     add_service_button.setEnabled(false);
   }
   // Check if the user pressed the add service button
   if ((e.getSource() == add_service_button) || (e.getSource() == add_service_field)) {
     String text = add_service_field.getText();
     if ((text != null) && (text.length() > 0)) {
       service_data.addElement(text);
       service_list.setListData(service_data);
     }
     add_service_field.setText("");
     add_service_field.requestFocus();
   }
   // Check if the user pressed the remove service button
   if (e.getSource() == remove_service_button) {
     Object[] sels = service_list.getSelectedValues();
     for (int i = 0; i < sels.length; i++) {
       service_data.removeElement(sels[i]);
     }
     service_list.setListData(service_data);
     service_list.clearSelection();
   }
 }
 // tar bort "blåmarkering" från listorna, finns pga bug där man inte kunde återvälja den "valde"
 // efter tab-byte
 public void clearAllSelections() {
   if (!isChanging) {
     isChanging = true;
     studentList.clearSelection();
     courseList.clearSelection();
     isChanging = false;
   }
 }
 public void clearFormOnReset() {
   spriteNameTextBox.setText("");
   spriteXTextBox.setText("");
   spriteYTextBox.setText("");
   moveLeft.setSelected(false);
   moveRight.setSelected(false);
   moveUp.setSelected(false);
   moveDown.setSelected(false);
   collisionEventActionHashMap.clear();
   collisionEventList.clearSelection();
   collisionEventActionList.clearSelection();
   collisionEventActionDisplay.setText("");
   selfMove.setSelected(false);
 }
Exemple #4
0
 public void launchDialog(ArrayList<String> values) {
   ok = false;
   display.clearSelection();
   setVisible(true);
   values.clear();
   if (ok) values.addAll(display.getSelectedValuesList());
 }
 private void showSubscriptionInfo(
     final ApplicationSubscriptionInfo.ApplicationSendingSubscription clientSendingSubscription) {
   _receiverList.clearSelection();
   _label.setText(
       "<html>"
           + "<b>Objekt: </b>"
           + clientSendingSubscription.getObject()
           + "<br>"
           + "<b>Attributgruppe: </b>"
           + clientSendingSubscription.getUsage().getAttributeGroup()
           + "<br>"
           + "<b>Aspekt: </b>"
           + clientSendingSubscription.getUsage().getAspect()
           + "<br>"
           + "<b>Simulationsvariante: </b>"
           + clientSendingSubscription.getSimVar()
           + "<br>"
           + "<b>Typ: </b>"
           + (clientSendingSubscription.isSource() ? "Quelle" : "Sender")
           + "<br>"
           + "<b>Unterstützt Sendesteuerung: </b>"
           + (clientSendingSubscription.isRequestSupported() ? "Ja" : "Nein")
           + "<br>"
           + "<b>Status: </b>"
           + stateToString(clientSendingSubscription.getState()));
 }
 private void showSubscriptionInfo(
     final ApplicationSubscriptionInfo.ApplicationReceivingSubscription
         clientReceivingSubscription) {
   _senderList.clearSelection();
   _label.setText(
       "<html>"
           + "<b>Objekt: </b>"
           + clientReceivingSubscription.getObject()
           + "<br>"
           + "<b>Attributgruppe: </b>"
           + clientReceivingSubscription.getUsage().getAttributeGroup()
           + "<br>"
           + "<b>Aspekt: </b>"
           + clientReceivingSubscription.getUsage().getAspect()
           + "<br>"
           + "<b>Simulationsvariante: </b>"
           + clientReceivingSubscription.getSimVar()
           + "<br>"
           + "<b>Typ: </b>"
           + (clientReceivingSubscription.isDrain() ? "Senke" : "Empfänger")
           + "<br>"
           + "<b>Nachgelieferte Daten: </b>"
           + (clientReceivingSubscription.isDelayed() ? "Ja" : "Nein")
           + "<br>"
           + "<b>Nur Änderungen: </b>"
           + (clientReceivingSubscription.isDelta() ? "Ja" : "Nein")
           + "<br>"
           + "<b>Status: </b>"
           + stateToString(clientReceivingSubscription.getState()));
 }
  private void loadList(JList list) {
    list.removeAll();
    profiles = parentGenerator.getProfiles();
    DefaultListModel model = new DefaultListModel();
    int i = 0;
    int foundLastProfile = -1;
    for (Profile p : profiles) {

      // Check that this profile says it's for this machine
      if (ProfileUtils.shouldDisplay(p) || filterBox.isSelected()) model.addElement(p.toString());
      if (p.toString().equals(Base.preferences.get("lastGeneratorProfileSelected", "---"))) {
        Base.logger.fine("Selecting last used element: " + p);
        foundLastProfile = i;
      }
      i++;
    }
    list.setModel(model);
    list.clearSelection();
    if (foundLastProfile != -1) {
      list.setSelectedIndex(foundLastProfile);
      doneButton.setEnabled(true);
      doneButton.requestFocusInWindow();
      doneButton.setFocusPainted(true);
    }
  }
    private void postMessage(final String type) {
      final String id = (String) list.getSelectedValue();
      if (id == null) {
        return;
      }
      list.clearSelection();

      //			final Endpoint endpoint = context.getEndpoint("http4://localhost:8122/");
      //			final Exchange exchange = endpoint.createExchange();
      //			exchange.getIn().setHeader(Exchange.HTTP_METHOD, "POST");
      //			exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "text/plain");
      //			exchange.getIn().setBody(id + ":" + type);
      //			producerTemplate.asyncSend(endpoint, exchange);

      // final String url = "jms:queue:itk-trunk/" + id + "/" + type.split("\\|")[0];

      final String url = "jms:topic:document-ebxml-acks";
      System.out.println("Sending message to: " + url);

      final Endpoint endpoint = context.getEndpoint(url);
      final Exchange exchange = endpoint.createExchange();
      exchange.getIn().setHeader("JMSCorrelationID", id);
      exchange.getIn().setBody(type.split("\\|")[1]);
      producerTemplate.send(endpoint, exchange);
    }
Exemple #9
0
 public void listClicked(MouseEvent e) {
   Point p = new Point(e.getX(), e.getY());
   int index = list.locationToIndex(p);
   Rectangle inside = list.getCellBounds(index, index);
   if (inside.contains(p) && (!newSelection)) {
     list.clearSelection();
   }
   newSelection = false;
 }
    private void clearItem() {
      final int index = list.getSelectedIndex();
      if (index == -1) {
        return;
      }
      list.clearSelection();

      listModel.remove(index);
    }
 // listener för kurslistan
 private void courseList_valueChanged(ListSelectionEvent e) {
   if (!isChanging) {
     isChanging = true;
     studentList.clearSelection();
     isChanging = false;
   }
   if (courseList.getSelectedValue() != null) {
     openCourse(courseRef.get(courseList.getSelectedIndex()));
   }
 }
  private void removeAllButtonActionPerformed() {
    JList selectedList = getSelectedRobotsList();
    SelectedRobotsModel selectedModel = (SelectedRobotsModel) selectedList.getModel();

    selectedRobots.clear();
    selectedList.clearSelection();
    selectedModel.changed();
    fireStateChanged();
    showInstructions();
  }
  void jList1_valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) return;

    JList theList = (JList) e.getSource();
    if (!theList.isSelectionEmpty()) {
      registerJID = (JID) services.get(theList.getSelectedValue());
      if (registerJID != null)
        backend.send(new InfoQuery(registerJID, "get", backend.getIdentifier(), new IQRegister()));
    }
    theList.clearSelection();
  }
  private void clearUserForm() {

    lblUserId.setText("");
    txtFirstName.setText("");
    txtLastName.setText("");
    txtEmail.setText("");
    btnAdd.setText("Add");
    btnAdd.setEnabled(false);
    lstUsers.clearSelection();
    btnClear.setEnabled(false);
  }
Exemple #15
0
 public void updateGUI() {
   if (jlist != null) {
     int enabled = this.enabled;
     jlist.clearSelection();
     for (int curindex = 0; curindex < size; curindex++) {
       if ((enabled & (1 << curindex)) != 0) {
         jlist.addSelectionInterval(curindex, curindex);
       }
     }
   }
 }
Exemple #16
0
  /*
   * when the remove button was pressed
   */
  private void onRemove() {
    if (m_selectedFileListModel.getSize() == 0) {

      JOptionPane.showMessageDialog(
          this, "No files in list to Remove", "Error", JOptionPane.ERROR_MESSAGE);

      return;
    }
    m_selectedFileListModel.remove(m_selectedFileList.getSelectedIndices());
    m_selectedFileList.clearSelection();
    fireSelectionChangedEvent();
  }
 // reverse the selected items between to listboxes
 private void flipLists(
     JList lstFrom, DefaultListModel modelFrom, JList lstTo, DefaultListModel modelTo) {
   if (lstFrom.getSelectedIndex() == -1) {
     return;
   }
   // for each i in lstFrom selected indexies
   int[] selectedIdx = lstFrom.getSelectedIndices();
   Vector<Products_Suppliers> v_ps = new Vector<Products_Suppliers>();
   for (int i : selectedIdx) {
     modelTo.addElement((Products_Suppliers) (modelFrom.getElementAt(i)));
     v_ps.addElement((Products_Suppliers) (modelFrom.getElementAt(i)));
   }
   for (Products_Suppliers ps : v_ps) {
     modelFrom.removeElement(ps);
   }
   // modelFrom.removeAllElements();
   lstFrom.clearSelection();
   lstTo.clearSelection();
   if (lstFrom == lstProdInc) {
     cmbProdFilter.setSelectedIndex(0);
   }
 }
  private void removeButtonActionPerformed() {
    JList selectedList = getSelectedRobotsList();
    SelectedRobotsModel selectedModel = (SelectedRobotsModel) selectedList.getModel();
    int sel[] = selectedList.getSelectedIndices();

    for (int i = 0; i < sel.length; i++) {
      selectedRobots.remove(sel[i] - i);
    }
    selectedList.clearSelection();
    selectedModel.changed();
    fireStateChanged();
    if (selectedModel.getSize() < minRobots || selectedModel.getSize() > maxRobots) {
      showWrongNumInstructions();
    } else {
      showInstructions();
    }
  }
  private void refreshSdkList() {
    final List<Sdk> pythonSdks = myInterpreterList.getAllPythonSdks(myProject);
    Sdk projectSdk = getSdk();
    if (!myShowOtherProjectVirtualenvs) {
      VirtualEnvProjectFilter.removeNotMatching(myProject, pythonSdks);
    }
    //noinspection unchecked
    mySdkList.setModel(new CollectionListModel<Sdk>(pythonSdks));

    mySdkListChanged = false;
    if (projectSdk != null) {
      projectSdk = myProjectSdksModel.findSdk(projectSdk.getName());
      mySdkList.clearSelection();
      mySdkList.setSelectedValue(projectSdk, true);
      mySdkList.updateUI();
    }
  }
Exemple #20
0
  /**
   * Method called at the start of the dialog. Caches current values and displays them in the 3D
   * tab.
   */
  @Override
  public void init() {
    threeDTechnology.setText("Layer cross section for technology '" + curTech.getTechName() + "'");
    threeDLayerModel = new DefaultListModel();
    threeDLayerList = new JList(threeDLayerModel);
    threeDLayerList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    threeDLayerPane.setViewportView(threeDLayerList);
    threeDLayerList.clearSelection();
    threeDLayerList.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent evt) {
            threeDValuesChanged(false);
          }
        });
    threeDThicknessMap = new HashMap<Layer, GenMath.MutableDouble>();
    threeDDistanceMap = new HashMap<Layer, GenMath.MutableDouble>();
    // Sorted by Height to be consistent with LayersTab
    for (Layer layer : curTech.getLayersSortedByName()) {
      if (layer.isPseudoLayer()) continue;
      threeDLayerModel.addElement(layer.getName());
      double thickness = getDouble(layer.getThicknessSetting());
      double distance = getDouble(layer.getDistanceSetting());
      threeDThicknessMap.put(layer, new GenMath.MutableDouble(thickness));
      threeDDistanceMap.put(layer, new GenMath.MutableDouble(distance));
    }
    threeDLayerList.setSelectedIndex(0);
    threeDHeight.getDocument().addDocumentListener(new ThreeDInfoDocumentListener(this));
    threeDThickness.getDocument().addDocumentListener(new ThreeDInfoDocumentListener(this));

    threeDSideView = new ThreeDSideView(this);
    threeDSideView.setMinimumSize(new java.awt.Dimension(200, 450));
    threeDSideView.setPreferredSize(new java.awt.Dimension(200, 450));
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 1;
    gbc.gridwidth = 2;
    gbc.gridheight = 4;
    gbc.weightx = 0.5;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new java.awt.Insets(4, 4, 4, 4);
    threeD.add(threeDSideView, gbc);
    threeDValuesChanged(false);
  }
  /** actualiza */
  @Override
  public void actualiza(Object obj) {
    if (obj instanceof Casilla) {
      Casilla casilla = (Casilla) obj;

      // si hay imagen en la casilla la quitamos y al revés
      if (tableroVista.getIconCasilla(casilla) == null)
        tableroVista.ponerIconoCasilla(
            casilla.getFil(), casilla.getCol(), recSwingApp.getIconoApp());
      else tableroVista.ponerIconoCasilla(casilla.getFil(), casilla.getCol(), null);

      // indicamos la casilla seleccionada en la línea de estado
      estadoTablero.setText(recSwingApp.getEtiqueta(ESTADO_TABLERO) + obj.toString());

      // desactivamos selección de nuevo jugador
      if (!listaJugadores.isSelectionEmpty()) listaJugadores.clearSelection();
      botonInvitar.setEnabled(false);
    }
  }
  private void addAllButtonActionPerformed() {
    JList selectedList = getSelectedRobotsList();
    SelectedRobotsModel selectedModel = (SelectedRobotsModel) selectedList.getModel();

    for (AvailableRobotsPanel.ItemWrapper selected : availableRobotsPanel.getAvailableRobots()) {
      selectedRobots.add(selected);
    }

    selectedList.clearSelection();
    selectedModel.changed();
    fireStateChanged();
    if (selectedModel.getSize() >= minRobots && selectedModel.getSize() <= maxRobots) {
      showInstructions();
    } else if (selectedModel.getSize() > maxRobots) {
      showWrongNumInstructions();
    }

    availableRobotsPanel.getAvailableRobotsList().requestFocus();
  }
 private void editColorsAndFonts() {
   final String toConfigure = getSelectedType().getSeverity(null).myName;
   doOKAction();
   myOptionsList.clearSelection();
   final DataContext dataContext = DataManager.getInstance().getDataContext(myPanel);
   final OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext);
   if (optionsEditor != null) {
     final ColorAndFontOptions colorAndFontOptions =
         optionsEditor.findConfigurable(ColorAndFontOptions.class);
     assert colorAndFontOptions != null;
     final SearchableConfigurable javaPage =
         colorAndFontOptions.findSubConfigurable(InspectionColorSettingsPage.class);
     LOG.assertTrue(javaPage != null);
     optionsEditor
         .clearSearchAndSelect(javaPage)
         .doWhenDone(
             new Runnable() {
               @Override
               public void run() {
                 final Runnable runnable = javaPage.enableSearch(toConfigure);
                 if (runnable != null) {
                   SwingUtilities.invokeLater(runnable);
                 }
               }
             });
   } else {
     ColorAndFontOptions colorAndFontOptions = new ColorAndFontOptions();
     final Configurable[] configurables = colorAndFontOptions.buildConfigurables();
     try {
       final SearchableConfigurable javaPage =
           colorAndFontOptions.findSubConfigurable(InspectionColorSettingsPage.class);
       LOG.assertTrue(javaPage != null);
       ShowSettingsUtil.getInstance()
           .editConfigurable(CommonDataKeys.PROJECT.getData(dataContext), javaPage);
     } finally {
       for (Configurable configurable : configurables) {
         configurable.disposeUIResources();
       }
       colorAndFontOptions.disposeUIResources();
     }
   }
 }
 private void updateFilter() {
   filteredData.clear();
   String filterTxt = filter.getText().trim().toLowerCase(Locale.ENGLISH);
   for (String code : data) {
     if (code.toLowerCase(Locale.ENGLISH).contains(filterTxt)) {
       filteredData.add(code);
     }
   }
   model.fireContentsChanged();
   int idx = filteredData.indexOf(lastCode);
   if (idx == -1) {
     selectionList.clearSelection();
     if (selectionList.getModel().getSize() > 0) {
       selectionList.ensureIndexIsVisible(0);
     }
   } else {
     selectionList.setSelectedIndex(idx);
     selectionList.ensureIndexIsVisible(idx);
   }
 }
    public void mouseClicked(MouseEvent evt) {
      // Note: we can't depend on evt.getSource() because of backward
      // compatability
      if (list != null && SwingUtilities.isLeftMouseButton(evt) && (evt.getClickCount() % 2 == 0)) {

        int index = SwingUtilities2.loc2IndexFileList(list, evt.getPoint());
        if (index >= 0) {
          File f = (File) list.getModel().getElementAt(index);
          try {
            // Strip trailing ".."
            f = ShellFolder.getNormalizedFile(f);
          } catch (IOException ex) {
            // That's ok, we'll use f as is
          }
          if (getFileChooser().isTraversable(f)) {
            list.clearSelection();
            changeDirectory(f);
          } else {
            getFileChooser().approveSelection();
          }
        }
      }
    }
 private void loadList(JList list) {
   list.removeAll();
   List<Profile> profiles = getProfiles();
   DefaultListModel model = new DefaultListModel();
   int i = 0;
   int foundLastProfile = -1;
   for (Profile p : profiles) {
     model.addElement(p);
     if (p.toString().equals(Base.preferences.get("lastGeneratorProfileSelected", "---"))) {
       Base.logger.fine("Selecting last used element: " + p);
       foundLastProfile = i;
     }
     i++;
   }
   list.setModel(model);
   list.clearSelection();
   if (foundLastProfile != -1) {
     list.setSelectedIndex(foundLastProfile);
     generate.setEnabled(true);
     generate.requestFocusInWindow();
     generate.setFocusPainted(true);
   }
 }
 private void _listContactList_valueChanged(ListSelectionEvent listSelectionEvent) {
   try {
     if (!listSelectionEvent.getValueIsAdjusting()) {
       ItemVO contactItemVO = (ItemVO) _listContactList.getSelectedValue();
       if (API.getInstance().getSocial().canMessageSend(contactItemVO.getService())) {
         if (_messageType == MessageType.TEXT)
           getParentPanel()
               .discardAndShowWindow(
                   new MessageSendWindow(
                       (ItemVO) _listContactList.getSelectedValue(), _itemVO, null));
         else if (_messageType == MessageType.VOICE)
           getParentPanel()
               .discardAndShowWindow(
                   new VoiceNoteSendWindow(
                       (ItemVO) _listContactList.getSelectedValue(), _itemVO, null));
       } else {
         getParentPanel()
             .showWindow(
                 new WarningWindow(
                     "Cannot send message",
                     "The service \""
                         + contactItemVO.getService()
                         + "\" does not let you send private messages to \""
                         + contactItemVO.getName()
                         + "\". Please select another contact.",
                     30,
                     "send-message-contact-list-can-not-send.wav"));
         _listContactList.clearSelection();
       }
     }
   } catch (APICommunicationException apiCommunicationException) {
     Debug.displayStack(this, apiCommunicationException);
   } catch (APIProtocolException apiProtocolException) {
     Debug.displayStack(this, apiProtocolException);
   }
 }
  public void actionPerformed(ActionEvent act) {
    // TODO Auto-generated method stub

    // AJOUTER BAS GAUCHE
    if (act.getSource() == button1
        && !textFieldNom.getText().equals(new String(""))
        && !textFieldPrenom.getText().equals(new String(""))) {
      String nom = textFieldNom.getText();
      String prenom = textFieldPrenom.getText();
      Entree entree = GererEntree.addEntree(nom, prenom);
      lm.addElement(entree);
      InitialisationAppli.initialisationNumero(lm2, nom, prenom);
      clearNom();
    }
    if (act.getSource() == button2
        && !textFieldNom.getText().equals(new String(""))
        && !textFieldPrenom.getText().equals(new String(""))) {
      String nom = textFieldNom.getText();
      String prenom = textFieldPrenom.getText();
      Entree entree = GererEntree.getEntree(nom, prenom);
      lm.clear();
      l1.clearSelection();
      l2.clearSelection();
      lm.removeElement(entree);
      lm2.removeAllElements();
      l1.clearSelection();
      clearNom();
      GererEntree.supprimeEntreeDeLaBDD(entree);
    }

    if (act.getSource() == button3) {
      clearNom();
    }
    if (act.getSource() == button4
        && !textFieldNom.getText().equals(new String(""))
        && !textFieldPrenom.getText().equals(new String(""))) {
      String nom = textFieldNom.getText();
      String prenom = textFieldPrenom.getText();
      String code = textFieldCode.getText();
      String valeur = textFieldValeur.getText();
      InitialisationAppli.ajouterNumero(nom, prenom, code, valeur);
      Numero num = GererNumero.addNumero(nom, prenom, code, valeur);
      lm2.addElement(num);
      clearCode();
    }
    if (act.getSource() == button5
        && !textFieldNom.getText().equals(new String(""))
        && !textFieldPrenom.getText().equals(new String(""))) {
      String code = textFieldCode.getText();
      String valeur = textFieldValeur.getText();
      String nom = textFieldNom.getText();
      String prenom = textFieldPrenom.getText();
      Entree entree = GererEntree.getEntree(nom, prenom);
      Numero numero = GererNumero.getNumero(code, valeur);
      l1.clearSelection();
      l2.clearSelection();
      lm2.removeElement(numero);
      clearNom();
      GererNumero.supprimeNumeroDeLaBDD(nom, prenom, numero);
      clearCode();
    }
    if (act.getSource() == button6) {
      clearCode();
    }
  }
  private void updateLine(Point pt) {
    if (list.locationToIndex(pt) < 0) list.clearSelection();

    list.repaint();
  }
 private void doNewAdd() {
   searchBox.setText(null);
   contactList.clearSelection();
   for (AccessInterface infoField : infoFields) infoField.setContent(null);
 }