Пример #1
0
  /*
   * (non-Javadoc)
   *
   * @see javax.swing.table.DefaultTableModel#getValueAt(int, int)
   */
  @Override
  public Object getValueAt(int row, int column) {
    // 公共属性
    if (itemList == null) {
      return "";
    }

    // 索引列
    if (column == 0) {
      switch (row) {
        case ConsDat.INDX_GUID - ConsDat.INDX_GUID:
          return Lang.getLang(LangRes.P30F1106, "日期");
        case ConsDat.INDX_META - ConsDat.INDX_GUID:
          return Lang.getLang(LangRes.P30F110A, "标题");
        case ConsDat.INDX_LOGO - ConsDat.INDX_GUID:
          return Lang.getLang(LangRes.P30F1112, "徽标");
        case ConsDat.INDX_HINT - ConsDat.INDX_GUID:
          return Lang.getLang(LangRes.P30F110B, "提醒");
        default:
          return row + 1 - ConsEnv.PWDS_HEAD_SIZE;
      }
    }

    IEditItem item = itemList.get(row);
    if (item.getType() == ConsDat.INDX_SIGN) {
      return Char.format(Lang.getLang(item.getSpec(SignItem.SPEC_SIGN_TPLT), ""), item.getName());
    }
    return item;
  }
Пример #2
0
  public void initLang() {
    Lang.setWText(bt_Update, LangRes.P30FA50A, "确定(@O)");

    Lang.setWText(bt_Cancel, LangRes.P30FA50B, "取消(@C)");

    setTitle(Lang.getLang(LangRes.P30F4207, "选择还原节点"));

    pack();
  }
Пример #3
0
  protected void initConfLang() {
    Lang.setWText(bt_FileView, LangRes.P30F1515, "@V");
    Lang.setWTips(bt_FileView, LangRes.P30F1516, "打开附件(Alt + V)");

    Lang.setWText(bt_FileApnd, LangRes.P30F1517, "@P");
    Lang.setWTips(bt_FileApnd, LangRes.P30F1518, "添加附件(Alt + P)");

    Lang.setWText(mi_ViewDef, null, "系统默认程序");

    dataBox.initLang();
  }
Пример #4
0
  private void mi_ViewAsActionPerformed(java.awt.event.ActionEvent evt) {
    String ext = itemData.getSpec(FileItem.SPEC_FILE_EXTS, "").toUpperCase();
    if (!extList.containsKey(ext)) {
      Lang.showMesg(formPtn, null, "查看器无法打开 {0} 类型的文件!", ext);
      return;
    }

    java.io.File file = deCryptData();
    if (file == null) {
      return;
    }

    try {
      Constructor c = Class.forName(extList.get(ext)).getConstructor(AMpwdPtn.class);
      if (c != null) {
        Object obj = c.newInstance(formPtn);
        if (obj != null && obj instanceof IDocsViewer) {
          IDocsViewer viewer = (IDocsViewer) obj;
          viewer.show(file);
        }
      }
    } catch (Exception ex) {
      Logs.exception(ex);
    }
  }
Пример #5
0
  private void mi_ViewOsActionPerformed(java.awt.event.ActionEvent evt) {
    java.io.File file = deCryptData();
    if (file == null) {
      return;
    }

    if (!Desk.open(file)) {
      Lang.showMesg(formPtn, LangRes.P30F1A03, "打开文件错误,请尝试手动方式查看!");
    }
  }
Пример #6
0
  void bt_UpdateActionPerformed(java.awt.event.ActionEvent evt) {
    Object obj = ls_DataList.getSelectedValue();
    if (obj == null || !(obj instanceof S1S1)) {
      Lang.showMesg(this, LangRes.P30FAA1E, "请选择您要恢复的节点!");
      return;
    }

    this.setVisible(false);

    S1S1 item = (S1S1) obj;
    backCall.callBack(IBackCall.OPTIONS_APPLY, item.getK());

    this.dispose();
  }
