Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~mata.li/designrel into release/10.0

final/10.0
Mata.Li 6 years ago
parent
commit
dcfdf0b200
  1. 10
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  2. 14
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  3. 103
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java
  4. 197
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java
  5. 2
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  6. 22
      designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java
  7. 184
      designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java
  8. 514
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java
  9. 47
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java
  10. 6
      designer-base/src/main/java/com/fr/design/mingche.java
  11. 8
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  12. 26
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  13. 21
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java
  14. 5
      designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java
  15. BIN
      designer-realize/src/main/resources/com/fr/start/jni/splash.dylib

10
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

@ -15,11 +15,13 @@ import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.connection.DBConnectAuth;
import javax.swing.SwingUtilities;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@ -62,8 +64,16 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
ConnectionConfig mgr = ConnectionConfig.getInstance();
Iterator<String> nameIt = mgr.getConnections().keySet().iterator();
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections();
if (noAuthConnections == null) {
return nameList.iterator();
}
while (nameIt.hasNext()) {
String conName = nameIt.next();
if (noAuthConnections.contains(conName)) {
continue;
}
Connection connection = mgr.getConnection(conName);
filterConnection(connection, conName, nameList);
}

14
designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java

@ -146,14 +146,14 @@ public class EnvFileTree extends RefreshableJTree {
*
* 返回currentTreeNode下是否找到了filePath
*/
private boolean selectFilePath(ExpandMutableTreeNode currentTreeNode, String prefix, String filePath, DefaultTreeModel m_model) {
private boolean selectFilePath(ExpandMutableTreeNode currentTreeNode, String prefix, String filePath, DefaultTreeModel model) {
FileNode fileNode = (FileNode) currentTreeNode.getUserObject();
String nodePath = fileNode.getName();
String currentTreePath = prefix + nodePath;
// 如果equals,说明找到了,不必再找下去了
if (ComparatorUtils.equals(new File(currentTreePath), new File(filePath))) {
this.setSelectionPath(new TreePath(m_model.getPathToRoot(currentTreeNode)));
this.setSelectionPath(new TreePath(model.getPathToRoot(currentTreeNode)));
return true;
}
// 如果当前路径是currentFilePath的ParentFile,则expandTreeNode,并继续往下找
@ -164,7 +164,7 @@ public class EnvFileTree extends RefreshableJTree {
for (int i = 0, len = currentTreeNode.getChildCount(); i < len; i++) {
ExpandMutableTreeNode childTreeNode = (ExpandMutableTreeNode) currentTreeNode.getChildAt(i);
if (selectFilePath(childTreeNode, prefix, filePath, m_model)) {
if (selectFilePath(childTreeNode, prefix, filePath, model)) {
return true;
}
}
@ -219,7 +219,7 @@ public class EnvFileTree extends RefreshableJTree {
resFns = tList.toArray(new FileNode[tList.size()]);
}
Arrays.sort(resFns, new FileNodeComparator());
Arrays.sort(resFns, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes()));
return resFns;
}
@ -248,8 +248,8 @@ public class EnvFileTree extends RefreshableJTree {
*/
public void refreshEnv() {
DefaultTreeModel m_model = (DefaultTreeModel) this.getModel();
ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) m_model.getRoot();
DefaultTreeModel model = (DefaultTreeModel) this.getModel();
ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) model.getRoot();
rootTreeNode.removeAllChildren();
FileNode[] fns;
@ -273,7 +273,7 @@ public class EnvFileTree extends RefreshableJTree {
rootTreeNode.add(node);
}
m_model.reload(rootTreeNode);
model.reload(rootTreeNode);
}
/*

103
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java

@ -10,16 +10,44 @@ import java.util.Comparator;
* Directory is in the first. and normal file the in the last.
*/
public class FileNodeComparator implements Comparator<FileNode> {
// 正序还是倒序
private boolean isReverse = false;
/**
* 正序还是倒序
*/
private boolean isReverse;
/**
* 文件扩展名类型
*/
private String[] supportTypes;
public FileNodeComparator() {
this(false);
}
/**
* @see FileNodeComparator#FileNodeComparator(boolean, String[])
* @deprecated
*/
@Deprecated
public FileNodeComparator() {
this(false);
}
public FileNodeComparator(boolean reverse) {
this.isReverse = reverse;
}
public FileNodeComparator(String[] types) {
this(false, types);
}
/**
* @param reverse 是否是倒序{@code true} 倒序{@code false} 正序
* @see FileNodeComparator#FileNodeComparator(boolean, String[])
* @deprecated
*/
@Deprecated
public FileNodeComparator(boolean reverse) {
this.isReverse = reverse;
this.supportTypes = FRContext.getFileNodes().getSupportedTypes();
}
public FileNodeComparator(boolean reverse, String[] types) {
this.isReverse = reverse;
this.supportTypes = types;
}
/**
* This method should return > 0 if v1 is greater than v2, 0 if
@ -29,49 +57,48 @@ public class FileNodeComparator implements Comparator<FileNode> {
* @return < 0, 0, or > 0 for v1<v2, v1==v2, or v1>v2.
*/
public int compare(FileNode nameNode1, FileNode nameNode2) {
int returnVal;
int returnVal;
if (nameNode1.isDirectory()) {
if (nameNode2.isDirectory()) {
returnVal = nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase());
returnVal = nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase());
} else {
returnVal = -1;
returnVal = -1;
}
} else {
if (nameNode2.isDirectory()) {
returnVal = 1;
returnVal = 1;
} else {
returnVal=groupByFileType(nameNode1, nameNode2, 0);
returnVal = groupByFileType(nameNode1, nameNode2, 0);
}
}
if (isReverse) {
returnVal = 0 - returnVal;
returnVal = 0 - returnVal;
}
return returnVal;
}
/**
* 一个简单的递归判断算法
* @param nameNode1
* @param nameNode2
* @param i
* @return
* 一个简单的递归判断算法依据文件类型排序
*
* @param nameNode1 节点1
* @param nameNode2 节点2
* @param i i
* @return value
*/
private int groupByFileType(FileNode nameNode1, FileNode nameNode2,
int i) {
String[] supportTypes = FRContext.getFileNodes().getSupportedTypes();
if (i < supportTypes.length) {
if (nameNode1.isFileType(supportTypes[i]))
if (nameNode2.isFileType(supportTypes[i]))
return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase());
else
return-1;
else if (nameNode2.isFileType(supportTypes[i]))
return 1;
else{
return groupByFileType(nameNode1, nameNode2, i+1);
}
}else
return -1;
}
}
private int groupByFileType(FileNode nameNode1, FileNode nameNode2,
int i) {
if (i < supportTypes.length) {
if (nameNode1.isFileType(supportTypes[i]))
if (nameNode2.isFileType(supportTypes[i]))
return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase());
else
return -1;
else if (nameNode2.isFileType(supportTypes[i]))
return 1;
else {
return groupByFileType(nameNode1, nameNode2, i + 1);
}
} else
return -1;
}
}

