Package org.trzcinka.intellitrac.gateway

Examples of org.trzcinka.intellitrac.gateway.TracGateway


      public void actionPerformed(ActionEvent e) {
        Container parent = ((Component) e.getSource()).getParent();
        Cursor oldCursor = parent.getCursor();
        parent.setCursor(MouseCursors.WAIT_CURSOR);
        ResourceBundle bundle = BundleLocator.getBundle();
        TracGateway gateway = TracGatewayLocator.retrieveTracGateway();
        try {
          ConnectionSettings settings = new ConnectionSettings();
          settings.setLogin(login.getText());
          settings.setPassword(password.getText());
          settings.setTracUrl(tracUrl.getText());
          gateway.testConnection(settings);
          Messages.showMessageDialog(bundle.getString("configuration.connection.dialogs.connection_success"), bundle.getString("dialogs.success"), Messages.getInformationIcon());
        } catch (ConnectionFailedException exception) {
          Messages.showMessageDialog(bundle.getString("configuration.connection.dialogs.connection_failed"), bundle.getString("dialogs.error"), Messages.getErrorIcon());
        } catch (MalformedURLException e1) {
          Messages.showMessageDialog(bundle.getString("configuration.connection.dialogs.malformed_url"), bundle.getString("dialogs.error"), Messages.getErrorIcon());
        } finally {
          parent.setCursor(oldCursor);
        }
      }
    });
    ticketTemplatesList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent e) {
        ListSelectionModel model = (ListSelectionModel) e.getSource();
        if (model.isSelectionEmpty()) {
          ticketTemplateNameTextField.setEnabled(false);
          ticketTemplateContentEditorPane.setEnabled(false);
          ticketTemplateNameTextField.setText(null);
          ticketTemplateContentEditorPane.setText(null);
          removeButton.setEnabled(false);
        } else {
          Template selected = (Template) ticketTemplatesList.getSelectedValue();
          ticketTemplateNameTextField.setEnabled(true);
          ticketTemplateContentEditorPane.setEnabled(true);
          ticketTemplateNameTextField.setText(selected.getName());
          ticketTemplateContentEditorPane.setText(selected.getContent());
          removeButton.setEnabled(true);
        }

      }
    });
    ticketTemplateNameTextField.getDocument().addDocumentListener(new DocumentAdapter() {
      protected void textChanged(DocumentEvent e) {
        Template selected = (Template) ticketTemplatesList.getSelectedValue();
        if (selected != null) {
          selected.setName(ticketTemplateNameTextField.getText());
        }
      }
    });
    ticketTemplateContentEditorPane.getDocument().addDocumentListener(new DocumentAdapter() {
      protected void textChanged(DocumentEvent e) {
        Template selected = (Template) ticketTemplatesList.getSelectedValue();
        if (selected != null) {
          selected.setContent(ticketTemplateContentEditorPane.getText());
        }
      }
    });
    newButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Template template = new Template();
        template.setName(BundleLocator.getBundle().getString("configuration.ticket_templates.new_template_name"));
        ticketTemplatesListModel.add(template);
      }
    });
    removeButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        ticketTemplatesListModel.remove(ticketTemplatesList.getSelectedIndex());
      }
    });

    rootComponent.addChangeListener(new ChangeListener() {
      public void stateChanged(ChangeEvent e) {
        if (defaultValuesPanel == rootComponent.getSelectedComponent()) {
          ConnectionSettings connectionSettings = new ConnectionSettings();
          connectionSettings.setLogin(login.getText());
          connectionSettings.setPassword(password.getText());
          connectionSettings.setTracUrl(tracUrl.getText());
          try {
            gateway.setConfiguration(connectionSettings);
            fillComboBox(componentComboBoxModel, gateway.retrieveComponents(), componentComboBox.getSelectedItem(), false);
            fillComboBox(priorityComboBoxModel, gateway.retrievePriorities(), priorityComboBox.getSelectedItem(), false);
            fillComboBox(typeComboBoxModel, gateway.retrieveTypes(), typeComboBox.getSelectedItem(), false);
            fillComboBox(milestoneComboBoxModel, gateway.retrieveMilestones(), milestoneComboBox.getSelectedItem(), false);
            fillComboBox(versionComboBoxModel, gateway.retrieveVersions(), versionComboBox.getSelectedItem(), false);
          } catch (Exception e1) {
            if (logger.isDebugEnabled()) {
              logger.debug(e1);
            }
          }
View Full Code Here

TOP

Related Classes of org.trzcinka.intellitrac.gateway.TracGateway

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.