public void enregistrerRecherche(Application application) {

    Recherche maRecherche = new Recherche();

    maRecherche.setNumRecherche(application.getMesRecherches().size() + 1);

    maRecherche.setDateRecherche(new Date());

    maRecherche.setMotRecherche(textFieldRecherche.getText());

    for (Entry<Integer, String> entry :
        Bddictionnairique.getInstance(application)
            .getVoletRechercheSimple()
            .getListeDicos()
            .entrySet()) {
      maRecherche.getListeDictionnaire().add(entry.getValue());
    }

    HeadwordDAO headwords = new HeadwordDAO("local");

    for (String dictionnaire : maRecherche.getListeDictionnaire()) {

      List<Headword> mots = headwords.findExactly(textFieldRecherche.getText(), dictionnaire);

      for (Headword headword : mots) {
        maRecherche.getListeResultat().put(headword.getIdHeadword(), headword);
      }
    }

    application.getMesRecherches().add(maRecherche);
  }
Exemple #2
0
  /**
   * Handles a click event. If the blocked user list is updated as a result the proxy will respond
   * with the new list asynchronously.
   *
   * @param actionCommand the action performed by the user
   */
  private void clickHandler(Object actionCommand) {
    System.out.println(
        "Received command: " + actionCommand + "\tText = " + blockTextField.getText());

    if (actionCommand.equals(CMD_BLOCK)) {
      String blocked = blockTextField.getText();
      if (blocked == null || "".equals(blocked)) {
        JOptionPane.showMessageDialog(
            this, "You must provide the username of the user to be blocked.");
        return;
      } else if (!isAlphaNumeric(blocked)) {
        JOptionPane.showMessageDialog(this, "The username must be alphanumeric");
        return;
      }
      try {
        blockingProcessing.processBlock(blocked);
      } catch (CommunicationsException e) {
        JOptionPane.showMessageDialog(this, "Unable to send the block request. (T__T)");
      }
    } else if (actionCommand.equals(CMD_UNBLOCK)) {
      String unblocked = blockedList.getSelectedValue();
      if (unblocked == null || "".equals(unblocked)) {
        JOptionPane.showMessageDialog(this, "Please select the user to be unblocked.");
        return;
      }
      try {
        blockingProcessing.processUnblock(unblocked);
      } catch (CommunicationsException e) {
        JOptionPane.showMessageDialog(this, "Unable to process block request. (T__T)");
      }
    }
  }
  /**
   * Change internal settings based on what was chosen in the prefs, then send a message to the
   * editor saying that it's time to do the same.
   */
  public void applyFrame() {
    // put each of the settings into the table
    String newSizeText = fontSizeField.getText();
    try {
      int newSize = Integer.parseInt(newSizeText.trim());
      String fontName = Base.preferences.get("editor.font", "Monospaced,plain,12");
      if (fontName != null) {
        String pieces[] = fontName.split(",");
        pieces[2] = String.valueOf(newSize);
        StringBuffer buf = new StringBuffer();
        for (String piece : pieces) {
          if (buf.length() > 0) buf.append(",");
          buf.append(piece);
        }
        Base.preferences.put("editor.font", buf.toString());
      }

    } catch (Exception e) {
      Base.logger.warning("ignoring invalid font size " + newSizeText);
    }
    String origUpdateUrl = Base.preferences.get("replicatorg.updates.url", "");
    if (!origUpdateUrl.equals(firmwareUpdateUrlField.getText())) {
      FirmwareUploader.invalidateFirmware();
      Base.preferences.put("replicatorg.updates.url", firmwareUpdateUrlField.getText());
      FirmwareUploader.checkFirmware(); // Initiate a new firmware check
    }

    String logPath = logPathField.getText();
    Base.preferences.put("replicatorg.logpath", logPath);
    Base.setLogFile(logPath);

    editor.applyPreferences();
  }
  void store(WizardDescriptor d) {
    String name = projectNameTextField.getText().trim();
    String folder = createdFolderTextField.getText().trim();

    d.putProperty("projdir", new File(folder));
    d.putProperty("name", name);
  }
