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; }
/* * (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; }
private void initExts(String value) { if (!Char.isValidate(value)) { return; } int mi = value.indexOf(':'); if (mi < 1) { return; } String type = value.substring(0, mi); value = value.substring(mi + 1).replaceAll("\\s+", "").toUpperCase(); for (String ext : value.split(",")) { extList.put(ext.replaceAll("^\\.|\\.$", ""), type); } }
private void btPathActionPerformed(java.awt.event.ActionEvent e) { javax.swing.JFileChooser fc = new javax.swing.JFileChooser(); fc.setFileSelectionMode(javax.swing.JFileChooser.FILES_ONLY); fc.setMultiSelectionEnabled(false); java.io.File file = null; if (Char.isValidate(tfPath.getText())) { file = new java.io.File(tfPath.getText().trim()); fc.setSelectedFile(file); } int status = fc.showOpenDialog(mgtdDlg); if (status != javax.swing.JFileChooser.APPROVE_OPTION) { return; } file = fc.getSelectedFile(); if (file != null) { tfPath.setText(file.getAbsolutePath()); } }
@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; }