Ejemplo n.º 1
0
 public static String[] getValidTwoDigits(String currencyCode) throws InterruptOperationException {
   while (true) {
     writeMessage(res.getString("choose.denomination.and.count.format"));
     String twoNumbers = readString();
     String[] numbers;
     if (twoNumbers != null) {
       numbers = twoNumbers.split(" ");
     } else {
       writeMessage(res.getString("invalid.data"));
       continue;
     }
     if (numbers.length != 2) {
       writeMessage(res.getString("invalid.data"));
       continue;
     }
     if (isInteger(numbers[0])
         && isInteger(numbers[1])
         && Integer.parseInt(numbers[0]) > 0
         && Integer.parseInt(numbers[1]) > 0) {
       return numbers;
     } else {
       writeMessage(res.getString("invalid.data"));
     }
   }
 }
Ejemplo n.º 2
0
 private static ResourceBundle getBundle(Locale locale) {
   try {
     return ResourceBundle.getBundle(BASE_NAME, locale);
   } catch (MissingResourceException e) {
     return ResourceBundle.getBundle(BASE_NAME);
   }
 }
Ejemplo n.º 3
0
  public void run() {
    String ipdest = "";
    try {

      ipdest = system.in.read(messages.getString("ipdest"));
      int count = 0;
      byte[] data = String.valueOf(count).getBytes();

      simulip.net.DatagramSocket d = new simulip.net.DatagramSocket(this);
      simulip.net.DatagramPacket p = new simulip.net.DatagramPacket(data, 5, ipdest, 54);
      while (true) {
        d.send(p);
        d.receive(p);
        system.out.println(
            MessageFormat.format(messages.getString("ackOf"), new String(p.getData())));
        p.setAddress(p.getAddress());
        p.setPort(p.getPort());
        count++;
        data = String.valueOf(count).getBytes();
        p.setData(data);
      }
    } catch (NetworkAddressFormatException nafe) {
      system.out.println(MessageFormat.format(messages.getString("badlyFormedAddress"), ipdest));
    } catch (Exception e) {
      system.out.println(e.getMessage());
      Logger.getLogger("").log(Level.SEVERE, "UdpEchoSend error", e);
    }
  }
Ejemplo n.º 4
0
  protected void spendXP() {
    String skillName = (String) choiceSkill.getSelectedItem();
    if (choiceNoSkill.equals(skillName)) {
      // This shouldn't happen, but guard against it anyway.
      return;
    }
    int rows = personnelTable.getRowCount();
    int improvedPersonnelCount = rows;
    while (rows > 0) {
      for (int i = 0; i < rows; ++i) {
        Person p = personnelModel.getPerson(personnelTable.convertRowIndexToModel(i));
        int cost = 0;
        if (p.hasSkill(skillName)) {
          cost = p.getCostToImprove(skillName);
        } else {
          cost = SkillType.getType(skillName).getCost(0);
        }
        int experience = p.getExperienceLevel(false);

        // Improve the skill and deduce the cost
        p.improveSkill(skillName);
        campaign.personUpdated(p);
        p.setXp(p.getXp() - cost);

        // The next part is bollocks and doesn't belong here, but as long as we hardcode AtB ...
        if (campaign.getCampaignOptions().getUseAtB()) {
          if ((p.getPrimaryRole() > Person.T_NONE)
              && (p.getPrimaryRole() <= Person.T_CONV_PILOT)
              && (p.getExperienceLevel(false) > experience)
              && (experience >= SkillType.EXP_REGULAR)) {
            String spa = campaign.rollSPA(p.getPrimaryRole(), p);
            if (null == spa) {
              if (campaign.getCampaignOptions().useEdge()) {
                p.acquireAbility(
                    PilotOptions.EDGE_ADVANTAGES, "edge", p.getEdge() + 1); // $NON-NLS-1$
                p.addLogEntry(
                    campaign.getDate(),
                    String.format(resourceMap.getString("gainedEdge.text"))); // $NON-NLS-1$
              }
            } else {
              p.addLogEntry(
                  campaign.getDate(),
                  String.format(resourceMap.getString("gained.format"), spa)); // $NON-NLS-1$
            }
          }
        }
      }
      // Refresh the filter and continue if we still have anyone available
      updatePersonnelTable();
      rows = personnelTable.getRowCount();
      dataChanged = true;
    }
    if (improvedPersonnelCount > 0) {
      campaign.addReport(
          String.format(
              resourceMap.getString("improvedSkills.format"),
              skillName,
              improvedPersonnelCount)); //$NON-NLS-1$
    }
  }