Exemple #5
0
  private void onOK() {
    if (!isValidInput()) {
      return;
    }
    dispose();
    String firstName = firstNameField.getText().trim();
    String lastName = lastNameField.getText().trim();
    String emailAddress = emailAddressField.getText().trim();
    SexOfPerson sexOfPerson;
    if (femaleRadioButton.isSelected()) {
      sexOfPerson = SexOfPerson.FEMALE;
    } else {
      sexOfPerson = SexOfPerson.MALE;
    }
    String country = (String) countryComboBox.getSelectedObject();
    Integer birthdayYear = (Integer) birthdayYearComboBox.getSelectedItem();
    Month birthdayMonth = (Month) birthdayMonthComboBox.getSelectedItem();
    Integer birthdayDay = (Integer) birthdayDayComboBox.getSelectedItem();
    char[] passwordArr = passwordField.getPassword();
    String password = new String(passwordArr);
    Arrays.fill(passwordArr, (char) 0);
    Image profilePicture = null;
    if (imageFromFileRadioButton.isSelected()) {
      if (fileSelector.getFilePath() != null) {
        profilePicture = new FileImage(fileSelector.getFilePath());
      }
    }
    Request request =
        new CreateUserRequest(
            communicator.getHttpClient(),
            frame,
            firstName,
            lastName,
            emailAddress,
            sexOfPerson,
            country,
            birthdayYear,
            birthdayMonth,
            birthdayDay,
            password,
            profilePicture) {

          @Override
          protected void onCreateUser(String status, Person person) {
            if (status.equals("INVALID_PROFILE_PICTURE")) {
              communicator.promptForCreateAccount("Invalid profile picture");
            } else if (status.equals("ERROR_CREATING_USER")) {
              communicator.promptForCreateAccount("Error creating user");
            } else if (status.equals("CONNECTION_ERROR")) {
              communicator.promptForCreateAccount("Error connecting to Modeling Commons");
            } else if (status.equals("SUCCESS")) {
              communicator.setPerson(person);
              communicator.promptForUpload();
            } else {
              communicator.promptForCreateAccount("Unknown server error");
            }
          }
        };
    request.execute();
  }
Exemple #6
0
 public void jButton12_actionPerformed(ActionEvent e) {
   List<TerminalInfoStruct> TerminalInfo = new LinkedList<TerminalInfoStruct>();
   List<DataContentStruct> DataContentInfo = new LinkedList<DataContentStruct>();
   for (int i = 0; i < 50; i++) {
     TerminalInfo.clear();
     DataContentInfo.clear();
     TerminalInfoStruct tis = new TerminalInfoStruct();
     int l = 91010001 + i;
     String s = Integer.toString(l);
     tis.TerminalAddress =
         ("" + s.substring(0, 4) + s.substring(6, 8) + s.substring(4, 6)).toCharArray();
     tis.TerminalCommType = 40;
     tis.TerminalProtocol = 80;
     TerminalInfo.add(tis);
     DataContentStruct dcs = new DataContentStruct();
     dcs.DataContentLength = txt_content.getText().length();
     dcs.DataContent = txt_content.getText().toCharArray();
     DataContentInfo.add(dcs);
     rtc.SendBatchToFep(
         Integer.parseInt(txt_AppID.getText()),
         TerminalInfo.size(),
         TerminalInfo,
         DataContentInfo,
         txt_gnm.getText().toCharArray(),
         0,
         0,
         0,
         0);
     try {
       Thread.sleep(1000);
     } catch (InterruptedException ex) {
     }
   }
 }
 private void showUserDialog() {
   JOptionPane.showConfirmDialog(
       null,
       new Object[] {
         this.error,
         "User:"******"Pwd:",
         passwordField,
         "Hostname:",
         hostNameField,
         "Auth URL",
         authURLField,
         "Rootservices",
         rootservicesURLField
       },
       "Specify Connection Details",
       JOptionPane.OK_CANCEL_OPTION);
   this.userName = userNameField.getText();
   this.password = passwordField.getPassword();
   this.hostname = hostNameField.getText();
   this.rootservicesURL = rootservicesURLField.getText();
   try {
     this.jazzAuthUrl = new URI(authURLField.getText());
   } catch (URISyntaxException e) {
     this.error = e.getMessage();
     e.printStackTrace();
     showUserDialog();
   }
 }