197
designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java

@ -1,5 +1,18 @@
package com.fr.design.gui.itree.filetree;
import com.fr.base.BaseUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.Icon;
import javax.swing.JTree;
import javax.swing.filechooser.FileSystemView;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
@ -11,26 +24,12 @@ import java.util.Comparator;
import java.util.List;
import java.util.Stack;
import javax.swing.Icon;
import javax.swing.JTree;
import javax.swing.filechooser.FileSystemView;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import com.fr.base.BaseUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.project.ProjectConstants;
/**
* File Tree.
*/
public class JFileTree extends AbstractFileTree {
protected FileFilter fileFilter ;
protected FileFilter fileFilter;
public JFileTree() {
this(null);
@ -43,8 +42,8 @@ public class JFileTree extends AbstractFileTree {
private void init(FileFilter filter) {
this.fileFilter = filter;
DefaultTreeModel m_model = new DefaultTreeModel(new DefaultMutableTreeNode(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_My_Computer")));
this.setModel(m_model);
DefaultTreeModel treeModel = new DefaultTreeModel(new DefaultMutableTreeNode(Toolkit.i18nText("Fine-Design_Basic_My_Computer")));
this.setModel(treeModel);
this.putClientProperty("JTree.lineStyle", "Angled");
@ -57,7 +56,7 @@ public class JFileTree extends AbstractFileTree {
}
public void setRootFile(File rootFile) {
setRootFiles(new File[] { rootFile });
setRootFiles(new File[]{rootFile});
}
public void setRootFiles(File[] rootFiles) {
@ -65,8 +64,8 @@ public class JFileTree extends AbstractFileTree {
return;
}
DefaultTreeModel m_model = (DefaultTreeModel) this.getModel();
DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode) m_model.getRoot();
DefaultTreeModel defaultTreeModel = (DefaultTreeModel) this.getModel();
DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode) defaultTreeModel.getRoot();
rootTreeNode.removeAllChildren();
for (int k = 0; k < rootFiles.length; k++) {
@ -78,7 +77,7 @@ public class JFileTree extends AbstractFileTree {
}
}
// richer:不是LocalEnv根本就不会运行到这儿
m_model.reload(rootTreeNode);
defaultTreeModel.reload(rootTreeNode);
if (rootFiles.length == 1) {
File expandFile = rootFiles[0];
@ -96,22 +95,19 @@ public class JFileTree extends AbstractFileTree {
public File getSelectedFile() {
TreePath selectedTreePath = this.getSelectionPath();
if(selectedTreePath == null) {
if (selectedTreePath == null) {
return null;
}
DefaultMutableTreeNode currentTreeNode = this.getMutableTreeNode(selectedTreePath);
StringBuffer fBuf = new StringBuffer();
while (true) {
// 如果已经到了根节点,直接退出.
if (currentTreeNode == null) {
break;
}
StringBuilder fBuf = new StringBuilder();
while (currentTreeNode != null) {
// 如果已经到了根节点,直接退出.
Object object = currentTreeNode.getUserObject();
if (object instanceof RootFile) {
// 当前文件.
RootFile rootFileNode = (RootFile) object;
// 当前文件.
RootFile rootFileNode = (RootFile) object;
return new File(rootFileNode.getFile() + fBuf.toString());
}
@ -128,6 +124,7 @@ public class JFileTree extends AbstractFileTree {
/**
* 通过文件夹寻找展开路径
*
* @param currentFile 当前文件
*/
public void selectFile(File currentFile) {
@ -181,26 +178,25 @@ public class JFileTree extends AbstractFileTree {
/**
* 列出当前所有的File
*
* @param currentTreeNode 当前文件节点
* @return 当前节点下的所有File
*/
@Override
public FileDirectoryNode[] listFileNodes(DefaultMutableTreeNode currentTreeNode) {
StringBuffer fBuf = new StringBuffer();
while (true) {
// 如果已经到了根节点,直接退出.
if (currentTreeNode == null) {
break;
}
StringBuilder fBuf = new StringBuilder();
while (currentTreeNode != null) {
// 如果已经到了根节点,直接退出.
Object object = currentTreeNode.getUserObject();
if (object instanceof RootFile) {
RootFile rootFileNode = (RootFile) object;
RootFile rootFileNode = (RootFile) object;
// 当前文件. (rootFileNode + fBuf.toString = Path  local地址)
File currentFile = new File(rootFileNode.getFile() + fBuf.toString());
// 列出当前文件的所有子文件,要判断下是否是系统保护的文件 能否打开. 打不开的话显示为null
File[] files = currentFile.listFiles();
// 如果文件列表为null 或者为File[0] = []返回null
if (files == null ) {
return new FileDirectoryNode[0];
if (files == null) {
return new FileDirectoryNode[0];
}
List fileNodeList = new ArrayList();
for (int k = 0; k < files.length; k++) {
@ -211,8 +207,8 @@ public class JFileTree extends AbstractFileTree {
}
// 过滤只显示文件夹 并进行 名字简化
if (fileFilter.accept(tmpFile)) {
// newNode 传递 isDirectory属性 并且只显示文件夹名字
FileDirectoryNode newNode = FileDirectoryNode.createFileDirectoryNode(tmpFile);
// newNode 传递 isDirectory属性 并且只显示文件夹名字
FileDirectoryNode newNode = FileDirectoryNode.createFileDirectoryNode(tmpFile);
fileNodeList.add(newNode);
}
}
@ -220,14 +216,14 @@ public class JFileTree extends AbstractFileTree {
FileDirectoryNode[] fileNodes = new FileDirectoryNode[fileNodeList.size()];
fileNodeList.toArray(fileNodes);
// 对文件夹进行排序
Arrays.sort(fileNodes, new FileNodeComparator());
Arrays.sort(fileNodes, new FileDirectoryNodeComparator());
return fileNodes;
}
// 名字进行逐层反序的回加. 例: Doload ==> C:\java\Doload ,返回到文件夹的path,因为有可能是String. 所以加上instanceof
if (object instanceof FileDirectoryNode) {
FileDirectoryNode nameNode = (FileDirectoryNode)object;
fBuf.insert(0, nameNode.getName());
fBuf.insert(0, "/");
FileDirectoryNode nameNode = (FileDirectoryNode) object;
fBuf.insert(0, nameNode.getName());
fBuf.insert(0, "/");
}
// 逐层返回
currentTreeNode = (DefaultMutableTreeNode) currentTreeNode.getParent();
@ -236,62 +232,61 @@ public class JFileTree extends AbstractFileTree {
}
/**
* cellRenderer: tree中显示文件的类型图标
* cellRenderer: tree中显示文件的类型图标
*/
private DefaultTreeCellRenderer fileTreeCellRenderer = new DefaultTreeCellRenderer() {
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selected, boolean expanded, boolean leaf, int row,
boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, selected, expanded,
leaf, row, hasFocus);
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value;
StringBuffer fBuf = new StringBuffer();
while(true) {
if (treeNode == null) {
break;
}
Object userObj = treeNode.getUserObject();
if (userObj instanceof RootFile) {
RootFile rootFileNode = (RootFile) userObj;
// 当前文件的全部路径. (rootFileNode + fBuf.toString = Path  local地址)
File currentFile = new File(rootFileNode.getFile() + fBuf.toString());
FileSystemView view = FileSystemView.getFileSystemView();
// File的全部路径.
// 得到本地tree图标
Icon tmpIcon = view.getSystemIcon(currentFile);
private DefaultTreeCellRenderer fileTreeCellRenderer = new DefaultTreeCellRenderer() {
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selected, boolean expanded, boolean leaf, int row,
boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, selected, expanded,
leaf, row, hasFocus);
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value;
StringBuilder fBuf = new StringBuilder();
while (treeNode != null) {
Object userObj = treeNode.getUserObject();
if (userObj instanceof RootFile) {
RootFile rootFileNode = (RootFile) userObj;
// 当前文件的全部路径. (rootFileNode + fBuf.toString = Path  local地址)
File currentFile = new File(rootFileNode.getFile() + fBuf.toString());
FileSystemView view = FileSystemView.getFileSystemView();
// File的全部路径.
// 得到本地tree图标
Icon tmpIcon = view.getSystemIcon(currentFile);
if (currentFile.isDirectory() && fBuf.length() > 0) {
tmpIcon=BaseUtils.readIcon("/com/fr/design/images/gui/folder.png");
tmpIcon = BaseUtils.readIcon("/com/fr/design/images/gui/folder.png");
}
this.setIcon(tmpIcon);
this.setName(null);
Font oldFont = this.getFont();
if(ComparatorUtils.equals(currentFile.getName(), ProjectConstants.WEBINF_NAME)){
this.setForeground(Color.blue);
this.setFont(new Font(oldFont.getName(),1,oldFont.getSize()));
}else{
this.setFont(new Font(oldFont.getName(),0,oldFont.getSize()));
}
}
// 名字进行逐层反序的回加. 例: Doload ==> C:\java\Doload
if (userObj instanceof FileDirectoryNode ) {
FileDirectoryNode nameNode = (FileDirectoryNode)userObj;
fBuf.insert(0, nameNode.getName());
fBuf.insert(0, "/");
}
// 逐层往上 倒退返回
treeNode = (DefaultMutableTreeNode) treeNode.getParent();
}
return this;
}
};
this.setName(null);
Font oldFont = this.getFont();
if (ComparatorUtils.equals(currentFile.getName(), ProjectConstants.WEBINF_NAME)) {
this.setForeground(Color.blue);
this.setFont(new Font(oldFont.getName(), Font.BOLD, oldFont.getSize()));
} else {
this.setFont(new Font(oldFont.getName(), Font.PLAIN, oldFont.getSize()));
}
}
// 名字进行逐层反序的回加. 例: Doload ==> C:\java\Doload
if (userObj instanceof FileDirectoryNode) {
FileDirectoryNode nameNode = (FileDirectoryNode) userObj;
fBuf.insert(0, nameNode.getName());
fBuf.insert(0, "/");
}
// 逐层往上 倒退返回
treeNode = (DefaultMutableTreeNode) treeNode.getParent();
}
return this;
}
};
/**
* 对文件夹进行排序 先文件夹 然后各种类型文件
* 对文件夹进行排序 先文件夹 然后各种类型文件
*
* @author kunsnat
*/
public class FileNodeComparator implements Comparator {
public class FileDirectoryNodeComparator implements Comparator<FileDirectoryNode> {
/**
* This method should return > 0 if v1 is greater than v2, 0 if
* v1 is equal to v2, or < 0 if v1 is less than v2.
@ -302,21 +297,19 @@ public class JFileTree extends AbstractFileTree {
* @param v2 comparison value.值2
* @return < 0, 0, or > 0 for v1<v2, v1==v2, or v1>v2 .值1大于值2返回大于0相等返回0小于和大于相反
*/
public int compare(Object v1, Object v2) {
FileDirectoryNode nameNode1 = (FileDirectoryNode) v1;
FileDirectoryNode nameNode2 = (FileDirectoryNode) v2;
if (nameNode1.isDirectory()) {
if (nameNode2.isDirectory()) {
return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase());
@Override
public int compare(FileDirectoryNode v1, FileDirectoryNode v2) {
if (v1.isDirectory()) {
if (v2.isDirectory()) {
return v1.getName().toLowerCase().compareTo(v2.getName().toLowerCase());
} else {
return -1;
}
} else {
if (nameNode2.isDirectory()) {
if (v2.isDirectory()) {
return 1;
} else {
return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase());
return v1.getName().toLowerCase().compareTo(v2.getName().toLowerCase());
}
}
}

2
designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -217,7 +217,7 @@ public class TemplateFileTree extends EnvFileTree {
fileNodes = list.toArray(new FileNode[list.size()]);
}
Arrays.sort(fileNodes, new FileNodeComparator());
Arrays.sort(fileNodes, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes()));
return fileNodes;
}

22
designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java

@ -6,11 +6,14 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.js.Hyperlink;
import javax.swing.*;
import java.awt.*;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -21,10 +24,17 @@ public abstract class AbstractHyperNorthPane<T extends Hyperlink> extends BasicB
public static final int DEFAULT_H_VALUE = 400;
public static final int DEFAULT_V_VALUE = 600;
private JPanel headerPane;
/**
* 链接打开方式对话框
*/
private UIComboBox targetFrameComboBox;
/**
* 对话框高度输入框
*/
private UINumberField heightTextFiled;
/**
* 对话框宽度输入框
*/
private UINumberField widthTextFiled;
@ -35,7 +45,7 @@ public abstract class AbstractHyperNorthPane<T extends Hyperlink> extends BasicB
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
headerPane = this.setHeaderPanel();
JPanel headerPane = this.setHeaderPanel();
this.add(headerPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
targetFrameComboBox = new UIComboBox(getTargetFrames());

184
designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java

@ -1,184 +0,0 @@
package com.fr.design.hyperlink;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itree.filetree.ReportletPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.js.ReportletHyperlink;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* 热点链接部分 上方 定义特征 样式 报表 等属性的界面.
*
* @author kunsnat
*/
public class ReporletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyperlink> {
private UITextField itemNameTextField;
private boolean needRenamePane = false;
private UITextField reportPathTextField;
private UICheckBox showParameterInterface;
private UIButton browserButton;
// richer:参数传递方式
private UIComboBox postComboBox;
public ReporletHyperNorthPane(boolean needRenamePane) {
this.needRenamePane = needRenamePane;
this.inits();
}
public ReporletHyperNorthPane() {
this.inits();
}
/**
* 初始化组件
*/
public void inits() {
super.initComponents();
}
@Override
protected JPanel setHeaderPanel() {
JPanel headerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] columnSize = {p, TableLayout.FILL};
// Reportlet.
JPanel reportletNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
reportPathTextField = new UITextField(20);
reportletNamePane.add(reportPathTextField, BorderLayout.CENTER);
browserButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select"));
browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, 20));
reportletNamePane.add(browserButton, BorderLayout.EAST);
browserButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
final ReportletPane reportletPane = new ReportletPane();
reportletPane.setSelectedReportletPath(reportPathTextField.getText());
BasicDialog reportletDialog = reportletPane.showWindow(SwingUtilities.getWindowAncestor(ReporletHyperNorthPane.this));
reportletDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
reportPathTextField.setText(reportletPane.getSelectedReportletPath());
}
});
reportletDialog.setVisible(true);
}
});
Component[][] components;
if (!this.needRenamePane) {
components = new Component[][]{
{new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet") + ":"), reportletNamePane},
};
} else {
itemNameTextField = new UITextField();
components = new Component[][]{
{new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Name") + ":"), itemNameTextField},
{new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet") + ":"), reportletNamePane},
};
}
JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
headerPane.add(northPane, BorderLayout.NORTH);
return headerPane;
}
@Override
protected String title4PopupWindow() {
return "reportlet";
}
@Override
protected void populateSubHyperlinkBean(ReportletHyperlink link) {
if (itemNameTextField != null) {
this.itemNameTextField.setText(link.getItemName());
}
this.reportPathTextField.setText(link.getReportletPath());
this.showParameterInterface.setSelected(link.isShowParameterInterface());
this.postComboBox.setSelectedIndex(link.isByPost() ? 1 : 0);
}
@Override
protected ReportletHyperlink updateSubHyperlinkBean() {
ReportletHyperlink reportletHyperlink = new ReportletHyperlink();
updateSubHyperlinkBean(reportletHyperlink);
return reportletHyperlink;
}
@Override
protected void updateSubHyperlinkBean(ReportletHyperlink reportletHyperlink) {
if (itemNameTextField != null) {
reportletHyperlink.setItemName(this.itemNameTextField.getText());
}
reportletHyperlink.setReportletPath(this.reportPathTextField.getText());
reportletHyperlink.setShowParameterInterface(this.showParameterInterface.isSelected());
reportletHyperlink.setByPost(postComboBox.getSelectedIndex() == 1 ? true : false);
}
public String getReportletName() {
return StringUtils.isBlank(this.reportPathTextField.getText()) ? StringUtils.EMPTY : this.reportPathTextField.getText().substring(1);
}
/**
* 获取按钮焦点
*/
public void requestButtonFocus() {
this.browserButton.requestFocus();
JPopupMenu popup = new JPopupMenu();
FakeTipAction tip = new FakeTipAction();
tip.setEnabled(false);
popup.add(tip);
GUICoreUtils.showPopupCloseMenu(popup, this.browserButton);
}
private class FakeTipAction extends UpdateAction {
public FakeTipAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Select"));
}
public void actionPerformed(ActionEvent e) {
//do nothing
}
}
@Override
protected JPanel setFootPanel() {
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] columnSize = {p, TableLayout.FILL};
showParameterInterface = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_UI_Display"));
JPanel showParameterPanel = new JPanel();
showParameterPanel.add(new UILabel());
showParameterPanel.add(showParameterInterface);
postComboBox = new UIComboBox(new String[]{"GET", "POST"});
JPanel postPanel = new JPanel();
postPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Reportlet_Parameter_Type")));
postPanel.add(postComboBox);
Component[][] components = {{postPanel},
{showParameterPanel},
{new UILabel(" ")}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
}

514
designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java

@ -0,0 +1,514 @@
package com.fr.design.hyperlink;
import com.fr.base.BaseFormula;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.event.UIObserverListener;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
import com.fr.design.formula.VariableResolver;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itree.filetree.ReportletPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.js.ReportletHyperlink;
import com.fr.js.ReportletHyperlinkDialogAttr;
import com.fr.stable.FormulaProvider;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* 热点链接部分 上方 定义特征 样式 报表 等属性的界面.
*
* @author kunsnat
*/
public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyperlink> {
/**
* item name text filed
*/
private UITextField itemNameTextField;
/**
* 是否展示item name
*/
private boolean needRenamePane = false;
/**
* 参数路径输入框
*/
private UITextField reportPathTextField;
/**
* 是否展示参数面板勾选框
*/
private UICheckBox showParameterInterface;
/**
* 选择文件按钮
*/
private UIButton browserButton;
/**
* 参数传递方式下拉选择框
*/
private UIComboBox postComboBox;
/**
* 对话框标题输入框
*/
private JFormulaField titleFiled;
/**
* 对话框居中按钮
*/
private UIRadioButton center;
/**
* 对话框位置自定义按钮
*/
private UIRadioButton custom;
/**
* 距左
*/
private UINumberField leftLocation;
/**
* 距上
*/
private UINumberField topLocation;
public ReportletHyperNorthPane(boolean needRenamePane) {
this.needRenamePane = needRenamePane;
}
public ReportletHyperNorthPane() {
}
/**
* 初始化面板
*/
@Override
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
final List<Component[]> dialogComponents = new ArrayList<>();
final List<Component[]> othersComponents = new ArrayList<>();
initRenamePanel(dialogComponents, othersComponents);
initHeaderPanel(dialogComponents, othersComponents);
initTargetComboBoxPanel(dialogComponents, othersComponents);
initTitlePanel(dialogComponents);
initDialogSizePanel(dialogComponents);
initDialogLocationPanel(dialogComponents);
initFooterPanel(dialogComponents, othersComponents);
initPlaceHolder(othersComponents);
bindListener(dialogComponents, othersComponents);
// 创建内容面板
JPanel content = TableLayoutHelper.createTableLayoutPane(dialogComponents.toArray(new Component[dialogComponents.size()][]), TableLayoutHelper.FILL_LASTCOL_AND_ROW);
this.add(content, BorderLayout.CENTER);
}
/**
* 生成最上方的配置面板
*
* @return JPanel
*/
@Override
protected JPanel setHeaderPanel() {
JPanel reportletNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
// 路径输入框
reportPathTextField = new UITextField(20);
reportletNamePane.add(reportPathTextField, BorderLayout.CENTER);
// 选择路径按钮
browserButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Select"));
browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, 20));
reportletNamePane.add(browserButton, BorderLayout.EAST);
browserButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
final ReportletPane reportletPane = new ReportletPane();
reportletPane.setSelectedReportletPath(reportPathTextField.getText());
BasicDialog reportletDialog = reportletPane.showWindow(SwingUtilities.getWindowAncestor(ReportletHyperNorthPane.this));
reportletDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
reportPathTextField.setText(reportletPane.getSelectedReportletPath());
}
});
reportletDialog.setVisible(true);
}
});
return reportletNamePane;
}
@Override
protected String title4PopupWindow() {
return "reportlet";
}
@Override
protected void populateSubHyperlinkBean(ReportletHyperlink link) {
if (itemNameTextField != null) {
this.itemNameTextField.setText(link.getItemName());
}
this.reportPathTextField.setText(link.getReportletPath());
this.showParameterInterface.setSelected(link.isShowParameterInterface());
this.postComboBox.setSelectedIndex(link.isByPost() ? 1 : 0);
ReportletHyperlinkDialogAttr attr = link.getAttr();
titleFiled.setFormulaText(StringUtils.EMPTY);
leftLocation.setText(StringUtils.EMPTY);
topLocation.setText(StringUtils.EMPTY);
center.setSelected(true);
if (attr != null) {
FormulaProvider title = attr.getTitleFormula();
String titleContent = title == null ? StringUtils.EMPTY : title.getPureContent();
titleFiled.setFormulaText(titleContent);
boolean isCenter = attr.isCenter();
if (!isCenter) {
int left = attr.getLeft(), top = attr.getTop();
leftLocation.setText(Integer.toString(left));
topLocation.setText(Integer.toString(top));
}
center.setSelected(isCenter);
custom.setSelected(!isCenter);
}
}
@Override
protected ReportletHyperlink updateSubHyperlinkBean() {
ReportletHyperlink reportletHyperlink = new ReportletHyperlink();
updateSubHyperlinkBean(reportletHyperlink);
return reportletHyperlink;
}
@Override
protected void updateSubHyperlinkBean(ReportletHyperlink reportletHyperlink) {
if (itemNameTextField != null) {
reportletHyperlink.setItemName(this.itemNameTextField.getText());
}
reportletHyperlink.setReportletPath(this.reportPathTextField.getText());
reportletHyperlink.setShowParameterInterface(this.showParameterInterface.isSelected());
reportletHyperlink.setByPost(postComboBox.getSelectedIndex() == 1);
ReportletHyperlinkDialogAttr attr = new ReportletHyperlinkDialogAttr();
attr.setTitleFormula(BaseFormula.createFormulaBuilder().build(titleFiled.getFormulaText()));
attr.setCenter(center.isSelected());
if (!attr.isCenter()) {
attr.setLeft((int) leftLocation.getValue());
attr.setTop((int) topLocation.getValue());
}
reportletHyperlink.setAttr(attr);
}
public String getReportletName() {
String text = this.reportPathTextField.getText();
return StringUtils.isBlank(text) ? StringUtils.EMPTY : text.substring(1);
}
/**
* 获取按钮焦点
*/
public void requestButtonFocus() {
this.browserButton.requestFocus();
JPopupMenu popup = new JPopupMenu();
FakeTipAction tip = new FakeTipAction();
tip.setEnabled(false);
popup.add(tip);
GUICoreUtils.showPopupCloseMenu(popup, this.browserButton);
}
private class FakeTipAction extends UpdateAction {
public FakeTipAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Template_Select"));
}
@Override
public void actionPerformed(ActionEvent e) {
// do nothing
}
}
/**
* 底部面板参数传递方式
*
* @return JPanel
*/
@Override
protected JPanel setFootPanel() {
JPanel content = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
// 参数传递方式下拉框
postComboBox = new UIComboBox(new String[]{"GET", "POST"});
postComboBox.setPreferredSize(new Dimension(60, 20));
postComboBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
content.add(postComboBox);
showParameterInterface = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Parameter_UI_Display"));
showParameterInterface.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
content.add(showParameterInterface);
return content;
}
private void bindListener(final List<Component[]> dialogComponents, final List<Component[]> othersComponents) {
final UIComboBox targetFrameComboBox = this.getTargetFrameComboBox();
targetFrameComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean show = DIALOG == targetFrameComboBox.getSelectedIndex();
JPanel content;
List<Component[]> cs;
if (show) {
cs = dialogComponents;
} else {
cs = othersComponents;
}
ReportletHyperNorthPane.this.removeAll();
content = TableLayoutHelper.createTableLayoutPane(cs.toArray(new Component[cs.size()][]), TableLayoutHelper.FILL_LASTCOL_AND_ROW);
ReportletHyperNorthPane.this.add(content, BorderLayout.CENTER);
ReportletHyperNorthPane.this.revalidate();
ReportletHyperNorthPane.this.repaint();
}
});
}
private void initPlaceHolder(List<Component[]> othersComponents) {
JPanel empty1 = new JPanel();
empty1.setPreferredSize(new Dimension(20, 20));
JPanel empty2 = new JPanel();
empty2.setPreferredSize(new Dimension(20, 20));
JPanel empty3 = new JPanel();
empty3.setPreferredSize(new Dimension(20, 23));
othersComponents.add(new Component[]{empty1, new JPanel()});
othersComponents.add(new Component[]{empty2, new JPanel()});
othersComponents.add(new Component[]{empty3, new JPanel()});
}
private void initRenamePanel(List<Component[]> dialogComponents, List<Component[]> othersComponents) {
// 是否有重命名属性
if (this.needRenamePane) {
itemNameTextField = new UITextField();
Component[] renameComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Name") + ":"), itemNameTextField};
dialogComponents.add(renameComponents);
othersComponents.add(renameComponents);
}
}
private void initHeaderPanel(List<Component[]> dialogComponents, List<Component[]> othersComponents) {
//最上方位置的面板
JPanel headerPane = this.setHeaderPanel();
Component[] headerComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet") + ":"), headerPane};
dialogComponents.add(headerComponents);
othersComponents.add(headerComponents);
}
private void initTargetComboBoxPanel(List<Component[]> dialogComponents, List<Component[]> othersComponents) {
// 链接打开于
UIComboBox targetFrameComboBox = new UIComboBox(getTargetFrames());
this.setTargetFrameComboBox(targetFrameComboBox);
targetFrameComboBox.setEditable(true);
targetFrameComboBox.setPreferredSize(new Dimension(100, 20));
JPanel targetFramePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
targetFramePanel.add(targetFrameComboBox);
Component[] targetComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Link_Opened_In") + ":"), targetFramePanel};
dialogComponents.add(targetComponents);
othersComponents.add(targetComponents);
}
private void initTitlePanel(List<Component[]> dialogComponents) {
// 对话框标题
titleFiled = new JFormulaField(15);
final JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
titlePanel.add(titleFiled);
Component[] titleComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Title") + ":"), titlePanel};
dialogComponents.add(titleComponents);
}
private void initDialogSizePanel(List<Component[]> dialogComponents) {// 对话框大小
final JPanel sizeJPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
UILabel heightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Height") + ":");
heightLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
sizeJPanel.add(heightLabel);
UINumberField heightTextFiled = new UINumberField();
heightTextFiled.setText(String.valueOf(DEFAULT_H_VALUE));
heightTextFiled.setPreferredSize(new Dimension(40, 20));
sizeJPanel.add(heightTextFiled);
this.setHeightTextFiled(heightTextFiled);
UILabel widthLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Designer_Width") + ":");
widthLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
sizeJPanel.add(widthLabel);
UINumberField widthTextFiled = new UINumberField();
widthTextFiled.setText(String.valueOf(DEFAULT_V_VALUE));
widthTextFiled.setPreferredSize(new Dimension(40, 20));
sizeJPanel.add(widthTextFiled);
this.setWidthTextFiled(widthTextFiled);
sizeJPanel.setVisible(true);
dialogComponents.add(new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Size") + ":"), sizeJPanel});
}
private void initDialogLocationPanel(List<Component[]> dialogComponents) {
// 显示位置
final JPanel locationPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
// 居中
center = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Center"));
// 自定义
custom = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Custom"));
custom.setBorder(BorderFactory.createEmptyBorder(4, 20, 4, 5));
ButtonGroup group = new ButtonGroup();
group.setSelected(center.getModel(), true);
group.add(center);
group.add(custom);
locationPanel.add(center);
locationPanel.add(custom);
// 位置 距左
final UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Left"));
leftLabel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 10));
leftLocation = new UINumberField();
leftLocation.setPreferredSize(new Dimension(40, 20));
// 位置 距上
final UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Top"));
topLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
topLocation = new UINumberField();
topLocation.setPreferredSize(new Dimension(40, 20));
locationPanel.add(leftLabel);
locationPanel.add(leftLocation);
locationPanel.add(topLabel);
locationPanel.add(topLocation);
leftLabel.setVisible(false);
leftLocation.setVisible(false);
topLabel.setVisible(false);
topLocation.setVisible(false);
ChangeListener actionListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean visible = custom.isSelected();
leftLabel.setVisible(visible);
leftLocation.setVisible(visible);
topLabel.setVisible(visible);
topLocation.setVisible(visible);
}
};
// 默认居中
center.setSelected(true);
center.addChangeListener(actionListener);
custom.addChangeListener(actionListener);
dialogComponents.add(new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Show_Position") + ":"), locationPanel});
}
private void initFooterPanel(List<Component[]> dialogComponents, List<Component[]> othersComponents) {
// 最下方的配置面板
// 参数传递方式
Component[] footerComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Reportlet_Parameter_Type") + ":"), this.setFootPanel()};
dialogComponents.add(footerComponents);
othersComponents.add(footerComponents);
}
/**
* 公式输入框
*/
public class JFormulaField extends JPanel {
private UITextField formulaTextField;
public JFormulaField(int columns) {
formulaTextField = new UITextField(columns);
JPanel textFieldPane = new JPanel(new BorderLayout());
textFieldPane.add(formulaTextField, BorderLayout.CENTER);
textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
UIButton formulaButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
formulaButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Formula") + "...");
formulaButton.setPreferredSize(new Dimension(24, formulaTextField.getPreferredSize().height));
formulaButton.addActionListener(formulaButtonActionListener);
JPanel pane = new JPanel(new BorderLayout());
pane.add(textFieldPane, BorderLayout.CENTER);
pane.add(formulaButton, BorderLayout.EAST);
this.setLayout(new BorderLayout());
this.add(pane, BorderLayout.NORTH);
}
public void setFormulaText(String formulaContent) {
this.formulaTextField.setText(formulaContent);
}
public String getFormulaText() {
String text = formulaTextField.getText();
if (text == null) {
text = StringUtils.EMPTY;
}
return text;
}
/**
* 添加事件监听器
*
* @param listener 公式文本输入框改动事件监听器
*/
public void addListener(UIObserverListener listener) {
this.formulaTextField.registerChangeListener(listener);
}
/**
* 取消事件监听器
*/
public void removeListener() {
this.formulaTextField.registerChangeListener(null);
}
private ActionListener formulaButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build();
valueFormula.setContent(getFormulaText());
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
formulaPane.populate(valueFormula, VariableResolver.DEFAULT);
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(ReportletHyperNorthPane.this), new DialogActionAdapter() {
@Override
public void doOk() {
BaseFormula valueFormula = formulaPane.update();
setFormulaText(valueFormula.getContent());
}
}).setVisible(true);
}
};
}
}

