示例#1
0
 public static String getLocaleName(Locale loc, boolean isDefault) {
   String value;
   if (!isDefault) {
     value = loc.getDisplayName(JPRManagerLauncher.getLocale());
   } else {
     if (loc == null) loc = Util.parseLocale(JPRManagerLauncher.getAppConf().getDefaultLanguage());
     value =
         JPRManagerLauncher.getResourceData().getText("main.tc.values")
             + " ["
             + loc.getDisplayName(JPRManagerLauncher.getLocale())
             + "]";
   }
   return value;
 }
  private JComponent createButtonPane() {
    JPanel toReturn = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    closeBt = new JButton(JPRManagerLauncher.getResourceData().getText("form.close"));
    toReturn.add(closeBt);

    return toReturn;
  }
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   Object nval;
   switch (column) {
     case 0:
       nval = ((Locale) value).getDisplayLanguage(JPRManagerLauncher.getLocale());
       break;
     case 1:
       nval = sdf.format((Date) value);
       break;
     case 2:
       nval = DictionariesInWebForm.getText("sizeformat", new Object[] {value});
       break;
     default:
       nval = value;
   }
   if (column == 2) setHorizontalAlignment(RIGHT);
   else setHorizontalAlignment(LEFT);
   return super.getTableCellRendererComponent(table, nval, isSelected, hasFocus, row, column);
 }
示例#4
0
 public static ImageIcon getImageIcon(Locale loc) {
   return JPRManagerLauncher.getFlagManager().getFlag(loc);
 }
示例#5
0
 public static JButton createToolButton(String id) {
   JButton toReturn = new JButton(JPRManagerLauncher.getResourceData().getIcon(id + ".icon"));
   toReturn.setToolTipText(JPRManagerLauncher.getResourceData().getText(id + ".shortDesc"));
   toReturn.setMargin(new Insets(1, 1, 1, 1));
   return toReturn;
 }
 private static String getText(String key) {
   return JPRManagerLauncher.getResourceData().getText("form.dictInWeb." + key);
 }
  private JComponent createCenterPane() {
    MyTableRenderer mtr = new MyTableRenderer();
    JPanel toReturn = new JPanel(new BorderLayout());

    JLabel lab = new JLabel(getText("found"));
    lab.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
    toReturn.add(lab, BorderLayout.NORTH);
    tableTb = new JTable();
    tableTb.setAutoCreateColumnsFromModel(false);
    TableColumn col = new TableColumn(0);
    col.setHeaderValue(getText("tclocale"));
    col.setCellRenderer(mtr);
    tableTb.addColumn(col);
    col = new TableColumn(1);
    col.setHeaderValue(getText("tcmodified"));
    col.setCellRenderer(mtr);
    tableTb.addColumn(col);
    col = new TableColumn(2);
    col.setHeaderValue(getText("tcsize"));
    col.setCellRenderer(mtr);
    tableTb.addColumn(col);
    col = new TableColumn(3);
    col.setHeaderValue(getText("tcurl"));
    col.setPreferredWidth(200);
    col.setCellRenderer(mtr);
    tableTb.addColumn(col);
    JScrollPane tscroll = new JScrollPane(tableTb);
    tscroll.setPreferredSize(new Dimension(tableTb.getPreferredSize().width, 300));
    toReturn.add(tscroll, BorderLayout.CENTER);

    new TableCellTipManager(tableTb);
    tableTb.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    refreshBt = new JButton();
    refreshBt.setMargin(new Insets(1, 1, 1, 1));
    JPRManagerLauncher.getResourceData().configureButton("form.dictInWeb.refreshBt", refreshBt);
    installBt = new JButton();
    installBt.setMargin(new Insets(1, 1, 1, 1));
    installBt.setEnabled(false);
    JPRManagerLauncher.getResourceData().configureButton("form.dictInWeb.indexBt", installBt);
    Box bts = Box.createVerticalBox();
    bts.add(refreshBt);
    bts.add(Box.createVerticalStrut(5));
    bts.add(installBt);
    bts.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
    toReturn.add(bts, BorderLayout.EAST);

    JPanel southPn = new JPanel(new BorderLayout());
    notesLb = new JTextPane();
    notesLb.setOpaque(false);
    notesLb.setEditable(false);
    notesLb.setFocusable(false);
    notesLb.setContentType("text/html");
    notesLb.addHyperlinkListener(
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              try {
                BrowserLauncher.openURL(e.getURL().toString());
              } catch (IOException _e) {
                JPRManagerLauncher.getMessageHandler()
                    .showMessage(
                        DictionariesInWebForm.this,
                        MessageConstants.OPEN_URL_ERROR,
                        new Object[] {e.getURL().toString()},
                        _e);
              }
            }
          }
        });
    JScrollPane nscroll = new JScrollPane(notesLb);
    nscroll.setBorder(BorderFactory.createEmptyBorder(5, 0, 6, 0));
    nscroll.setPreferredSize(new Dimension(200, 80));
    southPn.add(nscroll, BorderLayout.CENTER);

    JPanel progressPn = new JPanel(new BorderLayout());
    progressPb = new JProgressBar();
    progressPb.setStringPainted(true);
    progressPb.setString("");
    progressPb.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(2, 0, 3, 5), progressPb.getBorder()));
    cancelBt = new JButton(JPRManagerLauncher.getResourceData().getText("form.cancel"));
    progressPn.add(progressPb, BorderLayout.CENTER);
    progressPn.add(cancelBt, BorderLayout.EAST);
    southPn.add(progressPn, BorderLayout.SOUTH);
    toReturn.add(southPn, BorderLayout.SOUTH);

    return toReturn;
  }
 private static String getText(String key, Object[] data) {
   return JPRManagerLauncher.getResourceData().format("form.dictInWeb." + key, data);
 }