/** 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();
   }
 }
  /** Resets controls to their initial state */
  private void reset(ActionEvent event) {
    this.queryTime.setTime(new Date());
    String day = String.format("%02d", queryTime.get(queryTime.DAY_OF_MONTH));
    String month = String.format("%02d", queryTime.get(queryTime.MONTH) + 1);
    jTextDate.setText(day + "-" + month + "-" + queryTime.get(queryTime.YEAR));

    this.jButtonSetFound.setEnabled(false);
    this.jButtonSetLost.setEnabled(false);
    this.jListPackages.setListData(new Vector());
    this.jListScans.setListData(new Vector());
  }
Esempio n. 3
0
  // Listener method for list selection changes.
  public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting() == false) {

      if (list.getSelectedIndex() == -1) {
        // No selection: disable delete, up, and down buttons.
        deleteButton.setEnabled(false);
        upButton.setEnabled(false);
        downButton.setEnabled(false);
        nameField.setText("");

      } else if (list.getSelectedIndices().length > 1) {
        // Multiple selection: disable up and down buttons.
        deleteButton.setEnabled(true);
        upButton.setEnabled(false);
        downButton.setEnabled(false);

      } else {
        // Single selection: permit all operations.
        deleteButton.setEnabled(true);
        upButton.setEnabled(true);
        downButton.setEnabled(true);
        nameField.setText(list.getSelectedValue().toString());
      }
    }
  }
  public void showIt() {
    left.setText(null);
    right.setText(null);

    setLocationRelativeTo(parentFrame);

    setVisible(true);
  }
Esempio n. 5
0
  private void loadPreferences() {
    // grab the preferences so that they can be used to fill out the layout
    ThumbMakerPreferences myPreferences = ThumbMakerPreferences.getInstance();

    // x resolution text box
    xres.setText(myPreferences.getStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME));

    // y resolution text box
    yres.setText(myPreferences.getStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME));

    // aspect ratio checkbox
    aspect.setSelected(
        myPreferences
            .getStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME)
            .equalsIgnoreCase(ThumbMakerPreferences.BOOLEAN_TRUE_STRING));

    // load the color values from the preferences
    int redValueNumber = myPreferences.getIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME);
    int greenValueNumber =
        myPreferences.getIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME);
    int blueValueNumber = myPreferences.getIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME);

    // set the background color image
    colorBox.setBackground(new Color(redValueNumber, greenValueNumber, blueValueNumber));

    // red slider
    red.setValue(redValueNumber);
    redValue.setText("" + redValueNumber);

    // green slider
    green.setValue(greenValueNumber);
    greenValue.setText("" + greenValueNumber);

    // blue slider
    blue.setValue(blueValueNumber);
    blueValue.setText("" + blueValueNumber);

    // algorithm combo box
    algorithm.setSelectedIndex(
        myPreferences.getIntegerPref(ThumbMakerPreferences.RESIZE_ALG_PREF_NAME));

    // format combo box
    format.setSelectedIndex(
        myPreferences.getIntegerPref(ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME));

    // prepend field
    prepend.setText(myPreferences.getStringPref(ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME));

    // append field
    append.setText(myPreferences.getStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME));

    // output folder field
    output.setText(
        (new File(myPreferences.getStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME)))
            .getAbsolutePath());
  }