47
designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java

@ -6,23 +6,30 @@ import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.ParameterReader;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.js.ReportletHyperlink;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.JOptionPane;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.List;
public class ReportletHyperlinkPane extends AbstractHyperLinkPane<ReportletHyperlink> {
private ReporletHyperNorthPane northPane;
/**
* 超链配置面板
*/
private ReportletHyperNorthPane northPane;
/**
* 是否继承参数勾选框
*/
private UICheckBox extendParametersCheckBox;
public ReportletHyperlinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) {
@ -38,22 +45,29 @@ public class ReportletHyperlinkPane extends AbstractHyperLinkPane<ReportletHyper
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
northPane = new ReporletHyperNorthPane(needRenamePane());
northPane = new ReportletHyperNorthPane(needRenamePane());
this.add(northPane, BorderLayout.NORTH);
parameterViewPane = new ReportletParameterViewPane(new UITableEditAction[]{new HyperlinkParametersAction()}, getChartParaType(), getValueEditorPane(), getValueEditorPane());
parameterViewPane = new ReportletParameterViewPane(
new UITableEditAction[]{
new HyperlinkParametersAction()
},
getChartParaType(),
getValueEditorPane(),
getValueEditorPane()
);
this.add(parameterViewPane, BorderLayout.CENTER);
parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter"), null));
parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Basic_Parameter"), null));
extendParametersCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Extends_Report_Parameters"));
extendParametersCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Extends_Report_Parameters"));
this.add(GUICoreUtils.createFlowPane(extendParametersCheckBox, FlowLayout.LEFT), BorderLayout.SOUTH);
}
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet");
return Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet");
}
@Override
@ -77,6 +91,7 @@ public class ReportletHyperlinkPane extends AbstractHyperLinkPane<ReportletHyper
return reportletHyperlink;
}
@Override
public void updateBean(ReportletHyperlink reportletHyperlink) {
northPane.updateBean(reportletHyperlink);
// Parameter.
@ -94,16 +109,20 @@ public class ReportletHyperlinkPane extends AbstractHyperLinkPane<ReportletHyper
}
/**
* 自动添加模板参数的按钮操作
*/
protected class HyperlinkParametersAction extends UITableEditAction {
public HyperlinkParametersAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Parameter"));
this.setName(Toolkit.i18nText("Fine-Design_Basic_Template_Parameter"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/p.gif"));
}
@Override
public void actionPerformed(ActionEvent e) {
String tpl = northPane.getReportletName();
if (StringUtils.isBlank(tpl)) {
JOptionPane.showMessageDialog(ReportletHyperlinkPane.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Please_Select_Reportlet") + ".", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.WARNING_MESSAGE);
JOptionPane.showMessageDialog(ReportletHyperlinkPane.this, Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Please_Select_Reportlet") + ".", Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.WARNING_MESSAGE);
northPane.requestButtonFocus();
return;
}
@ -129,20 +148,22 @@ public class ReportletHyperlinkPane extends AbstractHyperLinkPane<ReportletHyper
}
public static class ChartNoRename extends ReportletHyperlinkPane {
@Override
protected int getChartParaType() {
return ParameterTableModel.CHART_NORMAL_USE;
}
@Override
protected boolean needRenamePane() {
return false;
}
}
public ReporletHyperNorthPane getNorthPane() {
public ReportletHyperNorthPane getNorthPane() {
return northPane;
}
public void setNorthPane(ReporletHyperNorthPane northPane) {
public void setNorthPane(ReportletHyperNorthPane northPane) {
this.northPane = northPane;
}

6
designer-base/src/main/java/com/fr/design/mingche.java

@ -1,6 +0,0 @@
package com.fr.design;
public class mingche
{
}

8
designer-base/src/main/java/com/fr/file/FileNodeFILE.java

@ -211,7 +211,7 @@ public class FileNodeFILE implements FILE {
try {
FileNode[] nodeArray;
nodeArray = listFile(node.getEnvPath());
Arrays.sort(nodeArray, new FileNodeComparator());
Arrays.sort(nodeArray, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes()));
return fileNodeArray2FILEArray(nodeArray, envPath);
} catch (Exception e) {
@ -240,7 +240,7 @@ public class FileNodeFILE implements FILE {
return FRContext.getFileNodes().list(rootFilePath);
}
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return new FileNode[0];
}
@ -280,7 +280,7 @@ public class FileNodeFILE implements FILE {
try {
return FRContext.getCommonOperator().fileLocked(node.getEnvPath());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
}
}
@ -304,7 +304,7 @@ public class FileNodeFILE implements FILE {
try {
return WorkContext.getWorkResource().exist(node.getEnvPath());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
}
}

26
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -37,7 +37,9 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.module.DesignModuleFactory;
import com.fr.form.ui.ChartEditor;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot;
@ -57,8 +59,13 @@ import com.fr.plugin.chart.scatter.VanChartScatterPlot;
import com.fr.plugin.chart.structure.VanChartStructurePlot;
import com.fr.plugin.chart.treemap.VanChartTreeMapPlot;
import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.injectable.PluginSingleInjection;
import com.fr.plugin.injectable.SpecialLevel;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.solution.closeable.CloseableContainedMap;
import com.fr.stable.ArrayUtils;
import com.fr.stable.AssistUtils;
@ -119,6 +126,25 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
readDefault();
readVanChart();
PluginModule.registerAgent(PluginModule.ExtraChartDesign, classManager);
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
synchronized (ChartTypeInterfaceManager.class) {
//因为是CloseableContainedMap,所以不能在mount那边处理。
DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption());
}
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraChartDesign, SpecialLevel.IndependentChartUIProvider.getTagName());
}
});
}
public static WidgetOption[] initWidgetOption() {

21
designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java

@ -34,8 +34,6 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
protected UIButtonGroup<Integer> isStacked;
protected UIButtonGroup<Integer> isPercentStacked;
private ConditionAttr conditionAttr;
private LiteConditionPane liteConditionPane;
public VanChartCustomStackAndAxisConditionPane() {
@ -99,10 +97,12 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
}
public void populateBean(ConditionAttr conditionAttr) {
this.conditionAttr = conditionAttr;
AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis) conditionAttr.getExisted(AttrSeriesStackAndAxis.class);
XAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getXAxisNamesArray());
YAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getYAxisNameArray());
AttrSeriesStackAndAxis seriesStackAndAxis = conditionAttr.getExisted(AttrSeriesStackAndAxis.class);
if (XAxis == null || YAxis == null) {
XAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getXAxisNamesArray());
YAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getYAxisNameArray());
}
doLayoutPane();
XAxis.setSelectedIndex(seriesStackAndAxis.getXAxisIndex());
@ -129,11 +129,16 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
}
public ConditionAttr updateBean() {
AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis)conditionAttr.getExisted(AttrSeriesStackAndAxis.class); seriesStackAndAxis.setXAxisIndex(XAxis.getSelectedIndex());
ConditionAttr conditionAttr = new ConditionAttr();
AttrSeriesStackAndAxis seriesStackAndAxis = conditionAttr.getExisted(AttrSeriesStackAndAxis.class);
if (seriesStackAndAxis == null) {
seriesStackAndAxis = new AttrSeriesStackAndAxis();
conditionAttr.addDataSeriesCondition(seriesStackAndAxis);
}
seriesStackAndAxis.setXAxisIndex(XAxis.getSelectedIndex());
seriesStackAndAxis.setYAxisIndex(YAxis.getSelectedIndex());
updateStackAndPercent(seriesStackAndAxis);
conditionAttr.addDataSeriesCondition(seriesStackAndAxis);
AbstractCondition con = (AbstractCondition) this.liteConditionPane.updateBean();
conditionAttr.setCondition(con);

5
designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java

@ -22,9 +22,9 @@ import com.fr.form.ui.WidgetConfig;
import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.injectable.SpecialLevel;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
@ -98,7 +98,8 @@ public class FormParaWidgetPane extends JPanel {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG);
return context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG)
|| context.contain(PluginModule.ExtraChartDesign, SpecialLevel.IndependentChartUIProvider.getTagName());
}
});
}

BIN
designer-realize/src/main/resources/com/fr/start/jni/splash.dylib

Binary file not shown.
Loading…
Cancel
Save