Exemple #8
0
 @Override
 public void run() {
   int hour = Integer.valueOf(textField.getText());
   int min = Integer.valueOf(textField_1.getText());
   int sec = Integer.valueOf(textField_2.getText());
   time zeit = new time(hour, min, sec);
   zeit.normalizeTime();
   int second = zeit.toSecond();
   for (int i = second; i >= 0; i--) {
     if (!running) return;
     zeit = time.normalizeSec(i);
     label.setText(zeit.toString());
     try {
       Thread.sleep(1000);
     } catch (InterruptedException e) {
       e.printStackTrace();
     }
   }
   try {
     shutdown();
   } catch (IOException e) {
     e.printStackTrace();
   } catch (RuntimeException e) {
     e.printStackTrace();
   }
 }
 private void doAdd() {
   Designer designer = Designer.theDesigner();
   String headline = headLineTextField.getText();
   int priority = ToDoItem.HIGH_PRIORITY;
   switch (priorityComboBox.getSelectedIndex()) {
     case 0:
       priority = ToDoItem.HIGH_PRIORITY;
       break;
     case 1:
       priority = ToDoItem.MED_PRIORITY;
       break;
     case 2:
       priority = ToDoItem.LOW_PRIORITY;
       break;
   }
   String desc = descriptionTextArea.getText();
   String moreInfoURL = moreinfoTextField.getText();
   ListSet newOffenders = new ListSet();
   for (int i = 0; i < offenderList.getModel().getSize(); i++) {
     newOffenders.add(offenderList.getModel().getElementAt(i));
   }
   ToDoItem item = new UMLToDoItem(designer, headline, priority, desc, moreInfoURL, newOffenders);
   designer.getToDoList().addElement(item); // ? inform()
   Designer.firePropertyChange(Designer.MODEL_TODOITEM_ADDED, null, item);
 }
  /** Validates the options of the fields inputted. */
  private void validateFields() {
    errorDisplay.removeAllErrors();
    Calendar cal = new GregorianCalendar();
    cal.setTime(Calendar.getInstance().getTime());
    cal.add(Calendar.DAY_OF_YEAR, -1);
    Iteration forName = IterationModel.getInstance().getIteration(boxName.getText().trim());
    if (boxName.getText().trim().length() == 0) {
      errorDisplay.displayError(EMPTY_NAME_ERROR);
    } else if (forName != null && forName != displayIteration) {
      errorDisplay.displayError(INVALID_NAME_ERROR);
    }

    if (endDateBox.getText().trim().length() == 0 || endDateBox.getText().trim().length() == 0) {
      errorDisplay.displayError(DATES_REQ);
    } else if (((Date) startDateBox.getValue()).after((Date) endDateBox.getValue())) {
      errorDisplay.displayError(START_AFTER_END_ERROR);
    } else if (((Date) startDateBox.getValue()).before(cal.getTime())) {
      errorDisplay.displayError(PAST_ERROR);
    } else {
      Iteration conflicting =
          IterationModel.getInstance()
              .getConflictingIteration(
                  (Date) startDateBox.getValue(), (Date) endDateBox.getValue());
      if (conflicting != null && conflicting != displayIteration) {
        errorDisplay.displayError(
            OVERLAPPING_ERROR + " Overlaps with " + conflicting.getName() + ".");
      }
    }

    buttonAdd.setEnabled(!errorDisplay.hasErrors());
  }
  /**
   * Finalizes our changes and updates the hashmaps
   *
   * @param slot - item slot we edited
   * @param shopId - shop id we are in
   */
  protected void enterSlotChange(int slot, int shopId) {

    // load data from shops hashmap into our temporary arrays
    Object[] shopData = new Object[3];
    int[][] itemsArrayLoaded = new int[41][2];
    for (HashMap.Entry<Object[], int[][]> entry :
        ShopEditorPanel.shopsMap.get(Integer.valueOf(shopId)).entrySet()) {
      shopData = (Object[]) entry.getKey();
      itemsArrayLoaded = (int[][]) entry.getValue();
    }

    // edit temporary arrays
    itemsArrayLoaded[slot][0] = Integer.parseInt(itemField.getText());
    itemsArrayLoaded[slot][1] = Integer.parseInt(amountField.getText());

    HashMap<Object[], int[][]> shopValues = new HashMap<Object[], int[][]>();

    // put edited data back into the shops hashmap
    shopValues.put(shopData, itemsArrayLoaded);
    ShopEditorPanel.shopsMap.put(Integer.valueOf(shopId), shopValues);

    // redraw the grid of items and close the popup jframe
    ShopEditorPanel.createItemsGrid(shopId);
    popupJFrame.dispose();
  }