Esempio n. 6
0
  /** Load the settings of this panel */
  private void loadSettings() {
    uploadPrioTextField.setText(settings.getValue(SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_UPLOAD));
    downloadPrioTextField.setText(
        settings.getValue(SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_DOWNLOAD));
    useOneConnectionForMessagesCheckBox.setSelected(
        settings.getBoolValue(SettingsClass.FCP2_USE_ONE_CONNECTION_FOR_MESSAGES));

    displayDaysTextField.setText(settings.getValue(SettingsClass.MAX_MESSAGE_DISPLAY));
    downloadDaysTextField.setText(settings.getValue(SettingsClass.MAX_MESSAGE_DOWNLOAD));
    messageBaseTextField.setText(settings.getValue(SettingsClass.MESSAGE_BASE));
    alwaysDownloadBackloadCheckBox.setSelected(
        settings.getBoolValue(SettingsClass.ALWAYS_DOWNLOAD_MESSAGES_BACKLOAD));

    minimumIntervalTextField.setText(
        settings.getValue(SettingsClass.BOARD_AUTOUPDATE_MIN_INTERVAL));
    concurrentUpdatesTextField.setText(
        settings.getValue(SettingsClass.BOARD_AUTOUPDATE_CONCURRENT_UPDATES));

    // this setting is in MainFrame
    automaticBoardUpdateCheckBox.setSelected(
        MainFrame.getInstance().isAutomaticBoardUpdateEnabled());
    refreshUpdateState();

    storeSentMessagesCheckBox.setSelected(
        settings.getBoolValue(SettingsClass.STORAGE_STORE_SENT_MESSAGES));
    silentlyRetryCheckBox.setSelected(settings.getBoolValue(SettingsClass.SILENTLY_RETRY_MESSAGES));

    altEditCheckBox.setSelected(settings.getBoolValue(SettingsClass.ALTERNATE_EDITOR_ENABLED));
    altEditTextField.setEnabled(altEditCheckBox.isSelected());
    altEditTextField.setText(settings.getValue(SettingsClass.ALTERNATE_EDITOR_COMMAND));
  }
 /**
  * Sets the values of the configuration dialog to the ones specified by the given
  * WebCrawling-instance.
  *
  * @param wcCfg the WebCrawling-instance containing the values for the dialog
  */
 public void setConfig(WebCrawlingConfig wcCfg) {
   if (wcCfg != null) {
     tfSearchEngineURL.setText(wcCfg.getSearchEngineURL());
     sliderNumberOfRetries.setValue(wcCfg.getNumberOfRetries());
     sliderIntervalBetweenRetries.setValue(wcCfg.getIntervalBetweenRetries());
     tfAdditionalKeywords.setText(wcCfg.getAdditionalKeywords());
     rbAfterSearchString.setSelected(wcCfg.getAdditionalKeywordsAfterSearchString());
     rbBeforeSearchString.setSelected(!wcCfg.getAdditionalKeywordsAfterSearchString());
     jsNumberOfPages.setValue(new Integer(wcCfg.getNumberOfRequestedPages()));
     tfPathStoreRetrievedPages.setText(wcCfg.getPathStoreRetrievedPages());
     tfPathExternalCrawler.setText(wcCfg.getPathExternalCrawler());
     cbStoreURLList.setSelected(wcCfg.isStoreURLList());
   }
 }
Esempio n. 8
0
  /** Loading the values stored into configuration form */
  private void loadValues() {
    PacketLoggingService packetLogging = LoggingUtilsActivator.getPacketLoggingService();
    PacketLoggingConfiguration cfg = packetLogging.getConfiguration();

    enableCheckBox.setSelected(cfg.isGlobalLoggingEnabled());

    sipProtocolCheckBox.setSelected(cfg.isSipLoggingEnabled());
    jabberProtocolCheckBox.setSelected(cfg.isJabberLoggingEnabled());
    rtpProtocolCheckBox.setSelected(cfg.isRTPLoggingEnabled());
    ice4jProtocolCheckBox.setSelected(cfg.isIce4JLoggingEnabled());
    fileCountField.setText(String.valueOf(cfg.getLogfileCount()));
    fileSizeField.setText(String.valueOf(cfg.getLimit() / 1000));

    updateButtonsState();
  }
Esempio n. 9
0
 /**
  * Sets the text of this text field.
  *
  * @param text the text to show in this text field
  */
 public void setText(String text) {
   if ((text == null || text.length() == 0) && !isFocusOwner()) setDefaultText();
   else {
     this.setForeground(foregroundColor);
     super.setText(text);
   }
 }
  /** Updates the information displayed in the fields. */
  public void update() {
    super.update(); // update the common fields

    InteractiveEntity interactiveEntity = (InteractiveEntity) entity;
    String sprite = interactiveEntity.getProperty("sprite");
    String behavior = interactiveEntity.getProperty("behavior");
    EntitySubtype subtype = interactiveEntity.getSubtype();

    boolean hasSprite = (!sprite.equals("_none"));

    withSpriteField.setSelected(hasSprite);
    spriteField.setSelectedId(hasSprite ? sprite : "");

    spriteField.setEnabled(hasSprite);

    if (behavior.equals("map")) {
      behaviorField.setSelectedIndex(1);
      messageField.setEnabled(false);
      itemField.setEnabled(false);
    } else if (behavior.substring(0, 5).equals("item#")) {
      behaviorField.setSelectedIndex(2);
      messageField.setEnabled(false);
      itemField.setEnabled(true);
      itemField.setSelectedId(behavior.substring(5));
    } else if (behavior.substring(0, 7).equals("dialog#")) {
      behaviorField.setSelectedIndex(0);
      messageField.setEnabled(true);
      itemField.setEnabled(false);
      messageField.setText(behavior.substring(7));
    }
  }
 public void valueChanged(TreeSelectionEvent event) {
   JscTreeNode node = (JscTreeNode) (tree.getLastSelectedPathComponent());
   if (node != null) {
     System.out.println(node.object.whenSelected());
     currentSelectionField.setText(node.object.whenSelected());
   }
 }