Пример #7
0
  @Override
  public boolean saveData(MgtdHeader mgtd) {
    String text = tfPath.getText();
    if (!Char.isValidate(text)) {
      Lang.showMesg(mgtdDlg, null, "请输入或选择您要打开的文件!");
      tfPath.requestFocus();
      return false;
    }
    java.io.File file = new java.io.File(text);
    if (!file.exists()) {
      Lang.showMesg(mgtdDlg, null, "您输入或选择的文件不存在!");
      tfPath.requestFocus();
      return false;
    }
    if (!file.canRead()) {
      Lang.showMesg(mgtdDlg, null, "无法访问您输入或选择的文件!");
      tfPath.requestFocus();
      return false;
    }

    mgtd.setP30F030F(text);
    mgtd.setP30F0311(tfArgs.getText());
    return true;
  }
Пример #8
0
  protected boolean enCryptData() {
    String file = itemData.getSpec(FileItem.SPEC_FILE_NAME);
    if (filePath != null) {
      if (!filePath.exists()) {
        Lang.showMesg(formPtn, LangRes.P30F7A03, "");
        tf_PropData.requestFocus();
        return false;
      }
      if (!filePath.isFile()) {
        Lang.showMesg(formPtn, LangRes.P30F7A04, "");
        tf_PropData.requestFocus();
        return false;
      }
      if (!filePath.canRead()) {
        Lang.showMesg(formPtn, LangRes.P30F7A05, "");
        tf_PropData.requestFocus();
        return false;
      }
      if (filePath.length() > 1048576) {
        Lang.showMesg(formPtn, LangRes.P30F7A06, "");
        tf_PropData.requestFocus();
        return false;
      }

      if (!com.magicpwd._util.Char.isValidate(file)) {
        file = com.magicpwd._util.Char.lPad(Long.toHexString(System.currentTimeMillis()), 16, '0');
      }
      try {
        java.io.File amaFile = new java.io.File(amaPath, file + ConsEnv.FILE_ATTACHMENT);
        if (!amaFile.exists()) {
          if (!amaFile.createNewFile()) {
            Lang.showMesg(formPtn, LangRes.P30F7A2C, "文件上传保存出错,请重试!");
            return false;
          }
        }
        enCrypt(filePath, amaFile);
      } catch (Exception exp) {
        Logs.exception(exp);
        Lang.showMesg(formPtn, LangRes.P30F7A2C, "文件上传保存出错,请重试!");
        return false;
      }
    }

    itemData.setData(tf_PropData.getText());
    itemData.setSpec(FileItem.SPEC_FILE_NAME, file);
    itemData.setSpec(
        FileItem.SPEC_FILE_EXTS, filePath != null ? File.getExtension(filePath.getName()) : "");
    return true;
  }
Пример #9
0
  protected java.io.File deCryptData() {
    try {
      java.io.File tmpPath = new java.io.File(System.getProperty("java.io.tmpdir"));
      if (!tmpPath.exists() || !tmpPath.canWrite()) {
        tmpPath = new java.io.File("./tmp/");
        if (!tmpPath.exists() || !tmpPath.isDirectory()) {
          tmpPath.mkdirs();
        }
      }

      java.io.File srcFile =
          new java.io.File(
              amaPath, itemData.getSpec(FileItem.SPEC_FILE_NAME) + ConsEnv.FILE_ATTACHMENT);
      java.io.File tmpFile = new java.io.File(tmpPath, itemData.getData());
      deCrypt(srcFile, tmpFile);

      return tmpFile;
    } catch (Exception exp) {
      Lang.showMesg(formPtn, null, exp.getLocalizedMessage());
      Logs.exception(exp);
      return null;
    }
  }
Пример #10
0
 /*
  * (non-Javadoc)
  *
  * @see javax.swing.table.DefaultTableModel#getColumnName(int)
  */
 @Override
 public String getColumnName(int columnIndex) {
   return columnIndex == 1
       ? Lang.getLang(MproRes.P30F7304, "属性(T)")
       : Lang.getLang(MproRes.P30F7303, "");
 }