Exemple #12
0
  /** Store changes to table preferences. This method is called when the user clicks Ok. */
  @Override
  public void storeSettings() {

    prefs.putBoolean(JabRefPreferences.NAMES_AS_IS, namesAsIs.isSelected());
    prefs.putBoolean(JabRefPreferences.NAMES_FIRST_LAST, namesFf.isSelected());
    prefs.putBoolean(JabRefPreferences.NAMES_NATBIB, namesNatbib.isSelected());
    prefs.putBoolean(JabRefPreferences.NAMES_LAST_ONLY, lastNamesOnly.isSelected());
    prefs.putBoolean(JabRefPreferences.ABBR_AUTHOR_NAMES, abbrNames.isSelected());

    prefs.putInt(
        JabRefPreferences.AUTO_RESIZE_MODE,
        autoResizeMode.isSelected() ? JTable.AUTO_RESIZE_ALL_COLUMNS : JTable.AUTO_RESIZE_OFF);
    prefs.putBoolean(JabRefPreferences.PRIMARY_SORT_DESCENDING, priDesc.isSelected());
    prefs.putBoolean(JabRefPreferences.SECONDARY_SORT_DESCENDING, secDesc.isSelected());
    prefs.putBoolean(JabRefPreferences.TERTIARY_SORT_DESCENDING, terDesc.isSelected());
    prefs.put(JabRefPreferences.PRIMARY_SORT_FIELD, priField.getText().toLowerCase().trim());
    prefs.put(JabRefPreferences.SECONDARY_SORT_FIELD, secField.getText().toLowerCase().trim());
    prefs.put(JabRefPreferences.TERTIARY_SORT_FIELD, terField.getText().toLowerCase().trim());

    prefs.putBoolean(JabRefPreferences.FLOAT_MARKED_ENTRIES, floatMarked.isSelected());
    // updatefont

    String oldVal = prefs.get(JabRefPreferences.NUMERIC_FIELDS);
    String newVal = numericFields.getText().trim();
    if (newVal.isEmpty()) {
      newVal = null;
    }
    if (newVal != null && oldVal == null
        || newVal == null && oldVal != null
        || newVal != null && !newVal.equals(oldVal)) {
      prefs.put(JabRefPreferences.NUMERIC_FIELDS, newVal);
      BibtexFields.setNumericFieldsFromPrefs();
    }
  }
 public Properties getProps() {
   props.setProperty("Database", database.getText());
   props.setProperty("Host_Name", host.getText());
   props.setProperty("Port", port.getText());
   props.setProperty("User_Name", user.getText());
   return props;
 }
Exemple #14
0
 public void handleNumber(String key) {
   if (isFirstDigit) display.setText(key);
   else if ((key.equals(".")) && (display.getText().indexOf(".") < 0))
     display.setText(display.getText() + ".");
   else if (!key.equals(".")) display.setText(display.getText() + key);
   isFirstDigit = false;
 }
Exemple #15
0
  public void addValuesToTable() {

    model.addRow(
        new Object[] {
          txtPathName.getText(), txtEdges.getText(), txtMaxSpeed.getText(), txtVehicleMin.getText()
        });
  }
Exemple #16
0
  // get tha data of textfield
  void get_polynomial() {
    A_BeforeSplit = polynomial_A.getText();
    B_BeforeSplit = polynomial_B.getText();

    // split and put data in A_polynomial and B_polynomial
    A_polynomial = A_BeforeSplit.split("[, ]+");
    B_polynomial = B_BeforeSplit.split("[, ]+");

    // get coefficient and index of polynomial A
    for (int i = 0; i < A_polynomial.length; i++) {
      if (i % 2 == 0 && i != 1) {
        A_coefficient[i / 2] = Integer.valueOf(A_polynomial[i]);
      } else { // i % 2 == 1 or i == 1
        A_index[(i + 1) / 2 - 1] = Integer.valueOf(A_polynomial[i]);
      }
    }

    // get coefficient and index of polynomial B
    for (int i = 0; i < B_polynomial.length; i++) {
      if (i % 2 == 0 && i != 1) {
        B_coefficient[i / 2] = Integer.valueOf(B_polynomial[i]);
      } else { // i % 2 == 1 or i == 1
        B_index[(i + 1) / 2 - 1] = Integer.valueOf(B_polynomial[i]);
      }
    }
  }