Esempio n. 12
0
    public boolean stopCellEditing() {
      Object descrip = null, costo = null;
      JTextField campo = ((JTextField) this.getComponent());
      String codigo = campo.getText();
      if (codigo == "") {
        return false;
      }
      descrip =
          Almacenes.groovyPort(
              "omoikane.principal.Articulos.getArticulo('codigo = \""
                  + codigo
                  + "\"').descripcion");
      costo =
          Almacenes.groovyPort(
              "omoikane.principal.Articulos.getArticulo('select * from articulos,precios where articulos.codigo = \""
                  + codigo
                  + "\" "
                  + "and articulos.id_articulo = precios.id_articulo and precios.id_almacen = '+omoikane.principal.Principal.config.idAlmacen[0].text()).costo");

      if (descrip == null) {
        Dialogos.lanzarAlerta("El artĂ­culo que capturĂł no exĂ­ste");
        campo.setText("");
        return false;
      } else {
        tablaPrincipal.setValueAt(
            descrip, tablaPrincipal.getEditingRow(), tablaPrincipal.getEditingColumn() + 1);
        tablaPrincipal.setValueAt(
            costo, tablaPrincipal.getEditingRow(), tablaPrincipal.getEditingColumn() + 2);
        return super.stopCellEditing();
      }
    }
Esempio n. 13
0
 /**
  * Method called when a user message has been sent. checks to see if it is a command or regular
  * message
  */
 private void sendMessage() {
   String txt = new String(messageText.getText());
   if (!txt.equals("")) {
     if (txt.charAt(0) == '\\' || txt.charAt(0) == '/') {
       parseCommand(txt.substring(1));
       messageText.setText("");
       history.add(txt);
     } else if (server != null && server.connected && username != null) {
       sendText(username, txt, false);
       messageText.setText("");
       sendChat(txt);
       history.add(txt);
     } else {
       error("Not connected, type \\reconnect to try and reconnect");
     }
   }
 }
  /** Observer method to update the insuranceCompanyTable */
  public void updateTable() {

    tableData.update(
        model.getInsuranceCompanies(), model.getSortingStrategy()); // Populate the table

    // Check if InsuranceCompany map is empty
    if (model.getInsuranceCompanies().size() > 0) {
      selectRow();
      int selectedCompanyId =
          Integer.valueOf(
              (String)
                  insuranceCompaniesTable.getValueAt(insuranceCompaniesTable.getSelectedRow(), 0));
      controller.selectInsuranceCompany(selectedCompanyId);
      recordEdited = -1; // Reset the recordEdited field
    } else {
      // If all records are deleted, clear the edit panel
      companyIdTextField.setText("");
      companyNameTextField.setText("");
      urlTextField.setText("");
      generalDescriptionTextField.setText("");
      insuranceTypesTextField.setText("");
      telephoneTextField.setText("");
      percentageTextField.setText("");
    }
  }
Esempio n. 15
0
  void doCaretUpdate(int dot, int mark) {
    if (dot == mark) {
      mainFrame.cutItem.setEnabled(false);
      mainFrame.copyItem.setEnabled(false);
      mainFrame.deleteItem.setEnabled(false);
    } else {
      mainFrame.cutItem.setEnabled(true);
      mainFrame.copyItem.setEnabled(true);
      mainFrame.deleteItem.setEnabled(true);
    }

    int length = sourceArea.getText().length();
    if (length == 0 || abs(mark - dot) == length) {
      mainFrame.selectAllItem.setEnabled(false);
    } else {
      mainFrame.selectAllItem.setEnabled(true);
    }

    try {
      if (length == 0) {
        mainFrame.selectLineItem.setEnabled(false);
      } else {
        int lineNum = sourceArea.getLineOfOffset(dot);
        int startLine = sourceArea.getLineStartOffset(lineNum);
        int endLine = sourceArea.getLineEndOffset(lineNum);
        if (endLine - startLine <= 1) {
          mainFrame.selectLineItem.setEnabled(false);
        } else {
          mainFrame.selectLineItem.setEnabled(true);
        }
      }
    } catch (BadLocationException ex) {
      ex.printStackTrace();
    }

    try {
      int line = sourceArea.getLineOfOffset(dot);
      lineText.setText(Integer.toString(line + 1));
      int column = dot - sourceArea.getLineStartOffset(line);
      columnText.setText(Integer.toString(column + 1));
    } catch (BadLocationException ex) {
      ex.printStackTrace();
    }
  }
 private void actionAdd() {
   URL verifiedUrl = verifyUrl(addTextField.getText());
   if (verifiedUrl != null) {
     tableModel.addDownload(new DownloadFile(verifiedUrl));
     addTextField.setText("");
   } else {
     JOptionPane.showMessageDialog(
         this, "Invalid Download URL", "Error", JOptionPane.ERROR_MESSAGE);
   }
 }