Ejemplo n.º 5
0
  static ModelNode getSubsystemDescription(final Locale locale) {
    final ResourceBundle bundle = getResourceBundle(locale);

    final ModelNode node = new ModelNode();

    node.get(DESCRIPTION).set(bundle.getString("web"));
    node.get(HEAD_COMMENT_ALLOWED).set(true);
    node.get(TAIL_COMMENT_ALLOWED).set(true);
    node.get(NAMESPACE).set(Namespace.WEB_1_0.getUriString());

    node.get(ATTRIBUTES, Constants.DEFAULT_VIRTUAL_SERVER, TYPE).set(ModelType.STRING);
    node.get(ATTRIBUTES, Constants.DEFAULT_VIRTUAL_SERVER, DESCRIPTION)
        .set(bundle.getString("web.default-virtual-server"));
    node.get(ATTRIBUTES, Constants.DEFAULT_VIRTUAL_SERVER, REQUIRED).set(false);
    node.get(ATTRIBUTES, Constants.DEFAULT_VIRTUAL_SERVER, DEFAULT).set("localhost");

    node.get(ATTRIBUTES, Constants.NATIVE, TYPE).set(ModelType.BOOLEAN);
    node.get(ATTRIBUTES, Constants.NATIVE, DESCRIPTION).set(bundle.getString("web.native"));
    node.get(ATTRIBUTES, Constants.NATIVE, REQUIRED).set(false);
    node.get(ATTRIBUTES, Constants.NATIVE, DEFAULT).set(true);

    getConfigurationCommonDescription(
        node.get(ATTRIBUTES, Constants.CONTAINER_CONFIG), ATTRIBUTES, bundle);
    getConnectorCommonDescription(node.get(CHILDREN, Constants.CONNECTOR), ATTRIBUTES, bundle);
    getVirtualServerCommonDescription(
        node.get(CHILDREN, Constants.VIRTUAL_SERVER), ATTRIBUTES, bundle);

    return node;
  }
Ejemplo n.º 6
0
 public String getNewDepartid(String departid) throws Exception {
   String mess = null;
   ResourceBundle resourceBundle = ResourceBundle.getBundle("sqlmap");
   String pd = resourceBundle.getString("procd.maxdepartid");
   mess = DBUtil.execOracleProcQueryString(pd, departid);
   return mess;
 }
Ejemplo n.º 7
0
 /**
  * Determine the text being shown for given panel.
  *
  * @param panel
  * @return The text shown, i18n.
  */
 public Map getHtmlCode(Panel panel) {
   PanelSession pSession = SessionManager.getPanelSession(panel);
   Map m = (Map) pSession.getAttribute(ATTR_TEXT);
   if (m != null) return m;
   HTMLText text = load(panel.getInstance());
   if (text != null) return text.getText();
   try {
     HTMLText textToCreate = new HTMLText();
     textToCreate.setPanelInstance(panel.getInstance());
     Locale[] locales = LocaleManager.lookup().getPlatformAvailableLocales();
     for (int i = 0; i < locales.length; i++) {
       Locale locale = locales[i];
       ResourceBundle i18n =
           localeManager.getBundle("org.jboss.dashboard.ui.panel.advancedHTML.messages", locale);
       textToCreate.setText(locale.getLanguage(), i18n.getString("defaultContent"));
     }
     textToCreate.save();
   } catch (Exception e) {
     log.error("Error creating empty text for panel: ", e);
   }
   text = load(panel.getInstance());
   if (text != null) return text.getText();
   log.error("Current HTML code is null for panel " + panel);
   return null;
 }
  public static String[] getValidTwoDigits(String currencyCode) throws InterruptOperationException {
    String[] array;
    writeMessage(
        String.format(res.getString("choose.denomination.and.count.format"), currencyCode));

    while (true) {
      String s = readString();
      array = s.split(" ");
      int k;
      int l;
      try {
        k = Integer.parseInt(array[0]);
        l = Integer.parseInt(array[1]);
      } catch (Exception e) {
        writeMessage(res.getString("invalid.data"));
        continue;
      }
      if (k <= 0 || l <= 0 || array.length > 2) {
        writeMessage(res.getString("invalid.data"));
        continue;
      }
      break;
    }
    return array;
  }