Exemple #17
0
  protected void updateTabes(KeyEvent arg0) {
    Tab tabee = tabAccess.get(tab.getSelectedIndex());
    if (arg0.getKeyCode() == KeyEvent.VK_ENTER) {
      MyEditorPane pane = new MyEditorPane(addressBar.getText());
      pane.addHyperlinkListener(HYHandler);
      JScrollPane scPane = new JScrollPane(pane);
      tabee.addPane(pane);
      pane.setEditable(false);

      int i = tab.getSelectedIndex();

      tabcreate = false;
      tab.remove(i);
      tabcreate = false;
      change = false;
      tab.insertTab(tabee.getPane().getAddress(), null, scPane, null, i);
      tabcreate = false;
      addCloseButton(i, tabee.getPane().getAddress());
      change = false;
      tabcreate = false;
      tab.setSelectedIndex(i);
      change = false;
      tabcreate = false;

      loadPage(pane, tabee.getPane().getAddress());
      tabcreate = true;
      return;
    }
    tabee.setAddress(addressBar.getText());
  }
Exemple #18
0
        public void actionPerformed(ActionEvent evt) {
          if (state == FIRST_PANEL) {
            if (fldName.getText().trim().length() == 0) {
              SimUtilities.showMessage("You must provide a snapshot file name");
              return;
            }
            setTopPanel(secondPanel);
            state = SECOND_PANEL;
            btnNext.setText("Finished");
            btnBack.setEnabled(true);
          } else {
            if (capture == CAPTURE_INTERVAL) {
              String num = fldInterval.getText().trim();
              if (num.length() == 0) {
                SimUtilities.showMessage("You must provide a numeric interval");
                return;
              }

              try {
                interval = Integer.parseInt(num);
                if (interval <= 0) {
                  SimUtilities.showMessage("Interval must be a positive whole number");
                  return;
                }
              } catch (NumberFormatException ex) {
                SimUtilities.showMessage("Interval must be a positive whole number");
                return;
              }
            }
            makeRetVal();
            close();
          }
        }
  protected void savePeople() {

    // get the people info from gui
    String firstName = firstNameTextField.getText();
    String lastName = lastNameTextField.getText();

    People people = new People(firstName, lastName);

    try {
      // save to the database
      peopleDAO.addPeople(people);

      // close dialog
      setVisible(false);
      dispose();

      // refresh gui list
      ClientWindow.refreshPeopleView();

      // TODO:
      // show success message
      // JOptionPane.showMessageDialog(clientWindow,
      // "people added succesfully.", "Info",
      // JOptionPane.INFORMATION_MESSAGE);
    } catch (Exception exc) {
      JOptionPane.showMessageDialog(
          clientWindow,
          "Error saving people: " + exc.getMessage(),
          "Error!",
          JOptionPane.ERROR_MESSAGE);
      exc.printStackTrace();
    }
  }
  private boolean add() {
    // Validation:
    if (StringUtil.isEmpty(jtf_fileName.getText())) {
      JOptionPane.showMessageDialog(
          this, "Name must be present!", "Validation: name empty!", JOptionPane.ERROR_MESSAGE);
      jtf_fileName.requestFocus();
      return false;
    }

    // Read values:
    final String fileName = jtf_fileName.getText();
    final ContentType ct = jp_contentType.getContentType();
    final File file = new File(jtf_file.getText());
    final ReqEntityFilePart part = new ReqEntityFilePartBean(fileName, ct, file);

    // Trigger all listeners:
    for (AddMultipartPartListener l : listeners) {
      l.addPart(part);
    }

    // Clear:
    clear();

    // Focus:
    jb_file.requestFocus();

    return true;
  }