Esempio n. 17
0
    /**
     * Set whether this a new projection
     *
     * @param v true for new projection
     * @param name name for new projection
     */
    void setDoingNewProjection(boolean v, String name) {
      doingNew = v;
      // For now don't disable the type box
      nameTF.setText(name);

      if (typeLabel != null) {
        //              typeLabel.setEnabled (doingNew);
        //              projClassCB.setEnabled (doingNew);
      }
    }
Esempio n. 18
0
 void addTextField(JPanel panel, String key, String label) {
   JLabel lab = new JLabel(label);
   lab.setAlignmentX(LEFT_ALIGNMENT);
   panel.add(lab);
   JTextField field = new JTextField();
   field.setText(sketch.configFile.get(key));
   field.setMaximumSize(new Dimension(Integer.MAX_VALUE, field.getPreferredSize().height));
   fields.put(key, field);
   panel.add(field);
 }
Esempio n. 19
0
  public void stateChanged(ChangeEvent e) {

    int deepE = lSlider.getValue();
    int shallE = rSlider.getValue();
    if (shallE > deepE) {
      shallE = deepE;
    }
    if (deepE < shallE) {
      deepE = shallE;
    }
    lSlider.setValue(deepE);
    rSlider.setValue(shallE);
    drawPool(deepE, shallE, 5);

    int v = (shallE + deepE) / 2 * 5 * 20;

    deepField.setText(Integer.toString(deepE));
    shallField.setText(Integer.toString(shallE));
    areaField.setText(Integer.toString(v));
  }
  public DecisionPromptEditor(String form_, String weight_) {

    graphicSetup(this);

    JPanel row = new JPanel();
    row.setLayout(new BoxLayout(row, BoxLayout.LINE_AXIS));

    formField = new JTextField(10);
    formField.setText(form_);

    wField = new JTextField(3);
    wField.setText(weight_);

    formField.setMaximumSize(new Dimension(250, 25));
    wField.setMaximumSize(new Dimension(25, 25));
    row.add(formField);
    row.add(wField);

    this.add(row);
  }
Esempio n. 21
0
 @Override
 public void setCount(String value) {
   boolean disabledEvents = disableEvents();
   try {
     countField.setText(value);
   } finally {
     if (disabledEvents) {
       enableEvents();
     }
   }
 }
Esempio n. 22
0
 public void nameFocusLost(java.awt.event.FocusEvent evt) {
   ctxt.saveState = true;
   String newName = name.getText(), msg;
   while (!Library.validateFileName(newName, false)) {
     msg = "The name '" + newName + "' violates the rules for names:";
     msg += "\nIt must have 2 to 28 characters.";
     msg += "\nYou may not use BackSlash, ForwardSlash, Colon, DoubleQuote";
     msg += "\nAsterisk, QuestionMark, LeftAngleBracket, RightAngleBracket,";
     msg += "\nor the VerticalBar in a name. TRY AGAIN.";
     newName = JOptionPane.showInputDialog(msg);
   } //  end of harrass-em-until-they-give-a-good-name
   name.setText(newName);
   if (!newName.equals(ctxt.languageName)) { // Made a change
     msg = "Change this context's language name\nto" + newName + "?";
     String[] options = {newName, ctxt.languageName};
     int choice =
         JOptionPane.showOptionDialog(
             this,
             msg,
             "Confirm Changed Language Name",
             JOptionPane.YES_NO_OPTION,
             JOptionPane.QUESTION_MESSAGE,
             null,
             options,
             options[0]);
     if (choice == 0) { //  Change is confirmed
       ctxt.languageName = newName;
       msg =
           "Normally, the file name for a context is the same as the language name "
               + "\nfor that context.  Change this context's file name\n"
               + "to "
               + newName
               + "?";
       options[0] = "Change File Name";
       options[1] = "Do Not Change";
       choice =
           JOptionPane.showOptionDialog(
               this,
               msg,
               "Confirm Correct File Name",
               JOptionPane.YES_NO_OPTION,
               JOptionPane.QUESTION_MESSAGE,
               null,
               options,
               options[0]);
       if (choice == 0) {
         Library.userContextName = newName;
         if (SIL_Edit.edWin != null && ctxt == Library.contextUnderConstruction) {
           SIL_Edit.edWin.chart.changeFileName(newName);
         }
       }
     } //  end of Change-is-confirmed
   } //  end of change-was-made
 }