Ejemplo n.º 9
0
 public void updateFolderAllowed(String path) {
   UIFormSelectBox sltWorkspace = getChildById(UIDriveInputSet.FIELD_WORKSPACE);
   String strWorkspace = sltWorkspace.getSelectedValues()[0];
   SessionProvider sessionProvider = WCMCoreUtils.getSystemSessionProvider();
   try {
     Session session =
         sessionProvider.getSession(
             strWorkspace,
             getApplicationComponent(RepositoryService.class).getCurrentRepository());
     Node rootNode = (Node) session.getItem(path);
     List<SelectItemOption<String>> foldertypeOptions = new ArrayList<SelectItemOption<String>>();
     RequestContext context = RequestContext.getCurrentInstance();
     ResourceBundle res = context.getApplicationResourceBundle();
     for (String foldertype : setFoldertypes) {
       if (isChildNodePrimaryTypeAllowed(rootNode, foldertype)) {
         try {
           foldertypeOptions.add(
               new SelectItemOption<String>(
                   res.getString(getId() + ".label." + foldertype.replace(":", "_")), foldertype));
         } catch (MissingResourceException mre) {
           foldertypeOptions.add(new SelectItemOption<String>(foldertype, foldertype));
         }
       }
     }
     Collections.sort(foldertypeOptions, new ItemOptionNameComparator());
     getUIFormSelectBox(FIELD_ALLOW_CREATE_FOLDERS).setOptions(foldertypeOptions);
   } catch (Exception e) {
     if (LOG.isErrorEnabled()) {
       LOG.error("Unexpected problem occurs while updating", e);
     }
   }
 }
Ejemplo n.º 10
0
  /** {@inheritDoc} */
  public void commit() {
    ResourceBundle rb = ResourceBundle.getBundle("TalendBridge", Locale.getDefault());

    if (waitToTruncate == true) {
      rowList.clear();
      return;
    }

    for (TalendRowImpl row : rowdraft) {
      if ((index.size() - 1) > 0 && index.contains(row.getKeySet())) {
        throw new IllegalStateException(
            String.format(Locale.getDefault(), rb.getString("exception.duplicateKey"), name));
      }
    }
    rowList.addAll(rowdraft);
    for (TalendRowImpl row : rowdraft) {
      if (row.presentInTable == false) {
        // index.put(row.getKeySet(), 1);
        index.add(row.getKeySet());
      }
      row.presentInTable = true;
      row.save();
    }
    rowdraft.clear();
  }
Ejemplo n.º 11
0
  private boolean checkPassword() {
    Password firstPassword;

    if (jpfFirst instanceof JPasswordQualityField) {
      char[] firstPasswordChars = ((JPasswordQualityField) jpfFirst).getPassword();

      if (firstPasswordChars == null) {
        JOptionPane.showMessageDialog(
            this,
            res.getString("MinimumPasswordQualityNotMet.message"),
            getTitle(),
            JOptionPane.WARNING_MESSAGE);
        return false;
      }

      firstPassword = new Password(firstPasswordChars);
    } else {
      firstPassword = new Password(((JPasswordField) jpfFirst).getPassword());
    }

    Password confirmPassword = new Password(jpfConfirm.getPassword());

    if (firstPassword.equals(confirmPassword)) {
      password = firstPassword;
      return true;
    }

    JOptionPane.showMessageDialog(
        this, res.getString("PasswordsNoMatch.message"), getTitle(), JOptionPane.WARNING_MESSAGE);

    return false;
  }
Ejemplo n.º 12
0
  /** {@inheritDoc} */
  public synchronized void removeColumn(TalendColumn column) {

    ResourceBundle rb = ResourceBundle.getBundle("TalendBridge", Locale.getDefault());

    int index = columnsList.indexOf(column);
    if (index == -1) {
      return;
    }

    if (columnImpls.get(column).isKey() && (!rowList.isEmpty() || !rowdraft.isEmpty())) {
      throw new IllegalStateException(
          String.format(
              Locale.getDefault(),
              rb.getString("exception.cannotRemoveKey"),
              column.getName(),
              name));
    }

    TalendColumnImpl c;
    for (index = index + 1; index < columnsList.size(); index++) {
      c = columnsList.get(index);
      c.index--;
    }

    for (TalendRowImpl row : rowList) {
      row.setValue(column, null, true);
    }

    columnsList.remove((TalendColumnImpl) column);
    columns.remove(column.getName());
    columnImpls.remove(column);
  }