Exemple #21
0
  public void test() throws Exception {

    Properties props = new Properties();
    props.put("mail.transport.protocol", "smtps");
    props.put("mail.smtps.host", SMTP_HOST_NAME);
    props.put("mail.smtps.auth", "true");
    props.put("mail.smtps.quitwait", "false");
    Session mailSession = Session.getDefaultInstance(props);
    mailSession.setDebug(true);

    Transport transport = mailSession.getTransport();
    MimeMessage message = new MimeMessage(mailSession);
    message.setFrom(new InternetAddress(username.getText()));
    message.setSubject(subject.getText());

    String s = msgfield.getText();
    message.setContent(s, "text/plain");
    message.addRecipient(Message.RecipientType.TO, new InternetAddress(emailID.getText()));
    System.out.println("8i m here ");
    try {
      transport.connect(SMTP_HOST_NAME, SMTP_HOST_PORT, username.getText(), password.getText());
    } catch (Exception e) {
      JOptionPane.showMessageDialog(null, "invalid username or password");
    }
    System.out.println("8i m here also yaar");
    // transport.sendMessage(message,message.getRecipients(Message.RecipientType.TO));
    transport.sendMessage(message123, message123.getAllRecipients());
    transport.close();
    System.out.println(s);
  }
    @Override
    public void keyPressed(KeyEvent e) {
        int keyCode = e.getKeyCode();

         if(keyCode == KeyEvent.VK_ENTER){
            final JDialog dialog = new JDialog();
            dialog.setTitle("Search results");
            dialog.setModal(true);
            int height = 40;
            
            dialog.setBounds(0, 0, 300, 500);

            JPanel panel = new JPanel();                     
            ArrayList list = DataLayer.search(zoekBalk.getText());
            panel.setLayout(new GridLayout(list.size(), 1));
            
            if(list.size() == 0){
                JOptionPane.showMessageDialog(null, zoekBalk.getText() + " kon niet gevonden worden/ bestaat niet!", "Niet gevonden", JOptionPane.INFORMATION_MESSAGE);
                //panel.add(new JLabel(zoekBalk.getText() + " kon niet gevonden worden/ bestaat niet!"));
            }else{
                for(int i = 0; i < list.size(); i++){
                    panel.add(new JLabel(list.get(i).toString()));
                    height = height + 20;
                }
                dialog.setPreferredSize(new Dimension(200, height));
                dialog.add(panel);
                dialog.pack();
                dialog.setLocationRelativeTo(null);
                dialog.setVisible(true);
                dialog.validate();
            }
        }
    }
Exemple #23
0
 private Factura getNewFactura() {
   return new Factura(
       fecha,
       txtBono.getText(),
       Integer.parseInt((txtValor.getText().equals("")) ? "0" : txtValor.getText()),
       0);
 }
 public void getParam() {
   Param.subghzBaud = (Integer) subghzBaud.getSelectedItem();
   Param.subghzChannel = (Integer) subghzChannel.getSelectedItem();
   Param.subghzPanid = subghzPanid.getText();
   Param.subghzStrTxaddr = subghzTxAddr.getText();
   Param.subghzPwr = (Integer) subghzPwr.getSelectedItem();
 }
  private void setNumericalValues() throws ParseException {
    perc = new int[PERCENT_MAX];

    // decimalFormat manage the localization.
    DecimalFormat decimalFormat = new DecimalFormat(format);

    if (!generateRandomPopTextRow.getText().equals("")) {
      perc[PERCENT_RANDOM] =
          (int)
              Math.round(
                  PERCENT_DOUBLE
                      * (decimalFormat.parse(generateRandomPopTextRow.getText()).doubleValue()));
    } else {
      perc[PERCENT_RANDOM] = 0;
    }
    if (!generateInitPopTextRow.getText().equals("")) {
      perc[PERCENT_INIT_POP] =
          (int)
              Math.round(
                  PERCENT_DOUBLE
                      * (decimalFormat.parse(generateInitPopTextRow.getText()).doubleValue()));
    } else {
      perc[PERCENT_INIT_POP] = 0;
    }
  }
 public String getRepositoryLocation() throws MalformedRepositoryLocationException {
   if (tree.getSelectionPath() != null) {
     Entry selectedEntry = (Entry) tree.getSelectionPath().getLastPathComponent();
     RepositoryLocation selectedLocation = selectedEntry.getLocation();
     if (selectedEntry instanceof Folder) {
       if (enforceValidRepositoryEntryName) {
         selectedLocation =
             new RepositoryLocation(selectedLocation, locationFieldRepositoryEntry.getText());
       } else {
         selectedLocation = new RepositoryLocation(selectedLocation, locationField.getText());
       }
     }
     if (RepositoryLocationChooser.this.resolveRelativeTo != null && resolveBox.isSelected()) {
       return selectedLocation.makeRelative(RepositoryLocationChooser.this.resolveRelativeTo);
     } else {
       return selectedLocation.getAbsoluteLocation();
     }
   } else {
     if (enforceValidRepositoryEntryName) {
       return locationFieldRepositoryEntry.getText();
     } else {
       return locationField.getText();
     }
   }
 }
  public void saveSettings() {
    datPath = path0.getText();
    dirPath = path1.getText();
    libPath = path2.getText();
    top = (Integer) spin.getValue();
    location = loc.getSelectedIndex();
    every = all.isSelected();
    filesys = choice.getSelectedIndex();
    rec = choice2.getSelectedIndex();

    config.setDatabasePath(datPath);
    config.setMusicLibraryPath(dirPath);
    config.setItunesLibraryPath(libPath);
    config.setTopArtists(top + "");
    config.setTopArtists(location + "");
    config.setScanFile(filesys + "");
    config.setScanRec(rec + "");

    if (every) config.setAllEvents("true");
    else config.setAllEvents("false");

    config.setEmailEnabled(emailNotificationEnabled.isSelected());
    config.setEmailAddress(usernameField.getText());
    config.setEmailPass(passwordField.getText());

    config.writePreferences();
  }