Esempio n. 23
0
  protected void init(Object value, Class<?> expectedClass) {
    boolean fieldEditable = Utils.isEditableType(expectedClass.getName());
    clearObject();
    if (value != null) {
      textField.setText(value.toString());
    } else {
      // null String value for the moment
      textField.setText("");
    }
    textField.setToolTipText(null);
    if (fieldEditable) {
      if (!textField.isEditable()) {
        textField.setEditable(true);
      }

    } else {
      if (textField.isEditable()) {
        textField.setEditable(false);
      }
    }
  }
Esempio n. 24
0
 @Override
 public void propertyChange(PropertyChangeEvent e) {
   if (e.getPropertyName().equals(CalendarCardPanel.PICKED_DATE)) {
     SimpleDate sd = (SimpleDate) e.getNewValue();
     tf.setText(SimpleDate.simpleDateToMmldate(sd));
     popup.setVisible(false);
     popup = null;
     String test = tf.getText().trim();
     if (!test.equals("")) {
       find(test);
     }
   }
 }
Esempio n. 25
0
  /** called when our JTree's nodes are selected. */
  void nodeSelected(TreeNode treeNode) {

    lastSelected = treeNode;
    Node node = jtree.getNode(treeNode);
    if (node == null) return;

    String xpath = DOMInfoExtractor.getXPath(node);
    selectedXPathTextField.setText(xpath);

    String message = DOMTreeFull.toString(node);
    message += "\r\n";
    message += xpath;
    setMessage(message);
  }
Esempio n. 26
0
  /** Change the view to display a given question number (1-origin) */
  protected void setQNumber(int nn) {
    String userShowNumber = Integer.toString(nn);

    System.out.println("setQNumber(" + userShowNumber + ");");

    // notify the model
    //	TODO -- if necessary!

    // update the view
    numTF.setText(userShowNumber);
    numSlider.setValue(nn);

    // show the right question
    myCardLayout.show(questionsPanel, userShowNumber);
  }
  /*
   * The following method resets the window to its original status.
   */
  public void init() {
    sampleField.setText(new String("Big Java"));
    textField.setText(new String("Big Java"));

    facenameCombo.setSelectedIndex(0);
    sizeCombo.setSelectedIndex(2);

    italicCheckBox.setSelected(false);
    boldCheckBox.setSelected(false);

    //            largeButton.setSelected(true);

    fontColor = Color.BLACK;

    setSampleFont();
  } // end init method
  // Add fee method
  private void addFees() {
    try {
      float feesadded = Float.parseFloat(addfeestextfield.getText());

      int id = table.getSelectionModel().getMinSelectionIndex();
      long studentid = (long) table.getValueAt(id, 0);

      int index = feestable.getSelectionModel().getMinSelectionIndex();
      String coursename = (String) feestable.getValueAt(index, 0);

      Database db = new Database();
      db.addFees(feesadded, studentid, coursename);

      updateFeesData(studentid);

      addfeestextfield.setText("");
    } catch (Exception e) {
      JOptionPane.showMessageDialog(this, e.getMessage(), null, JOptionPane.ERROR_MESSAGE);
    }
  }
  /** Observer method to update the editPanel and it's contents */
  public void updateEditPanel() {

    InsuranceCompany insuranceCompany = model.getCurrentInsuranceCompany();

    if (insuranceCompany != null) { // If no currentInsuranceCompany is set (if the db is empty)
      // Update all text fields
      String id =
          (String) insuranceCompaniesTable.getValueAt(insuranceCompaniesTable.getSelectedRow(), 0);
      companyIdTextField.setText(id);
      companyNameTextField.setText(insuranceCompany.getCompanyName());
      urlTextField.setText(insuranceCompany.getUrl());
      urlTextField.setCaretPosition(0);
      generalDescriptionTextField.setText(insuranceCompany.getGeneralDescription());
      generalDescriptionTextField.setCaretPosition(0);
      insuranceTypesTextField.setText(insuranceCompany.getInsuranceTypes());
      insuranceTypesTextField.setCaretPosition(0);
      telephoneTextField.setText(insuranceCompany.getTelephone());
      percentageTextField.setText(Float.toString(insuranceCompany.getPercentage()));
    }
  }
 @Override
 public void valueChanged(TreeSelectionEvent event) {
   currentSelectionField.setText(tree.getLastSelectedPathComponent().toString());
 }