Ejemplo n.º 13
0
  private void initComponents() {
    addButton = new JButton(rb.getString("Button.Add"));
    addButton.setIcon(IconUtils.getIcon("/jgnash/resource/list-add.png"));
    addButton.setHorizontalTextPosition(SwingConstants.LEADING);

    removeButton = new JButton(rb.getString("Button.Remove"));
    removeButton.setIcon(IconUtils.getIcon("/jgnash/resource/list-remove.png"));

    aJList = new JList<>();
    cJList = new JList<>();

    helpPane = new JEditorPane();
    helpPane.setEditable(false);
    helpPane.setEditorKit(new StyledEditorKit());
    helpPane.setBackground(getBackground());
    helpPane.setText(TextResource.getString("NewFileThree.txt"));

    addComponentListener(
        new ComponentAdapter() {

          @Override
          public void componentHidden(ComponentEvent evt) {
            isPageValid();
          }
        });

    addButton.addActionListener(this);
    removeButton.addActionListener(this);
  }
Ejemplo n.º 14
0
  @Override
  public String getString(String key, Locale locale) {
    ResourceBundle bundle = resourceBundles.get(locale.getISO3Language());
    if (bundle == null) {
      try {
        bundle = ResourceBundle.getBundle(languageBundleName, locale);
        resourceBundles.put(locale.getISO3Language(), bundle);
      } catch (MissingResourceException e) {
        bundle = resourceBundles.get(FALLBACK_LANGUAGE_ISO);
      }
    }

    try {
      String value = bundle.getString(key);

      if (LOG.isDebugEnabled()) {
        LOG.debug(
            "Key '"
                + key
                + "' with ISO "
                + locale.getISO3Language()
                + " resulted in value: "
                + value);
      }

      return value;
    } catch (MissingResourceException e) {
      return "Missing text for key " + key;
    }
  }
  /**
   * Return a named ResourceBundle for a particular locale. This method mimics the behavior of
   * ResourceBundle.getBundle().
   *
   * @param className Name of local-specific subclass.
   * @param locale the locale to prefer when searching for the bundle
   */
  public static final XResourceBundle loadResourceBundle(String className, Locale locale)
      throws MissingResourceException {

    String suffix = getResourceSuffix(locale);

    // System.out.println("resource " + className + suffix);
    try {

      // first try with the given locale
      String resourceName = className + suffix;
      return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale);
    } catch (MissingResourceException e) {
      try // try to fall back to en_US if we can't load
      {

        // Since we can't find the localized property file,
        // fall back to en_US.
        return (XResourceBundle) ResourceBundle.getBundle(XSLT_RESOURCE, new Locale("en", "US"));
      } catch (MissingResourceException e2) {

        // Now we are really in trouble.
        // very bad, definitely very bad...not going to get very far
        throw new MissingResourceException("Could not load any resource bundles.", className, "");
      }
    }
  }
Ejemplo n.º 16
0
 protected void handleModified() {
   if (Setup.isAutoSaveEnabled()) {
     storeValues();
     return;
   }
   if (OperationsXml.areFilesDirty()) {
     int result =
         javax.swing.JOptionPane.showOptionDialog(
             this,
             Bundle.getMessage("PromptQuitWindowNotWritten"),
             Bundle.getMessage("PromptSaveQuit"),
             javax.swing.JOptionPane.YES_NO_OPTION,
             javax.swing.JOptionPane.WARNING_MESSAGE,
             null, // icon
             new String[] {
               ResourceBundle.getBundle("jmri.util.UtilBundle").getString("WarnYesSave"), // NOI18N
               ResourceBundle.getBundle("jmri.util.UtilBundle").getString("WarnNoClose")
             }, // NOI18N
             ResourceBundle.getBundle("jmri.util.UtilBundle").getString("WarnYesSave"));
     if (result == javax.swing.JOptionPane.NO_OPTION) {
       return;
     }
     // user wants to save
     storeValues();
   }
 }