Exemple #28
0
  private void eliminar() {
    try {
      Persistencia.Entities.Perfil perfil =
          implPerfil.findPerfilById(Integer.parseInt(txtCodigo_Perfil.getText().trim()));
      Boolean validar = true;
      String mensaje = "";
      if (txtCodigo_Perfil.getText().equals("")) {
        validar = false;
      }
      if (perfil.getPermisosList().size() != 0) {
        mensaje += "Hay Permisos con este Perfil \n";
        validar = false;
      }
      if (perfil.getUsuarioList().size() != 0) {
        mensaje += "Hay Usuarios con este Perfil \n";
        validar = false;
      }
      if (validar) {

        if (implPerfil.elimiarPerfil(perfil) == null) {
          JOptionPane.showMessageDialog(this, "Perfil Eliminado");
          clear_Table();
          findAllEntities();
          reloadSelectPerfil();
        } else {
          JOptionPane.showMessageDialog(this, "Error al Elimimnar el Perfil");
        }
      } else {
        JOptionPane.showMessageDialog(this, mensaje);
      }
    } catch (Exception e) {
      JOptionPane.showMessageDialog(this, "Error");
      e.printStackTrace();
    }
  }
  private void onCreateNewAuctionClicked() {
    try {
      int startingPrice;
      String description = txtDescription.getText();

      if (txtStartingPrice.getText().equals("")) {
        startingPrice = 0;
      } else {
        startingPrice = Integer.parseInt(txtStartingPrice.getText());
      }

      // Get a reference to an inactive auction from the auction manager.
      String auctionRef = auctionFactoryImpl.getInactiveAuction();

      // resolve the Object Reference in Naming
      Auction auctionImpl = AuctionHelper.narrow(ncRef.resolve_str(auctionRef));

      // Put an item up for sale
      auctionImpl.offerItem(userName, description, startingPrice);

      // Update the auction lists
      updateAuctionLists(false);

      appletDisplay("Started new auction");

    } catch (NumberFormatException e1) {
      appletDisplay("Invalid starting price");
    } catch (AuctionFailure e2) {
      appletDisplay(e2.description);
    } catch (Exception e3) {
      appletDisplay("Unable to create a new auction");
      System.out.println("ERROR : " + e3);
      e3.printStackTrace(System.out);
    }
  }
  private void saveItem() {

    File f = new File("config.txt");

    if (f.exists() && !f.isDirectory()) {

      try (PrintWriter out =
          new PrintWriter(new BufferedWriter(new FileWriter("config.txt", true)))) {
        if (!searchName.getText().equals("") && !item.getText().equals("")) {

          out.println(
              searchName.getText()
                  + ","
                  + "http://www.reddit.com/r/hardwareswap/search?q="
                  + item.getText()
                  + "&sort=new&restrict_sr=on");
          addItem();

        } else {

          results.setText("Please provide all info for Search Name and Item");
        }

      } catch (IOException e1) {
        results.append("Error saving to file.");
      }

    } else {
      Main.checkFiles();
    }
  }