Ejemplo n.º 17
0
  /**
   * Formats a message with the specified arguments using the given locale information.
   *
   * @param locale The locale of the message.
   * @param key The message key.
   * @param arguments The message replacement text arguments. The order of the arguments must match
   *     that of the placeholders in the actual message.
   * @return Returns the formatted message.
   * @throws MissingResourceException Thrown if the message with the specified key cannot be found.
   */
  public String formatMessage(Locale locale, String key, Object[] arguments)
      throws MissingResourceException {

    if (fResourceBundle == null || locale != fLocale) {
      if (locale != null) {
        fResourceBundle =
            PropertyResourceBundle.getBundle("org.apache.xerces.impl.msg.XIncludeMessages", locale);
        // memorize the most-recent locale
        fLocale = locale;
      }
      if (fResourceBundle == null)
        fResourceBundle =
            PropertyResourceBundle.getBundle("org.apache.xerces.impl.msg.XIncludeMessages");
    }

    String msg = fResourceBundle.getString(key);
    if (arguments != null) {
      try {
        msg = java.text.MessageFormat.format(msg, arguments);
      } catch (Exception e) {
        msg = fResourceBundle.getString("FormatFailed");
        msg += " " + fResourceBundle.getString(key);
      }
    }

    if (msg == null) {
      msg = fResourceBundle.getString("BadMessageKey");
      throw new MissingResourceException(msg, "org.apache.xerces.impl.msg.XIncludeMessages", key);
    }

    return msg;
  }
Ejemplo n.º 18
0
 /**
  * 方法名: </br> 详述: </br>修改build文件配置文件 开发人员:谭明</br> 创建时间:Apr 1, 2014</br>
  *
  * @param project_path
  * @throws Exception
  */
 public static void update_sysconfig_properties(String project_path) throws Exception {
   File file =
       new File(project_path + File.separator + "src" + File.separator + "sysConfig.properties");
   if (!file.exists()) {
     throw new Exception("项目sysConfig.properties文件不存在!");
   }
   InputStream in;
   try {
     in = new BufferedInputStream(new FileInputStream(file));
     Properties p = new Properties();
     p.load(in);
     in.close();
     p.remove("a");
     OutputStream fos = new FileOutputStream(file);
     p.setProperty("URL_SOCKET", ResourceBundle.getBundle("config").getString("socket_ip"));
     String url = ResourceBundle.getBundle("config").getString("push_url");
     p.setProperty("URL_SERVER", url.replaceAll("\\\\", ""));
     p.setProperty("URL_SOCKETPORT", ResourceBundle.getBundle("config").getString("socket_port"));
     p.store(fos, "Update URL_SOCKET、URL_SERVER、URL_SOCKETPORT value");
     fos.close();
   } catch (FileNotFoundException e) {
     e.printStackTrace();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 19
0
 @Override
 public String toString() {
   Locale locale = Locale.getDefault();
   ResourceBundle res =
       ResourceBundle.getBundle("javaeetutorial.dukestutoring.util.StatusMessages", locale);
   return res.getString(name() + ".string");
 }
Ejemplo n.º 20
0
  private static String getMessageFromResourceBundle(String key, Locale locale) {
    ResourceBundle bundle;
    String message = "";

    if (locale == null) {
      locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
    }

    try {
      bundle = ResourceBundle.getBundle(BUNDLE_NAME, locale, getCurrentLoader(BUNDLE_NAME));
      if (bundle == null) {
        return NOT_FOUND;
      }
    } catch (MissingResourceException e) {
      LOGGER.log(Level.INFO, e.getMessage(), e);
      return NOT_FOUND;
    }

    try {
      message = bundle.getString(key);
    } catch (Exception e) {
      LOGGER.log(Level.INFO, e.getMessage(), e);
    }
    return message;
  }
 private static ResourceBundle getBundle(String simpleName, Locale locale) {
   try {
     return ResourceBundle.getBundle(RESOURCES_PREFIX + simpleName + RESOURCES_SUFFIX, locale);
   } catch (MissingResourceException ex) {
     return ResourceBundle.getBundle(RESOURCES_PREFIX + simpleName, locale);
   }
 }
Ejemplo n.º 22
0
 @SuppressWarnings("unchecked")
 @Override
 public ActionResult execute(WebContext webContext) {
   ResourceBundle messagesBundle = webContext.getMessagesBundle();
   CategoryService categoryService = new CategoryService();
   ActionResult backToPreviousPage = new ActionResult(webContext.getPreviousURI(), true);
   String name = webContext.getParameter(CATEGORY);
   if (name == null || name.isEmpty()) {
     webContext.setAttribute(
         "errorMessage",
         messagesBundle.getString("add-category.message.categoryIsEmpty"),
         Scope.FLASH);
     return backToPreviousPage;
   }
   Category createdCategory = categoryService.createCategory(name);
   // add new category to the list in app context
   if (createdCategory != null) {
     List<Category> categories =
         (List<Category>)
             webContext.getAttribute(ContextListener.CATEGORIES_LIST, Scope.APPLICATION);
     categories.add(createdCategory);
     webContext.setAttribute(
         "successMessage", messagesBundle.getString("add-category.message.success"), Scope.FLASH);
   } else {
     webContext.setAttribute(
         "errorMessage", messagesBundle.getString("add-category.message.exist"), Scope.FLASH);
   }
   return backToPreviousPage;
 }
Ejemplo n.º 23
0
  /**
   * Return a named ResourceBundle for a particular locale. This method mimics the behavior of
   * ResourceBundle.getBundle().
   *
   * @param className the name of the class that implements the resource bundle.
   * @return the ResourceBundle
   * @throws MissingResourceException
   */
  public static final XMLErrorResources loadResourceBundle(String className)
      throws MissingResourceException {

    Locale locale = Locale.getDefault();
    String suffix = getResourceSuffix(locale);

    try {

      // first try with the given locale
      return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale);
    } catch (MissingResourceException e) {
      try // try to fall back to en_US if we can't load
      {

        // Since we can't find the localized property file,
        // fall back to en_US.
        return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US"));
      } catch (MissingResourceException e2) {

        // Now we are really in trouble.
        // very bad, definitely very bad...not going to get very far
        throw new MissingResourceException("Could not load any resource bundles.", className, "");
      }
    }
  }
Ejemplo n.º 24
0
  public static String getString(String key) {
    if (!BUNDLE.containsKey(key)) {
      return String.format(DEFAULT_VALUE, key);
    }

    return BUNDLE.getString(key);
  }
Ejemplo n.º 25
0
 static ModelNode getConnectorRemove(final Locale locale) {
   final ResourceBundle bundle = getResourceBundle(locale);
   final ModelNode node = new ModelNode();
   node.get(OPERATION_NAME).set(REMOVE);
   node.get(DESCRIPTION).set(bundle.getString("web.connector.remove"));
   return node;
 }
Ejemplo n.º 26
0
 private void deleteBorrowerPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_deleteBorrowerPerformed
   if (borrowersTable.getSelectedRowCount() > 0) {
     try {
       Borrower b =
           reader.getBorrower((Integer) model.getValueAt(borrowersTable.getSelectedRow(), 0));
       int result =
           JOptionPane.showConfirmDialog(
               this,
               java.util.ResourceBundle.getBundle("de/web/feitsch/fabian/loft/bundles/bundle")
                       .getString("gui.delete_question")
                   + b.getName()
                   + " "
                   + b.getSurname()
                   + "'?",
               java.util.ResourceBundle.getBundle("de/web/feitsch/fabian/loft/bundles/bundle")
                   .getString("gui.msgtitles.warning"),
               JOptionPane.YES_NO_OPTION);
       if (result == JOptionPane.YES_OPTION) {
         BorrowerBookQuest relationQuest = new BorrowerBookQuest();
         relationQuest.addNumericCondition(
             "borrower_id", b.getID(), DigitOperator.EQUAL, SQLOperator.AND);
         ArrayList<BorrowerBookRelation> relations =
             reader.getBorrowerBookRelations(relationQuest);
         for (BorrowerBookRelation relation : relations) {
           writer.deleteEntry(relation);
         }
         writer.deleteEntry(b);
         repaint();
       }
     } catch (SQLException ex) {
       Logger.getLogger(BorrowerPanel.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 } // GEN-LAST:event_deleteBorrowerPerformed
Ejemplo n.º 27
0
 private void persist(PersistAction persistAction, String successMessage) {
   if (selected != null) {
     setEmbeddableKeys();
     try {
       if (persistAction != PersistAction.DELETE) {
         getFacade().edit(selected);
       } else {
         getFacade().remove(selected);
       }
       JsfUtil.addSuccessMessage(successMessage);
     } catch (EJBException ex) {
       String msg = "";
       Throwable cause = ex.getCause();
       if (cause != null) {
         msg = cause.getLocalizedMessage();
       }
       if (msg.length() > 0) {
         JsfUtil.addErrorMessage(msg);
       } else {
         JsfUtil.addErrorMessage(
             ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
       }
     } catch (Exception ex) {
       Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
       JsfUtil.addErrorMessage(
           ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
     }
   }
 }
  public static final class OutputLevelEditor extends java.beans.PropertyEditorSupport {
    /** Display Names for alignment. */
    private static final String[] names = {
      formBundle.getString("VALUE_OutputLevel_Minimum"),
      formBundle.getString("VALUE_OutputLevel_Normal"),
      formBundle.getString("VALUE_OutputLevel_Maximum"),
    };

    /** @return names of the possible directions */
    public String[] getTags() {
      return names;
    }

    /** @return text for the current value */
    public String getAsText() {
      int value = ((Integer) getValue()).intValue();
      if ((value < 0) || (value > 2)) return null;
      return names[value];
    }

    /**
     * Setter.
     *
     * @param str string equal to one value from directions array
     */
    public void setAsText(String str) {
      for (int i = 0; i <= 2; i++) {
        if (names[i].equals(str)) {
          setValue(new Integer(i));
          return;
        }
      }
    }
  }
 public TvShowSettingsContainerPanel() {
   setLayout(new BorderLayout(0, 0));
   {
     JTabbedPane tabbedPanePages = new JTabbedPane(JTabbedPane.TOP);
     add(tabbedPanePages, BorderLayout.CENTER);
     {
       JScrollPane scrollPane = new JScrollPane();
       scrollPane.setViewportView(new TvShowSettingsPanel());
       tabbedPanePages.addTab(
           BUNDLE.getString("Settings.general"), null, scrollPane, null); // $NON-NLS-1$
     }
     {
       JScrollPane scrollPane = new JScrollPane();
       scrollPane.setViewportView(new TvShowScraperSettingsPanel());
       tabbedPanePages.addTab(
           BUNDLE.getString("Settings.scraper"), null, scrollPane, null); // $NON-NLS-1$
     }
     {
       JScrollPane scrollPane = new JScrollPane();
       scrollPane.setViewportView(new TvShowRenamerSettingsPanel());
       tabbedPanePages.addTab(
           BUNDLE.getString("Settings.renamer"), null, scrollPane, null); // $NON-NLS-1$
     }
   }
 }
Ejemplo n.º 30
0
  /**
   * Generates the returnToUrl parameter that is passed to the OP. The User Agent (i.e., the
   * browser) will be directed to this page following authentication.
   *
   * @param representedPage The RegistrationPage object whose cover is to be cracked open to get at
   *     the raw HttpServlet goodies inside.
   * @return String - the returnToUrl to be used for the authentication request.
   */
  public static String getReturnToUrl() {
    ResourceBundle properties = ResourceBundle.getBundle("icardea");
    boolean isSalkUsage = Boolean.parseBoolean(properties.getString("salk.usage"));
    String server = "";
    String port = "";
    String url = "";
    if (isSalkUsage) {
      server = properties.getString("salk.server");
      port = properties.getString("secure.port");
      url = server + ":" + port + "/ppm_v2/";
    } else { // (isSalkUSage) NoSalkUsage, we assume localhost testing
      log.info("Localhost testing. salk.usage was not 'true'");
      server = "http://127.0.0.1";
      port = "10101";
      url = server + ":" + port + "/";
    }
    url = url + "view?startup=de.offis.health.icardea.ppm.viewapp";

    /*try {
        InetAddress addr = InetAddress.getLocalHost();

        // Get IP Address
        byte[] ipAddr = addr.getAddress();
        String ipadd = ipAddr.toString();
        // Get hostname
        String hostname = addr.getHostAddress();
        url = "https://"+ hostname + ":"+securePort+"/icardea_careplaneditor/servlet/loginServlet?";
    } catch (UnknownHostException e) {
    }*/
    return url;
  }