{
panel.setBackground(null);
panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
titleLabel.setText(" " + model.getName());
- String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png";
if (model.hasAction()) {
if (isSelected) {
+ String iconUrl = "/com/fr/design/mainframe/alphafine/images/selected" + model.getType().getTypeValue() + ".png";
panel.setBackground(AlphaFineConstants.BLUE);
+ titleLabel.setForeground(Color.white);
+ titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl)));
+ } else {
+ String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png";
+ titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl)));
+ titleLabel.setForeground(AlphaFineConstants.BLACK);
}
- titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl)));
- titleLabel.setForeground(AlphaFineConstants.BLACK);
+
} else {
titleLabel.setIcon(null);
titleLabel.setForeground(AlphaFineConstants.MEDIUM_GRAY);
diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
index 5a1c892201..074279e7cc 100644
--- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
+++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
@@ -68,7 +68,7 @@ public class AlphaFineDialog extends UIDialog {
private static final String DS_NAME = "dsname=\"";
private static final String PLUGIN_MARK_SHORT = "k:4 ";
private static final String PLUGIN_MARK = "k:shop ";
- private static final String PLACE_HOLDER = "AlphaFine";
+ private static final String PLACE_HOLDER = Inter.getLocText("FR-Designer_AlphaFine");
private AlphaFineTextField searchTextField;
private UIButton closeButton;
@@ -299,8 +299,12 @@ public class AlphaFineDialog extends UIDialog {
leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
rightSearchResultPane = new JPanel();
rightSearchResultPane.setBackground(Color.white);
+ UILabel splitLine = new UILabel();
+ splitLine.setBackground(AlphaFineConstants.GRAY);
+ splitLine.setPreferredSize(new Dimension(1, AlphaFineConstants.CONTENT_HEIGHT));
+ rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH - 1, AlphaFineConstants.CONTENT_HEIGHT));
searchResultPane.add(leftSearchResultPane, BorderLayout.WEST);
- rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
+ searchResultPane.add(splitLine, BorderLayout.CENTER);
searchResultPane.add(rightSearchResultPane, BorderLayout.EAST);
UILabel splitLabel = new UILabel();
splitLabel.setBackground(AlphaFineConstants.GRAY);
diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/selected1.png b/designer/src/com/fr/design/mainframe/alphafine/images/selected1.png
new file mode 100644
index 0000000000..3d7cf2514a
Binary files /dev/null and b/designer/src/com/fr/design/mainframe/alphafine/images/selected1.png differ
diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/selected2.png b/designer/src/com/fr/design/mainframe/alphafine/images/selected2.png
new file mode 100644
index 0000000000..dd04302fc1
Binary files /dev/null and b/designer/src/com/fr/design/mainframe/alphafine/images/selected2.png differ
diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/selected3.png b/designer/src/com/fr/design/mainframe/alphafine/images/selected3.png
new file mode 100644
index 0000000000..6242e61944
Binary files /dev/null and b/designer/src/com/fr/design/mainframe/alphafine/images/selected3.png differ
diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/selected4.png b/designer/src/com/fr/design/mainframe/alphafine/images/selected4.png
new file mode 100644
index 0000000000..2d4c9b2620
Binary files /dev/null and b/designer/src/com/fr/design/mainframe/alphafine/images/selected4.png differ
diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/selected5.png b/designer/src/com/fr/design/mainframe/alphafine/images/selected5.png
new file mode 100644
index 0000000000..a4734fb91c
Binary files /dev/null and b/designer/src/com/fr/design/mainframe/alphafine/images/selected5.png differ
diff --git a/designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java b/designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java
index 3da7406c65..07f95d54f9 100644
--- a/designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java
+++ b/designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java
@@ -1,21 +1,21 @@
package com.fr.design.mainframe.cell;
-import java.awt.BorderLayout;
-import java.awt.CardLayout;
-import java.awt.Dimension;
+import java.awt.*;
import java.util.*;
+import java.util.List;
-import javax.swing.Icon;
-import javax.swing.JPanel;
+import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.CellAttributeProvider;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIHeadGroup;
+import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.cell.settingpane.*;
import com.fr.design.dialog.BasicPane;
+import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane;
@@ -44,21 +44,33 @@ public class CellElementEditPane extends BasicPane {
private int PaneListIndex;
private CardLayout card;
private JPanel center;
-
+ private JPanel downTitle;
+ private JPanel title;
+ private UILabel titlename;
private TitleChangeListener titleChangeListener = null;
private CellAttributeProvider cellAttributeProvider = null;
+ public static void main(String[] args){
+ JFrame jf = new JFrame("test");
+ jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ JPanel content = (JPanel)jf.getContentPane();
+ content.setLayout(new BorderLayout());
+ content.add(new CellElementEditPane(),BorderLayout.CENTER);
+ GUICoreUtils.centerWindow(jf);
+ jf.setSize(270, 400);
+ jf.setVisible(true);
+ }
public CellElementEditPane() {
setLayout(new BorderLayout());
initPaneList();
- Icon[] iconArray = new Icon[paneList.size()];
+ String[] iconArray = new String[paneList.size()];
card = new CardLayout();
center = new JPanel(card);
for (int i = 0; i < paneList.size(); i++) {
AbstractCellAttrPane pane = paneList.get(i);
- iconArray[i] = BaseUtils.readIcon(pane.getIconPath());
+ iconArray[i] = pane.getIconPath();
center.add(pane, pane.title4PopupWindow());
}
@@ -74,8 +86,22 @@ public class CellElementEditPane extends BasicPane {
}
};
tabsHeaderIconPane.setNeedLeftRightOutLine(false);
- this.add(tabsHeaderIconPane, BorderLayout.NORTH);
- this.add(center, BorderLayout.CENTER);
+
+ titlename = new UILabel(Inter.getLocText("Cell-Cell_Attributes"));
+ titlename.setFont(new Font("Dialog", 1, 14));
+ titlename.setForeground(new Color(30,190,245));
+ title = new JPanel();
+ title.setLayout(new BorderLayout());
+ title.add(titlename, BorderLayout.NORTH);
+
+ downTitle = new JPanel();
+ downTitle.setLayout(new BorderLayout());
+ downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH);
+ downTitle.add(center, BorderLayout.CENTER);
+
+ this.add(title, BorderLayout.NORTH);
+ this.add(downTitle, BorderLayout.CENTER);
+
}
diff --git a/designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java b/designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java
index 7ac79975a1..f105ad4792 100644
--- a/designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java
+++ b/designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java
@@ -35,7 +35,7 @@ public class QuickEditorRegion extends JPanel {
private static QuickEditorRegion singleton = new QuickEditorRegion();
private static JPanel EMPTY;
- private QuickEditorRegion() {
+ public QuickEditorRegion() {
this.setLayout(new BorderLayout());
}
diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
index 1b95b85697..128c014182 100644
--- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
+++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
@@ -10,6 +10,8 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
+import com.fr.design.foldablepane.UIExpandablePane;
+import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.report.cell.DefaultTemplateCellElement;
@@ -31,6 +33,9 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
private UICheckBox horizontalExpandableCheckBox;
private UICheckBox verticalExpandableCheckBox;
private SortExpandAttrPane sortAfterExpand;
+ private JPanel layoutPane;
+ private JPanel basicPane;
+ private JPanel seniorPane;
/**
*
@@ -56,33 +61,83 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
}
+ public static void main(String[] args){
+// JFrame jf = new JFrame("test");
+// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+// JPanel content = (JPanel) jf.getContentPane();
+// content.setLayout(new BorderLayout());
+// content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER);
+// GUICoreUtils.centerWindow(jf);
+// jf.setSize(290, 400);
+// jf.setVisible(true);
+ }
+
private void initAllNames() {
- expandDirectionButton.setGlobalName(Inter.getLocText("ExpandD-Expand_Direction"));
- leftFatherPane.setGlobalName(Inter.getLocText("LeftParent"));
- rightFatherPane.setGlobalName(Inter.getLocText("ExpandD-Up_Father_Cell"));
- horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("ExpandD-Expandable"));
- verticalExpandableCheckBox.setGlobalName(Inter.getLocText("ExpandD-Expandable"));
+ expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"));
+ leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent"));
+ rightFatherPane.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"));
+ horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable"));
+ verticalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable"));
}
private JPanel layoutPane() {
+ layoutPane = new JPanel(new BorderLayout());
+ basicPane = new JPanel();
+ seniorPane = new JPanel();
+ basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"),290,20,basicPane());
+ seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"),290,20,seniorPane());
+ layoutPane.add(basicPane,BorderLayout.NORTH);
+ layoutPane.add(seniorPane,BorderLayout.CENTER);
+ return layoutPane;
+// double f = TableLayout.FILL;
+// double p = TableLayout.PREFERRED;
+// Component[][] components = new Component[][]{
+// new Component[]{new UILabel(Inter.getLocText("ExpandD-Expand_Direction") + ":", SwingConstants.RIGHT), expandDirectionButton},
+// new Component[]{new UILabel(Inter.getLocText("LeftParent") + ":", SwingConstants.RIGHT), leftFatherPane},
+// new Component[]{new UILabel(Inter.getLocText("ExpandD-Up_Father_Cell") + ":", SwingConstants.RIGHT), rightFatherPane},
+// new Component[]{new JSeparator(), null},
+// new Component[]{new UILabel(Inter.getLocText("ExpandD-Expandable") + ":", SwingConstants.RIGHT), horizontalExpandableCheckBox},
+// new Component[]{null, verticalExpandableCheckBox},
+// new Component[]{new UILabel(Inter.getLocText("ExpandD-Sort_After_Expand") + ":", SwingConstants.RIGHT), sortAfterExpand},
+// };
+// double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p, p, p};
+// double[] columnSize = {p, f};
+// int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 3}};
+// return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
+ }
+
+ private JPanel basicPane(){
+ double f = TableLayout.FILL;
+ double p = TableLayout.PREFERRED;
+ Component[][] components = new Component[][]{
+ new Component[]{null,null},
+ new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")+" ", SwingConstants.LEFT), expandDirectionButton},
+ new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_LeftParent"), SwingConstants.LEFT), leftFatherPane},
+ new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"), SwingConstants.LEFT), rightFatherPane},
+ };
+ double[] rowSize = {p, p, p, p, p, p};
+ double[] columnSize = {p, f};
+ int[][] rowCount = {{1, 1},{1, 1}, {1, 3}, {1, 3}};
+ return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
+ }
+
+ private JPanel seniorPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
- new Component[]{new UILabel(Inter.getLocText("ExpandD-Expand_Direction") + ":", SwingConstants.RIGHT), expandDirectionButton},
- new Component[]{new UILabel(Inter.getLocText("LeftParent") + ":", SwingConstants.RIGHT), leftFatherPane},
- new Component[]{new UILabel(Inter.getLocText("ExpandD-Up_Father_Cell") + ":", SwingConstants.RIGHT), rightFatherPane},
- new Component[]{new JSeparator(), null},
- new Component[]{new UILabel(Inter.getLocText("ExpandD-Expandable") + ":", SwingConstants.RIGHT), horizontalExpandableCheckBox},
- new Component[]{null, verticalExpandableCheckBox},
- new Component[]{new UILabel(Inter.getLocText("ExpandD-Sort_After_Expand") + ":", SwingConstants.RIGHT), sortAfterExpand},
+ new Component[]{null,null},
+ new Component[]{horizontalExpandableCheckBox, null},
+ new Component[]{verticalExpandableCheckBox, null},
+ new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.RIGHT), sortAfterExpand},
};
- double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p, p, p};
+ double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize = {p, f};
- int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 3}};
+ int[][] rowCount = {{1, 1}, {1, 1}, {1, 3}, {1, 3}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
+
@Override
protected void populateBean() {
this.leftFatherPane.setElementCasePane(elementCasePane);
@@ -120,9 +175,11 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
@Override
public String getIconPath() {
- return "com/fr/design/images/expand/cellAttr.gif";
+// return "com/fr/design/images/expand/cellAttr.gif";
+ return Inter.getLocText("FR-Designer_Expand");
}
+
@Override
public void updateBean(TemplateCellElement cellElement) {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
@@ -130,19 +187,19 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
cellExpandAttr = new CellExpandAttr();
cellElement.setCellExpandAttr(cellExpandAttr);
}
- if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Expand_Direction"))) {
+ if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"))) {
cellExpandAttr.setDirection(expandDirectionButton.getSelectedItem());
}
- if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("LeftParent"))) {
+ if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_LeftParent"))) {
this.leftFatherPane.update(cellExpandAttr);
}
- if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Up_Father_Cell"))) {
+ if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"))) {
this.rightFatherPane.update(cellExpandAttr);
}
// extendable
- if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Expandable"))) {
+ if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD-Expandable"))) {
if (horizontalExpandableCheckBox.isSelected()) {
if (verticalExpandableCheckBox.isSelected()) {
cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE);
diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
index 0e45a1e970..ee4ecfa4dc 100644
--- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
+++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
@@ -214,7 +214,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
@Override
public String getIconPath() {
- return "com/fr/design/images/m_format/cellstyle/otherset.png";
+// return "com/fr/design/images/m_format/cellstyle/otherset.png";
+ return Inter.getLocText("FR-Designer_Other");
}
@Override
diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java
index 0c357e30dd..8d29ff1335 100644
--- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java
+++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java
@@ -25,21 +25,22 @@ public class CellPresentPane extends AbstractCellAttrPane {
*/
public JPanel createContentPane() {
presentPane = new PresentPane();
- JPanel content = new JPanel(new BorderLayout());
- content.add(presentPane, BorderLayout.CENTER);
- presentPane.addTabChangeListener(new ItemListener() {
+ JPanel content = new JPanel(new BorderLayout());
+ content.add(presentPane, BorderLayout.CENTER);
+ presentPane.addTabChangeListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent e) {
- adjustValues();
- }
- });
- return content;
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ adjustValues();
+ }
+ });
+ return content;
}
@Override
public String getIconPath() {
- return "com/fr/design/images/data/source/dataDictionary.png";
+// return "com/fr/design/images/data/source/dataDictionary.png";
+ return Inter.getLocText("FR-Designer_Present");
}
@Override
diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
index 563b26bba2..ce03519315 100644
--- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
+++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
@@ -2,12 +2,13 @@ package com.fr.design.mainframe.cell.settingpane;
import java.awt.*;
-import javax.swing.JPanel;
+import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Style;
import com.fr.design.mainframe.cell.settingpane.style.StylePane;
+import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
@@ -40,11 +41,24 @@ public class CellStylePane extends AbstractCellAttrPane {
return content;
}
+ public static void main(String[] args){
+// JFrame jf = new JFrame("test");
+// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+// JPanel content = (JPanel) jf.getContentPane();
+// content.setLayout(new BorderLayout());
+// content.add(new CellStylePane().createContentPane(), BorderLayout.CENTER);
+// GUICoreUtils.centerWindow(jf);
+// jf.setSize(290, 400);
+// jf.setVisible(true);
+ }
+
@Override
public String getIconPath() {
- return "com/fr/design/images/m_format/cell.png";
+// return "com/fr/design/images/m_format/cell.png";
+ return Inter.getLocText("FR-Designer_Style");
}
+
@Override
public void updateBean(TemplateCellElement cellElement) {
cellElement.setStyle(stylePane.updateBean());
@@ -106,7 +120,7 @@ public class CellStylePane extends AbstractCellAttrPane {
@Override
public String title4PopupWindow() {
- return Inter.getLocText("Style");
+ return Inter.getLocText(Inter.getLocText("FR-Designer_Style"));
}
public void setSelectedByIds(int level, String... id) {
diff --git a/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfo.java b/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfo.java
new file mode 100644
index 0000000000..c101706496
--- /dev/null
+++ b/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfo.java
@@ -0,0 +1,130 @@
+package com.fr.design.mainframe.errorinfo;
+
+import com.fr.base.FRContext;
+import com.fr.general.IOUtils;
+import com.fr.json.JSONException;
+import com.fr.json.JSONObject;
+import com.fr.stable.EncodeConstants;
+import com.fr.stable.ProductConstants;
+import com.fr.stable.StableUtils;
+import com.fr.stable.core.UUID;
+
+import java.io.*;
+import java.text.DateFormat;
+import java.util.Date;
+
+/**
+ * Created by Administrator on 2017/7/24 0024.
+ */
+public class ErrorInfo {
+
+ private String username;
+ private String uuid;
+ private String activekey;
+ private String uploadtime;
+ private String templateid;
+ private String logid;
+ private String log;
+
+ public ErrorInfo(String username, String uuid, String activekey) {
+ this.username = username;
+ this.uuid = uuid;
+ this.activekey = activekey;
+ this.uploadtime = dateToString();
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public String getActivekey() {
+ return activekey;
+ }
+
+ public void setActivekey(String activekey) {
+ this.activekey = activekey;
+ }
+
+ public String getUploadtime() {
+ return uploadtime;
+ }
+
+ public void setUploadtime(String uploadtime) {
+ this.uploadtime = uploadtime;
+ }
+
+ public String getTemplateid() {
+ return templateid;
+ }
+
+ public void setTemplateid(String templateid) {
+ this.templateid = templateid;
+ }
+
+ public String getLogid() {
+ return logid;
+ }
+
+ public void setLogid(String logid) {
+ this.logid = logid;
+ }
+
+ public String getLog() {
+ return log;
+ }
+
+ public void setLog(String log) {
+ this.log = log;
+ }
+
+ private String dateToString(){
+ DateFormat df = FRContext.getDefaultValues().getDateTimeFormat();
+ return df.format(new Date());
+ }
+
+ /**
+ * 将出错对象存为json字符串, 并放到设计器缓存目录.
+ * 等下一次上传到云中心.
+ */
+ public void saveAsJSON(){
+ JSONObject jo = JSONObject.create();
+ try {
+ jo.put("username", username);
+ jo.put("uuid", uuid);
+ jo.put("activekey", activekey);
+ jo.put("templateid", templateid);
+ jo.put("uploadtime", uploadtime);
+ jo.put("logid", logid);
+ jo.put("log", log);
+ } catch (JSONException ignore) {
+ }
+
+ saveFileToCache(jo);
+ }
+
+ private void saveFileToCache(JSONObject jo) {
+ String content = jo.toString();
+ String fileName = UUID.randomUUID() + ErrorInfoUploader.SUFFIX;
+ File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), ErrorInfoUploader.FOLDER_NAME, fileName));
+ try {
+ StableUtils.makesureFileExist(file);
+ FileOutputStream out = new FileOutputStream(file);
+ InputStream in = new ByteArrayInputStream(content.getBytes(EncodeConstants.ENCODING_UTF_8));
+ IOUtils.copyBinaryTo(in, out);
+ out.close();
+ } catch (IOException ignore) {
+ }
+ }
+}
diff --git a/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java b/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java
new file mode 100644
index 0000000000..1d4f65de53
--- /dev/null
+++ b/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java
@@ -0,0 +1,139 @@
+package com.fr.design.mainframe.errorinfo;
+
+import com.fr.base.FRContext;
+import com.fr.base.io.IOFile;
+import com.fr.base.io.XMLReadHelper;
+import com.fr.design.DesignerEnvManager;
+import com.fr.general.FRLogLevel;
+import com.fr.general.FRLogManager;
+import com.fr.general.LogDuration;
+import com.fr.stable.StringUtils;
+import com.fr.stable.project.ProjectConstants;
+import com.fr.stable.xml.XMLPrintWriter;
+import com.fr.stable.xml.XMLableReader;
+import com.fr.web.core.SessionDealWith;
+import com.fr.web.core.SessionIDInfor;
+import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.Level;
+import org.apache.log4j.spi.LoggingEvent;
+
+import java.io.InputStream;
+
+/**
+ * 收集设计器报错信息的appender.
+ *
+ * Created by Administrator on 2017/7/24 0024.
+ */
+public class ErrorInfoLogAppender extends AppenderSkeleton {
+
+ private static final int ERROR_LEN = 8;
+
+ // 缓存下不变的, 没必要频繁取.
+ private String username;
+ private String uuid;
+ private String activekey;
+
+ public ErrorInfoLogAppender() {
+ this.layout = new org.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n");
+
+ DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
+ this.username = envManager.getBBSName();
+ this.uuid = envManager.getUUID();
+ this.activekey = envManager.getActivationKey();
+ }
+
+ protected void append(LoggingEvent event) {
+ this.subAppend(event);
+ }
+
+ public boolean requiresLayout() {
+ return true;
+ }
+
+ public synchronized void close() {
+ if (this.closed) {
+ return;
+ }
+ this.closed = true;
+
+ }
+
+ public void subAppend(LoggingEvent event) {
+ Level level = event.getLevel();
+ // 只分析上传记录error以上的.
+ if (level.isGreaterOrEqual(FRLogLevel.ERROR)) {
+ String msg = this.layout.format(event);
+ // 这个id并不是一定会有的, 有就记录下, 说明是预览模板出的错.
+ String templateid = readTemplateID();
+ String logid = readLogID(msg);
+ ErrorInfo errorInfo = new ErrorInfo(username, uuid, activekey);
+ errorInfo.setTemplateid(templateid);
+ errorInfo.setLog(msg);
+ errorInfo.setLogid(logid);
+ errorInfo.saveAsJSON();
+ }
+ }
+
+ private String readLogID(String log) {
+ int dotIndex = log.lastIndexOf(":");
+ if (dotIndex != -1) {
+ int end = Math.min(dotIndex + ERROR_LEN, log.length());
+ String logid = log.substring(dotIndex + 1, end).trim();
+ try {
+ Long.parseLong(logid);
+ return logid;
+ } catch (Exception ignore) {
+
+ }
+ }
+
+ return StringUtils.EMPTY;
+ }
+
+ private String readTemplateID() {
+ LogDuration logDuration = FRLogManager.getSession();
+ if (logDuration == null) {
+ return StringUtils.EMPTY;
+ }
+
+ String sessionID = logDuration.getSessionID();
+ SessionIDInfor infor = SessionDealWith.getSessionIDInfor(sessionID);
+ if (infor == null) {
+ return StringUtils.EMPTY;
+ }
+
+ String bookPath = infor.getBookPath();
+ // 这个iofile只读一个templateid, 其他以后有需要再读.
+ IOFile file = new IOFile() {
+ @Override
+ public void readStream(InputStream in) throws Exception {
+ XMLableReader xmlReader = XMLReadHelper.createXMLableReader(in, XMLPrintWriter.XML_ENCODER);
+ xmlReader.readXMLObject(this);
+ xmlReader.close();
+ in.close();
+ }
+
+ @Override
+ public void readXML(XMLableReader reader) {
+ super.readXML(reader);
+ readDesign(reader);
+ }
+
+ @Override
+ protected String openTag() {
+ return StringUtils.EMPTY;
+ }
+
+ @Override
+ protected void mainContent(XMLPrintWriter writer) {
+ }
+ };
+ try {
+ file.readStream(FRContext.getCurrentEnv().readBean(bookPath, ProjectConstants.REPORTLETS_NAME));
+ return file.getTemplateID();
+ } catch (Exception ignore) {
+ }
+
+ return StringUtils.EMPTY;
+ }
+}
\ No newline at end of file
diff --git a/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java b/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
new file mode 100644
index 0000000000..0204d33a96
--- /dev/null
+++ b/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
@@ -0,0 +1,98 @@
+package com.fr.design.mainframe.errorinfo;
+
+import com.fr.general.*;
+import com.fr.general.http.HttpClient;
+import com.fr.json.JSONObject;
+import com.fr.stable.CodeUtils;
+import com.fr.stable.EnvChangedListener;
+import com.fr.stable.ProductConstants;
+import com.fr.stable.StableUtils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.HashMap;
+
+/**
+ * Created by Administrator on 2017/7/24 0024.
+ */
+public class ErrorInfoUploader {
+
+ public static final String SUFFIX = ".json";
+ public static final String FOLDER_NAME = "errorInfo";
+
+ private static ErrorInfoUploader collector;
+
+ static {
+ GeneralContext.addEnvChangedListener(new EnvChangedListener() {
+ @Override
+ public void envChanged() {
+ FRLogger.getLogger().addLogAppender(new ErrorInfoLogAppender());
+ }
+ });
+ }
+
+ private ErrorInfoUploader() {
+ FRLogger.getLogger().addLogAppender(new ErrorInfoLogAppender());
+ }
+
+ public static ErrorInfoUploader getInstance() {
+ if (collector == null) {
+ collector = new ErrorInfoUploader();
+ }
+
+ return collector;
+ }
+
+ public void sendErrorInfo(){
+ //读取文件夹里的json, 加入上传队列中.
+ File folder = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FOLDER_NAME));
+ if (!folder.exists()) {
+ return;
+ }
+
+ File[] files = folder.listFiles();
+ try {
+ for (File file : files) {
+ String filePath = file.getPath();
+ String suffix = filePath.substring(filePath.lastIndexOf("."));
+
+ if (suffix.endsWith(SUFFIX)) {
+ Thread.sleep(1000L);
+ String content = IOUtils.inputStream2String(new FileInputStream(file));
+ String url = SiteCenter.getInstance().acquireUrlByKind("design.error");
+ if (sendErroInfo(url, content)) {
+ file.delete();
+ }
+ }
+ }
+ } catch (Exception ignore) {
+
+ }
+ }
+
+ private boolean sendErroInfo(String url, String content) {
+ HashMap para = new HashMap<>();
+ String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
+ para.put("token", CodeUtils.md5Encode(date, "", "MD5"));
+ para.put("content", content);
+ HttpClient httpClient = new HttpClient(url, para, true);
+ httpClient.asGet();
+
+ if (!httpClient.isServerAlive()) {
+ return false;
+ }
+
+ String res = httpClient.getResponseText();
+ boolean success;
+ try {
+ success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
+ } catch (Exception ex) {
+ success = false;
+ }
+ return success;
+ }
+
+
+}
diff --git a/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java b/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java
index 11bfbe476d..b6173c6d80 100644
--- a/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java
+++ b/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java
@@ -1,30 +1,43 @@
package com.fr.design.mainframe.form;
+import com.fr.base.DynamicUnitList;
+import com.fr.base.ScreenResolution;
+import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
+import com.fr.design.file.HistoryTemplateListPane;
+import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory;
-import com.fr.design.mainframe.BaseJForm;
-import com.fr.design.mainframe.DesignerContext;
+import com.fr.design.mainframe.*;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider;
+import com.fr.grid.Grid;
+import com.fr.grid.GridUtils;
+import com.fr.report.ReportHelper;
import com.fr.report.worksheet.FormElementCase;
import javax.swing.*;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
import java.awt.*;
+import java.awt.event.*;
/**
* 整个FormElementCase编辑区域 包括滚动条、中间的grid或者聚合块、下面的sheetTab
*/
public class FormReportComponentComposite extends JComponent implements TargetModifiedListener, FormECCompositeProvider{
-
- private FormElementCaseDesigner elementCaseDesigner;
+
+ private static final int MAX = 400;
+ private static final int HUND = 100;
+ private static final int MIN = 10;
+ public FormElementCaseDesigner elementCaseDesigner;
private BaseJForm jForm;
private FormTabPane sheetNameTab;
private JPanel hbarContainer;
-
-
+ private JSliderPane jSliderContainer;
+ private boolean isCtrl = false;
public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) {
this.jForm = jform;
@@ -33,12 +46,114 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
this.add(elementCaseDesigner, BorderLayout.CENTER);
sheetNameTab = new FormTabPane(ecContainer, jform);
this.add(createSouthControlPane(), BorderLayout.SOUTH);
-
+ jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener);
+ jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
+ ((JForm)this.jForm).getFormDesign().getArea().addMouseWheelListener(showValSpinnerMouseWheelListener);
+ ((JForm)this.jForm).getFormDesign().getArea().addKeyListener(showValSpinnerKeyListener);
+ this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
+ this.elementCaseDesigner.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
elementCaseDesigner.addTargetModifiedListener(this);
}
+ KeyListener showValSpinnerKeyListener = new KeyListener() {
+ @Override
+ public void keyTyped(KeyEvent e) {
+
+ }
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if( e.isControlDown()){
+ isCtrl = true ;
+ }
+ }
+ @Override
+ public void keyReleased(KeyEvent e) {
+ isCtrl = false ;
+ }
+ };
+
+ MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
+ @Override
+ public void mouseWheelMoved(MouseWheelEvent e) {
+ if (isCtrl){
+ int dir = e.getWheelRotation();
+ int old_resolution = (int) jSliderContainer.getShowVal().getValue();
+ jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN));
+ }
+ }
+ };
+
+
+ ChangeListener showValSpinnerChangeListener = new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ double value = (int) ((UIBasicSpinner)e.getSource()).getValue();
+ value = value > MAX ? MAX : value;
+ value = value < MIN ? MIN : value;
+ int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND);
+ setScale(resolution);
+// HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
+ }
+ };
+
+ ItemListener selfAdaptButtonItemListener = new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ if (jSliderContainer.getSelfAdaptButton().isSelected()){
+ int resolution = selfAdaptUpdate();
+ jSliderContainer.getShowVal().setValue(resolution*HUND/ScreenResolution.getScreenResolution());
+ }
+ }
+ };
+
private java.util.List targetModifiedList = new java.util.ArrayList();
+ private void setScale(int resolution){
+ JForm jForm = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
+ ElementCasePane elementCasePane = ((FormReportComponentComposite)jForm.getReportComposite()).elementCaseDesigner.getEditingElementCasePane();
+ elementCasePane.setResolution(resolution);
+ elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution);
+ elementCasePane.getGrid().setResolution(resolution);
+ //更新Grid
+ Grid grid = elementCasePane.getGrid();
+ DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(elementCasePane.getEditingElementCase());
+ DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(elementCasePane.getEditingElementCase());
+ grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution));
+ grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution));
+ elementCasePane.getGrid().updateUI();
+ //更新Column和Row
+ ((DynamicScrollBar)elementCasePane.getVerticalScrollBar()).setDpi(resolution);
+ ((DynamicScrollBar)elementCasePane.getHorizontalScrollBar()).setDpi(resolution);
+ elementCasePane.getGridColumn().setResolution(resolution);
+ elementCasePane.getGridColumn().updateUI();
+ elementCasePane.getGridRow().setResolution(resolution);
+ elementCasePane.getGridRow().updateUI();
+ }
+
+ private int selfAdaptUpdate(){
+ JForm jForm = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
+ if (jForm.resolution == 0){
+ jForm.resolution = ScreenResolution.getScreenResolution();
+ }
+ ElementCasePane elementCasePane = ((FormReportComponentComposite)jForm.getReportComposite()).elementCaseDesigner.getEditingElementCasePane();
+ ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane();
+ int column = reportPane.getSelection().getSelectedColumns()[0];
+ double columnLength = reportPane.getSelection().getSelectedColumns().length;
+ double columnExtent = reportPane.getGrid().getHorizontalExtent();
+ int row = reportPane.getSelection().getSelectedRows()[0];
+ double rowLength = reportPane.getSelection().getSelectedRows().length;
+ double rowExtent = reportPane.getGrid().getVerticalExtent();
+ if (columnLength == 0||rowLength == 0){
+ return jForm.resolution;
+ }
+ double time =(columnExtent/columnLength)<(rowExtent/rowLength) ? (columnExtent/columnLength) : (rowExtent/rowLength);
+ if (reportPane.isHorizontalScrollBarVisible()) {
+ reportPane.getVerticalScrollBar().setValue(row);
+ reportPane.getHorizontalScrollBar().setValue(column);
+ }
+ return (int) (time * elementCasePane.getGrid().getResolution());
+ }
+
/**
* 添加目标改变的监听
* @param targetModifiedListener 目标改变事件
@@ -62,13 +177,18 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
}
private JComponent createSouthControlPane() {
+ JPanel southPane = new JPanel(new BorderLayout());
hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
hbarContainer.add(elementCaseDesigner.getHorizontalScrollBar());
- JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer);
+ jSliderContainer = JSliderPane.getInstance();
+
+ JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, jSliderContainer);
+ southPane.add(hbarContainer,BorderLayout.NORTH);
+ southPane.add(splitpane,BorderLayout.CENTER);
splitpane.setBorder(null);
splitpane.setDividerSize(3);
- splitpane.setResizeWeight(0.6);
- return splitpane;
+ splitpane.setResizeWeight(1);
+ return southPane;
}
/**
diff --git a/designer/src/com/fr/design/present/BarCodePane.java b/designer/src/com/fr/design/present/BarCodePane.java
index f7676ebd27..27a42a7e98 100644
--- a/designer/src/com/fr/design/present/BarCodePane.java
+++ b/designer/src/com/fr/design/present/BarCodePane.java
@@ -69,6 +69,7 @@ public class BarCodePane extends FurtherBasicBeanPane {
addlistener();
}
+
private void initComponents() {
barCodePreviewPane = new BarCodePreviewPane();
this.barWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(1, 1, 100, 0.1));
diff --git a/designer/src/com/fr/grid/AbstractGridHeaderMouseHandler.java b/designer/src/com/fr/grid/AbstractGridHeaderMouseHandler.java
index 42f7417b54..b68ddd197a 100644
--- a/designer/src/com/fr/grid/AbstractGridHeaderMouseHandler.java
+++ b/designer/src/com/fr/grid/AbstractGridHeaderMouseHandler.java
@@ -41,7 +41,6 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
protected static final int SEPARATOR_GAP = 5;
private GridHeader gHeader;
-
private int dragType = GridUtils.DRAG_NONE;
//james 是否为选定多行的drag
private boolean isMultiSelectDragPermited = false;
@@ -53,10 +52,16 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
private int dragIndex = 0;
private JToolTip tip = null;
private JWindow tipWindow = null;
+ protected int resolution = ScreenResolution.getScreenResolution();
public AbstractGridHeaderMouseHandler(GridHeader gHeader) {
this.gHeader = gHeader;
- }
+ if (gHeader instanceof GridColumn){
+ this.resolution = ((GridColumn)gHeader).getResolution();
+ }else {
+ this.resolution = ((GridRow)gHeader).getResolution();
+ }
+ }
public void setStartMultiSelectIndex(int index) {
this.startMultiSelectIndex = index;
@@ -98,7 +103,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
@Override
public boolean run(MouseEvent evt, int index, double tmpSize1, double tmpSize2, int tmpIncreaseSize, int oldEndValueSize, ElementCase report, DynamicUnitList sizeList) {
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
// richer:这边这么做的原因是调整了行高列宽后需要通知聚合块改变边界
Method method = null;
try {
@@ -142,7 +147,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
private ScrollAction PRESS_ACTION = new ScrollAction() {
@Override
public boolean run(MouseEvent evt, int index, double tmpSize1, double tmpSize2, int tmpIncreaseSize, int oldEndValueSize, ElementCase report, DynamicUnitList sizeList) {
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
if (isOnSeparatorLineIncludeZero(evt, tmpSize2, tmpIncreaseSize) || isOnNormalSeparatorLine(evt, tmpSize2)) {
dragType = GridUtils.DRAG_CELL_SIZE;
@@ -177,7 +182,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
double tmpIncreaseSize = 0;
double oldEndValueSize = 0;
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
for (int index = beginValue; index < endValue; index++) { // denny:
// beginValue
@@ -215,7 +220,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
ePane.getGrid().stopEditing();// james 停止当前的所有编辑
// peter:选中格子位置.
- ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(ePane, evt.getX(), evt.getY());
+ ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evt.getX(), evt.getY(),resolution);
iterateScrollBar(ePane, evt, PRESS_ACTION);
@@ -255,7 +260,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
* @param evtY
*/
private void doShiftSelectHeader(ElementCasePane ePane, double evtX, double evtY) {
- ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(ePane, evtX, evtY);
+ ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evtX, evtY, resolution);
int selectedCellPointX = selectedCellPoint.getColumn();// column.
int selectedCellPointY = selectedCellPoint.getRow();// row.
CellSelection cs = ((CellSelection) ePane.getSelection()).clone();
@@ -294,7 +299,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
private String createToolTipString(double doubleValue, double totalDoubleValue) {
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
FU ulen = FU.valueOfPix((int) doubleValue, resolution);
FU tulen = FU.valueOfPix((int) totalDoubleValue, resolution);
String unit;
@@ -317,11 +322,11 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
unit = Inter.getLocText("Unit_MM");
}
StringBuilder sb = new StringBuilder();
- sb.append(Utils.convertNumberStringToString(new Float(len)))
- .append('/').append(Utils.convertNumberStringToString(new Float(tlen)))
+ sb.append(String.format("%.2f", new Double(len)))
+ .append('/').append(String.format("%.2f", new Double(tlen)))
.append(unit).append('(')
- .append(Utils.doubleToString(doubleValue)).append('/')
- .append(Utils.doubleToString(totalDoubleValue))
+ .append((int)(doubleValue)).append('/')
+ .append((int)(totalDoubleValue))
.append(Inter.getLocText("px"))
.append(')');
return sb.toString();
@@ -401,7 +406,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
if (!this.isMultiSelectDragPermited) {
return;
}
- ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(ePane, evt.getX(), evt.getY());
+ ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evt.getX(), evt.getY(), resolution);
endMultiSelectIndex = getColumnOrRowByGridHeader(selectedCellPoint);
resetGridSelectionByDrag(cs, ePane, startMultiSelectIndex, endMultiSelectIndex);
cs.setSelectedType(doChooseFrom());
@@ -421,7 +426,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
iterateScrollBar(ePane, evt, DRAG_ACTION);
DynamicUnitList sizeList = getSizeList(report);
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
this.setToolTipText2(this.createToolTipString(sizeList.get(dragIndex).toPixD(resolution), sizeList.getRangeValue(0, dragIndex + 1).toPixD(resolution)));
}
@@ -472,7 +477,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
double tmpSize1 = 0;
double tmpSize2;
double tmpIncreaseSize = 0;
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
for (int i = beginValue; i < endValue; i++) {
if (i == 0) {
diff --git a/designer/src/com/fr/grid/Grid.java b/designer/src/com/fr/grid/Grid.java
index 178cd085ed..01a2bb1d84 100644
--- a/designer/src/com/fr/grid/Grid.java
+++ b/designer/src/com/fr/grid/Grid.java
@@ -114,6 +114,7 @@ public class Grid extends BaseGridComponent {
private int resolution;
// 判断SmartJTablePane是否显示,做为动态虚线标识符
private boolean notShowingTableSelectPane = true;
+ private GridMouseAdapter gridMouseAdapter;
public Grid(int resolution) {
this.resolution = resolution;
@@ -121,7 +122,7 @@ public class Grid extends BaseGridComponent {
enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
GridKeyAction.initGridInputActionMap(this);
- GridMouseAdapter gridMouseAdapter = new GridMouseAdapter(this);
+ gridMouseAdapter = new GridMouseAdapter(this);
this.addMouseListener(gridMouseAdapter);
this.addMouseMotionListener(gridMouseAdapter);
@@ -136,6 +137,14 @@ public class Grid extends BaseGridComponent {
this.updateUI();
}
+ public void setResolution(int resolution) {
+ this.resolution = resolution;
+ }
+
+ public int getResolution() {
+ return this.resolution;
+ }
+
/**
* 应用界面设置
*
@@ -149,6 +158,7 @@ public class Grid extends BaseGridComponent {
setUI(localComponentUI);
}
+
/**
* 是否显示格子线
*
@@ -173,6 +183,10 @@ public class Grid extends BaseGridComponent {
this.getElementCasePane().repaint();
}
+ public GridMouseAdapter getGridMouseAdapter(){
+ return this.gridMouseAdapter;
+ }
+
/**
* Gets grid line color.
*
diff --git a/designer/src/com/fr/grid/GridColumn.java b/designer/src/com/fr/grid/GridColumn.java
index e2366c9bca..165a5727a9 100644
--- a/designer/src/com/fr/grid/GridColumn.java
+++ b/designer/src/com/fr/grid/GridColumn.java
@@ -6,9 +6,15 @@ package com.fr.grid;
import java.awt.Dimension;
import com.fr.base.GraphHelper;
+import com.fr.base.ScreenResolution;
+import com.fr.design.ExtraDesignClassManager;
+import com.fr.design.fun.GridUIProcessor;
import com.fr.design.mainframe.ElementCasePane;
+import com.fr.design.mainframe.JSliderPane;
import com.fr.stable.StableUtils;
+import javax.swing.plaf.ComponentUI;
+
/**
* GridColumn used to paint and edit grid column.
*
@@ -17,9 +23,15 @@ import com.fr.stable.StableUtils;
*/
public class GridColumn extends GridHeader {
+ public int resolution = ScreenResolution.getScreenResolution();
+
+ private GridColumnMouseHandler gridColumnMouseHandler;
+
@Override
protected void initByConstructor() {
- GridColumnMouseHandler gridColumnMouseHandler = new GridColumnMouseHandler(this);
+ resolution = ScreenResolution.getScreenResolution();
+ this.setResolution(resolution);
+ gridColumnMouseHandler = new GridColumnMouseHandler(this);
this.addMouseListener(gridColumnMouseHandler);
this.addMouseMotionListener(gridColumnMouseHandler);
this.updateUI();
@@ -32,7 +44,22 @@ public class GridColumn extends GridHeader {
@Override
public void updateUI() {
- this.setUI(new GridColumnUI());
+ this.removeMouseListener(gridColumnMouseHandler);
+ this.removeMouseMotionListener(gridColumnMouseHandler);
+ gridColumnMouseHandler = new GridColumnMouseHandler(this);
+ this.addMouseListener(gridColumnMouseHandler);
+ this.addMouseMotionListener(gridColumnMouseHandler);
+// gridColumnMouseHandler.setResolution(resolution);
+ this.setUI(new GridColumnUI(resolution));
+ }
+
+ public void setResolution(int resolution) {
+ this.resolution = resolution;
+ }
+
+ @Override
+ public int getResolution() {
+ return this.resolution;
}
/**
diff --git a/designer/src/com/fr/grid/GridColumnMouseHandler.java b/designer/src/com/fr/grid/GridColumnMouseHandler.java
index b7864bf051..2d93d01d29 100644
--- a/designer/src/com/fr/grid/GridColumnMouseHandler.java
+++ b/designer/src/com/fr/grid/GridColumnMouseHandler.java
@@ -9,6 +9,7 @@ import java.awt.event.MouseEvent;
import javax.swing.SwingUtilities;
import com.fr.base.DynamicUnitList;
+import com.fr.base.ScreenResolution;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.selection.CellSelection;
@@ -22,8 +23,15 @@ import com.fr.stable.ColumnRow;
*/
public class GridColumnMouseHandler extends AbstractGridHeaderMouseHandler {
+ private int resolution;
+
public GridColumnMouseHandler(GridColumn gridColumn) {
super(gridColumn);
+ this.resolution = gridColumn.resolution;
+ }
+
+ public void setResolution(int resolution){
+ this.resolution = resolution;
}
@Override
@@ -86,7 +94,6 @@ public class GridColumnMouseHandler extends AbstractGridHeaderMouseHandler {
/**
* Checks whether is on zero separator line.
*
- * @param evtX event x
*/
@Override
protected boolean isOnSeparatorLineIncludeZero(MouseEvent evt, double tmpWidth2, double tmpIncreaseWidth) {
diff --git a/designer/src/com/fr/grid/GridColumnUI.java b/designer/src/com/fr/grid/GridColumnUI.java
index 52df976937..36a011a931 100644
--- a/designer/src/com/fr/grid/GridColumnUI.java
+++ b/designer/src/com/fr/grid/GridColumnUI.java
@@ -29,7 +29,14 @@ import com.fr.report.elementcase.ElementCase;
public class GridColumnUI extends ComponentUI {
protected Color withoutDetailsBackground = Color.lightGray;
- protected int resolution = ScreenResolution.getScreenResolution();
+ private int resolution ;
+
+ public GridColumnUI(int resolution){
+ if (resolution == 0){
+ resolution = ScreenResolution.getScreenResolution();
+ }
+ this.resolution = resolution;
+ }
@Override
public void paint(Graphics g, JComponent c) {
@@ -154,11 +161,11 @@ public class GridColumnUI extends ComponentUI {
}
double stringWidth = gridColumn.getFont().getStringBounds(columnContent, fontRenderContext).getWidth();
- if (stringWidth > tmpIncreaseWidth) {
- paintMoreContent(i, g2d, tmpWidth1, size, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent);
- } else {
+// if (stringWidth > tmpIncreaseWidth) {
+// paintMoreContent(i, g2d, tmpWidth1, size, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent);
+// } else {
paintNormalContent(i, g2d, tmpWidth1, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent);
- }
+// }
}
diff --git a/designer/src/com/fr/grid/GridHeader.java b/designer/src/com/fr/grid/GridHeader.java
index 3b331d2706..b0dca649da 100644
--- a/designer/src/com/fr/grid/GridHeader.java
+++ b/designer/src/com/fr/grid/GridHeader.java
@@ -1,17 +1,21 @@
package com.fr.grid;
+import com.fr.base.ScreenResolution;
+
import java.awt.Color;
public abstract class GridHeader extends BaseGridComponent {
public final static int SIZE_ADJUST = 4;
-
+
//属性
private Color separatorLineColor = new Color(172, 168, 153); //separator lines
private Color selectedForeground = Color.black;
private Color selectedBackground = new Color(253, 216, 153);
+ protected int resolution;
+
public GridHeader() {
//清除所有的Key Action.
this.getInputMap().clear();
@@ -22,7 +26,15 @@ public abstract class GridHeader extends BaseGridComponent {
initByConstructor();
}
-
+
+ public void setResolution(int resolution){
+ this.resolution = resolution;
+ }
+
+ public int getResolution(){
+ return this.resolution;
+ }
+
protected abstract void initByConstructor();
protected abstract T getDisplay(int index) ;
diff --git a/designer/src/com/fr/grid/GridMouseAdapter.java b/designer/src/com/fr/grid/GridMouseAdapter.java
index 8a40533530..27e93b8660 100644
--- a/designer/src/com/fr/grid/GridMouseAdapter.java
+++ b/designer/src/com/fr/grid/GridMouseAdapter.java
@@ -7,6 +7,7 @@ import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
+import com.fr.design.mainframe.JSliderPane;
import com.fr.design.present.CellWriteAttrPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.grid.selection.CellSelection;
@@ -71,6 +72,8 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
private int ECBlockGap = 40;
+ private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
+
protected GridMouseAdapter(Grid grid) {
this.grid = grid;
}
@@ -101,7 +104,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
// 用户没有按住Shift键时,tempOldSelectedCell是一直变化的。如果一直按住shift,是不变的
ElementCasePane ePane = grid.getElementCasePane();
if (!evt.isShiftDown() && ePane.getSelection() instanceof CellSelection) {
- tempOldSelectedCell = GridUtils.getAdjustEventColumnRow(ePane, oldEvtX, oldEvtY);
+ tempOldSelectedCell = GridUtils.getAdjustEventColumnRow_withresolution(ePane, oldEvtX, oldEvtY,resolution);
}
}
@@ -118,7 +121,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
int horizentalScrollValue = grid.getHorizontalValue();
int verticalScrollValue = grid.getVerticalValue();
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
FU evtX_fu = FU.valueOfPix(this.oldEvtX, resolution);
FU evtY_fu = FU.valueOfPix(this.oldEvtY, resolution);
@@ -142,7 +145,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
FloatElement selectedFloatElement = (FloatElement) tmpFloatElementCursor[0];
reportPane.setSelection(new FloatSelection(selectedFloatElement.getName()));
} else {
- ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, this.oldEvtX, this.oldEvtY);
+ ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, this.oldEvtX, this.oldEvtY, this.resolution);
if (!reportPane.getSelection().containsColumnRow(selectedCellPoint)) {
GridUtils.doSelectCell(reportPane, selectedCellPoint.getColumn(), selectedCellPoint.getRow());
}
@@ -187,7 +190,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
// peter:选择GridSelection,支持Shift
doOneClickSelection(this.oldEvtX, this.oldEvtY, isShiftDown, isControlDown);
// 得到点击所在的column and row
- ColumnRow columnRow = GridUtils.getEventColumnRow(reportPane, this.oldEvtX, this.oldEvtY);
+ ColumnRow columnRow = GridUtils.getEventColumnRow_withresolution(reportPane, this.oldEvtX, this.oldEvtY, this.resolution);
TemplateCellElement cellElement = report.getTemplateCellElement(columnRow.getColumn(), columnRow.getRow());
if (clickCount >= 2 && !BaseUtils.isAuthorityEditing()) {
grid.startEditing();
@@ -206,7 +209,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
*/
private void showWidetWindow(TemplateCellElement cellElement, TemplateElementCase report) {
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
double fixed_pos_x = this.oldEvtX - columnWidthList.getRangeValue(grid.getHorizontalValue(), cellElement.getColumn()).toPixD(resolution);
@@ -223,6 +226,10 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
&& cell_width - fixed_pos_x < WIDGET_WIDTH && cell_height - fixed_pos_y < WIDGET_WIDTH;
}
+ public void setResolution(int resolution) {
+ this.resolution = resolution;
+ }
+
/**
* @param evt
*/
@@ -372,7 +379,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
doWithCellElementDragged(evtX, evtY, (CellSelection) selection);
} else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION && !BaseUtils.isAuthorityEditing()) {
// peter:获得调整过的Selected Column Row.
- ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY);
+ ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
if (selectedCellPoint.getColumn() != grid.getDragRectangle().x || selectedCellPoint.getRow() != grid.getDragRectangle().y) {
grid.getDragRectangle().x = selectedCellPoint.getColumn();
grid.getDragRectangle().y = selectedCellPoint.getRow();
@@ -393,7 +400,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
private void doWithFloatElementDragged(int evtX, int evtY, FloatSelection fs) {
ElementCase report = grid.getElementCasePane().getEditingElementCase();
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
String floatName = fs.getSelectedFloatName();
FloatElement floatElement = report.getFloatElement(floatName);
int cursorType = grid.getCursor().getType();
@@ -453,7 +460,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
ElementCasePane reportPane = grid.getElementCasePane();
java.awt.Rectangle cellRectangle = cs.toRectangle();
- ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY);
+ ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
if (cellRectangle.contains(selectedCellPoint.getColumn(), selectedCellPoint.getRow())) {
grid.getDragRectangle().setBounds(cellRectangle);
} else {
@@ -507,7 +514,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
if (s instanceof FloatSelection) {
return;
}
- ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY);
+ ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
int selectedCellPointX = selectedCellPoint.getColumn();
int selectedCellPointY = selectedCellPoint.getRow();
CellSelection gridSelection = ((CellSelection) s).clone();
@@ -543,7 +550,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
return;
}
- ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY);
+ ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
//拷贝,而不是直接强制使用以监听单元格选择变化
CellSelection gridSelection = ((CellSelection) s).clone();
gridSelection.setSelectedType(((CellSelection) s).getSelectedType());
@@ -606,7 +613,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
} else {
grid.setCursor(UIConstants.CELL_DEFAULT_CURSOR);
}
- ColumnRow selectedCellColumnRow = GridUtils.getEventColumnRow(reportPane, evtX, evtY);
+ ColumnRow selectedCellColumnRow = GridUtils.getEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
TemplateCellElement curCellElement = report.getTemplateCellElement(selectedCellColumnRow.getColumn(), selectedCellColumnRow.getRow());
if (curCellElement != null) {
@@ -630,7 +637,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
* @param report
*/
private void setCursorAndToolTips(TemplateCellElement curCellElement, TemplateElementCase report) {
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
// 计算相对Grid的显示位置.
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
@@ -674,7 +681,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
double leftColDistance = columnWidthList.getRangeValue(grid.getHorizontalValue(), cs.getColumn()).toPixD(resolution);
double rightColDistance = columnWidthList.getRangeValue(grid.getHorizontalValue(), cs.getColumn() + cs.getColumnSpan()).toPixD(resolution);
@@ -725,7 +732,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
} else if (isControlDown) {
doControlSelectCell(evtX, evtY);
} else {
- ColumnRow selectedCellPoint = GridUtils.getEventColumnRow(reportPane, evtX, evtY);
+ ColumnRow selectedCellPoint = GridUtils.getEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
int type = reportPane.ensureColumnRowVisible(selectedCellPoint.getColumn(), selectedCellPoint.getRow());
if (type == ElementCasePane.NO_OVER) {
GridUtils.doSelectCell(reportPane, selectedCellPoint.getColumn(), selectedCellPoint.getRow());
@@ -766,7 +773,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
this.oldEvtX = evtX;
this.oldEvtY = evtY;
FloatElement el = report.getFloatElement(floatName);
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
int verticalValue = grid.getVerticalValue();
int horizentalValue = grid.getHorizontalValue();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
diff --git a/designer/src/com/fr/grid/GridRow.java b/designer/src/com/fr/grid/GridRow.java
index 5301d5b588..28a97e1709 100644
--- a/designer/src/com/fr/grid/GridRow.java
+++ b/designer/src/com/fr/grid/GridRow.java
@@ -6,8 +6,13 @@ package com.fr.grid;
import java.awt.Dimension;
import com.fr.base.GraphHelper;
+import com.fr.base.ScreenResolution;
+import com.fr.design.ExtraDesignClassManager;
+import com.fr.design.fun.GridUIProcessor;
import com.fr.design.mainframe.ElementCasePane;
+import javax.swing.plaf.ComponentUI;
+
/**
* GridRow used to paint and edit grid row.
*
@@ -15,9 +20,16 @@ import com.fr.design.mainframe.ElementCasePane;
* @since 2012-3-22下午6:12:03
*/
public class GridRow extends GridHeader {
+
+ private static final int MAX = 5;
+ private int resolution = ScreenResolution.getScreenResolution();
+ private GridRowMouseHandler gridRowMouseHandler;
+
@Override
protected void initByConstructor() {
- GridRowMouseHandler gridRowMouseHandler = new GridRowMouseHandler(this);
+ resolution = ScreenResolution.getScreenResolution();
+ this.setResolution(resolution);
+ gridRowMouseHandler = new GridRowMouseHandler(this);
this.addMouseListener(gridRowMouseHandler);
this.addMouseMotionListener(gridRowMouseHandler);
this.updateUI();
@@ -30,9 +42,23 @@ public class GridRow extends GridHeader {
@Override
public void updateUI() {
- this.setUI(new GridRowUI());
+ this.removeMouseListener(gridRowMouseHandler);
+ this.removeMouseMotionListener(gridRowMouseHandler);
+ gridRowMouseHandler = new GridRowMouseHandler(this);
+ this.addMouseListener(gridRowMouseHandler);
+ this.addMouseMotionListener(gridRowMouseHandler);
+ this.setUI(new GridRowUI(resolution));
}
+ public void setResolution(int resolution) {
+ this.resolution = resolution;
+ }
+
+ public int getResolution() {
+ return this.resolution;
+ }
+
+
/**
* Gets the preferred size.
*/
@@ -52,7 +78,7 @@ public class GridRow extends GridHeader {
* Calculates max char number.
*/
private int caculateMaxCharNumber(ElementCasePane reportPane) {
- int maxCharNumber = 5;
+ int maxCharNumber = MAX;
maxCharNumber = Math.max(maxCharNumber, ("" + (reportPane.getGrid().getVerticalValue() + reportPane.getGrid().getVerticalExtent())).length() + 1);
return maxCharNumber;
diff --git a/designer/src/com/fr/grid/GridRowUI.java b/designer/src/com/fr/grid/GridRowUI.java
index 1bf3c38c43..b03dbb414b 100644
--- a/designer/src/com/fr/grid/GridRowUI.java
+++ b/designer/src/com/fr/grid/GridRowUI.java
@@ -27,6 +27,14 @@ import com.fr.report.elementcase.ElementCase;
*/
public class GridRowUI extends ComponentUI {
private Color detailsBackground = Color.lightGray;
+ private int resolution ;
+
+ GridRowUI(int resolution){
+ if (resolution == 0){
+ resolution = ScreenResolution.getScreenResolution();
+ }
+ this.resolution = resolution;
+ }
@Override
public void paint(Graphics g, JComponent c) {
@@ -49,7 +57,6 @@ public class GridRowUI extends ComponentUI {
// paint more rows(double extent), for dragging.
int verticalEndValue = verticalValue + verticalExtent + 1;
double horizontalLineHeight = size.getHeight();
- int resolution = ScreenResolution.getScreenResolution();
// use background to paint first.
// denny: 用来标识已有数据
@@ -149,23 +156,20 @@ public class GridRowUI extends ComponentUI {
float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent();
double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth();
double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight();
- // AUGUST:如果高度太小了就不画了
- if (stringHeight <= tmpIncreaseHeight + 2) {
-
- if (isSelectedBounds) {
- g2d.setColor(gridRow.getSelectedForeground());
+ if (isSelectedBounds) {
+ g2d.setColor(gridRow.getSelectedForeground());
+ } else {
+ // p:检查eanbled
+ if (gridRow.isEnabled()) {
+ g2d.setColor(gridRow.getForeground());
} else {
- // p:检查eanbled
- if (gridRow.isEnabled()) {
- g2d.setColor(gridRow.getForeground());
- } else {
- g2d.setPaint(UIManager.getColor("controlShadow"));
- }
+ g2d.setPaint(UIManager.getColor("controlShadow"));
}
-
- GraphHelper.drawString(g2d, paintText, (size.width - stringWidth) / 2, tmpHeight1 + (tmpIncreaseHeight - stringHeight) / 2 + GridHeader.SIZE_ADJUST / 2 + fmAscent
- - 2);
}
+
+ GraphHelper.drawString(g2d, paintText, (size.width - stringWidth) / 2, tmpHeight1 + (tmpIncreaseHeight - stringHeight) / 2 + GridHeader.SIZE_ADJUST / 2 + fmAscent
+ - 2);
+
}
}
\ No newline at end of file
diff --git a/designer/src/com/fr/grid/GridUI.java b/designer/src/com/fr/grid/GridUI.java
index 526f0f074b..93ca03f811 100644
--- a/designer/src/com/fr/grid/GridUI.java
+++ b/designer/src/com/fr/grid/GridUI.java
@@ -429,6 +429,7 @@ public class GridUI extends ComponentUI {
this.calculateForcedPagingOfCellElement(reportPane, tmpCellElement, hideWidth, hideHeight);
storeFatherLocation(selectedCellElement, tmpCellElement);
// element bounds
+ // TODO: 2017/7/13 tmpRectangle : 72*19
this.caculateScrollVisibleBounds(this.tmpRectangle, tmpCellElement.getColumn(),
tmpCellElement.getRow(), tmpCellElement.getColumnSpan(),
tmpCellElement.getRowSpan());
@@ -455,8 +456,9 @@ public class GridUI extends ComponentUI {
paintCellElementList.add(tmpCellElement);
paintCellElementRectangleList.add(this.tmpRectangle.clone());
- int cellWidth = (int) this.tmpRectangle.getWidth(), cellHeight = (int) this.tmpRectangle
- .getHeight();
+
+ int cellWidth = (int) this.tmpRectangle.getWidth();
+ int cellHeight = (int) this.tmpRectangle.getHeight();
// denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框
painter.paintBackground(g2d, report, tmpCellElement, cellWidth, cellHeight);
@@ -1077,6 +1079,7 @@ public class GridUI extends ComponentUI {
grid.ajustEditorComponentBounds(); // refresh size
}
+
private void dealWithSizeBeforePaint(Grid grid, TemplateElementCase elementCase) {
// 取出所有的行高和列宽的List
this.rowHeightList = ReportHelper.getRowHeightList(elementCase);
diff --git a/designer/src/com/fr/grid/GridUtils.java b/designer/src/com/fr/grid/GridUtils.java
index e04c92e203..d197ec907d 100644
--- a/designer/src/com/fr/grid/GridUtils.java
+++ b/designer/src/com/fr/grid/GridUtils.java
@@ -6,6 +6,7 @@ import com.fr.design.cell.clipboard.CellElementsClip;
import com.fr.design.cell.clipboard.ElementsTransferable;
import com.fr.design.cell.clipboard.FloatElementsClip;
import com.fr.design.mainframe.ElementCasePane;
+import com.fr.design.mainframe.JSliderPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection;
@@ -48,6 +49,7 @@ public class GridUtils {
//peter:下面这几个量是在Drag列的时候用.
public final static int DRAG_CELL_SIZE = 1; //peter:drag的时候改变格子的宽度.
public final static int DRAG_SELECT_UNITS = 2; //peter:drag的时候,选中单元格.
+// public static int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
/**
* Is above float element.(the return may be null).
@@ -67,7 +69,8 @@ public class GridUtils {
double[] floatArray = caculateFloatElementLocations(tmpFloatElement, ReportHelper.getColumnWidthList(report),
ReportHelper.getRowHeightList(report), reportPane.getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue());
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
+ int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
//peter:悬浮元素的范围.
Rectangle2D floatElementRect = new Rectangle2D.Double(floatArray[0], floatArray[1], tmpFloatElement.getWidth().toPixD(resolution), tmpFloatElement.getHeight().toPixD(resolution));
//peter:不是当前选中的悬浮元素,不支持六个改变大小的点.
@@ -123,8 +126,8 @@ public class GridUtils {
*/
public static double[] caculateFloatElementLocations(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList,
int verticalValue, int horizentalValue) {
- int resolution = ScreenResolution.getScreenResolution();
-
+// int resolution = ScreenResolution.getScreenResolution();
+ int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution);
double floatY = rowHeightList.getRangeValue(verticalValue, 0).toPixD(resolution) + floatElement.getTopDistance().toPixD(resolution);
@@ -166,7 +169,66 @@ public class GridUtils {
private static int cc_selected_column_or_row(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList) {
double tmpIntIndex = 0;
int selectedCellIndex = 0;
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
+ int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
+ if (mouseEvtPosition < 0) {
+ selectedCellIndex = value;
+ for (; true; selectedCellIndex--) {
+ if (tmpIntIndex < mouseEvtPosition) {
+ break;
+ }
+ tmpIntIndex -= sizeList.get(selectedCellIndex).toPixD(resolution);
+
+ }
+ } else {
+ boolean isInnerFrozen = false;
+ for (int i = beginValue; i < 0; i++) {
+ tmpIntIndex += sizeList.get(i).toPixD(resolution);
+
+ if (tmpIntIndex > mouseEvtPosition) {
+ selectedCellIndex = i;
+ isInnerFrozen = true;
+ break;
+ }
+ }
+
+ if (!isInnerFrozen) {
+ selectedCellIndex = value;
+ for (; true; selectedCellIndex++) {
+ tmpIntIndex += sizeList.get(selectedCellIndex).toPixD(resolution);
+ if (tmpIntIndex > mouseEvtPosition) {
+ break;
+ }
+ }
+ }
+ }
+
+ return selectedCellIndex;
+ }
+
+ public static ColumnRow getEventColumnRow_withresolution(ElementCasePane reportPane, double evtX, double evtY, int resolution) {
+ ElementCase report = reportPane.getEditingElementCase();
+
+ // Width and height list.
+ DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
+ DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
+
+ int verticalValue = reportPane.getGrid().getVerticalValue();
+ int horizentalValue = reportPane.getGrid().getHorizontalValue();
+
+ // denny: get verticalBeginValue and horizontalBeginValue;
+ int verticalBeginValue = reportPane.getGrid().getVerticalBeginValue();
+ int horizontalBeginValue = reportPane.getGrid().getHorizontalBeginValue();
+ return ColumnRow.valueOf(
+ cc_selected_column_or_row_withresolution(evtX, horizontalBeginValue, horizentalValue, columnWidthList, resolution),
+ cc_selected_column_or_row_withresolution(evtY, verticalBeginValue, verticalValue, rowHeightList, resolution)
+ );
+ }
+
+ private static int cc_selected_column_or_row_withresolution(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList, int resolution) {
+ double tmpIntIndex = 0;
+ int selectedCellIndex = 0;
+// int resolution = ScreenResolution.getScreenResolution();
if (mouseEvtPosition < 0) {
selectedCellIndex = value;
for (; true; selectedCellIndex--) {
@@ -222,6 +284,16 @@ public class GridUtils {
return ColumnRow.valueOf(col, row);
}
+ public static ColumnRow getAdjustEventColumnRow_withresolution(ElementCasePane reportPane, double evtX, double evtY, int resolution) {
+ ColumnRow selectedCellPoint = GridUtils.getEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
+
+ int col = Math.max(selectedCellPoint.getColumn(), 0);
+ int row = Math.max(selectedCellPoint.getRow(), 0);
+
+
+ return ColumnRow.valueOf(col, row);
+ }
+
/**
* 是否可将当前单元格变为可见的格子
*/
@@ -395,4 +467,5 @@ public class GridUtils {
}
}
+
}
\ No newline at end of file
diff --git a/designer/src/com/fr/poly/PolyArea.java b/designer/src/com/fr/poly/PolyArea.java
index 07a79edc53..c9589f69f1 100644
--- a/designer/src/com/fr/poly/PolyArea.java
+++ b/designer/src/com/fr/poly/PolyArea.java
@@ -1,15 +1,29 @@
package com.fr.poly;
+
import javax.swing.JComponent;
public class PolyArea extends JComponent {
private PolyDesigner polyDesigner;
+ private int resolution;
- public PolyArea(PolyDesigner polyDesigner) {
+ public PolyArea(PolyDesigner polyDesigner, int resolution) {
this.polyDesigner = polyDesigner;
- setUI(new PolyDesignUI());
+ this.resolution = resolution;
+ this.setUI(new PolyDesignUI(resolution));
+// setUI(new PolyDesignUI());
+ }
+
+
+ public void setResolution(int resolution) {
+ this.resolution = resolution;
}
+ public int getResolution() {
+ return this.resolution;
+ }
+
+
public PolyDesigner getPolyDesigner() {
return polyDesigner;
}
diff --git a/designer/src/com/fr/poly/PolyDesignUI.java b/designer/src/com/fr/poly/PolyDesignUI.java
index e46a24310a..0eaf7c139e 100644
--- a/designer/src/com/fr/poly/PolyDesignUI.java
+++ b/designer/src/com/fr/poly/PolyDesignUI.java
@@ -10,6 +10,7 @@ import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
import java.util.ArrayList;
@@ -27,12 +28,14 @@ import com.fr.general.Inter;
import com.fr.page.PaperSettingProvider;
import com.fr.page.ReportSettingsProvider;
import com.fr.poly.creator.BlockCreator;
+import com.fr.poly.creator.ECBlockCreator;
import com.fr.poly.model.AddedData;
import com.fr.poly.model.AddingData;
import com.fr.report.report.Report;
import com.fr.report.report.TemplateReport;
import com.fr.report.stable.ReportConstants;
import com.fr.stable.Constants;
+import com.fr.stable.CoreGraphHelper;
import com.fr.stable.unit.UNIT;
/**
@@ -44,13 +47,17 @@ public class PolyDesignUI extends ComponentUI {
private static final double SCROLL_POINT = 50;
private static final int SCROLL_DISTANCE = 15;
-
+ private static final int TEN = 10;
+ private static final int HHUNDRED = 100;
private PolyDesigner designer;
- private int resolution = ScreenResolution.getScreenResolution();
- private int ten = 10;
- private int hundred = 100;
+ private int resolution;
+ private float time;
- public PolyDesignUI() {
+ public PolyDesignUI(int resolution) {
+ if (resolution == 0){
+ resolution = ScreenResolution.getScreenResolution();
+ }
+ this.resolution = resolution;
}
/**
@@ -83,6 +90,8 @@ public class PolyDesignUI extends ComponentUI {
@Override
public void paint(Graphics g, JComponent c) {
+ this.resolution = ((PolyArea)c).getResolution();
+ this.time = (float)resolution/ScreenResolution.getScreenResolution();
paintBackground(g, c);
Graphics2D g2d = (Graphics2D) g;
paintAddedData(g2d);
@@ -100,20 +109,20 @@ public class PolyDesignUI extends ComponentUI {
BlockCreator creator = addedData.getAddedAt(i);
// richer:如果当前这个组件正在编辑,那么他是完全被他的编辑器所遮挡的,不需要画出来
if (creator == designer.getSelection()) {
- paintPositionLine(g, creator.getX(), creator.getY(), designer.getHorizontalValue(), designer
- .getVerticalValue());
- if (creator.getEditor().isDragging()) {
- creator.getEditor().paintAbsorptionline(g);
- //如果与其他块重合了, 需要画出提示禁止重叠
- changeForbiddenWindowVisibility(creator);
- //到边缘地带自动滚动
- scrollWhenCreatorAtCorner(creator);
- }else{
- creator.getEditor().hideForbiddenWindow();
- }
+ paintPositionLine(g, creator.getX(time), creator.getY(time),
+ (int) (designer.getHorizontalValue()*time), (int) (designer.getVerticalValue()*time));
+ if (creator.getEditor().isDragging()) {
+ creator.getEditor().paintAbsorptionline(g);
+ //如果与其他块重合了, 需要画出提示禁止重叠
+ changeForbiddenWindowVisibility(creator);
+ //到边缘地带自动滚动
+ scrollWhenCreatorAtCorner(creator);
+ }else{
+ creator.getEditor().hideForbiddenWindow();
+ }
} else {
- paintCreator(g, creator, creator.getX() - designer.getHorizontalValue(), creator.getY() - designer.getVerticalValue(),
- creator.getWidth(), creator.getHeight());
+ paintCreator(g, creator, (int) (creator.getX()*time - designer.getHorizontalValue()*time), (int) (creator.getY()*time - designer.getVerticalValue()*time),
+ (int) (creator.getWidth()*time), (int) (creator.getHeight()*time));
}
}
}
@@ -126,8 +135,8 @@ public class PolyDesignUI extends ComponentUI {
return;
}
- int x = (int) (designer.getAreaLocationX() + pixRec.getCenterX() - designer.getHorizontalValue());
- int y = (int) (designer.getAreaLocationY() + pixRec.getCenterY() - designer.getVerticalValue());
+ int x = (int) (designer.getAreaLocationX() + pixRec.getCenterX()*time - designer.getHorizontalValue());
+ int y = (int) (designer.getAreaLocationY() + pixRec.getCenterY()*time - designer.getVerticalValue());
creator.getEditor().showForbiddenWindow(x, y);
}
@@ -183,16 +192,16 @@ public class PolyDesignUI extends ComponentUI {
private String convertUnit(int i) {
short unit = designer.getRulerLengthUnit();
- int resolution = ScreenResolution.getScreenResolution();
+// int resolution = ScreenResolution.getScreenResolution();
if (unit == Constants.UNIT_MM) {
Double j = (i + 2) * 1.0 * Constants.HUNDRED_FU_PER_INCH / Constants.HUNDRED_FU_PER_MM / resolution;
return j.intValue() + Inter.getLocText("Unit_MM");
} else if (unit == Constants.UNIT_CM) {
Double j = (i + 2) * 1.0 * Constants.HUNDRED_FU_PER_INCH / Constants.HUNDRED_FU_PER_MM / resolution;
- return new DecimalFormat("0.0").format(j.intValue() * 1.0 / ten) + Inter.getLocText("Unit_CM");
+ return new DecimalFormat("0.0").format(j.intValue() * 1.0 / TEN) + Inter.getLocText("Unit_CM");
} else if (unit == Constants.UNIT_INCH) {
- Double j = i == 0 ? 0 : (i + 2) * 1.0 / resolution * hundred;
- return new DecimalFormat("0.00").format(j.intValue() * 1.0 / hundred) + Inter.getLocText("Unit_INCH");
+ Double j = i == 0 ? 0 : (i + 2) * 1.0 / resolution * HHUNDRED;
+ return new DecimalFormat("0.00").format(j.intValue() * 1.0 / HHUNDRED) + Inter.getLocText("Unit_INCH");
} else if (unit == Constants.UNIT_PT) {
int j = i == 0 ? 0 : (i + 2) * UNIT.PT_PER_INCH / resolution;
return j + Inter.getLocText("Unit_PT");
@@ -203,10 +212,10 @@ public class PolyDesignUI extends ComponentUI {
private void paintAddingData(Graphics g, AddingData addingData) {
BlockCreator comp = addingData.getCreator();
- int x = addingData.getCurrentX();
- int y = addingData.getCurrentY();
- int width = comp.getWidth();
- int height = comp.getHeight();
+ int x = (int) (addingData.getCurrentX()*time);
+ int y = (int) (addingData.getCurrentY()*time);
+ int width = (int) (comp.getWidth()*time);
+ int height = (int) (comp.getHeight()*time);
paintCreator(g, comp, x, y, width, height);
}
@@ -214,9 +223,16 @@ public class PolyDesignUI extends ComponentUI {
ArrayList dbcomponents = new ArrayList();
// richer:禁止双缓冲行为,否则会出现两个图像
ComponentUtils.disableBuffer(comp, dbcomponents);
- Graphics clipg = g.create(x, y, width, height);
- comp.paint(clipg);
- clipg.dispose();
+// Graphics clipg = g.create(x, y, width*resolution/ScreenResolution.getScreenResolution(), height*resolution/ScreenResolution.getScreenResolution());
+//
+ BufferedImage img = CoreGraphHelper.createBufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_RGB);
+ Graphics2D g2d = img.createGraphics();
+ comp.printAll(g2d);
+ g2d.dispose();
+ g.drawImage(img,x,y,width,height,null);
+
+// comp.paint(clipg);
+// clipg.dispose();
ComponentUtils.resetBuffer(dbcomponents);
}
diff --git a/designer/src/com/fr/poly/PolyDesigner.java b/designer/src/com/fr/poly/PolyDesigner.java
index 66cdcecb78..088ef95e0e 100644
--- a/designer/src/com/fr/poly/PolyDesigner.java
+++ b/designer/src/com/fr/poly/PolyDesigner.java
@@ -3,25 +3,6 @@
*/
package com.fr.poly;
-import java.awt.AWTEvent;
-import java.awt.Adjustable;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.Point;
-import java.awt.event.ActionEvent;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.ActionMap;
-import javax.swing.InputMap;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JScrollBar;
-import javax.swing.KeyStroke;
-
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
@@ -36,16 +17,7 @@ import com.fr.design.designer.EditingState;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.layout.FRGUIPaneFactory;
-import com.fr.design.mainframe.AuthorityEditPane;
-import com.fr.design.mainframe.CellElementPropertyPane;
-import com.fr.design.mainframe.DesignerContext;
-import com.fr.design.mainframe.EastRegionContainerPane;
-import com.fr.design.mainframe.ElementCasePane;
-import com.fr.design.mainframe.ElementCasePaneAuthorityEditPane;
-import com.fr.design.mainframe.FormScrollBar;
-import com.fr.design.mainframe.JTemplate;
-import com.fr.design.mainframe.NoSupportAuthorityEdit;
-import com.fr.design.mainframe.ReportComponent;
+import com.fr.design.mainframe.*;
import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
@@ -61,11 +33,7 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.Selection;
import com.fr.poly.actions.DeleteBlockAction;
-import com.fr.poly.creator.BlockCreator;
-import com.fr.poly.creator.BlockEditor;
-import com.fr.poly.creator.ECBlockCreator;
-import com.fr.poly.creator.ECBlockEditor;
-import com.fr.poly.creator.PolyElementCasePane;
+import com.fr.poly.creator.*;
import com.fr.poly.hanlder.DataEditingListener;
import com.fr.poly.hanlder.PolyDesignerDropTarget;
import com.fr.poly.model.AddedData;
@@ -81,6 +49,15 @@ import com.fr.stable.unit.OLDPIX;
import com.fr.stable.unit.UNIT;
import com.fr.stable.unit.UnitRectangle;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author richer
* @since 6.5.3 聚合报表的设计块,不包括底部和右边的滚动条以及左边和上边的像素标识条
@@ -99,6 +76,7 @@ public class PolyDesigner extends ReportComponent clip_board = new ArrayList();
-
// richer:鼠标滚轮每滚动一下,PolyDesignPane的尺寸就改变ROTATIONS这么多
private static final int ROTATIONS = 50;
+ private static final int MIN = 10;
private JScrollBar verScrollBar;
private JScrollBar horScrollBar;
- private JComponent polyArea;
+
private PolyComponetsBar polyComponetsBar = new PolyComponetsBar();
private JComponent[] toolBarComponent = null;
-
- private int resolution = ScreenResolution.getScreenResolution();
+ private JPanel ployareaPane;
+ private JSliderPane jSliderContainer;
+ private int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes);
+ private float time;
+ private boolean isCtrl = false;
public PolyDesigner(PolyWorkSheet report) {
super(report);
setDoubleBuffered(true);
+
// 为了处理键盘事件,需要FormDesigner能够获取焦点
setFocusable(true);
setFocusTraversalKeysEnabled(false);
@@ -131,11 +113,13 @@ public class PolyDesigner extends ReportComponent jt = DesignerContext.getDesignerFrame().getSelectedJTemplate();
- if(jt != null){
- jt.setComposite();
- }
+ if (jt != null) {
+ jt.setComposite();
+ }
DesignerContext.getDesignerFrame().resetToolkitByPlus(DesignerContext.getDesignerFrame().getSelectedJTemplate());
if (BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance());
} else if (isChooseBlock()) {
- EastRegionContainerPane.getInstance().replaceDownPane(PolyBlockProperPane.getInstance(PolyDesigner.this));
+ EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_CHART);
+ EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(PolyBlockProperPane.getInstance(PolyDesigner.this));
} else if (type != SelectionType.NONE) {
- EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());
+ EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_REPORT);
+ EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
} else {
- EastRegionContainerPane.getInstance().replaceDownPane(new JPanel());
+ EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
+// EastRegionContainerPane.getInstance().replaceDownPane(new JPanel());
}
}
}
@@ -873,8 +921,9 @@ public class PolyDesigner extends ReportComponent extends JComponent i
LayoutUtils.layoutContainer(this);
}
+ public void setResolution(int resolution){
+ this.resolution = resolution;
+ }
+
//默认大小, 报表块默认3列6行, 图表块默认330*240
public abstract UnitRectangle getDefaultBlockBounds();
@@ -85,6 +89,11 @@ public abstract class BlockCreator extends JComponent i
public abstract BlockEditor getEditor();
+ public abstract int getX(float time);
+
+ public abstract int getY(float time);
+
+
/**
* 检测按钮状态
diff --git a/designer/src/com/fr/poly/creator/BlockEditor.java b/designer/src/com/fr/poly/creator/BlockEditor.java
index 2e058b0f49..070f3e3a02 100644
--- a/designer/src/com/fr/poly/creator/BlockEditor.java
+++ b/designer/src/com/fr/poly/creator/BlockEditor.java
@@ -50,7 +50,7 @@ public abstract class BlockEditor
public BlockEditor(PolyDesigner designer, BlockCreator creator) {
this.designer = designer;
this.creator = creator;
-
+ this.resolution = creator.resolution;
this.initComponets();
this.addColumnRowListeners();
diff --git a/designer/src/com/fr/poly/creator/ChartBlockCreator.java b/designer/src/com/fr/poly/creator/ChartBlockCreator.java
index ca8106ffae..d713356c60 100644
--- a/designer/src/com/fr/poly/creator/ChartBlockCreator.java
+++ b/designer/src/com/fr/poly/creator/ChartBlockCreator.java
@@ -3,13 +3,15 @@
*/
package com.fr.poly.creator;
-import java.awt.Color;
+import java.awt.*;
+import java.awt.image.BufferedImage;
-import javax.swing.BorderFactory;
-import javax.swing.JComponent;
+import javax.swing.*;
+import com.fr.base.ScreenResolution;
import com.fr.design.DesignState;
import com.fr.design.designer.TargetComponent;
+import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
@@ -34,6 +36,7 @@ public class ChartBlockCreator extends BlockCreator {
private static final UNIT DEFAULT_WIDTH = FU.getInstance(12573000);
private static final UNIT DEFAULT_HEIGHT = FU.getInstance(9144000);
+
public ChartBlockCreator() {
}
@@ -42,6 +45,10 @@ public class ChartBlockCreator extends BlockCreator {
super(block);
}
+ public void setResolution(int resolution){
+ this.resolution = resolution;
+ }
+
/**
* 初始化
* @return 初始化的控件.
@@ -64,6 +71,16 @@ public class ChartBlockCreator extends BlockCreator {
return editor;
}
+ @Override
+ public int getX(float time) {
+ return (int) (this.getX() * time);
+ }
+
+ @Override
+ public int getY(float time) {
+ return (int) (this.getY() * time);
+ }
+
/**
* 检测按钮状态
diff --git a/designer/src/com/fr/poly/creator/ChartBlockEditor.java b/designer/src/com/fr/poly/creator/ChartBlockEditor.java
index 8b0d90542d..8996b58fba 100644
--- a/designer/src/com/fr/poly/creator/ChartBlockEditor.java
+++ b/designer/src/com/fr/poly/creator/ChartBlockEditor.java
@@ -5,6 +5,7 @@ package com.fr.poly.creator;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
+import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartGetter;
@@ -13,6 +14,7 @@ import com.fr.design.border.UIRoundedBorder;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.mainframe.EastRegionContainerPane;
+import com.fr.design.mainframe.JSliderPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.NoSupportAuthorityEdit;
import com.fr.design.mainframe.cell.QuickEditorRegion;
@@ -25,6 +27,7 @@ import com.fr.poly.PolyDesigner.SelectionType;
import com.fr.poly.hanlder.ColumnOperationMouseHandler;
import com.fr.poly.hanlder.RowOperationMouseHandler;
import com.fr.report.poly.PolyChartBlock;
+import com.fr.stable.CoreGraphHelper;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
@@ -32,6 +35,7 @@ import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.awt.image.BufferedImage;
/**
* @author richer
@@ -43,6 +47,7 @@ public class ChartBlockEditor extends BlockEditor {
private ECBlockEditor editor;
+ private static final int CREATOR_WIDTH = 30;
+ private static final int CREATOR_HEIGHT = 19;
+
public ECBlockCreator() {
@@ -64,6 +67,16 @@ public class ECBlockCreator extends BlockCreator {
return editor;
}
+ @Override
+ public int getX(float time) {
+ return (int) ((this.getX() - CREATOR_WIDTH) * time) + CREATOR_WIDTH;
+ }
+
+ @Override
+ public int getY(float time) {
+ return (int) ((this.getY() - CREATOR_HEIGHT) * time) + CREATOR_HEIGHT;
+ }
+
/**
* 检测按钮状态
*
diff --git a/designer/src/com/fr/poly/creator/ECBlockEditor.java b/designer/src/com/fr/poly/creator/ECBlockEditor.java
index 69d5352f38..c464ff1723 100644
--- a/designer/src/com/fr/poly/creator/ECBlockEditor.java
+++ b/designer/src/com/fr/poly/creator/ECBlockEditor.java
@@ -6,6 +6,7 @@ package com.fr.poly.creator;
import java.awt.Dimension;
import com.fr.base.BaseUtils;
+import com.fr.base.ScreenResolution;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
@@ -70,6 +71,10 @@ public class ECBlockEditor extends BlockEditor {
@Override
protected void initSize() {
+ resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
+ if (resolution == 0){
+ resolution = ScreenResolution.getScreenResolution();
+ }
Dimension cornerSize = getCornerSize();
PolyECBlock block = getValue();
UnitRectangle ub = block.getBounds();
@@ -142,6 +147,6 @@ public class ECBlockEditor extends BlockEditor {
}
QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor());
CellElementPropertyPane.getInstance().populate(editComponent);
- EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());
+ EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
}
}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/DesignerEnvManager.java b/designer_base/src/com/fr/design/DesignerEnvManager.java
index 2dd6bef373..d02d41abf4 100644
--- a/designer_base/src/com/fr/design/DesignerEnvManager.java
+++ b/designer_base/src/com/fr/design/DesignerEnvManager.java
@@ -3,7 +3,10 @@
*/
package com.fr.design;
-import com.fr.base.*;
+import com.fr.base.BaseXMLUtils;
+import com.fr.base.Env;
+import com.fr.base.FRContext;
+import com.fr.base.Utils;
import com.fr.dav.LocalEnv;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants;
@@ -18,7 +21,6 @@ import com.fr.stable.xml.*;
import javax.swing.*;
import javax.swing.SwingWorker.StateValue;
-
import java.awt.*;
import java.io.*;
import java.util.*;
@@ -26,7 +28,7 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
-import java.util.logging.Level;
+import org.apache.log4j.Level;
/**
* The manager of Designer GUI.
@@ -150,17 +152,19 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
designerEnvManager.setCurEnvName(name);
}
}
+
+ GeneralContext.addEnvChangedListener(new EnvChangedListener() {
+ @Override
+ public void envChanged() {
+
+ designerEnvManager.setCurrentDirectoryPrefix(FILEFactory.ENV_PREFIX);
+ designerEnvManager.setDialogCurrentDirectory(ProjectConstants.REPORTLETS_NAME);
+ }
+ });
+
}
- GeneralContext.addEnvChangedListener(new EnvChangedListener() {
- @Override
- public void envChanged() {
-
- designerEnvManager.setCurrentDirectoryPrefix(FILEFactory.ENV_PREFIX);
- designerEnvManager.setDialogCurrentDirectory(ProjectConstants.REPORTLETS_NAME);
- }
- });
-
+
return designerEnvManager;
}
@@ -1798,8 +1802,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (env == null) {
return;
}
-
- writer.startTAG("Env").attr("class", env.getClass().getName()).attr("name", name);
+
+ writer.startTAG("Env");
+ writer.classAttr(env.getClass());
+ writer.attr("name", name);
env.writeXML(writer);
diff --git a/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java b/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java
index 4a79a2d986..4d73692054 100644
--- a/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java
+++ b/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java
@@ -1 +1 @@
-package com.fr.design.actions;
import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.*;
/**
* Author : daisy
* Date: 13-8-30
* Time: 上午10:12
*/
public class AllowAuthorityEditAction extends TemplateComponentAction {
public AllowAuthorityEditAction(TargetComponent t) {
super(t);
this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png"));
}
/**
* 撤销
*/
public void prepare4Undo() {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState();
}
/**
* 执行动作
*
* @return 是否执行成功
*/
public boolean executeActionReturnUndoRecordNeeded() {
TargetComponent tc = getEditingComponent();
if (tc == null) {
return false;
}
cleanAuthorityCondition();
//进入时是格式刷则取消格式刷
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) {
tc.cancelFormat();
}
BaseUtils.setAuthorityEditing(true);
ReportAndFSManagePane.getInstance().refreshDockingView();
RolesAlreadyEditedPane.getInstance().refreshDockingView();
WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance());
DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY);
DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus());
DesignerContext.getDesignerFrame().needToAddAuhtorityPaint();
EastRegionContainerPane.getInstance().replaceUpPane(tc.getEastUpPane());
DesignerContext.getDesignerFrame().refreshDottedLine();
EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance());
EastRegionContainerPane.getInstance().removeParameterPane();
//画虚线
return true;
}
/**
* 进入权限编辑之前将权限编辑界面重置一下工具栏
*/
private void cleanAuthorityCondition() {
java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList();
for (int i = 0; i < opendedTemplate.size(); i++) {
opendedTemplate.get(i).cleanAuthorityUndo();
}
}
}
\ No newline at end of file
+package com.fr.design.actions;
import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.*;
/**
* Author : daisy
* Date: 13-8-30
* Time: 上午10:12
*/
public class AllowAuthorityEditAction extends TemplateComponentAction {
public AllowAuthorityEditAction(TargetComponent t) {
super(t);
this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png"));
}
/**
* 撤销
*/
public void prepare4Undo() {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState();
}
/**
* 执行动作
*
* @return 是否执行成功
*/
public boolean executeActionReturnUndoRecordNeeded() {
TargetComponent tc = getEditingComponent();
if (tc == null) {
return false;
}
cleanAuthorityCondition();
//进入时是格式刷则取消格式刷
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) {
tc.cancelFormat();
}
BaseUtils.setAuthorityEditing(true);
ReportAndFSManagePane.getInstance().refreshDockingView();
RolesAlreadyEditedPane.getInstance().refreshDockingView();
WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance());
DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY);
DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus());
DesignerContext.getDesignerFrame().needToAddAuhtorityPaint();
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(tc.getEastUpPane());
DesignerContext.getDesignerFrame().refreshDottedLine();
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
EastRegionContainerPane.getInstance().removeParameterPane();
//画虚线
return true;
}
/**
* 进入权限编辑之前将权限编辑界面重置一下工具栏
*/
private void cleanAuthorityCondition() {
java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList();
for (int i = 0; i < opendedTemplate.size(); i++) {
opendedTemplate.get(i).cleanAuthorityUndo();
}
}
}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/extra/LoginWebBridge.java b/designer_base/src/com/fr/design/extra/LoginWebBridge.java
index 079a393e5d..549cb17632 100644
--- a/designer_base/src/com/fr/design/extra/LoginWebBridge.java
+++ b/designer_base/src/com/fr/design/extra/LoginWebBridge.java
@@ -327,6 +327,7 @@ public class LoginWebBridge {
DesignerEnvManager.getEnvManager().setBBSName(username);
DesignerEnvManager.getEnvManager().setBbsUid(uid);
DesignerEnvManager.getEnvManager().setInShowBBsName(username);
+ BBSPluginLogin.getInstance().login(new BBSUserInfo(username, ""));
} else if (status.equals(LOGIN_FAILED)) {
//账号没有QQ授权
closeQQWindow();
diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java
index a2a30c7483..7f64bcec46 100644
--- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java
+++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java
@@ -509,6 +509,13 @@ public class PluginWebBridge {
LoginWebBridge.getHelper().showQQ();
}
+ //通过QQ登录后通知登录
+ public void ucsynLogin(long uid, String username){
+ BBSUserInfo bbsUserInfo = new BBSUserInfo(username, "");
+ BBSPluginLogin.getInstance().login(bbsUserInfo);
+ uiLabel.setText(username);
+ }
+
/**
* 清除用户信息
*/
diff --git a/designer_base/src/com/fr/design/extra/WebViewDlgHelper.java b/designer_base/src/com/fr/design/extra/WebViewDlgHelper.java
index 3af2b5d439..84ecb10c38 100644
--- a/designer_base/src/com/fr/design/extra/WebViewDlgHelper.java
+++ b/designer_base/src/com/fr/design/extra/WebViewDlgHelper.java
@@ -80,21 +80,29 @@ public class WebViewDlgHelper {
public static void checkAndCopyMainFile(String indexPath, String mainJsPath){
File file = new File(indexPath);
if (!file.exists()) {
- try {
- File mainJsFile = new File(mainJsPath);
- int byteread = 0;
- if (mainJsFile.exists()) {
- InputStream inStream = new FileInputStream(mainJsPath);
- FileOutputStream fs = new FileOutputStream(indexPath);
- byte[] buffer = new byte[BYTES_NUM];
- while ((byteread = inStream.read(buffer)) != -1) {
- fs.write(buffer, 0, byteread);
- }
- inStream.close();
+ copyMainFile(indexPath, mainJsPath);
+ }
+ }
+
+ /**
+ * 將script文件夹中的index.html文件复制到webreport下
+ *
+ */
+ public static void copyMainFile(String indexPath, String mainJsPath){
+ try {
+ File mainJsFile = new File(mainJsPath);
+ int byteread = 0;
+ if (mainJsFile.exists()) {
+ InputStream inStream = new FileInputStream(mainJsPath);
+ FileOutputStream fs = new FileOutputStream(indexPath);
+ byte[] buffer = new byte[BYTES_NUM];
+ while ((byteread = inStream.read(buffer)) != -1) {
+ fs.write(buffer, 0, byteread);
}
- } catch (Exception e) {
- FRContext.getLogger().error(e.getMessage());
+ inStream.close();
}
+ } catch (Exception e) {
+ FRContext.getLogger().error(e.getMessage());
}
}
@@ -186,7 +194,9 @@ public class WebViewDlgHelper {
try {
if (get()) {
+ String relativePath = "/scripts/store/web/index.html";
IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome);
+ copyMainFile(StableUtils.pathJoin(installHome, "index.html"), StableUtils.pathJoin(installHome, relativePath));
// TODO: 2017/4/17 删除之前存放在安装目录下的script
int rv = JOptionPane.showOptionDialog(
null,
diff --git a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java
new file mode 100644
index 0000000000..b136d4b77a
--- /dev/null
+++ b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java
@@ -0,0 +1,111 @@
+package com.fr.design.foldablepane;
+
+import com.fr.design.constants.UIConstants;
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import javax.swing.JPanel;
+
+/**
+ * Created by MoMeak on 2017/7/5.
+ */
+public class HeaderPane extends JPanel {
+ private static final long serialVersionUID = 1L;
+ private int headWidth = 280;
+ private int headHeight = 25;
+ private Color bgColor;
+ private boolean isShow;
+ private String title;
+ private Image image;
+ private int fontSize = 13;
+ public void setShow(boolean isShow) {
+ this.isShow = isShow;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ public void setHeadWidth(int headwidth){
+ this.headWidth = headwidth;
+ }
+
+ public void setheadHeight(int headHeight){
+ this.headHeight = headHeight;
+ }
+
+ public void setFontSize(int fontSize){
+ this.fontSize = fontSize;
+ }
+
+
+ @Override
+ protected void paintComponent(Graphics g) {
+ Graphics2D g2d = (Graphics2D) g.create();
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ BufferedImage panelImage = createPanelImage();
+ g2d.drawImage(panelImage, null, 0, 0);
+ }
+
+ private BufferedImage createPanelImage() {
+ BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB);
+ Graphics2D g2d = panelImage.createGraphics();
+
+ g2d.fillRect(0, 0, headWidth, headHeight);
+ g2d.drawImage(UIConstants.DRAG_BAR, 0, 0, headWidth, headHeight, null);
+ g2d.setFont(new Font("SimSun", 0, fontSize));
+ g2d.setPaint(bgColor);
+// g2d.drawString(this.title, fontSize/2, headHeight-fontSize/3);
+ g2d.drawString(this.title, 0, headHeight-fontSize/3);
+ if(this.isShow)
+ {
+ image = UIConstants.DRAG_DOWN_PRESS;
+ g2d.drawImage(image, title.length() * fontSize, headHeight/2-1, null);
+ }
+ else
+ {
+ image = UIConstants.DRAG_RIGHT_PRESS;
+ g2d.drawImage(image, title.length() * fontSize, headHeight/3, null);
+ }
+
+
+ return panelImage;
+ }
+
+ @Override
+ public Dimension getPreferredSize() {
+ return new Dimension(this.getWidth(), headHeight);
+ }
+
+ @Override
+ public Dimension getSize() {
+ return new Dimension(this.getWidth(), headHeight);
+ }
+
+ public HeaderPane(Color bgColor) {
+ this.bgColor = bgColor;
+ this.isShow = true;
+
+ }
+
+ public HeaderPane(Color bgColor, String title , int headWidth, int headHeight) {
+ this(bgColor);
+ this.title = title;
+ this.headHeight = headHeight;
+ this.headWidth = headWidth;
+ }
+
+ public static void main(String[] args)
+ {
+// JFrame mainFrame = new JFrame("UI Demo - Gloomyfish");
+// mainFrame.getContentPane().setLayout(new BorderLayout());
+// mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本",280,25), BorderLayout.CENTER);
+// mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+// mainFrame.pack();
+// mainFrame.setSize(280, 400);
+// mainFrame.setVisible(true);
+ }
+
+}
diff --git a/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java b/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java
new file mode 100644
index 0000000000..b6a908d333
--- /dev/null
+++ b/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java
@@ -0,0 +1,95 @@
+package com.fr.design.foldablepane;
+
+import java.awt.*;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.*;
+
+
+/**
+ * Created by MoMeak on 2017/7/5.
+ */
+public class UIExpandablePane extends JPanel {
+ private static final long serialVersionUID = 1L;
+ private HeaderPane headerPanel;
+ private JPanel contentPanel;
+ private Color color = Color.black;
+ private String title;
+ private int headWidth;
+ private int headHeight;
+
+
+ public UIExpandablePane(String title,int headWidth,int headHeight,JPanel contentPanel)
+ {
+ super();
+ this.title = title;
+ this.headWidth = headWidth;
+ this.headHeight = headHeight;
+ this.contentPanel = contentPanel;
+ initComponents();
+ }
+
+ private void initComponents() {
+ this.setLayout(new BorderLayout());
+
+ headerPanel = new HeaderPane(color, title,headWidth,headHeight);
+ headerPanel.addMouseListener(new PanelAction());
+ this.add(headerPanel, BorderLayout.NORTH);
+ this.add(contentPanel, BorderLayout.CENTER);
+ setOpaque(false);
+ }
+
+ class PanelAction extends MouseAdapter
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ HeaderPane hp = (HeaderPane)e.getSource();
+ if(contentPanel.isShowing())
+ {
+ contentPanel.setVisible(false);
+ hp.setShow(false);
+ }
+ else
+ {
+ contentPanel.setVisible(true);
+ hp.setShow(true);
+ }
+ hp.getParent().validate();
+ hp.getParent().repaint();
+ }
+ }
+
+
+ public static void main(String[] args)
+ {
+// JFrame jf = new JFrame("test");
+// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+// JPanel content = (JPanel) jf.getContentPane();
+// content.setLayout(new BorderLayout());
+//
+// JPanel myPanel = new JPanel();
+// myPanel.setLayout(new BorderLayout());
+// JPanel Panel = new JPanel();
+// Panel.setBackground(Color.blue);
+// myPanel.add(new UIExpandablePane("基本",280,25,Panel),BorderLayout.CENTER);
+//// myPanel.setLayout(new GridBagLayout());
+//// myPanel.add(new JExpandablePanel());
+//// GridBagConstraints gbc = new GridBagConstraints();
+//// JPanel[] panels = new JPanel[4]; //
+//// gbc.insets = new Insets(1,3,0,3);
+//// gbc.weightx = 1.0;
+//// gbc.fill = GridBagConstraints.HORIZONTAL;
+//// gbc.gridwidth = GridBagConstraints.REMAINDER;
+//// for(int j = 0; j < panels.length; j++)
+//// {
+//// panels[j] = new JExpandablePanel();
+//// myPanel.add(panels[j], gbc);
+//// }
+// content.add(myPanel, BorderLayout.CENTER);
+// GUICoreUtils.centerWindow(jf);
+// jf.setSize(280, 400);
+// jf.setVisible(true);
+ }
+
+}
diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
new file mode 100644
index 0000000000..8878cd43a8
--- /dev/null
+++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
@@ -0,0 +1,286 @@
+package com.fr.design.gui.controlpane;
+
+import com.fr.design.dialog.BasicPane;
+import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.gui.itoolbar.UIToolbar;
+import com.fr.design.layout.FRGUIPaneFactory;
+import com.fr.design.layout.TableLayout;
+import com.fr.design.layout.TableLayoutHelper;
+import com.fr.design.mainframe.EastRegionContainerPane;
+import com.fr.design.menu.ShortCut;
+import com.fr.design.menu.ToolBarDef;
+import com.fr.design.utils.gui.GUICoreUtils;
+import com.fr.general.Inter;
+import com.fr.stable.ArrayUtils;
+import com.fr.stable.Nameable;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * Created by plough on 2017/7/21.
+ */
+public abstract class UIControlPane extends BasicPane implements UnrepeatedNameHelper {
+ protected static final int SHORT_WIDTH = 30; //每加一个short Divider位置加30
+ protected JPanel controlUpdatePane;
+
+ private ShortCut4JControlPane[] shorts;
+ private NameableCreator[] creators;
+ private ToolBarDef toolbarDef;
+
+ private UIToolbar toolBar;
+ protected PopupEditPane popupEditPane;
+ // peter:这是整体的一个cardLayout Pane
+ protected CardLayout cardLayout;
+
+ protected JPanel cardPane;
+
+ public UIControlPane() {
+ this.initComponentPane();
+ }
+
+ /**
+ * 生成添加按钮的NameableCreator
+ *
+ * @return 按钮的NameableCreator
+ */
+ public abstract NameableCreator[] createNameableCreators();
+
+ public ShortCut4JControlPane[] getShorts() {
+ return shorts;
+ }
+
+ public void setShorts(ShortCut4JControlPane[] shorts) {
+ this.shorts = shorts;
+ }
+
+ public void setCreators(NameableCreator[] creators) {
+ this.creators = creators;
+ }
+
+ public ToolBarDef getToolbarDef() {
+ return toolbarDef;
+ }
+
+ public void setToolbarDef(ToolBarDef toolbarDef) {
+ this.toolbarDef = toolbarDef;
+ }
+
+ public UIToolbar getToolBar() {
+ return toolBar;
+ }
+
+ public void setToolBar(UIToolbar toolBar) {
+ this.toolBar = toolBar;
+ }
+
+ public CardLayout getCardLayout() {
+ return cardLayout;
+ }
+
+ public void setCardLayout(CardLayout cardLayout) {
+ this.cardLayout = cardLayout;
+ }
+
+ public JPanel getCardPane() {
+ return cardPane;
+ }
+
+ public void setCardPane(JPanel cardPane) {
+ this.cardPane = cardPane;
+ }
+
+ protected void initComponentPane() {
+ this.setLayout(FRGUIPaneFactory.createBorderLayout());
+ this.creators = this.createNameableCreators();
+ this.controlUpdatePane = createControlUpdatePane();
+
+ // p: edit card layout
+ this.cardLayout = new CardLayout();
+ cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
+ cardPane.setLayout(this.cardLayout);
+ // p:选择的Label
+ UILabel selectLabel = new UILabel();
+ cardPane.add(selectLabel, "SELECT");
+ cardPane.add(controlUpdatePane, "EDIT");
+ popupEditPane = new PopupEditPane(cardPane);
+ // SplitPane
+// JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane);
+// mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
+// mainSplitPane.setOneTouchExpandable(true);
+
+ this.add(getLeftPane(), BorderLayout.CENTER);
+ this.setBorder(BorderFactory.createEmptyBorder(0, 10, 12, 10));
+// mainSplitPane.setDividerLocation(getLeftPreferredSize());
+ this.checkButtonEnabled();
+ }
+
+ protected abstract JPanel createControlUpdatePane();
+
+ protected JPanel getLeftPane() {
+ // LeftPane
+ JPanel leftPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
+
+ JPanel leftContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
+ initLeftPane(leftContentPane);
+ leftPane.add(leftContentPane, BorderLayout.CENTER);
+
+ shorts = this.createShortcuts();
+ if (ArrayUtils.isEmpty(shorts)) {
+ return leftPane;
+ }
+
+ toolbarDef = new ToolBarDef();
+ for (ShortCut4JControlPane sj : shorts) {
+ toolbarDef.addShortCut(sj.getShortCut());
+ }
+ toolBar = ToolBarDef.createJToolBar();
+// toolBar.setLayout(new FlowLayout(FlowLayout.LEFT));
+ toolbarDef.updateToolBar(toolBar);
+ // 封装一层,加边框
+ JPanel toolBarPane = new JPanel(new BorderLayout());
+ toolBarPane.add(toolBar, BorderLayout.CENTER);
+ toolBarPane.setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, new Color(201, 198, 184)));
+ leftContentPane.add(toolBarPane, BorderLayout.NORTH);
+// leftContentPane.setBorder(BorderFactory.createLineBorder(new Color(201, 198, 184)));
+
+ // 顶部标签及add按钮
+ UIToolbar topToolBar = new UIToolbar();
+ topToolBar.setLayout(new BorderLayout());
+ ShortCut addItem = addItemShortCut().getShortCut();
+ addItem.intoJToolBar(topToolBar);
+ topToolBar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
+ double p = TableLayout.PREFERRED;
+ double f = TableLayout.FILL;
+ double[] columnSize = { p, f };
+ double[] rowSize = { p};
+ Component[][] components = new Component[][]{
+ new Component[]{new UILabel("add hyperlink "), topToolBar},
+ };
+ JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
+ leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
+ leftPane.add(leftTopPane, BorderLayout.NORTH);
+
+ return leftPane;
+ }
+
+ /**
+ * 初始化左边面板
+ */
+ protected void initLeftPane(JPanel leftPane) {
+
+ }
+
+ protected int getLeftPreferredSize() {
+ return shorts.length * SHORT_WIDTH;
+ }
+
+
+ protected ShortCut4JControlPane[] createShortcuts() {
+ return new ShortCut4JControlPane[]{
+// addItemShortCut(),
+ copyItemShortCut(),
+ moveUpItemShortCut(),
+ moveDownItemShortCut(),
+ sortItemShortCut(),
+ removeItemShortCut()
+ };
+ }
+
+ protected abstract ShortCut4JControlPane addItemShortCut();
+
+ protected abstract ShortCut4JControlPane removeItemShortCut();
+
+ protected abstract ShortCut4JControlPane copyItemShortCut();
+
+ protected abstract ShortCut4JControlPane moveUpItemShortCut();
+
+ protected abstract ShortCut4JControlPane moveDownItemShortCut();
+
+ protected abstract ShortCut4JControlPane sortItemShortCut();
+
+ public abstract Nameable[] update();
+
+
+ public void populate(Nameable[] nameableArray) {
+ }
+
+ /**
+ * 检查按钮可用状态 Check button enabled.
+ */
+ public void checkButtonEnabled() {
+ }
+
+ protected void doBeforeRemove() {
+ }
+
+ protected void doAfterRemove() {
+ }
+
+ public NameableCreator[] creators() {
+ return creators == null ? new NameableCreator[0] : creators;
+ }
+
+ protected abstract boolean hasInvalid(boolean isAdd);
+
+ /**
+ * 刷新 NameableCreator
+ *
+ * @param creators 生成器
+ */
+ public void refreshNameableCreator(NameableCreator[] creators) {
+ this.creators = creators;
+ shorts = this.createShortcuts();
+ toolbarDef.clearShortCuts();
+ for (ShortCut4JControlPane sj : shorts) {
+ toolbarDef.addShortCut(sj.getShortCut());
+ }
+
+ toolbarDef.updateToolBar(toolBar);
+ toolBar.validate();
+ toolBar.repaint();
+ this.repaint();
+ }
+
+ // 点击"编辑"按钮,弹出面板
+ protected class PopupEditPane extends JPopupMenu {
+ private JComponent contentPane;
+ private static final int WIDTH = 460;
+ private static final int HEIGHT = 500;
+ // private PopupToolPane popupToolPane;
+// private int fixedHeight;
+
+ PopupEditPane(JComponent pane) {
+ contentPane = pane;
+ this.setLayout(new BorderLayout());
+ this.add(contentPane, BorderLayout.CENTER);
+ this.setOpaque(false);
+ contentPane.setPreferredSize(new Dimension(WIDTH, HEIGHT));
+// fixedHeight = getPreferredSize().height - contentPane.getPreferredSize().height;
+// updateSize();
+ }
+
+// private void updateSize() {
+// int newHeight = fixedHeight + contentPane.getPreferredSize().height;
+// this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight));
+// }
+
+ public JComponent getContentPane() {
+ return contentPane;
+ }
+
+ public void replaceContentPane(JComponent pane) {
+// remove(pane);
+ this.remove(this.contentPane);
+ this.add(this.contentPane = pane);
+// updateSize();
+ refreshContainer();
+ }
+
+ private void refreshContainer() {
+ validate();
+ repaint();
+ revalidate();
+ }
+ }
+}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java
new file mode 100644
index 0000000000..c082f66983
--- /dev/null
+++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java
@@ -0,0 +1,974 @@
+package com.fr.design.gui.controlpane;
+
+import com.fr.base.BaseUtils;
+import com.fr.base.FRContext;
+import com.fr.design.actions.UpdateAction;
+import com.fr.design.beans.BasicBeanPane;
+import com.fr.design.data.tabledata.tabledatapane.GlobalMultiTDTableDataPane;
+import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane;
+import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane;
+import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane;
+import com.fr.design.file.HistoryTemplateListPane;
+import com.fr.design.gui.ibutton.UIButton;
+import com.fr.design.gui.icontainer.UIScrollPane;
+import com.fr.design.gui.ilist.UINameEdList;
+import com.fr.design.gui.ilist.ListModelElement;
+import com.fr.design.gui.ilist.ModNameActionListener;
+import com.fr.design.layout.FRGUIPaneFactory;
+import com.fr.design.mainframe.JTemplate;
+import com.fr.design.menu.LineSeparator;
+import com.fr.design.menu.MenuDef;
+import com.fr.design.menu.ShortCut;
+import com.fr.design.menu.ToolBarDef;
+import com.fr.design.utils.gui.GUICoreUtils;
+import com.fr.general.ComparatorUtils;
+import com.fr.general.Inter;
+import com.fr.stable.ArrayUtils;
+import com.fr.stable.Nameable;
+import com.fr.stable.core.PropertyChangeAdapter;
+import sun.swing.DefaultLookup;
+
+import javax.swing.*;
+import javax.swing.border.Border;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.Comparator;
+
+/**
+ * Created by plough on 2017/7/19.
+ */
+
+public abstract class UIListControlPane extends UIControlPane {
+ public static final String LIST_NAME = "UIControl_List";
+ private static final int EDIT_RANGE = 25; // 编辑按钮的x坐标范围
+
+ protected UINameEdList nameableList;
+ protected int editingIndex;
+ protected String selectedName;
+ private boolean isNameRepeated = false;
+
+ public UIListControlPane() {
+ this.initComponentPane();
+ }
+
+ @Override
+ protected JPanel createControlUpdatePane() {
+ return new JControlUpdatePane();
+ }
+
+ /**
+ * 生成添加按钮的NameableCreator
+ *
+ * @return 按钮的NameableCreator
+ */
+ @Override
+ public abstract NameableCreator[] createNameableCreators();
+
+
+ @Override
+ protected void initLeftPane(JPanel leftPane) {
+ nameableList = createJNameList();
+ nameableList.setName(LIST_NAME);
+ leftPane.add(new UIScrollPane(nameableList), BorderLayout.CENTER);
+
+
+ nameableList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+ nameableList.addMouseListener(listMouseListener);
+ nameableList.addListSelectionListener(new ListSelectionListener() {
+ public void valueChanged(ListSelectionEvent evt) {
+ // richie:避免多次update和populate大大降低效率
+ if (!evt.getValueIsAdjusting()) {
+ // shoc 切换的时候加检验
+ if (hasInvalid(false)) {
+ return;
+ }
+ ((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).update();
+ ((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).populate();
+ UIListControlPane.this.checkButtonEnabled();
+ }
+ }
+ });
+ }
+
+ public UINameEdList createJNameList() {
+ UINameEdList nameEdList = new UINameEdList(new DefaultListModel()) {
+ @Override
+ protected void doAfterLostFocus() {
+ UIListControlPane.this.updateControlUpdatePane();
+ }
+ };
+ nameEdList.setCellRenderer(new UINameableListCellRenderer(this));
+ return nameEdList;
+ }
+
+ public void updateControlUpdatePane() {
+ ((JControlUpdatePane) controlUpdatePane).update();
+ }
+
+ protected void doWhenPopulate(BasicBeanPane beanPane) {
+
+ }
+
+ protected void doBeforePopulate(ListModelElement el, Object obj) {
+
+ }
+
+ @Override
+ protected ShortCut4JControlPane addItemShortCut() {
+ ShortCut addItemShortCut;
+ NameableCreator[] creators = creators();
+ if (creators.length == 1) {
+ addItemShortCut = new AddItemUpdateAction(creators);
+ } else {
+ addItemShortCut = new AddItemMenuDef(creators);
+ }
+ return new AbsoluteEnableShortCut(addItemShortCut);
+ }
+
+ @Override
+ protected ShortCut4JControlPane removeItemShortCut() {
+ return new NormalEnableShortCut(new RemoveItemAction());
+ }
+
+ @Override
+ protected ShortCut4JControlPane copyItemShortCut() {
+ return new NormalEnableShortCut(new CopyItemAction());
+ }
+
+ @Override
+ protected ShortCut4JControlPane moveUpItemShortCut() {
+ return new NormalEnableShortCut(new MoveUpItemAction());
+ }
+
+ @Override
+ protected ShortCut4JControlPane moveDownItemShortCut() {
+ return new NormalEnableShortCut(new MoveDownItemAction());
+ }
+
+ @Override
+ protected ShortCut4JControlPane sortItemShortCut() {
+ return new NormalEnableShortCut(new SortItemAction());
+ }
+
+ public void setNameListEditable(boolean editable) {
+ this.nameableList.setEditable(editable);
+ }
+
+ @Override
+ public Nameable[] update() {
+ java.util.List res = new java.util.ArrayList();
+ ((JControlUpdatePane) this.controlUpdatePane).update();
+ DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
+ for (int i = 0, len = listModel.getSize(); i < len; i++) {
+ res.add(((ListModelElement) listModel.getElementAt(i)).wrapper);
+ }
+
+ return res.toArray(new Nameable[res.size()]);
+ }
+
+ @Override
+ public void populate(Nameable[] nameableArray) {
+ DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
+ listModel.removeAllElements();
+ if (ArrayUtils.isEmpty(nameableArray)) {
+ return;
+ }
+
+ for (Nameable aNameableArray : nameableArray) {
+ listModel.addElement(new ListModelElement(aNameableArray));
+ }
+
+ if (listModel.size() > 0) {
+ this.nameableList.setSelectedIndex(0);
+ }
+ this.checkButtonEnabled();
+ }
+
+ /**
+ * 添加名字改变时的listener
+ *
+ * @param l 名字改变时的监听
+ */
+ public void addModNameActionListener(ModNameActionListener l) {
+ this.nameableList.addModNameActionListener(l);
+ }
+
+ /**
+ * 添加Editinglistener
+ *
+ * @param l 监听
+ */
+ public void addEditingListner(PropertyChangeAdapter l) {
+ this.nameableList.addEditingListner(l);
+ }
+
+ /*
+ * 刷新当前的选中的UpdatePane
+ */
+ protected void populateSelectedValue() {
+ ((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).populate();
+ }
+
+ /**
+ * 根据name,选中UINameEdList中的item
+ */
+ public void setSelectedName(String name) {
+ DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
+ for (int i = 0, len = listModel.getSize(); i < len; i++) {
+ Nameable item = ((ListModelElement) listModel.getElementAt(i)).wrapper;
+ if (ComparatorUtils.equals(name, item.getName())) {
+ this.nameableList.setSelectedIndex(i);
+ break;
+ }
+ }
+ }
+
+ public String getEditingName() {
+ return this.nameableList.getEditingName();
+ }
+
+ public Object getEditingType() {
+ return this.nameableList.getAllTypes()[editingIndex];
+ }
+
+ public void setWarnigText(int index) {
+ this.nameableList.setWarnigText(index);
+ }
+
+ /**
+ * 获取选中的名字
+ */
+ public String getSelectedName() {
+ ListModelElement el = (ListModelElement) this.nameableList.getSelectedValue();
+
+ return el == null ? null : el.wrapper.getName();
+ }
+
+ protected boolean isNameRepeted(java.util.List[] list, String name) {
+ for (int i = 0; i < list.length; i++) {
+ if (list[i].contains(name)) {
+ isNameRepeated = true;
+ return true;
+ }
+ }
+ isNameRepeated = false;
+ return false;
+ }
+
+ /**
+ * 名字是否重复
+ *
+ * @return 重复则返回true
+ */
+ public boolean isNameRepeated() {
+ return isNameRepeated;
+ }
+
+ /**
+ * 添加 Nameable
+ *
+ * @param nameable 添加的Nameable
+ * @param index 序号
+ */
+ public void addNameable(Nameable nameable, int index) {
+ UINameEdList nameEdList = UIListControlPane.this.nameableList;
+ DefaultListModel model = (DefaultListModel) nameEdList.getModel();
+
+ ListModelElement el = new ListModelElement(nameable);
+ model.add(index, el);
+ nameableList.setSelectedIndex(index);
+ nameableList.ensureIndexIsVisible(index);
+
+ nameEdList.repaint();
+ }
+
+ /**
+ * 是否重命名
+ *
+ * @return 是则true
+ */
+ public boolean isContainsRename() {
+ String rename = Inter.getLocText("FR-Please_Rename") + "!";
+ String[] names = this.nameableList.getAllNames();
+ for (int i = names.length - 1; i >= 0; i--) {
+ if (ComparatorUtils.equals(names[i], rename)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected DefaultListModel getModel() {
+ return (DefaultListModel) UIListControlPane.this.nameableList.getModel();
+ }
+
+ private String createUnrepeatedCopyName(String suffix) {
+ DefaultListModel model = this.getModel();
+ String[] names = new String[model.getSize()];
+ for (int i = 0; i < model.size(); i++) {
+ names[i] = ((ListModelElement) model.get(i)).wrapper.getName();
+ }
+ String lastName = "CopyOf" + suffix;
+ while (ArrayUtils.contains(names, lastName)) {
+ lastName = "CopyOf" + lastName;
+ }
+ return lastName;
+ }
+
+
+ /**
+ * 生成不重复的名字
+ *
+ * @param prefix 名字前缀
+ * @return 名字
+ */
+ @Override
+ public String createUnrepeatedName(String prefix) {
+ DefaultListModel model = this.getModel();
+ Nameable[] all = new Nameable[model.getSize()];
+ for (int i = 0; i < model.size(); i++) {
+ all[i] = ((ListModelElement) model.get(i)).wrapper;
+ }
+ // richer:生成的名字从1开始. kunsnat: 添加属性从0开始.
+ int count = all.length + 1;
+ while (true) {
+ String name_test = prefix + count;
+ boolean repeated = false;
+ for (int i = 0, len = model.size(); i < len; i++) {
+ Nameable nameable = all[i];
+ if (ComparatorUtils.equals(nameable.getName(), name_test)) {
+ repeated = true;
+ break;
+ }
+ }
+
+ if (!repeated) {
+ return name_test;
+ }
+
+ count++;
+ }
+ }
+
+ private void popupEditPane() {
+ if (editingIndex < 0) {
+ return;
+ }
+ GUICoreUtils.showPopupMenu(popupEditPane, this,
+ - popupEditPane.getPreferredSize().width, editingIndex * EDIT_RANGE);
+ }
+
+ /**
+ * 增加项的UpdateAction
+ */
+ protected class AddItemUpdateAction extends UpdateAction {
+ final NameableCreator creator;
+
+ public AddItemUpdateAction(NameableCreator[] creators) {
+ this.creator = creators[0];
+ this.setName(Inter.getLocText("FR-Action_Add"));
+ this.setMnemonic('A');
+ this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Nameable nameable = creator.createNameable(UIListControlPane.this);
+
+ UIListControlPane.this.addNameable(nameable, getModel().getSize());
+ }
+ }
+
+ /*
+ * 增加项的MenuDef
+ */
+ protected class AddItemMenuDef extends MenuDef {
+ public AddItemMenuDef(NameableCreator[] creators) {
+ this.setName(Inter.getLocText("FR-Action_Add"));
+ this.setMnemonic('A');
+ this.setIconPath("/com/fr/design/images/control/addPopup.png");
+ wrapActionListener(creators);
+ }
+
+ /**
+ * 生成UIButton
+ * @return 菜单按钮
+ */
+ public UIButton createUIButton() {
+ createdButton = super.createUIButton();
+ // 此按钮单独抽出,不应使用工具栏外观
+ if (!createdButton.isOpaque()) {
+ createdButton.setOpaque(true);
+ createdButton.setNormalPainted(true);
+ createdButton.setBorderPaintedOnlyWhenPressed(false);
+ }
+ return createdButton;
+ }
+
+ private void wrapActionListener(NameableCreator[] creators) {
+ for (final NameableCreator creator : creators) {
+ if (!whetherAdd(creator.menuName())) {
+ continue;
+ }
+ boolean isTrue = ComparatorUtils.equals(creator.menuName(), Inter.getLocText("Datasource-Stored_Procedure")) ||
+ ComparatorUtils.equals(creator.menuName(), Inter.getLocText("DS-Relation_TableData")) || ComparatorUtils.equals(creator.menuName(), Inter.getLocText("DS-Multi_Dimensional_Database"));
+ if (isTrue) {
+ this.addShortCut(new LineSeparator());
+ }
+ this.addShortCut(new UpdateAction() {
+ {
+ this.setName(creator.menuName());
+ Icon icon = creator.menuIcon();
+ if (icon != null) {
+ this.setSmallIcon(icon);
+ }
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (hasInvalid(true)) {
+ return;
+ }
+
+ Nameable nameable = creator.createNameable(UIListControlPane.this);
+
+ UIListControlPane.this.addNameable(nameable, getModel().getSize());
+ }
+ });
+ }
+ }
+
+ private boolean whetherAdd(String itemName) {
+ JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
+ if (jTemplate == null) {
+ return false;
+ }
+ //先屏蔽掉这个,之后还有别的
+ String[] names = {Inter.getLocText("FR-Hyperlink_Chart_Float")};
+ for (String name : names) {
+ if (!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, name)) {
+ return false;
+ }
+ }
+ String formName = Inter.getLocText("Hyperlink-Form_link");
+ return !(jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, formName));
+ }
+ }
+
+ /*
+ * 移除item
+ */
+ private class RemoveItemAction extends UpdateAction {
+ public RemoveItemAction() {
+ this.setName(Inter.getLocText("FR-Action_Remove"));
+ this.setMnemonic('R');
+ this.setSmallIcon(BaseUtils
+ .readIcon("/com/fr/base/images/cell/control/remove.png"));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent evt) {
+ try {
+ UIListControlPane.this.nameableList.getCellEditor()
+ .stopCellEditing();
+ } catch (Exception ignored) {
+ }
+ // bug:在选中一个NameObject并删除,会遗留下Name.
+ doBeforeRemove();
+ if (GUICoreUtils.removeJListSelectedNodes(SwingUtilities
+ .getWindowAncestor(UIListControlPane.this), nameableList)) {
+ checkButtonEnabled();
+ doAfterRemove();
+ }
+ }
+ }
+
+ /*
+ * CopyItem
+ */
+ private class CopyItemAction extends UpdateAction {
+ public CopyItemAction() {
+ this.setName(Inter.getLocText("FR-Action_Copy"));
+ this.setMnemonic('C');
+ this.setSmallIcon(BaseUtils
+ .readIcon("/com/fr/base/images/cell/control/copy.png"));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent evt) {
+ // p:选中的值.
+ ListModelElement selectedValue = (ListModelElement) nameableList.getSelectedValue();
+ if (selectedValue == null) {
+ return;
+ }
+
+ ((JControlUpdatePane) controlUpdatePane).update();
+
+ Nameable selectedNameable = selectedValue.wrapper;
+
+ // p: 用反射机制实现
+ try {
+ Nameable newNameable = (Nameable) BaseUtils.cloneObject(selectedNameable);
+ newNameable.setName(createUnrepeatedCopyName(selectedNameable.getName()));
+
+ UIListControlPane.this.addNameable(newNameable, nameableList.getSelectedIndex() + 1);
+ } catch (Exception e) {
+ FRContext.getLogger().error(e.getMessage(), e);
+ }
+ }
+ }
+
+ /*
+ * 上移Item
+ */
+ private class MoveUpItemAction extends UpdateAction {
+ public MoveUpItemAction() {
+ this.setName(Inter.getLocText("Utils-Move_Up"));
+ this.setMnemonic('U');
+ this.setSmallIcon(BaseUtils
+ .readIcon("/com/fr/design/images/control/up.png"));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent evt) {
+ int selectedIndex = nameableList.getSelectedIndex();
+ if (selectedIndex == -1) {
+ return;
+ }
+
+ // 上移
+ if (selectedIndex > 0) {
+ DefaultListModel listModel = (DefaultListModel) nameableList
+ .getModel();
+
+ Object selecteObj1 = listModel.get(selectedIndex - 1);
+ listModel.set(selectedIndex - 1, listModel.get(selectedIndex));
+ listModel.set(selectedIndex, selecteObj1);
+
+ nameableList.setSelectedIndex(selectedIndex - 1);
+ nameableList.ensureIndexIsVisible(selectedIndex - 1);
+ }
+ }
+ }
+
+ /*
+ * 下移Item
+ */
+ private class MoveDownItemAction extends UpdateAction {
+ public MoveDownItemAction() {
+ this.setName(Inter.getLocText("Utils-Move_Down"));
+ this.setMnemonic('D');
+ this.setSmallIcon(BaseUtils
+ .readIcon("/com/fr/design/images/control/down.png"));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent evt) {
+ int selectedIndex = nameableList.getSelectedIndex();
+ if (selectedIndex == -1) {
+ return;
+ }
+
+ if (selectedIndex < nameableList.getModel().getSize() - 1) {
+ DefaultListModel listModel = (DefaultListModel) nameableList
+ .getModel();
+
+ Object selecteObj1 = listModel.get(selectedIndex + 1);
+ listModel.set(selectedIndex + 1, listModel.get(selectedIndex));
+ listModel.set(selectedIndex, selecteObj1);
+
+ nameableList.setSelectedIndex(selectedIndex + 1);
+ nameableList.ensureIndexIsVisible(selectedIndex + 1);
+ }
+ }
+ }
+
+ private class SortItemAction extends UpdateAction {
+ private boolean isAtoZ = false;
+
+ public SortItemAction() {
+ this.setName(Inter.getLocText("FR-Action_Sort"));
+ this.setMnemonic('S');
+ this.setSmallIcon(BaseUtils
+ .readIcon("/com/fr/design/images/control/sortAsc.png"));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent evt) {
+ // p:选中的值.
+ Object selectedValue = nameableList.getSelectedValue();
+
+ DefaultListModel listModel = (DefaultListModel) nameableList
+ .getModel();
+ Nameable[] nameableArray = new Nameable[listModel.getSize()];
+ if (nameableArray.length <= 0) {
+ return;
+ }
+
+ for (int i = 0; i < listModel.getSize(); i++) {
+ nameableArray[i] = ((ListModelElement) listModel.getElementAt(i)).wrapper;
+ }
+
+ // p:排序.
+ if (isAtoZ) {
+ Comparator nameableComparator = new Comparator() {
+ @Override
+ public int compare(Nameable o1, Nameable o2) {
+ return -ComparatorUtils.compare(o1.getName(), o2
+ .getName());
+ }
+ };
+ isAtoZ = !isAtoZ;
+ Arrays.sort(nameableArray, nameableComparator);
+ } else {
+ Comparator nameableComparator = new Comparator() {
+ @Override
+ public int compare(Nameable o1, Nameable o2) {
+ return ComparatorUtils.compare(o1.getName(), o2
+ .getName());
+ }
+ };
+ isAtoZ = !isAtoZ;
+ Arrays.sort(nameableArray, nameableComparator);
+ }
+
+ for (int i = 0; i < nameableArray.length; i++) {
+ listModel.set(i, new ListModelElement(nameableArray[i]));
+ }
+
+ // p:需要选中以前的那个值.
+ if (selectedValue != null) {
+ nameableList.setSelectedValue(selectedValue, true);
+ }
+
+ checkButtonEnabled();
+ // p:需要repaint.
+ nameableList.repaint();
+ }
+ }
+
+ /*
+ * UINameEdList的鼠标事件
+ */
+ private MouseListener listMouseListener = new MouseAdapter() {
+ @Override
+ public void mouseReleased(MouseEvent evt) {
+ nameableList.stopEditing();
+ if (evt.getClickCount() >= 2
+ && SwingUtilities.isLeftMouseButton(evt) && evt.getX() > EDIT_RANGE) {
+ editingIndex = nameableList.getSelectedIndex();
+ selectedName = nameableList.getNameAt(editingIndex);
+ nameableList.editItemAt(nameableList.getSelectedIndex());
+ } else if (SwingUtilities.isLeftMouseButton(evt) && evt.getX() <= EDIT_RANGE) {
+ editingIndex = nameableList.getSelectedIndex();
+ popupEditPane();
+ }
+
+ // peter:处理右键的弹出菜单
+ if (!SwingUtilities.isRightMouseButton(evt)) {
+ return;
+ }
+
+ // peter: 注意,在checkButtonEnabled()方法里面,设置了所有的Action的Enabled.
+ checkButtonEnabled();
+
+ // p:右键菜单.
+ JPopupMenu popupMenu = new JPopupMenu();
+
+ for (ShortCut4JControlPane sj : getShorts()) {
+ sj.getShortCut().intoJPopupMenu(popupMenu);
+ }
+
+ // peter: 只有弹出菜单有子菜单的时候,才需要弹出来.
+ GUICoreUtils.showPopupMenu(popupMenu, nameableList, evt.getX() - 1,
+ evt.getY() - 1);
+ }
+
+ @Override
+ public void mouseMoved(MouseEvent e) {
+
+ }
+ };
+
+ /**
+ * 检查按钮可用状态 Check button enabled.
+ */
+ @Override
+ public void checkButtonEnabled() {
+
+ int selectedIndex = nameableList.getSelectedIndex();
+ if (selectedIndex == -1) {
+ this.cardLayout.show(cardPane, "SELECT");
+ } else {
+ this.cardLayout.show(cardPane, "EDIT");
+ }
+ for (ShortCut4JControlPane sj : getShorts()) {
+ sj.checkEnable();
+ }
+ }
+
+
+ public class AbsoluteEnableShortCut extends ShortCut4JControlPane {
+ public AbsoluteEnableShortCut(ShortCut shortCut) {
+ this.shortCut = shortCut;
+ }
+
+ /**
+ * 检查是否可用
+ */
+ @Override
+ public void checkEnable() {
+ this.shortCut.setEnabled(true);
+ }
+ }
+
+ public class NormalEnableShortCut extends ShortCut4JControlPane {
+ public NormalEnableShortCut(ShortCut shortCut) {
+ this.shortCut = shortCut;
+ }
+
+ /**
+ * 检查是否可用
+ */
+ @Override
+ public void checkEnable() {
+ this.shortCut.setEnabled(getModel()
+ .getSize() > 0
+ && UIListControlPane.this.nameableList.getSelectedIndex() != -1);
+ }
+ }
+
+ public class SortEnableShortCut extends ShortCut4JControlPane {
+ public SortEnableShortCut(ShortCut shortCut) {
+ this.shortCut = shortCut;
+ }
+
+ /**
+ * 检查是否可用
+ */
+ @Override
+ public void checkEnable() {
+ this.shortCut.setEnabled(getModel().getSize() > 1);
+ }
+
+ }
+
+ public class MoveUpEnableShortCut extends ShortCut4JControlPane {
+ public MoveUpEnableShortCut(ShortCut shortCut) {
+ this.shortCut = shortCut;
+ }
+
+ /**
+ * 检查是否可用
+ */
+ @Override
+ public void checkEnable() {
+ this.shortCut.setEnabled(getModel().getSize() > 1
+ && UIListControlPane.this.nameableList.getSelectedIndex() > 0);
+ }
+
+ }
+
+ public class MoveDownEnableShortCut extends ShortCut4JControlPane {
+ public MoveDownEnableShortCut(ShortCut shortCut) {
+ this.shortCut = shortCut;
+ }
+
+ /**
+ * 检查是否可用
+ */
+ @Override
+ public void checkEnable() {
+ this.shortCut.setEnabled(getModel().getSize() > 1
+ && UIListControlPane.this.nameableList.getSelectedIndex() < UIListControlPane.this.nameableList.getModel().getSize() - 1);
+ }
+
+ }
+
+ private class JControlUpdatePane extends JPanel {
+ private CardLayout card;
+ private JPanel cardPane;
+ private BasicBeanPane[] updatePanes;
+
+ private ListModelElement elEditing;
+
+ public JControlUpdatePane() {
+ initUpdatePane();
+ }
+
+ private void initUpdatePane() {
+ NameableCreator[] creators = creators();
+ if (creators == null) {
+ return;
+ }
+ card = new CardLayout();
+ cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
+ cardPane.setLayout(card);
+ this.setLayout(FRGUIPaneFactory.createBorderLayout());
+ this.add(cardPane);
+ int len = creators.length;
+ updatePanes = new BasicBeanPane[len];
+ }
+
+ public void populate() {
+ ListModelElement el = (ListModelElement) UIListControlPane.this.nameableList.getSelectedValue();
+ if (el == null) {
+ return;
+ }
+
+ elEditing = el;
+ NameableCreator[] creators = creators();
+
+ for (int i = 0, len = updatePanes.length; i < len; i++) {
+ Object ob2Populate = creators[i].acceptObject2Populate(el.wrapper);
+ if (ob2Populate != null) {
+ if (updatePanes[i] == null) {
+ if (isMulti(creators[i].getUpdatePane()) || isTree(creators[i].getUpdatePane())) {
+ updatePanes[i] = createPaneByCreators(creators[i], el.wrapper.getName());
+ } else {
+ updatePanes[i] = createPaneByCreators(creators[i]);
+ }
+ cardPane.add(updatePanes[i], String.valueOf(i));
+ }
+ card.show(cardPane, String.valueOf(i));
+ doBeforePopulate(el, ob2Populate);
+ updatePanes[i].populateBean(ob2Populate);
+ doWhenPopulate(updatePanes[i]);
+ break;
+ }
+ }
+ }
+
+ public boolean isMulti(Class _class) {
+ return ComparatorUtils.equals(_class, GlobalMultiTDTableDataPane.class) || ComparatorUtils.equals(_class, MultiTDTableDataPane.class);
+ }
+
+ public boolean isTree(Class _class) {
+ return ComparatorUtils.equals(_class, GlobalTreeTableDataPane.class) || ComparatorUtils.equals(_class, TreeTableDataPane.class);
+ }
+
+ public void update() {
+ NameableCreator[] creators = creators();
+ for (int i = 0; i < updatePanes.length; i++) {
+ BasicBeanPane pane = updatePanes[i];
+
+ if (pane != null && pane.isVisible()) {
+ Object bean = pane.updateBean();
+ if (i < creators.length) {
+ creators[i].saveUpdatedBean(elEditing, bean);
+ }
+ }
+ }
+ }
+
+ public void checkValid() throws Exception {
+ if (updatePanes != null) {
+ for (int i = 0; i < updatePanes.length; i++) {
+ if (updatePanes[i] != null) {
+ updatePanes[i].checkValid();
+ }
+ }
+ }
+ }
+ }
+
+ protected BasicBeanPane createPaneByCreators(NameableCreator creator) {
+ try {
+ return creator.getUpdatePane().newInstance();
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected BasicBeanPane createPaneByCreators(NameableCreator creator, String string) {
+ Constructor constructor = null;
+ try {
+ constructor = creator.getUpdatePane().getDeclaredConstructor(new Class[]{String.class});
+ constructor.setAccessible(true);
+ return (BasicBeanPane) constructor.newInstance(string);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ // 选项添加个数有限制等情况下 要求能控制快捷按钮的状态
+ protected void setToolbarDefEnable(int shortCutIndex, int itemIndex, boolean enabled) {
+ ToolBarDef toolbarDef = getToolbarDef();
+ if (toolbarDef.getShortCutCount() > shortCutIndex) {
+ ShortCut sc = toolbarDef.getShortCut(shortCutIndex);
+ if (sc instanceof AddItemMenuDef) {
+ AddItemMenuDef am = (AddItemMenuDef) sc;
+ if (am.getShortCutCount() > itemIndex) {
+ am.getShortCut(itemIndex).setEnabled(enabled);
+ }
+ }
+ }
+ }
+
+ /**
+ * 检查是否符合规范
+ *
+ * @throws Exception
+ */
+ @Override
+ public void checkValid() throws Exception {
+ ((JControlUpdatePane) this.controlUpdatePane).checkValid();
+ }
+
+ private int getInValidIndex() {
+ BasicBeanPane[] p = ((JControlUpdatePane) controlUpdatePane).updatePanes;
+ if (p != null) {
+ for (int i = 0; i < p.length; i++) {
+ if (p[i] != null) {
+ try {
+ p[i].checkValid();
+ } catch (Exception e) {
+ return i;
+ }
+ }
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ protected boolean hasInvalid(boolean isAdd) {
+ int idx = UIListControlPane.this.getInValidIndex();
+ if (isAdd || nameableList.getSelectedIndex() != idx) {
+ try {
+ checkValid();
+ } catch (Exception exp) {
+ JOptionPane.showMessageDialog(UIListControlPane.this, exp.getMessage());
+ nameableList.setSelectedIndex(idx);
+ return true;
+ }
+ }
+ return false;
+ }
+ /**
+ * 设置选中项
+ *
+ * @param index 选中项的序列号
+ */
+ public void setSelectedIndex(int index) {
+ nameableList.setSelectedIndex(index);
+ }
+
+}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java b/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java
new file mode 100644
index 0000000000..e56b038074
--- /dev/null
+++ b/designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java
@@ -0,0 +1,162 @@
+package com.fr.design.gui.controlpane;
+
+import com.fr.base.BaseUtils;
+import com.fr.design.gui.ibutton.UIButton;
+import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.gui.ilist.ListModelElement;
+import com.fr.design.gui.itextfield.UITextField;
+import com.fr.design.utils.gui.GUICoreUtils;
+import com.fr.stable.Nameable;
+import sun.swing.DefaultLookup;
+
+import javax.swing.*;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/**
+ * Nameable的ListCellRenerer
+ * Created by plough on 2017/7/21.
+ */
+
+public class UINameableListCellRenderer extends
+ JPanel implements ListCellRenderer {
+ private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
+ private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
+ private static final Color BORDER_COLOR = new Color(201, 198, 184);
+ protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER;
+ private static final int BUTTON_WIDTH = 25;
+ private UILabel editButton; // "编辑按钮",实际上是一个 UILabel,由列表项(UIListControlPane)统一处理点击事件
+ private UILabel label;
+ private UIListControlPane listControlPane;
+
+ public UINameableListCellRenderer(UIListControlPane listControlPane) {
+ super();
+ this.listControlPane = listControlPane;
+ initComponents();
+ setOpaque(true);
+ setBorder(getNoFocusBorder());
+ setName("List.cellRenderer");
+ }
+
+ private void initComponents() {
+ editButton = new UILabel() {
+ public Dimension getPreferredSize() {
+ return new Dimension(BUTTON_WIDTH, BUTTON_WIDTH);
+ }
+ };
+// editButton.set4LargeToolbarButton();
+ editButton.setIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"));
+ editButton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, BORDER_COLOR));
+ editButton.setHorizontalAlignment(SwingConstants.CENTER);
+// editButton.addActionListener(new ActionListener() {
+// @Override
+// public void actionPerformed(ActionEvent e) {
+// popupEditPane();
+// }
+// });
+ label = new UILabel();
+ label.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
+// label.setEditable(false);
+ this.setLayout(new BorderLayout());
+ this.add(editButton, BorderLayout.WEST);
+ this.add(label, BorderLayout.CENTER);
+ }
+
+ private Border getNoFocusBorder() {
+// return BorderFactory.createLineBorder(new Color(201, 198, 184));
+ return BorderFactory.createMatteBorder(0, 0, 1, 0, BORDER_COLOR);
+ // Border border = DefaultLookup.getBorder(this, ui, "List.cellNoFocusBorder");
+// if (System.getSecurityManager() != null) {
+// if (border != null) return border;
+// return SAFE_NO_FOCUS_BORDER;
+// } else {
+// if (border != null &&
+// (noFocusBorder == null ||
+// noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
+// return border;
+// }
+// return noFocusBorder;
+// }
+ }
+
+ private void setText(String t) {
+ label.setText(t);
+ }
+
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus) {
+ setComponentOrientation(list.getComponentOrientation());
+
+ Color bg = null;
+ Color fg = null;
+
+ JList.DropLocation dropLocation = list.getDropLocation();
+ if (dropLocation != null
+ && !dropLocation.isInsert()
+ && dropLocation.getIndex() == index) {
+
+ bg = DefaultLookup.getColor(this, ui, "List.dropCellBackground");
+ fg = DefaultLookup.getColor(this, ui, "List.dropCellForeground");
+
+ isSelected = true;
+ }
+
+ if (isSelected) {
+ setBackground(bg == null ? list.getSelectionBackground() : bg);
+ setForeground(fg == null ? list.getSelectionForeground() : fg);
+ }
+ else {
+ setBackground(list.getBackground());
+ setForeground(list.getForeground());
+ }
+
+// if (value instanceof Icon) {
+// setIcon((Icon)value);
+// setText("");
+// }
+// else {
+// setIcon(null);
+ setText((value == null) ? "" : value.toString());
+// }
+
+ setEnabled(list.isEnabled());
+ setFont(list.getFont());
+
+ Border border = null;
+ if (cellHasFocus) {
+ if (isSelected) {
+ border = DefaultLookup.getBorder(this, ui, "List.focusSelectedCellHighlightBorder");
+ }
+ if (border == null) {
+ border = DefaultLookup.getBorder(this, ui, "List.focusCellHighlightBorder");
+ }
+ } else {
+ border = getNoFocusBorder();
+ }
+ setBorder(border);
+
+ if (value instanceof ListModelElement) {
+ Nameable wrappee = ((ListModelElement) value).wrapper;
+ this.setText(((ListModelElement) value).wrapper.getName());
+
+ boolean iconSet = false;
+ for (NameableCreator creator : listControlPane.creators()) {
+ if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) {
+// this.setIcon(creator.menuIcon());
+ this.setToolTipText(creator.createTooltip());
+ iconSet = true;
+ break;
+ }
+ }
+// if (!iconSet) {
+// this.setIcon(BaseUtils.readIcon("/com/fr/base/images/oem/cpt.png"));
+// }
+ }
+
+ return this;
+ }
+}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java b/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
index 3408bf371d..fcd9ba3833 100644
--- a/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
+++ b/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
@@ -4,6 +4,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
+import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.Inter;
import com.fr.general.NameObject;
@@ -23,8 +24,7 @@ import java.util.Set;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间:2013-6-25 上午11:17:57
*/
-public class HyperlinkGroupPane extends JListControlPane {
-
+public abstract class HyperlinkGroupPane extends UIListControlPane {
/**
* 生成添加按钮的NameableCreator
*
diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java
new file mode 100644
index 0000000000..85e11d8d7b
--- /dev/null
+++ b/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java
@@ -0,0 +1,311 @@
+package com.fr.design.gui.icontainer;
+
+import com.fr.base.BaseUtils;
+import com.fr.design.constants.UIConstants;
+import com.fr.design.gui.ibutton.UIButton;
+import com.fr.design.mainframe.DesignerContext;
+import com.fr.design.utils.gui.GUICoreUtils;
+import com.fr.stable.Constants;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionListener;
+
+/**
+ * Created by plough on 2017/7/7.
+ */
+public class UIEastResizableContainer extends JPanel {
+ private static final long serialVersionUID = 1854340560790476907L;
+ private int containerWidth = 240;
+ private int preferredWidth = 240;
+ private int topToolPaneHeight = 20;
+ private int leftPaneWidth = 40;
+
+ private JComponent leftPane;
+ private JComponent rightPane;
+
+ // private HorizotalToolPane horizontToolPane;
+ private TopToolPane topToolPane;
+
+
+ private static final int ARROW_MARGIN = 15;
+ private static final int ARROW_RANGE = 35;
+
+// private boolean isRightPaneVisible = true;
+
+ public UIEastResizableContainer() {
+ this(new JPanel(), new JPanel());
+ }
+
+ /**
+ * 设置面板宽度
+ *
+ * @param width
+ */
+ public void setContainerWidth(int width) {
+ this.containerWidth = width;
+ this.preferredWidth = width;
+ }
+
+ public boolean isRightPaneVisible() {
+ return containerWidth > leftPaneWidth;
+ }
+
+
+// public void setRightPaneVisible(boolean isVisible){
+// this.isRightPaneVisible = isVisible;
+// }
+
+ private void setPreferredWidth(int width) {
+ this.preferredWidth = width;
+ }
+
+ public UIEastResizableContainer(JComponent leftPane, JComponent rightPane) {
+ setBackground(UIConstants.NORMAL_BACKGROUND);
+ this.leftPane = leftPane;
+ this.rightPane = rightPane;
+
+ this.topToolPane = new TopToolPane();
+
+ setLayout(containerLayout);
+ add(topToolPane);
+ add(leftPane);
+ add(rightPane);
+ }
+
+ public static void main(String... args) {
+ JFrame jf = new JFrame("test");
+ jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ JPanel content = (JPanel) jf.getContentPane();
+ content.setLayout(new BorderLayout());
+
+ JPanel leftPane = new JPanel();
+ leftPane.setBackground(Color.yellow);
+ JPanel rightPane = new JPanel();
+ rightPane.setBackground(Color.green);
+
+ UIButton b1, b2;
+ b1 = new UIButton("b1");
+ b2 = new UIButton("b2");
+ b1.setPreferredSize(new Dimension(40, 40));
+ b2.setPreferredSize(new Dimension(40, 40));
+ leftPane.add(b1);
+ leftPane.add(b2);
+
+
+ UIEastResizableContainer bb = new UIEastResizableContainer(leftPane, rightPane);
+
+ JPanel cc = new JPanel();
+ cc.setBackground(Color.white);
+
+ content.add(bb, BorderLayout.EAST);
+ content.add(cc, BorderLayout.CENTER);
+ GUICoreUtils.centerWindow(jf);
+ jf.setSize(500, 500);
+ jf.setVisible(true);
+ }
+
+ /**
+ * 将面板设置成最佳的宽度
+ */
+ public void setWindow2PreferWidth() {
+ if (containerWidth == leftPaneWidth) {
+ containerWidth = preferredWidth;
+ refreshContainer();
+ }
+ }
+
+ /**
+ * 得到容器的宽度
+ *
+ * @return
+ */
+ public int getContainerWidth() {
+ return this.containerWidth;
+ }
+
+ /**
+ * 设置关闭设计器前最后一次面板的宽度
+ *
+ * @param containerWidth
+ */
+ public void setLastContainerWidth(int containerWidth) {
+ this.containerWidth = containerWidth;
+ }
+
+ private LayoutManager containerLayout = new LayoutManager() {
+
+ @Override
+ public void removeLayoutComponent(Component comp) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Dimension preferredLayoutSize(Container parent) {
+ return parent.getPreferredSize();
+ }
+
+ @Override
+ public Dimension minimumLayoutSize(Container parent) {
+ return null;
+ }
+
+ @Override
+ public void layoutContainer(Container parent) {
+ if (topToolPane == null || rightPane == null) {
+ return;
+ }
+
+// topToolPane.setBounds(0, 0, containerWidth, topToolPaneHeight);//0,0,10,462
+ topToolPane.setBounds(0, 0, leftPaneWidth, topToolPaneHeight);//0,0,10,462
+ leftPane.setBounds(0, topToolPaneHeight, leftPaneWidth, getHeight() - topToolPaneHeight);
+
+// parameterPane.setBounds(20, 0, 230, getParameterPaneHeight());//10,0,230,462
+ rightPane.setBounds(leftPaneWidth, 0, containerWidth-leftPaneWidth, getHeight());//20,0,230,0
+ }
+
+ @Override
+ public void addLayoutComponent(String name, Component comp) {
+ }
+ };
+
+ @Override
+ /**
+ * 得到最佳大小
+ */
+ public Dimension getPreferredSize() {
+ return new Dimension(containerWidth, 400);
+ }
+
+ /**
+ * 替换左子面板
+ *
+ * @param pane 面板
+ */
+ public void replaceLeftPane(JComponent pane) {
+ remove(pane);
+ remove(this.leftPane);
+ add(this.leftPane = pane);
+ refreshContainer();
+ }
+
+
+ /**
+ * 替换右子面板
+ *
+ * @param pane 面板
+ */
+ public void replaceRightPane(JComponent pane) {
+ remove(pane);
+ remove(this.rightPane);
+ add(this.rightPane = pane);
+ refreshContainer();
+ }
+
+ /**
+ * 得到左子面板
+ *
+ * @return
+ */
+ public JComponent getLeftPane() {
+ return this.leftPane;
+ }
+
+ /**
+ * 得到右子面板
+ *
+ * @return
+ */
+ public JComponent getRightPane() {
+ return this.rightPane;
+ }
+
+ private void refreshContainer() {
+ validate();
+ repaint();
+ revalidate();
+ }
+
+ /**
+ * 伸缩右子面板时,触发此方法
+ */
+ public void onResize() {
+ }
+
+ private class TopToolPane extends JPanel {
+ private int model = UIConstants.MODEL_NORMAL;
+
+ public TopToolPane() {
+ super();
+ addMouseMotionListener(new MouseMotionListener() {
+
+ @Override
+ public void mouseMoved(MouseEvent e) {
+ if (e.getX() <= ARROW_RANGE) {
+ setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ model = UIConstants.MODEL_PRESS;
+ } else {
+ setCursor(Cursor.getDefaultCursor());
+ model = UIConstants.MODEL_NORMAL;
+ }
+ repaint();
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent e) {
+ }
+ });
+ addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseExited(MouseEvent e) {
+ setCursor(Cursor.getDefaultCursor());
+ model = UIConstants.MODEL_NORMAL;
+ repaint();
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ if (e.getX() <= ARROW_RANGE) {
+ if (containerWidth == leftPaneWidth) {
+ containerWidth = preferredWidth;
+ } else {
+ setPreferredWidth(containerWidth);
+ containerWidth = leftPaneWidth;
+ }
+ onResize();
+ refreshContainer();
+ if (BaseUtils.isAuthorityEditing()) {
+ DesignerContext.getDesignerFrame().doResize();
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public void paint(Graphics g) {
+ Image button;
+
+ g.drawImage(UIConstants.DRAG_BAR, 0, 0, containerWidth, topToolPaneHeight, null);
+ if (containerWidth == leftPaneWidth) {
+ if (model == UIConstants.MODEL_NORMAL) {
+ button = UIConstants.DRAG_LEFT_NORMAL;
+ } else {
+ button = UIConstants.DRAG_LEFT_PRESS;
+ }
+ } else {
+ if (model == UIConstants.MODEL_NORMAL) {
+ button = UIConstants.DRAG_RIGHT_NORMAL;
+ } else {
+ button = UIConstants.DRAG_RIGHT_PRESS;
+ }
+ }
+// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null);
+ g.drawImage(button, 18, 7, 5, 5, null);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java
index 96eccfc595..afb23ec702 100644
--- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java
+++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java
@@ -37,9 +37,9 @@ public class UIResizableContainer extends JPanel {
private static final int MIN_WIDTH = 165;
private static final int ARROW_MARGIN = 15;
- private static final int ARROW_MARGIN_VERTICAL = 20;
+ private static final int ARROW_MARGIN_VERTICAL = 7;
private static final int ARROW_RANGE = 35;
- private static final int ARROW_RANGE_VERTICAL = 40;
+ private static final int ARROW_RANGE_VERTICAL = 25;
private boolean isLeftRightDragEnabled = true;
private boolean isDownPaneVisible = true ;
@@ -502,7 +502,7 @@ public class UIResizableContainer extends JPanel {
button = UIConstants.DRAG_LEFT_PRESS;
}
}
- g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null);
+ g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, 5, null);
} else {
g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null);
if (containerWidth == toolPaneHeight) {
diff --git a/designer_base/src/com/fr/design/gui/ilist/UINameEdList.java b/designer_base/src/com/fr/design/gui/ilist/UINameEdList.java
new file mode 100644
index 0000000000..823c95d6e4
--- /dev/null
+++ b/designer_base/src/com/fr/design/gui/ilist/UINameEdList.java
@@ -0,0 +1,398 @@
+package com.fr.design.gui.ilist;
+
+import com.fr.base.Utils;
+import com.fr.design.gui.itextfield.UITextField;
+import com.fr.general.Inter;
+import com.fr.general.NameObject;
+import com.fr.stable.Nameable;
+import com.fr.stable.StringUtils;
+import com.fr.stable.core.PropertyChangeAdapter;
+
+import javax.swing.*;
+import javax.swing.event.CellEditorListener;
+import javax.swing.event.ChangeEvent;
+import java.awt.*;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.Vector;
+
+/**
+ * Created by plough on 2017/7/23.
+ */
+public class UINameEdList extends UIList implements CellEditorListener {
+ private static final int TEST_LIST_LENTH = 20;
+ private static final int BUTTON_WIDTH = 25;
+ private boolean editable = true;
+
+ // kunsnat: 是否强制ListName是数字 (int型)
+ private boolean isNameShouldNumber = false;
+
+ transient protected ListCellEditor cellEditor;
+ transient protected Component editorComp;
+ transient protected int editingIndex;
+ private PropertyChangeAdapter editingListner;
+ private java.util.List ll = new ArrayList();
+
+ public UINameEdList(ListModel dataModel) {
+ super(dataModel);
+ }
+
+ public UINameEdList(final Object[] listData) {
+ super(listData);
+ }
+
+ public UINameEdList(final Vector> listData) {
+ super(listData);
+ }
+
+ public UINameEdList() {
+ super();
+ }
+
+ /*
+ * Sets是否可编辑
+ */
+ public void setEditable(boolean editable) {
+ this.editable = editable;
+ }
+
+ /**
+ * 是否可编辑
+ *
+ * @return 是则返回true
+ */
+ public boolean isEditable() {
+ return this.editable;
+ }
+
+ public void setNameShouldNumber(boolean isNameShouldNumber) {
+ this.isNameShouldNumber = isNameShouldNumber;
+ }
+
+ /**
+ * 是否强制ListName是数字 (int型)
+ *
+ * @return 是则返回true
+ */
+ public boolean isNameShouldNumber() {
+ return isNameShouldNumber;
+ }
+
+ /**
+ * 添加名字改变时的listener
+ *
+ * @param l 监听器
+ */
+ public void addModNameActionListener(ModNameActionListener l) {
+ ll.add(l);
+ }
+
+ /**
+ * 编辑时的监听器
+ *
+ * @param l 监听器
+ */
+ public void addEditingListner(PropertyChangeAdapter l) {
+ this.editingListner = l;
+ }
+
+ /**
+ * 移除某名字改变时的listener
+ *
+ * @param l 监听器
+ */
+ public void removeModNameActionListener(ModNameActionListener l) {
+ ll.remove(l);
+ }
+
+ public ListCellEditor getCellEditor() {
+ if (cellEditor == null) {
+ UITextField editField = new UITextField();
+ if (editingListner != null) {
+ editField.addFocusListener(new FocusListener() {
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ editingListner.propertyChange();
+
+ }
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+ }
+ cellEditor = new DefaultListCellEditor(editField) {
+ public boolean stopCellEditing() {
+ boolean isTrue = super.stopCellEditing();
+ stopEditing();
+
+ return isTrue;
+ }
+ };
+ cellEditor.addCellEditorListener(this);
+ }
+
+ return cellEditor;
+ }
+
+ protected void doAfterLostFocus() {
+
+ }
+
+ public void setCellEditor(ListCellEditor editor) {
+ this.cellEditor = editor;
+ }
+
+ /*
+ * 取得index节点的名字
+ */
+ public String getNameAt(int index) {
+ Nameable nameable = ((ListModelElement) getModel().getElementAt(index)).wrapper;
+ if (nameable != null) {
+ return nameable.getName();
+ }
+
+ return null;
+ }
+
+ public Object getType(int index) {
+ Nameable nameable = ((ListModelElement) getModel().getElementAt(index)).wrapper;
+ if (nameable != null && nameable instanceof NameObject) {
+ return ((NameObject) nameable).getObject();
+ }
+ return null;
+ }
+
+
+ public void setWarnigText() {
+ setWarnigText(this.getSelectedIndex());
+ }
+
+ public void setWarnigText(int index) {
+ setNameAt(Inter.getLocText("Please_Rename") + "!", index);
+ this.repaint();
+ }
+
+ /*
+ * 设置index节点的名字
+ */
+ // b:edit改变name的时候怎么办?
+ public void setNameAt(String name, int index) {
+ Nameable nameable = ((ListModelElement) getModel().getElementAt(index)).wrapper;
+ if (nameable != null) {
+ String oldName = nameable.getName();
+
+ if (isNameShouldNumber()) {
+ // kunsnat: 限制只能是数字(int型)
+ Number number = Utils.string2Number(name);
+ if (number == null) {
+ nameable.setName(oldName);
+ } else {
+ int newName = number.intValue();
+ nameable.setName(String.valueOf(newName));
+ }
+ } else {
+ nameable.setName(name);
+ }
+
+ for (int i = 0, len = ll.size(); i < len; i++) {
+ ll.get(i).nameModed(index, oldName, name);
+ }
+ }
+ }
+
+ /*
+ * 编辑第index个item
+ */
+ private String oldName;
+
+ /**
+ * 编辑第index项
+ *
+ * @param index 序号
+ * @return 成功返回true
+ */
+ public boolean editItemAt(int index) {
+ // 如果不可编辑,返回
+ if (!this.editable) {
+ return false;
+ }
+
+ if (cellEditor != null && !cellEditor.stopCellEditing()) {
+ return false;
+ }
+ if (index < 0 || index >= this.getModel().getSize()) {
+ return false;
+ }
+
+ ListCellEditor editor = getCellEditor();
+ Object value = editor.getCellEditorValue();
+ if (!StringUtils.isBlank(value.toString())) {
+ oldName = value.toString();
+ }
+ editorComp = prepareEditor(editor, index);
+ if (editorComp == null) {
+ return false;
+ }
+ Rectangle rect = this.getCellBounds(index, index);
+ // alex:所有的UINameEdList都有Icon,空出前面20 * 20的位置就是放的Icon
+ rect.setRect(createRect(rect, BUTTON_WIDTH));
+
+ editorComp.setBounds(rect);
+ add(editorComp);
+ editorComp.validate();
+ editorComp.requestFocus();
+ if (editorComp instanceof UITextField) {
+ ((UITextField) editorComp).selectAll();
+ }
+
+ setEditingIndex(index);
+
+ return true;
+ }
+
+ public Rectangle createRect(Rectangle rect, int iconWidth) {
+ return new Rectangle(rect.x + iconWidth, rect.y, rect.width - iconWidth, rect.height);
+ }
+
+ public String getEditingName() {
+ return (String) getCellEditor().getCellEditorValue();
+ }
+
+ /*
+ * 根据ListCellEditor取得编辑器的Component
+ */
+ private Component prepareEditor(ListCellEditor cellEditor, int index) {
+ String name = getNameAt(index);
+ boolean isSelected = this.isSelectedIndex(index);
+ Component comp = cellEditor.getListCellEditorComponent(this, name, isSelected, index);
+
+ return comp;
+ }
+
+ /*
+ * 记录正在编辑的index
+ */
+ private void setEditingIndex(int idx) {
+ editingIndex = idx;
+ }
+
+ /**
+ * 编辑取消
+ *
+ * @param e 事件
+ */
+ public void editingCanceled(ChangeEvent e) {
+ removeComp();
+ }
+
+ /**
+ * 编辑结束
+ *
+ * @param e 事件
+ */
+ public void editingStopped(ChangeEvent e) {
+ doAfterLostFocus();
+ stopEditing();
+ }
+
+ /**
+ * 停止编辑事件
+ */
+ public void stopEditing() {
+ ListCellEditor editor = getCellEditor();
+ if (editor != null && editorComp != null) {
+ Object value = editor.getCellEditorValue();
+ String name = StringUtils.isBlank(value.toString()) ? oldName : value.toString();
+ setNameAt(name, editingIndex);
+ removeComp();
+ }
+ }
+
+ public String[] getAllNames() {
+ int length = this.getModel().getSize();
+ String[] names = new String[length];
+ for (int i = 0; i < length; i++) {
+ names[i] = getNameAt(i);
+ }
+ return names;
+ }
+
+ public Object[] getAllTypes() {
+ int length = this.getModel().getSize();
+ Object[] types = new Object[length];
+ for (int i = 0; i < length; i++) {
+ types[i] = getType(i);
+ }
+ return types;
+ }
+
+
+ /*
+ * 移除编辑器的Component
+ */
+ private void removeComp() {
+ if (editorComp != null) {
+ remove(editorComp);
+ }
+ Rectangle cellRect = this.getCellBounds(editingIndex, editingIndex);
+ setEditingIndex(-1);
+ editorComp = null;
+ repaint(cellRect);
+ }
+
+ /**
+ * 主函数
+ *
+ * @param args 参数
+ */
+ public static void main(String... args) {
+ JFrame f = new JFrame();
+ JPanel c = (JPanel) f.getContentPane();
+ c.setLayout(new BorderLayout());
+ ListModelElement[] data = new ListModelElement[TEST_LIST_LENTH];
+ for (int i = 0; i < TEST_LIST_LENTH; i++) {
+ data[i] = new ListModelElement(new NameObject(i + 1 + "", i));
+ }
+ final UINameEdList list = new UINameEdList(data);
+ list.setEditable(true);
+ list.addMouseListener(new MouseAdapter() {
+ public void mouseReleased(MouseEvent evt) {
+ list.stopEditing();
+ if (evt.getClickCount() >= 2
+ && SwingUtilities.isLeftMouseButton(evt)) {
+ list.editItemAt(list.getSelectedIndex());
+ }
+ }
+ })
+ ;
+
+ list.setCellEditor(new DefaultListCellEditor(new UITextField()));
+ list.setCellRenderer(new NameableListCellRenderer());
+ c.add(list, BorderLayout.CENTER);
+ f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ f.setSize(400, 600);
+ f.setVisible(true);
+ }
+
+ private static class NameableListCellRenderer extends DefaultListCellRenderer {
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
+ boolean cellHasFocus) {
+ super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+
+ if (value instanceof Nameable) {
+ Nameable wrappee = (Nameable) value;
+ this.setText(wrappee.getName());
+ }
+ return this;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/gui/style/BackgroundPane.java b/designer_base/src/com/fr/design/gui/style/BackgroundPane.java
index 440d8fcef1..ced48d50d3 100644
--- a/designer_base/src/com/fr/design/gui/style/BackgroundPane.java
+++ b/designer_base/src/com/fr/design/gui/style/BackgroundPane.java
@@ -1,9 +1,15 @@
package com.fr.design.gui.style;
+import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.design.ExtraDesignClassManager;
+import com.fr.design.constants.LayoutConstants;
import com.fr.design.fun.BackgroundQuickUIProvider;
+import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
+import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.layout.TableLayout;
+import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.*;
import com.fr.general.Background;
import com.fr.general.Inter;
@@ -35,7 +41,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
this.setLayout(new BorderLayout(0, 6));
typeComboBox = new UIComboBox();
final CardLayout cardlayout = new CardLayout();
- this.add(typeComboBox, BorderLayout.NORTH);
+// this.add(typeComboBox, BorderLayout.NORTH);
paneList = supportKindsOfBackgroundUI();
@@ -50,7 +56,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
typeComboBox.addItem(pane.title4PopupWindow());
centerPane.add(pane, pane.title4PopupWindow());
}
- this.add(centerPane, BorderLayout.CENTER);
+// this.add(centerPane, BorderLayout.CENTER);
typeComboBox.addItemListener(new ItemListener() {
@Override
@@ -59,6 +65,20 @@ public class BackgroundPane extends AbstractBasicStylePane {
fireStateChanged();
}
});
+
+ double f = TableLayout.FILL;
+ double p = TableLayout.PREFERRED;
+ Component[][] components = new Component[][]{
+ new Component[]{null, null},
+ new Component[]{new UILabel(Inter.getLocText("FR-Chart-Shape_Fill") + " ", SwingConstants.LEFT),typeComboBox},
+ new Component[]{null, centerPane}
+ };
+ double[] rowSize = {p, p, p};
+ double[] columnSize = {p,f};
+ int[][] rowCount = {{1, 1},{1, 1},{1, 1}};
+ JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
+ this.add(panel, BorderLayout.CENTER);
+
}
protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {
diff --git a/designer_base/src/com/fr/design/gui/style/BorderPane.java b/designer_base/src/com/fr/design/gui/style/BorderPane.java
index cb37f1c1a1..585bfe98bd 100644
--- a/designer_base/src/com/fr/design/gui/style/BorderPane.java
+++ b/designer_base/src/com/fr/design/gui/style/BorderPane.java
@@ -9,8 +9,11 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
+import com.fr.design.constants.LayoutConstants;
+import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
-import javax.swing.JPanel;
+
+import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -21,6 +24,7 @@ import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
+import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import com.fr.stable.CoreConstants;
@@ -45,22 +49,28 @@ public class BorderPane extends AbstractBasicStylePane {
private LineComboBox currentLineCombo;
private NewColorSelectBox currentLineColorPane;
+ private JPanel panel;
+ private JPanel borderPanel;
+ private JPanel backgroundPanel;
+ private BackgroundPane backgroundPane;
public BorderPane() {
this.initComponents();
}
+ public static void main(String[] args){
+ JFrame jf = new JFrame("test");
+ jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ JPanel content = (JPanel) jf.getContentPane();
+ content.setLayout(new BorderLayout());
+ content.add(new BorderPane(), BorderLayout.CENTER);
+ GUICoreUtils.centerWindow(jf);
+ jf.setSize(290, 400);
+ jf.setVisible(true);
+ }
protected void initComponents() {
initButtonsWithIcon();
this.setLayout(new BorderLayout(0, 6));
- double p = TableLayout.PREFERRED, f = TableLayout.FILL;
- double[] columnSize1 = {p, f}, rowSize1 = {p, p};
- Component[][] components1 = new Component[][]{
- new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style") + ":"), currentLineCombo},
- new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + ":"), currentLineColorPane},
- };
- JPanel northPane = TableLayoutHelper.createTableLayoutPane(components1, rowSize1, columnSize1);
- double[] columnSize2 = {p, f}, rowSize2 = {p, p};
JPanel externalPane = new JPanel(new GridLayout(0, 4));
externalPane.add(topToggleButton);
externalPane.add(leftToggleButton);
@@ -69,34 +79,56 @@ public class BorderPane extends AbstractBasicStylePane {
JPanel insidePane = new JPanel(new GridLayout(0, 2));
insidePane.add(horizontalToggleButton);
insidePane.add(verticalToggleButton);
- Component[][] components2 = new Component[][]{
- new Component[]{outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png")), innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))},
- new Component[]{externalPane, insidePane,}
+ double f = TableLayout.FILL;
+ double p = TableLayout.PREFERRED;
+ Component[][] components = new Component[][]{
+ new Component[]{null,null},
+ new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style") + " ", SwingConstants.LEFT), currentLineCombo},
+ new Component[]{null,null},
+ new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + " ", SwingConstants.LEFT), currentLineColorPane},
+ new Component[]{null,null},
+ new Component[]{new UILabel(Inter.getLocText("FR-Designer_outBorder") +" ", SwingConstants.LEFT),outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png"))},
+ new Component[]{null,externalPane},
+ new Component[]{null,null},
+ new Component[]{new UILabel(Inter.getLocText("FR-Designer_inBorder") +" ", SwingConstants.LEFT),innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))},
+ new Component[]{null,insidePane},
+ new Component[]{null,null}
};
- JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components2, rowSize2, columnSize2);
- this.setLayout(new BorderLayout(0, 6));
- this.add(northPane, BorderLayout.NORTH);
- this.add(centerPane, BorderLayout.CENTER);
- outerToggleButton.addChangeListener(new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- boolean value = outerToggleButton.isSelected();
- topToggleButton.setSelected(value);
- bottomToggleButton.setSelected(value);
- leftToggleButton.setSelected(value);
- rightToggleButton.setSelected(value);
- }
- });
- innerToggleButton.addChangeListener(new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- boolean value = innerToggleButton.isSelected();
- horizontalToggleButton.setSelected(value);
- verticalToggleButton.setSelected(value);
- }
- });
+ double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p};
+ double[] columnSize = {p,f};
+ int[][] rowCount = {{1, 1},{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
+ panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
+ borderPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Border"),280,20,panel);
+ this.add(borderPanel,BorderLayout.NORTH);
+
+ backgroundPane = new BackgroundPane();
+ backgroundPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Background"),280,20,backgroundPane);
+ this.add(backgroundPanel,BorderLayout.CENTER);
+
+ outerToggleButton.addChangeListener(outerToggleButtonChangeListener);
+ innerToggleButton.addChangeListener(innerToggleButtonChangeListener);
}
+ ChangeListener outerToggleButtonChangeListener = new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ boolean value = outerToggleButton.isSelected();
+ topToggleButton.setSelected(value);
+ bottomToggleButton.setSelected(value);
+ leftToggleButton.setSelected(value);
+ rightToggleButton.setSelected(value);
+ }
+ };
+
+ ChangeListener innerToggleButtonChangeListener = new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ boolean value = innerToggleButton.isSelected();
+ horizontalToggleButton.setSelected(value);
+ verticalToggleButton.setSelected(value);
+ }
+ };
+
private void initButtonsWithIcon(){
topToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"));
leftToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png"));
@@ -113,7 +145,8 @@ public class BorderPane extends AbstractBasicStylePane {
return Inter.getLocText("FR-Designer_Border");
}
- public void populate(Style style) {
+ @Override
+ public void populateBean(Style style) {
if (style == null) {
style = Style.DEFAULT_STYLE;
}
@@ -127,8 +160,9 @@ public class BorderPane extends AbstractBasicStylePane {
cellBorderStyle.setBottomColor(style.getBorderBottomColor());
cellBorderStyle.setRightStyle(style.getBorderRight());
cellBorderStyle.setRightColor(style.getBorderRightColor());
-
+ this.backgroundPane.populateBean(style.getBackground());
this.populateBean(cellBorderStyle, false, style.getBorderTop(), style.getBorderTopColor());
+
}
public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, int currentStyle, Color currentColor) {
@@ -151,10 +185,10 @@ public class BorderPane extends AbstractBasicStylePane {
this.innerToggleButton.setEnabled(this.insideMode);
this.horizontalToggleButton.setEnabled(this.insideMode);
this.verticalToggleButton.setEnabled(this.insideMode);
-
}
public Style update(Style style) {
+ style = style.deriveBackground(backgroundPane.update());
if (style == null) {
style = Style.DEFAULT_STYLE;
}
@@ -163,7 +197,6 @@ public class BorderPane extends AbstractBasicStylePane {
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
-
return style;
}
diff --git a/designer_base/src/com/fr/design/gui/style/FRFontPane.java b/designer_base/src/com/fr/design/gui/style/FRFontPane.java
index 2dafb005dc..e7267d683e 100644
--- a/designer_base/src/com/fr/design/gui/style/FRFontPane.java
+++ b/designer_base/src/com/fr/design/gui/style/FRFontPane.java
@@ -7,6 +7,7 @@ package com.fr.design.gui.style;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.util.Vector;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@@ -37,12 +38,15 @@ import com.fr.design.utils.gui.GUICoreUtils;
* Pane to edit Font.
*/
public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObserver {
+ private static final int MAX_FONT_SIZE = 100;
public static Integer[] FONT_SIZES = {new Integer(6), new Integer(8), new Integer(9), new Integer(10), new Integer(11), new Integer(12), new Integer(14), new Integer(16),
new Integer(18), new Integer(20), new Integer(22), new Integer(24), new Integer(26), new Integer(28), new Integer(36), new Integer(48), new Integer(72)};
- private static final Dimension BUTTON_SIZE = new Dimension(24, 20);
+ private static final Dimension BUTTON_SIZE = new Dimension(20, 18);
+ private final String[] fontSizeStyles = {Inter.getLocText("FR-Designer_FRFont_plain"), Inter.getLocText("FR-Designer_FRFont_bold"), Inter.getLocText("FR-Designer_FRFont_italic"), Inter.getLocText("FR-Designer_FRFont_bolditalic")};
private JPanel buttonPane;
private JPanel isSuperOrSubPane;
private UIComboBox fontNameComboBox;
+ private UIComboBox fontSizeStyleComboBox;
private UIComboBox fontSizeComboBox;
private UIToggleButton bold;
private UIToggleButton italic;
@@ -58,14 +62,27 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private UIToggleButton superPane;
private UIToggleButton subPane;
private JPanel linePane;
+ private int italic_bold;
public FRFontPane() {
this.initComponents();
}
+ public static void main(String[] args){
+ JFrame jf = new JFrame("test");
+ jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ JPanel content = (JPanel) jf.getContentPane();
+ content.setLayout(new BorderLayout());
+ content.add(new FRFontPane(), BorderLayout.CENTER);
+ GUICoreUtils.centerWindow(jf);
+ jf.setSize(290, 400);
+ jf.setVisible(true);
+ }
+
+
@Override
protected String title4PopupWindow() {
- return Inter.getLocText("Sytle-FRFont");
+ return Inter.getLocText("FR-Designer_Sytle-FRFont");
}
/**
@@ -73,7 +90,8 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
*/
public void populateBean(FRFont frFont) {
fontNameComboBox.setSelectedItem(frFont.getFamily());
- fontSizeComboBox.setSelectedItem(frFont.getSize());
+ fontSizeStyleComboBox.setSelectedIndex(frFont.getStyle());
+ fontSizeComboBox.setSelectedItem(Utils.round5(frFont.getSize2D()));
bold.setSelected(frFont.isBold());
italic.setSelected(frFont.isItalic());
@@ -112,31 +130,34 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
*/
public FRFont update(FRFont frFont) {
- if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Family"))) {
+ if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Name"))) {
frFont = frFont.applyName((String) fontNameComboBox.getSelectedItem());
}
- if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Size"))) {
- frFont = frFont.applySize((Integer) fontSizeComboBox.getSelectedItem());
+ if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Style"))) {
+ frFont = frFont.applyStyle(fontSizeStyleComboBox.getSelectedIndex());
+ }
+ if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-FRFont_Size"))) {
+ frFont = frFont.applySize(Float.parseFloat(fontSizeComboBox.getSelectedItem().toString()));
}
- if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Foreground"))) {
+ if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Foreground"))) {
frFont = frFont.applyForeground(this.colorSelectPane.getColor());
}
- if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Underline"))) {
+ if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Underline"))) {
int line = underline.isSelected() ? this.underlineCombo.getSelectedLineStyle() : Constants.LINE_NONE;
frFont = frFont.applyUnderline(line);
}
- if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Line-Style"))) {
+ if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-FRFont_Line_Style"))) {
frFont = frFont.applyUnderline(this.underlineCombo.getSelectedLineStyle());
}
- if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Strikethrough"))) {
+ if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Strikethrough"))) {
frFont = frFont.applyStrikethrough(isStrikethroughCheckBox.isSelected());
}
- if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Shadow"))) {
+ if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Shadow"))) {
frFont = frFont.applyShadow(isShadowCheckBox.isSelected());
}
@@ -147,7 +168,6 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private FRFont updateOthers(FRFont frFont) {
- frFont = updateItalicBold(frFont);
frFont = updateSubSuperscript(frFont);
return frFont;
}
@@ -155,7 +175,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private FRFont updateSubSuperscript(FRFont frFont) {
boolean isSuper = frFont.isSuperscript();
boolean isSub = frFont.isSubscript();
- if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Superscript"))) {
+ if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Superscript"))) {
//如果上标没有选中,点击则选中上标,并且下标一定是不选中状态
//如果上标选中,点击则取消选中上标,字体回复正常
if (superPane.isSelected() && !isSuper) {
@@ -165,7 +185,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
frFont = frFont.applySuperscript(false);
}
}
- if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Subscript"))) {
+ if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Subscript"))) {
if (subPane.isSelected() && !isSub) {
frFont = frFont.applySubscript(true);
frFont = frFont.applySuperscript(false);
@@ -176,29 +196,6 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
return frFont;
}
- private FRFont updateItalicBold(FRFont frFont) {
- int italic_bold = frFont.getStyle();
- boolean isItalic = italic_bold == Font.ITALIC || italic_bold == (Font.BOLD + Font.ITALIC);
- boolean isBold = italic_bold == Font.BOLD || italic_bold == (Font.BOLD + Font.ITALIC);
- if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-italic"))) {
- if (italic.isSelected() && !isItalic) {
- italic_bold += Font.ITALIC;
- } else if (!italic.isSelected() && isItalic) {
- italic_bold -= Font.ITALIC;
- }
- frFont = frFont.applyStyle(italic_bold);
- }
- if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-bold"))) {
- if (bold.isSelected() && !isBold) {
- italic_bold += Font.BOLD;
- } else if (!bold.isSelected() && isBold) {
- italic_bold -= Font.BOLD;
- }
- frFont = frFont.applyStyle(italic_bold);
- }
- return frFont;
- }
-
@Override
public void populateBean(Style style) {
this.populateBean(style.getFRFont());
@@ -212,10 +209,20 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
return style.deriveFRFont(frFont);
}
+ public static Vector getFontSizes(){
+ Vector FONT_SIZES = new Vector();
+ for (int i = 1; i < MAX_FONT_SIZE; i++) {
+ FONT_SIZES.add(i);
+ }
+ return FONT_SIZES;
+ }
+
protected void initComponents() {
+ fontSizeStyleComboBox = new UIComboBox(fontSizeStyles);
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox.setPreferredSize(new Dimension(144, 20));
- fontSizeComboBox = new UIComboBox(FONT_SIZES);
+ fontSizeComboBox = new UIComboBox(getFontSizes());
+ fontSizeComboBox.setEditable(true);
this.underlineCombo = new LineComboBox(UIConstants.BORDER_LINE_STYLE_ARRAY);
colorSelectPane = new UIColorButton();
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
@@ -229,48 +236,53 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
isShadowCheckBox = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/shadow.png"));
isShadowCheckBox.setPreferredSize(BUTTON_SIZE);
superPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sup.png"));
- superPane.setPreferredSize(new Dimension(22, 18));
+ superPane.setPreferredSize(BUTTON_SIZE);
subPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sub.png"));
- subPane.setPreferredSize(new Dimension(22, 18));
+ subPane.setPreferredSize(BUTTON_SIZE);
isSuperOrSubPane = new TwoButtonPane(superPane, subPane);
+// Component[] components_font = new Component[]{
+// colorSelectPane, italic, bold, underline, isStrikethroughCheckBox, isShadowCheckBox
+// };
Component[] components_font = new Component[]{
- colorSelectPane, italic, bold, underline, isStrikethroughCheckBox, isShadowCheckBox
+ colorSelectPane, underline, isStrikethroughCheckBox, isShadowCheckBox
};
buttonPane = new JPanel(new BorderLayout());
buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL));
- buttonPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
+// buttonPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
linePane = new JPanel(new CardLayout());
initAllNames();
setToolTips();
this.setLayout(new BorderLayout());
+ this.add(fontNameComboBox, BorderLayout.NORTH);
this.add(createPane(), BorderLayout.CENTER);
DefaultValues defaultValues = FRContext.getDefaultValues();
populateBean(defaultValues.getFRFont());
}
private void initAllNames() {
- fontNameComboBox.setGlobalName(Inter.getLocText("FRFont-Family"));
- fontSizeComboBox.setGlobalName(Inter.getLocText("FRFont-Size"));
- colorSelectPane.setGlobalName(Inter.getLocText("FRFont-Foreground"));
- italic.setGlobalName(Inter.getLocText("FRFont-italic"));
- bold.setGlobalName(Inter.getLocText("FRFont-bold"));
- underline.setGlobalName(Inter.getLocText("FRFont-Underline"));
- underlineCombo.setGlobalName(Inter.getLocText("Line-Style"));
- isStrikethroughCheckBox.setGlobalName(Inter.getLocText("FRFont-Strikethrough"));
- isShadowCheckBox.setGlobalName(Inter.getLocText("FRFont-Shadow"));
- superPane.setGlobalName(Inter.getLocText("FRFont-Superscript"));
- subPane.setGlobalName(Inter.getLocText("FRFont-Subscript"));
+ fontSizeStyleComboBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Style"));
+ fontNameComboBox.setGlobalName(Inter.getLocText("FR-Designer_Name"));
+ fontSizeComboBox.setGlobalName(Inter.getLocText("FR-Designer-FRFont_Size"));
+ colorSelectPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Foreground"));
+ italic.setGlobalName(Inter.getLocText("FR-Designer_FRFont_italic"));
+ bold.setGlobalName(Inter.getLocText("FR-Designer_FRFont_bold"));
+ underline.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Underline"));
+ underlineCombo.setGlobalName(Inter.getLocText("FR-Designer-FRFont_Line_Style"));
+ isStrikethroughCheckBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Strikethrough"));
+ isShadowCheckBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Shadow"));
+ superPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Superscript"));
+ subPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Subscript"));
}
private void setToolTips() {
- colorSelectPane.setToolTipText(Inter.getLocText("FRFont-Foreground"));
- italic.setToolTipText(Inter.getLocText("FRFont-italic"));
- bold.setToolTipText(Inter.getLocText("FRFont-bold"));
- underline.setToolTipText(Inter.getLocText("FRFont-Underline"));
- isStrikethroughCheckBox.setToolTipText(Inter.getLocText("FRFont-Strikethrough"));
- isShadowCheckBox.setToolTipText(Inter.getLocText("FRFont-Shadow"));
- superPane.setToolTipText(Inter.getLocText("FRFont-Superscript"));
- subPane.setToolTipText(Inter.getLocText("FRFont-Subscript"));
+ colorSelectPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Foreground"));
+ italic.setToolTipText(Inter.getLocText("FR-Designer_FRFont_italic"));
+ bold.setToolTipText(Inter.getLocText("FR-Designer_FRFont_bold"));
+ underline.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Underline"));
+ isStrikethroughCheckBox.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Strikethrough"));
+ isShadowCheckBox.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Shadow"));
+ superPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Superscript"));
+ subPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Subscript"));
}
@@ -292,10 +304,11 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createLeftPane() {
double p = TableLayout.PREFERRED;
- double[] columnSize = {p};
+ double f = TableLayout.FILL;
+ double[] columnSize = {f};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
- new Component[]{fontNameComboBox},
+ new Component[]{fontSizeStyleComboBox},
new Component[]{buttonPane},
new Component[]{createLinePane()}
};
@@ -317,9 +330,10 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
- double[] columnSize = {p, f};
- double[] rowSize = {p};
+ double[] columnSize = {f, f};
+ double[] rowSize = {p,p};
Component[][] components = new Component[][]{
+ new Component[]{null, null},
new Component[]{createLeftPane(), createRightPane()},
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@@ -349,7 +363,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
public TwoButtonPane(UIToggleButton leftButton, UIToggleButton rightButton) {
this.leftButton = leftButton;
this.rightButton = rightButton;
- this.setLayout(new FlowLayout(FlowLayout.RIGHT, 1, 0));
+ this.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
initButton(leftButton);
initButton(rightButton);
diff --git a/designer_base/src/com/fr/design/gui/style/FormatPane.java b/designer_base/src/com/fr/design/gui/style/FormatPane.java
index c426bbed26..4d81d0101e 100644
--- a/designer_base/src/com/fr/design/gui/style/FormatPane.java
+++ b/designer_base/src/com/fr/design/gui/style/FormatPane.java
@@ -7,27 +7,24 @@ import com.fr.base.TextFormat;
import com.fr.data.core.FormatField;
import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.border.UIRoundedBorder;
+import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
-import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
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.general.ComparatorUtils;
import com.fr.general.Inter;
-import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
import java.awt.*;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
+import java.awt.event.*;
import java.text.Format;
import java.text.SimpleDateFormat;
@@ -37,7 +34,7 @@ import java.text.SimpleDateFormat;
* @author zhou
* @since 2012-5-24上午10:57:00
*/
-public class FormatPane extends AbstractBasicStylePane {
+public class FormatPane extends AbstractBasicStylePane{
private static final long serialVersionUID = 724330854437726751L;
private static final int LABLE_X = 4;
@@ -54,13 +51,16 @@ public class FormatPane extends AbstractBasicStylePane {
private Format format;
private UIComboBox typeComboBox;
+ private UIComboBox textField;
private UILabel sampleLabel;
-
- private FormatePaneNumField patternTextField = null;
- private JList patternList = null;
+ private JPanel contentPane;
+ private JPanel txtCenterPane;
private JPanel centerPane;
+ private JPanel formatFontPane;
+ private FRFontPane frFontPane;
private boolean isRightFormate;
private boolean isDate = false;
+ private boolean isFormat = false;
/**
* Constructor.
*/
@@ -68,41 +68,59 @@ public class FormatPane extends AbstractBasicStylePane {
this.initComponents(TYPES);
}
+ public static void main(String[] args){
+ JFrame jf = new JFrame("test");
+ jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ JPanel content = (JPanel) jf.getContentPane();
+ content.setLayout(new BorderLayout());
+ content.add(new FormatPane(), BorderLayout.CENTER);
+ GUICoreUtils.centerWindow(jf);
+ jf.setSize(290, 400);
+ jf.setVisible(true);
+ }
+
protected void initComponents(Integer[] types) {
this.setLayout(new BorderLayout(0, 4));
-
iniSampleLable();
-
- JPanel contentPane = new JPanel(new BorderLayout(0, 4)) {
+ contentPane = new JPanel(new BorderLayout(0, 4)) {
@Override
public Dimension getPreferredSize() {
- return new Dimension(super.getPreferredSize().width, 185);
+ return new Dimension(super.getPreferredSize().width, 70);
}
-
};
typeComboBox = new UIComboBox(types);
UIComboBoxRenderer render = createComBoxRender();
typeComboBox.setRenderer(render);
typeComboBox.addItemListener(itemListener);
contentPane.add(sampleLabel, BorderLayout.NORTH);
- this.add(typeComboBox, BorderLayout.NORTH);
centerPane = new JPanel(new CardLayout());
centerPane.add(new JPanel(), "hide");
+ centerPane.setPreferredSize(new Dimension(0, 0) );
centerPane.add(contentPane, "show");
- this.add(centerPane, BorderLayout.CENTER);
- // content pane.
- JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
- contentPane.add(centerPane, BorderLayout.CENTER);
- patternTextField = new FormatePaneNumField();
- centerPane.add(patternTextField, BorderLayout.NORTH);
- patternTextField.getDocument().addDocumentListener(patternTextDocumentListener);
- patternList = new JList(new DefaultListModel());
- centerPane.add(new UIScrollPane(patternList), BorderLayout.CENTER);
- patternList.addListSelectionListener(patternListSelectionListener);
- patternList.setSelectionBackground(UIConstants.LIGHT_BLUE);
- patternList.setSelectionForeground(Color.black);
- // init values.
-
+ formatFontPane = new JPanel(new BorderLayout());
+ formatFontPane.add(centerPane, BorderLayout.NORTH);
+ formatFontPane.add(new FRFontPane(), BorderLayout.CENTER);
+ txtCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
+ contentPane.add(txtCenterPane, BorderLayout.CENTER);
+ textField = new UIComboBox(FormatField.getInstance().getFormatArray(getFormatContents()));
+ textField.addItemListener(textFieldItemListener);
+ textField.setEditable(true);
+ txtCenterPane.add(textField, BorderLayout.NORTH);
+ frFontPane = new FRFontPane();
+ double f = TableLayout.FILL;
+ double p = TableLayout.PREFERRED;
+ Component[][] components = new Component[][]{
+ new Component[]{null,null},
+ new Component[]{new UILabel(Inter.getLocText("FR-Base_Format")+" ", SwingConstants.LEFT), typeComboBox },
+ new Component[]{null,centerPane},
+ new Component[]{new UILabel(Inter.getLocText("FR-Designer_FRFont"), SwingConstants.LEFT), frFontPane},
+ new Component[]{null,null}
+ };
+ double[] rowSize = {p, p, p, p, p};
+ double[] columnSize = {p,f};
+ int[][] rowCount = {{1, 1},{1, 1}, {1, 1}, {1, 3}, {1, 1}};
+ JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
+ this.add(panel,BorderLayout.CENTER);
}
protected UIComboBoxRenderer createComBoxRender(){
@@ -187,7 +205,6 @@ public class FormatPane extends AbstractBasicStylePane {
} else {
setPatternComboBoxAndList(FormatContents.NUMBER, pattern);
}
- patternTextField.setText(pattern);
} else if (format instanceof SimpleDateFormat) { // date and time
String pattern = ((SimpleDateFormat) format).toPattern();
if (!isTimeType(pattern)) {
@@ -195,7 +212,6 @@ public class FormatPane extends AbstractBasicStylePane {
} else {
setPatternComboBoxAndList(FormatContents.TIME, pattern);
}
- patternTextField.setText(pattern);
} else if (format instanceof TextFormat) { // Text
this.typeComboBox.setSelectedItem(FormatContents.TEXT);
}
@@ -224,9 +240,9 @@ public class FormatPane extends AbstractBasicStylePane {
this.typeComboBox.setSelectedItem(formatStyle);
int i = isArrayContainPattern(FormatField.getInstance().getFormatArray(formatStyle), pattern);
if (i == -1) {
- this.patternList.setSelectedIndices(ArrayUtils.EMPTY_INT_ARRAY);
+ this.textField.setSelectedIndex(0);
} else {
- this.patternList.setSelectedIndex(i);
+ this.textField.setSelectedIndex(i);
}
}
@@ -238,7 +254,7 @@ public class FormatPane extends AbstractBasicStylePane {
* update
*/
public Format update() {
- String patternString = patternTextField.getText();
+ String patternString = String.valueOf(textField.getSelectedItem());
if (getFormatContents() == FormatContents.TEXT) {
return FormatField.getInstance().getFormat(getFormatContents(), patternString);
}
@@ -262,10 +278,10 @@ public class FormatPane extends AbstractBasicStylePane {
this.sampleLabel.setForeground(UIManager.getColor("Label.foreground"));
try {
isRightFormate = true;
- if (StringUtils.isEmpty(patternTextField.getText())) {
+ if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) {
return;
}
- this.sampleLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), patternTextField.getText()));
+ this.sampleLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), String.valueOf(textField.getSelectedItem())));
} catch (Exception e) {
this.sampleLabel.setForeground(Color.red);
this.sampleLabel.setText(e.getMessage());
@@ -285,55 +301,34 @@ public class FormatPane extends AbstractBasicStylePane {
@Override
public void itemStateChanged(ItemEvent e) {
- int contents = getFormatContents();
- CardLayout cardLayout = (CardLayout) centerPane.getLayout();
- if (isTextOrNull()) {
- cardLayout.show(centerPane, "hide");
- patternTextField.setText("");
- } else {
- cardLayout.show(centerPane, "show");
- }
-
- String[] patternArray = FormatField.getInstance().getFormatArray(contents, false);
- //
- DefaultListModel patternModel = (DefaultListModel) patternList.getModel();
- patternModel.removeAllElements();
-
- for (int i = 0; i < patternArray.length; i++) {
- patternModel.addElement(patternArray[i]);
+ if(e.getStateChange() == ItemEvent.SELECTED){
+ int contents = getFormatContents();
+ String[] items = FormatField.getInstance().getFormatArray(contents);
+ CardLayout cardLayout = (CardLayout) centerPane.getLayout();
+
+ if (isTextOrNull()) {
+ centerPane.setPreferredSize(new Dimension(0, 0) );
+ cardLayout.show(centerPane, "hide");
+ } else {
+ textField.removeAllItems();
+ for (int i = 0; i < items.length; i++) {
+ textField.addItem(items[i]);
+ }
+ centerPane.setPreferredSize(new Dimension(270, 70) );
+ cardLayout.show(centerPane, "show");
+ }
+ isFormat = true;
}
- if (patternModel.size() > 0) {
- patternList.setSelectedIndex(0);
- }
}
-
};
- /**
- * text pattern document listener.
- */
- DocumentListener patternTextDocumentListener = new DocumentListener() {
-
- public void insertUpdate(DocumentEvent evt) {
- refreshPreviewLabel();
- }
-
- public void removeUpdate(DocumentEvent evt) {
- refreshPreviewLabel();
- }
-
- public void changedUpdate(DocumentEvent evt) {
- refreshPreviewLabel();
- }
- };
- /**
- * Pattern list selection listener.
- */
- ListSelectionListener patternListSelectionListener = new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent evt) {
- if (!evt.getValueIsAdjusting()) {
- patternTextField.setText((String) patternList.getSelectedValue());
+ ItemListener textFieldItemListener = new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ if(e.getStateChange() == ItemEvent.SELECTED){
+ isFormat = true;
+ refreshPreviewLabel();
}
}
};
@@ -344,6 +339,8 @@ public class FormatPane extends AbstractBasicStylePane {
*/
public void populateBean(Style style) {
this.populateBean(style.getFormat());
+ isFormat = false;
+ this.frFontPane.populateBean(style.getFRFont());
}
@Override
@@ -351,7 +348,12 @@ public class FormatPane extends AbstractBasicStylePane {
* update
*/
public Style update(Style style) {
- return style.deriveFormat(this.update());
+ if (isFormat){
+ isFormat = false;
+ return style.deriveFormat(this.update());
+ } else {
+ return style.deriveFRFont(this.frFontPane.update(style.getFRFont()));
+ }
}
/**
@@ -401,4 +403,5 @@ public class FormatPane extends AbstractBasicStylePane {
}
}
}
+
}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties
index 3c6d79d4dd..a590ac1171 100644
--- a/designer_base/src/com/fr/design/locale/designer.properties
+++ b/designer_base/src/com/fr/design/locale/designer.properties
@@ -1999,10 +1999,55 @@ FR-Designer_Templates_Content=Templates Contents
FR-Designer_AlphaFine_ShowAll=show all
FR-Designer_AlphaFine_Latest=Latest
FR-Designer_AlphaFine_ShowLess=show less
-FR-Designer_Alphafine=AlphaFine
+FR-Designer_AlphaFine=AlphaFine
FR-Designer-Alphafine_No_Remind=
-<<<<<<< HEAD
FR-Designer_AlphaFine_NoResult=no results
FR-Designer_ConnectionFailed=connection failed
FR-Designer_NoResult=No results
FR-Designer-AlphaFine_SetShortcuts=
+FR-Designer_Write_Enhance_Preview=Write Enhance PreviewFR-Designer_Double=Double
+FR-Designer_Query=
+FR-Designer_Font=Font
+FR-Designer_Confirm=
+FR-Designer_Parameter=
+FR-Designer-Plugin_Plugin=Plugin
+FR-Designer_Background=Background
+Template=Template
+
+FR-Designer_Parent_Marked_Field=Parent Marked Field
+FR-Designer_Original_Marked_Filed=Original Marked Filed
+FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=Build Tree according parent's marked filed
+FR-Designer_Build_Tree_Accord_Marked_Filed_Length=Build Tree according marked filed's length
+FR-Product_Demo=Demo
+FR-Designer_Tree_Data_Field=Tree Data Field
+FR-Designer_Data_Filter=Data Filter
+Default=Default
+FR-Base-Load_Resource_File=Load resource file
+FR-Designer_Cell_Element=Cell Element
+FR-Designer_Cell_Attributes=Cell Attributes
+FR-Designer_Float_Element=Float Element
+FR-Designer_Widget_Library=Widget Library
+FR-Designer_No_Settings_Available=No Settings Available!
+FR-Designer_Configured_Roles=Configured role
+FR-Designer_Scale_EnlargeOrReduce=Scale
+FR-Designer_Scale_selfAdaptButton=Fit the selected area exactly
+FR-Designer_Scale_customButton=custom
+FR-Designer_FRFont_Subscript=Subscript
+FR-Designer_FRFont_Superscript=Superscript
+FR-Designer_FRFont_Shadow=Shadow
+FR-Designer_FRFont_Strikethrough=Strikethrough
+FR-Designer_FRFont_Underline=Underline
+FR-Designer_FRFont_bold=bold
+FR-Designer_FRFont_italic=italic
+FR-Designer_FRFont_Foreground=Foreground
+FR-Designer_FRFont_Style=Style
+FR-Designer_FRFont_plain=plain
+FR-Designer_FRFont_bolditalic=bolditalic
+FR-Designer_outBorder=outBorder
+FR-Designer_inBorder=inBorder
+FR-Designer_ExpandD_Up_Father_Cell=Up_Father_Cell
+FR-Designer_ExpandD_Expand_Direction=Expand_Direction
+FR-Designer_Expand=Expand
+FR-Designer_ExpendSort=ExpendSort
+FR-Designer_ExpandD_Expandable=Expandable
+FR-Designer_Read_failure=Read_failure
diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties
index 1d11d02d12..1051af8ef0 100644
--- a/designer_base/src/com/fr/design/locale/designer_en_US.properties
+++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties
@@ -1997,8 +1997,7 @@ FR-Designer_Templates_Content=Files'contents
FR-Designer_AlphaFine_ShowAll=Show all
FR-Designer_AlphaFine_Latest=Recent
FR-Designer_AlphaFine_ShowLess=Show less
-FR-Designer_Alphafine=AlphaFine
-<<<<<<< HEAD
+FR-Designer_AlphaFine=AlphaFine
FR-Designer-Alphafine_No_Remind=don't remind
FR-Designer_AlphaFine_NoResult=No results
FR-Designer_ConnectionFailed=Connection failed
@@ -2006,3 +2005,50 @@ FR-Designer_AlphaFine_EnableAlphaFine=Enable AlphaFine
FR-Designer_AlphaFine_EnableInternet=Internet
FR-Designer_NoResult=No results
FR-Designer-AlphaFine_SetShortcuts=please press two key to set shortcut
+FR-Designer_Write_Enhance_Preview=Write Enhance PreviewFR-Designer_Double=Decimal
+FR-Designer_Query=Query
+FR-Designer_Font=Font
+FR-Designer_Confirm=OK
+FR-Designer_Parameter=Parameter
+FR-Designer-Plugin_Plugin=Plugin
+FR-Designer_Background=BG
+Template=Template
+
+FR-Designer_Original_Marked_Filed=Original Tag Field
+FR-Designer_Build_Tree_Accord_Marked_Filed_Length=Build tree according to tag field's length
+FR-Designer_Can_not_use_FormatBursh=Can't use format painter in multiple selections
+FR-Designer_Tree_Data_Field=Tree Data Field
+FR-Designer_Parent_Marked_Field=Parent Tag Field
+FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=Build Tree according to the parent tag field of the selected data set
+FR-Product_Demo=Demo
+FR-Designer_Data_Filter=Data Filter
+Default=Default
+FR-Base-Load_Resource_File=Load Configuration File
+FR-Designer_Cell_Element=Cell Element
+FR-Designer_Cell_Attributes=Cell Attributes
+FR-Designer_Float_Element=Float Element
+FR-Designer_Widget_Library=Widget Library
+FR-Designer_No_Settings_Available=No Settings Available!
+FR-Designer_Configured_Roles=Configured role
+FR-Designer_Scale_EnlargeOrReduce=Scale
+FR-Designer_Scale_selfAdaptButton=Fit the selected area exactly
+FR-Designer_Scale_customButton=custom
+FR-Designer_FRFont_Subscript=Subscript
+FR-Designer_FRFont_Superscript=\
+FR-Designer_FRFont_Shadow=Shadow
+FR-Designer_FRFont_Strikethrough=Strikethrough
+FR-Designer_FRFont_Underline=Underline
+FR-Designer_FRFont_bold=bold
+FR-Designer_FRFont_italic=italic
+FR-Designer_FRFont_Foreground=Foreground
+FR-Designer_FRFont_Style=Style
+FR-Designer_FRFont_plain=plain
+FR-Designer_FRFont_bolditalic=bolditalic
+FR-Designer_outBorder=outBorder
+FR-Designer_inBorder=inBorder
+FR-Designer_ExpandD_Up_Father_Cell=Up_Father_Cell
+FR-Designer_ExpandD_Expand_Direction=Expand_Direction
+FR-Designer_Expand=Expand
+FR-Designer_ExpendSort=ExpendSort
+FR-Designer_ExpandD_Expandable=Expandable
+FR-Designer_Read_failure=Read_failure
diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties
index 5b73160401..9ba46e7037 100644
--- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties
+++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties
@@ -641,8 +641,8 @@ FR-Server_Embedded_Server_Stop=\u5185\u8535\u30B5\u30FC\u30D0\u30FC-\u4E00\u6642
FR-Designer-Plugin_Detecting_Update=\u66F4\u65B0\u3092\u30C1\u30A7\u30C3\u30AF\u3057\u3066\u3044\u307E\u3059
HF-Whether_to_define_the_selected_type=\u9078\u629E\u3055\u308C\u305F\u30BF\u30A4\u30D7\u3092\u5B9A\u7FA9\u3057\u307E\u3059\u304B
StyleAlignment-Right=\u53F3\u8A70\u3081
-FR-Designer_Alignment-Style=\u30A2\u30E9\u30A4\u30F3\u30E1\u30F3\u30C8
-PageSetup-Title_Start_Column=\u91CD\u8907\u3059\u308B\u6A19\u984C\u5217
+FR-Designer_Alignment-Style=\u63C3\u3048\u65B9\u6CD5
+PageSetup-Title_Start_Column=\u91CD\u8907\u30D8\u30C3\u30C0\u30FC\u5217
Tree-Mutiple_Selection_Or_Not=\u8907\u6570\u9078\u629E
FR-Designer-Plugin_Search=\u691C\u7D22
Choose_Role=\u6A29\u9650\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB
@@ -777,13 +777,13 @@ Cannot-Add_To_This_Area=\u5730\u57DF\u306B\u306F\u8FFD\u52A0\u3067\u304D\u307E\u
Run=\u904B\u884C
Set_Submit_Condition=\u6761\u4EF6\u3092\u8A2D\u7F6E\u306B\u63D0\u51FA\u3059\u308B\u3053\u3068\u306B\u3057\u305F
FR-Base_Value=\u5024
-fileLocked_undeleted=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u304C\u30ED\u30C3\u30AF\u3055\u308C\u3066\u3044\u308B\u3001\u3042\u306A\u305F\u304C\u524A\u9664\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\uFF01
-Web_Apply=WEB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3
-Refresh_Database=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u5237\u65B0
-Set_Row_Title_End=\u91CD\u8907\u3059\u308B\u7D42\u4E86\u884C\u3092\u8A2D\u5B9A
-FR-Utils-New_Folder=\u30D5\u30A1\u30A4\u30EB\u65B0\u898F\u4F5C\u6210
-BiasD-From-upper_left_to_lower_right=\u5DE6\u4E0A\u5074\u304B\u3089\u53F3\u4E0B\u5074\u3078\u5E83\u304C\u308B
-CapsLock=Caps Lock\u30AD\u30FC\u304C\u30AA\u30F3\u306B\u306A\u3063\u3066\u3044\u308B
+fileLocked_undeleted=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u304C\u30ED\u30C3\u30AF\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u524A\u9664\u3067\u304D\u307E\u305B\u3093\u3002OK\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3001\u30EA\u30B9\u30C8\u3092\u518D\u8AAD\u307F\u8FBC\u307F\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+Web_Apply=WEB\u30A2\u30D7\u30EA
+Refresh_Database=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u66F4\u65B0
+Set_Row_Title_End=\u91CD\u8907\u30D5\u30C3\u30BF\u30FC\u884C\u8A2D\u5B9A
+FR-Utils-New_Folder=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0\u30FC\u306E\u4F5C\u6210
+BiasD-From-upper_left_to_lower_right=\u5DE6\u4E0A\u5074\u304B\u3089\u53F3\u4E0B\u5074\u3078\u5E83\u3052\u308B
+CapsLock=Caps Lock\u304C\u30AA\u30F3\u306B\u306A\u3063\u3066\u3044\u308B
StyleFormat-Sample=\u4F8B
RWA-Smart_Add_Cell_Group=\u30A4\u30F3\u30C6\u30EA\u30B8\u30A7\u30F3\u30C8\u6DFB\u52A0\u30EC\u30A4\u30E4\u30FC\u7D44
MConfig-CancelButton=\u30AD\u30E3\u30F3\u30BB\u30EB
@@ -794,7 +794,7 @@ BackgroundTexture-GreenMarble=\u7DD1\u8272\u306E\u5927\u7406\u77F3
read_time_out=\u30ED\u30FC\u30C9\u306E\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8
JavaScript-Commit_to_Database=\u5165\u5EAB\u63D0\u51FA
DS-Relation_TableData=\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u95A2\u9023\u4ED8\u3051
-CellWrite-Page_Before_Row=\u884C\u524D\u306E\u6539\u9801
+CellWrite-Page_Before_Row=\u884C\u524D\u306E\u6539\u30DA\u30FC\u30B8
FR-Designer-Plugin_Load_Plugins_From_Server=\u30D7\u30E9\u30B0\u30A4\u30F3\u30DE\u30FC\u30B1\u30C3\u30C8\u304B\u3089\u30C7\u30FC\u30BF\u53D6\u5F97\u4E2D
D-Dispaly_Divide_Result_Set_into_Groups=resultset\u306E\u30B0\u30EB\u30FC\u30D7\u5206\u3051
Closed=\u9589\u9396\u6E08\u307F
@@ -886,7 +886,7 @@ Device=\u8A2D\u5099
M_Insert-Cell=\u30BB\u30EB\u8981\u7D20
Present-Formula_Present=\u516C\u5F0F\u30D5\u30A9\u30EB\u30E0
FRFont-Superscript=\u4E0A\u4ED8\u304D
-CellWrite-Page_Before_Column=\u5217\u524D\u306E\u6539\u9801
+CellWrite-Page_Before_Column=\u5217\u524D\u306E\u6539\u30DA\u30FC\u30B8
Golden=\u30B4\u30FC\u30EB\u30C7\u30F3
Preference-Support_Cell_Editor_Definition=\u30BB\u30EB\u30A8\u30C7\u30A3\u30BF\u30FC\u3092\u30B5\u30DD\u30FC\u30C8\u3059\u308B
M-Page_Preview=\u30DA\u30FC\u30B8\u5225\u30D7\u30EC\u30D3\u30E5\u30FC
@@ -997,8 +997,8 @@ Hyperlink-Web_link=\u30A6\u30A7\u30D6\u30EA\u30F3\u30AF
StyleAlignment-between_-90_and_90=-90\u304B\u308990\u307E\u3067\u306E\u7BC4\u56F2\u3067
FormulaD-Custom_Function=\u30E6\u30FC\u30B6\u5B9A\u7FA9\u95A2\u6570
FR-Designer_Integer=\u6574\u6570
-PageSetup-Finis_Start_Row=\u91CD\u8907\u3059\u308B\u7D42\u4E86\u884C
-RWA-Remove_Field=\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30EA\u30E0\u30FC\u30D6
+PageSetup-Finis_Start_Row=\u91CD\u8907\u30D5\u30C3\u30BF\u30FC\u884C
+RWA-Remove_Field=\u30D5\u30A3\u30FC\u30EB\u30C9\u524A\u9664
Form-Desin_Width=\u30C7\u30B6\u30A4\u30F3\u5E45
No-tableData=\u623B\u3057\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u304C\u3042\u308A\u307E\u305B\u3093
Page_Total=\u5408\u8A08
@@ -1317,20 +1317,20 @@ FR-Base_Table=\u8868
Des-Remove_WorkSheet=\u9078\u629E\u3059\u308B\u5E33\u7968\u306B\u306F\u30C7\u30FC\u30BF\u304C\u3042\u308B\u304B\u3082\u3057\u308C\u307E\u305B\u3093\u304C\u3001\u5B8C\u5168\u306B\u524A\u9664\u3059\u308B\u5834\u5408\u3001
Rotation=\u56DE\u8EE2
Undefined=\u672A\u5B9A\u7FA9
-Support-Auto_Complete_Shortcut=\u81EA\u52D5\u3067\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8\u30AD\u30FC\u3092\u88DC\u3046
-Set_Column_Title_End=\u91CD\u8907\u3059\u308B\u7D42\u4E86\u5217\u3092\u8A2D\u5B9A
-Submit_Url=\u30A2\u30C9\u30EC\u30B9\u63D0\u51FA
-ReportServerP-Are_you_sure_to_delete_the_selected_printer=\u9078\u629E\u3055\u308C\u305F\u30D7\u30EA\u30F3\u30BF\u30FC\u3092\u524A\u9664\u3057\u3066
-long_data_can_not_show_fully=\u9577\u3044\u30C7\u30FC\u30BF\u304C\u5341\u5206\u306B\u767A\u63EE\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
-Utils-Beyond_the_bottom_side_of_Border=\u4E0B\u9818\u57DF\u3092\u30AA\u30FC\u30D0\u30FC
-FR-Import-Export_PDF=PDF\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8
-Form-CheckBoxGroup=\u30D5\u30EC\u30FC\u30E0\u30BB\u30C3\u30C8\u3092\u8907\u6570\u9078\u629E
-Click-Me=\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u30B5\u30D7\u30E9\u30A4\u30BA\u304C\u3042\u308A\u307E\u3059\u3088\uFF01
-Hyperlink-Self=\u540C\u3058Frame(S)
-Tree-Select_Leaf_Only_Tips=\u30C1\u30A7\u30C3\u30AF\u3057\u306A\u3044\u5834\u5408\u3001\u623B\u308A\u5024\u306F\u5F53\u30CE\u30FC\u30C9\u3060\u3051\u3002
-StyleAlignment-Text_Rotation=\u30C6\u30AD\u30B9\u30C8\u65B9\u5411
-Format-Error=\u5165\u529B\u3057\u305F\u5024\u306E\u66F8\u5F0F\u304C\u4E0D\u6B63\u78BA\u3067\u3059
-Server-Stop=\u4E00\u6642\u505C\u6B62
+Support-Auto_Complete_Shortcut=\u81EA\u52D5\u88DC\u5B8C\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8\u30AD\u30FC
+Set_Column_Title_End=\u91CD\u8907\u30D5\u30C3\u30BF\u30FC\u5217\u8A2D\u5B9A
+Submit_Url=\u66F8\u304D\u8FBC\u307F\u30A2\u30C9\u30EC\u30B9
+ReportServerP-Are_you_sure_to_delete_the_selected_printer=\u9078\u629E\u3055\u308C\u305F\u30D7\u30EA\u30F3\u30BF\u3092\u524A\u9664\u3057\u307E\u3059\u304B
+long_data_can_not_show_fully=\u9577\u3044\u30C7\u30FC\u30BF\u306E\u8868\u793A\u306F\u4E0D\u5B8C\u5168
+Utils-Beyond_the_bottom_side_of_Border=\u4E0B\u306E\u5883\u754C\u3092\u8D85\u904E\u3057\u3066\u3044\u307E\u3059\u3002
+FR-Import-Export_PDF=PDF
+Form-CheckBoxGroup=\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9\u30B0\u30EB\u30FC\u30D7
+Click-Me=\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u30B5\u30D7\u30E9\u30A4\u30BA\u304C\u3042\u308A\u307E\u3059\u3088!
+Hyperlink-Self=\u540C\u3058\u30D5\u30EC\u30FC\u30E0(S)
+Tree-Select_Leaf_Only_Tips=(\u30C1\u30A7\u30C3\u30AF\u304C\u306A\u3044\u5834\u5408\u3001\u5B50\u30CE\u30FC\u30C9\u3092\u542B\u307E\u306A\u3044\u9078\u629E\u306E\u30CE\u30FC\u30C9\u3060\u3051\u3092\u623B\u3059)
+StyleAlignment-Text_Rotation=\u6587\u5B57\u5217\u306E\u65B9\u5411
+Format-Error=\u5165\u529B\u5024\u306E\u66F8\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093
+Server-Stop=\u505C\u6B62
Preference-Setting_Grid=\u30B0\u30EA\u30C3\u30C9\u8A2D\u5B9A
ReportServerP-Add_Printer=\u30D7\u30EA\u30F3\u30BF\u30FC\u8FFD\u52A0
FR-Designer-Plugin_Active=\u4F7F\u7528\u958B\u59CB
@@ -1374,10 +1374,10 @@ Formula_Tips=\u5F0F\u306F "\
FR-Action_Copy=\u30B3\u30D4\u30FC
Compile_Success=\u7DE8\u96C6\u7FFB\u8A33\u306B\u6210\u529F\u3057\u307E\u3057\u305F
BackgroundTexture-RecycledPaper=\u518D\u751F\u7D19
-StyleAlignment-Single_Line=\u4E00\u884C\u3067\u8868\u793A
-Utils-Move_Down=\u4E0B\u3078\u79FB\u52D5
-Please_Set_Repeat_First=\u307E\u305A\u91CD\u8907\u3059\u308B\u6A19\u984C\u884C\u3068\u5217\u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044
-Writer-ShortCuts_Setting=\u5831\u544A\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8\u30AD\u30FC\u8A2D\u5B9A
+StyleAlignment-Single_Line=1\u884C\u8868\u793A
+Utils-Move_Down=\u4E0B\u3078
+Please_Set_Repeat_First=\u91CD\u8907\u30D8\u30C3\u30C0\u30FC\u884C\u3068\u5217\u3092\u4E8B\u524D\u306B\u5B9A\u7FA9\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
+Writer-ShortCuts_Setting=\u66F8\u304D\u8FBC\u307F\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8\u30AD\u30FC\u8A2D\u5B9A
Verify-Data_Verify=\u30C7\u30FC\u30BF\u691C\u8A3C
FR-mobile_analysis_style=\u89E3\u6790\u65B9\u5F0F
Confirm-Delete-File=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u524A\u9664\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F
@@ -1405,13 +1405,13 @@ LayerData=\u5E95\u5C42\u6570\u636E
Rename=\u540D\u79F0\u306E\u5909\u66F4
Widget-Load_By_Async=\u975E\u540C\u671F\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9
Shape=\u56F3\u5F62
-BindColumn-This_Condition_has_been_existed=\u5F53\u8A72\u6761\u4EF6\u306F\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
-NS-exception_readError=\u30A8\u30E9\u30FC\u30B3\u30FC\u30C9\:11300005 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u89E3\u6790\u306B\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3057\u305F
-Set_Column_Title_Start=\u91CD\u8907\u3059\u308B\u6A19\u984C\u5217\u3092\u8A2D\u5B9A
-Fri=\u91D1
-M_Report-Report_Parameter=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC
-REPORTLETS=\u8907\u6570\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u30EB\u30FC\u30C8\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC\u306B\u30A2\u30AF\u30BB\u30B9
-WLayout-Card-ToolTip=\u30AB\u30FC\u30C9\u306E\u30EC\u30A4\u30A2\u30A6\u30C8\u306F\u3001\u30EC\u30A4\u30A2\u30A6\u30C8\u30B3\u30F3\u30C6\u30CA\u5185\u306E\u4ED6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u6570
+BindColumn-This_Condition_has_been_existed=\u3053\u306E\u6761\u4EF6\u306F\u65E2\u306B\u3042\u308A\u307E\u3059
+NS-exception_readError=\u30A8\u30E9\u30FC\u30B3\u30FC\u30C9\:1305 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u89E3\u6790\u30A8\u30E9\u30FC
+Set_Column_Title_Start=\u91CD\u8907\u30D8\u30C3\u30C0\u30FC\u5217\u8A2D\u5B9A
+Fri=\u91D1\u66DC\u65E5
+M_Report-Report_Parameter=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D1\u30E9\u30E1\u30FC\u30BF
+REPORTLETS=\u8907\u6570\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u30D1\u30B9\u306E\u30D1\u30E9\u30E1\u30FC\u30BF
+WLayout-Card-ToolTip=\u30AB\u30FC\u30C9\u578B\u30EC\u30A4\u30A2\u30A6\u30C8\u3002\u3053\u306E\u30EC\u30A4\u30A2\u30A6\u30C8\u30B3\u30F3\u30C6\u30CA\u306B\u8907\u6570\u306E\u4ED6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u3092\u8FFD\u52A0\u3067\u304D\u307E\u3059\u3002
M-Popup_ChartType=\u30B0\u30E9\u30D5\u30BF\u30A4\u30D7
Please-Wait=\u5C11\u3005\u304A\u5F85\u3061\u304F\u3060\u3055\u3044
FR-Designer-Form-ToolBar_Widget=\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB
@@ -1530,7 +1530,7 @@ M_Insert-Barcode=\u30D0\u30FC\u30B3\u30FC\u30C9
Bounds=\u30DC\u30FC\u30C0\u30FC
FR-Designer-Undo_All_Authority_Operations=\u524D\u56DE\u306E\u6A29\u9650\u7DE8\u96C6\u6642\u306E\u5168\u3066\u306E\u30AA\u30DA\u30EC\u30FC\u30B7\u30E7\u30F3\u3092\u64A4\u56DE\u3059
Datasource-Context=\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8
-CellWrite-Page_After_Column=\u5217\u5F8C\u306E\u6539\u9801
+CellWrite-Page_After_Column=\u5217\u5F8C\u306E\u6539\u30DA\u30FC\u30B8
FR-Designer_Cancel=\u30AD\u30E3\u30F3\u30BB\u30EB
Button-Group-Display-Columns=\u5217\u306E\u6570\u3092\u8868\u793A\u3059\u308B
Widget-Height=\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB\u9AD8\u3055
@@ -1736,11 +1736,11 @@ No_Editor_Property_Definition=\u5F53\u8A72\u30A8\u30C7\u30A3\u30BF\u306F\u5C5E\u
Env-Remote_Server=\u30EA\u30E2\u30FC\u30C8\u30B5\u30FC\u30D0\u30FC
FR-Utils_Background=\u80CC\u666F
FR-Designer-Plugin_Warning=\u8B66\u544A
-Server-version-info=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u306F\u3001\u5F8C\u3067\u8A2D\u8A08\u3084\u5143\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u5C5E\u6027\u3092\u5931\u3046\u30EA\u30B9\u30AF\u306B
-CellWrite-Page_After_Row=\u884C\u5F8C\u306E\u6539\u9801
-HF-Right_Section=\u53F3\u5074\u30BB\u30AF\u30B7\u30E7\u30F3
-PageSetup-Title_Start_Row=\u91CD\u8907\u3059\u308B\u6A19\u984C\u884C
-From=\u7B2C\u3000\u304B\u3089
+Server-version-info=\u958B\u3044\u305F\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u306F\u3001\u4E0A\u4F4D\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3\u306E\u30C7\u30B6\u30A4\u30CA\u30FC\u3067\u4F5C\u6210\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u4E0A\u4F4D\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3\u3067\u4F5C\u6210\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F\u3068\u30A8\u30E9\u30FC\u306E\u767A\u751F\u539F\u56E0\u3068\u306A\u308B\u307B\u304B\u3001\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u6A5F\u80FD\u3084\u5C5E\u6027\u306E\u4E00\u90E8\u3092\u5931\u3046\u6050\u308C\u304C\u3042\u308A\u307E\u3059\u3002\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u4F5C\u6210\u7528\u306E\u30C7\u30B6\u30A4\u30CA\u30FC\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u304C\u3001\u914D\u5099\u3055\u308C\u308B\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3\u3088\u308A\u3082\u4E0B\u4F4D\u306E\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3\u3067\u3042\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+CellWrite-Page_After_Row=\u884C\u5F8C\u306E\u6539\u30DA\u30FC\u30B8
+HF-Right_Section=\u53F3\u5074
+PageSetup-Title_Start_Row=\u91CD\u8907\u30D8\u30C3\u30C0\u30FC\u884C
+From=From
Preference-Grid_Line_Color=\u30B0\u30EA\u30C3\u30C9\u7DDA\u306E\u8272
RowTo=\u884C\u304B\u3089\u7B2C\u307E\u3067
FR-Designer_ReportColumns-Repeat_Column=\u5217\u9806\u5E8F\u3092\u30B3\u30D4\u30FC
@@ -1819,8 +1819,8 @@ FR-mobile_native_analysis=\u4E00\u6B21\u89E3\u6790
HighLight=\u30CF\u30A4\u30E9\u30A4\u30C8
FR-Designer_Dropdown-More-Preview=\u4E0B\u62C9\u83B7\u53D6\u66F4\u591A\u9884\u89C8\u65B9\u5F0F
local=\u30ED\u30FC\u30AB\u30EB
-FR-Designer_Gradation=\u69CB\u6210
-PageSetup-Finis_Start_Column=\u91CD\u8907\u3059\u308B\u7D42\u4E86\u5217
+FR-Designer_Gradation=\u30EC\u30D9\u30EB
+PageSetup-Finis_Start_Column=\u91CD\u8907\u30D5\u30C3\u30BF\u30FC\u5217
Env-Invalid_User_and_Password=\u7121\u52B9\u306A\u30E6\u30FC\u30B6\u30FC\u540D\u307E\u305F\u306F\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u3059
FR-Designer-Plugin_All_Plugins=\u5168\u3066\u306E\u30D7\u30E9\u30B0\u30A4\u30F3
FR-Designer_Prepare_Export=\u5C0E\u51FA\u3092\u958B\u59CB\u3057\u3066\u3044\u307E\u3059\u3002\u304A\u5F85\u3061\u304F\u3060\u3055\u3044
@@ -1933,16 +1933,16 @@ Sun=\u65E5
FR-Designer_ToolBar_Bottom=\u30D5\u30C3\u30BF\u30FC\u30C4\u30FC\u30EB\u30D0\u30FC
Widget-Width=\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB\u5E45
Series_Name=\u7CFB\u5217\u540D
-Set_Row_Title_Start=\u91CD\u8907\u3059\u308B\u6A19\u984C\u884C\u3092\u8A2D\u5B9A
-HF-Default_Page=\u30C7\u30D5\u30A9\u30EB\u30C8\u30DA\u30FC\u30B8
-Env_Des=\u30ED\u30B0\u30A4\u30F3\u74B0\u5883\u4E2D\u306E\u5E33\u7968\u5DE5\u7A0B\u306B\u6A29\u9650\u3092\u4ED8\u4E0E\u3059\u308B\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u540D\u3068\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u8A18\u5165\u306F\u5FC5\u305A
-Widget-User_Defined=\u30D7\u30EC\u5B9A\u7FA9
-Url_location=\u7D76\u5BFE\u30EB\u30FC\u30C8
-Disk_File=\u30CF\u30FC\u30C9\u30C7\u30A3\u30B9\u30AF\u30D5\u30A1\u30A4\u30EB
-Inside=\u5185\u90E8
-FR-Designer_filedChosen=
-ServerM-Predefined_Styles=\u30D7\u30EC\u5B9A\u7FA9\u30B9\u30BF\u30A4\u30EB
-is_need_word_adjust=\u884C\u306E\u9AD8\u3055\u3092\u56FA\u5B9A\u305B\u305A\u5C0E\u51FA
+Set_Row_Title_Start=\u91CD\u8907\u30D8\u30C3\u30C0\u30FC\u884C\u8A2D\u5B9A
+HF-Default_Page=\u65E2\u5B9A\u30DA\u30FC\u30B8
+Env_Des=\u30ED\u30B0\u30A4\u30F3\u74B0\u5883\u4E2D\u306E\u5E33\u7968\u5DE5\u7A0B\u306B\u6A29\u9650\u3092\u4ED8\u4E0E\u3059\u308B\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u540D\u3068\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u8A18\u5165\u306F\u5FC5\u305A\u5BFE\u5FDC\u3059\u308B\u30ED\u30B0\u30A4\u30F3\u74B0\u5883\u306E\u30E6\u30FC\u30B6\u30FC\u3068\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u306A\u3051\u308C\u3070\u306A\u308A\u307E\u305B\u3093\u3002
+Widget-User_Defined=\u4E8B\u524D\u5B9A\u7FA9
+Url_location=\u7D76\u5BFE\u30D1\u30B9
+Disk_File=\u30D5\u30A1\u30A4\u30EB
+Inside=\u5185\u5074
+FR-Designer_filedChosen=\u4F9D\u5B58\u30D5\u30A3\u30FC\u30EB\u30C9
+ServerM-Predefined_Styles=\u4E8B\u524D\u5B9A\u7FA9\u30B9\u30BF\u30A4\u30EB
+is_need_word_adjust=\u884C\u306E\u9AD8\u3055\u3092\u56FA\u5B9A\u3057\u306A\u3044
Background-Null=\u80CC\u666F\u306A\u3057
PageSetup-Vertically=\u5782\u76F4\u4E2D\u592E\u63C3\u3048
FR-Designer_Root=\u30EB\u30FC\u30C8\u30CE\u30FC\u30C9
@@ -1976,9 +1976,62 @@ ColumnSpan=\u5217\u7BC4\u56F2
StyleAlignment-Bottom=\u4E0B\u8A70\u3081
Read_failure=\u8AAD\u307F\u306B\u969C\u5BB3\u304C\u767A\u751F\u3059\u308B\u3068\u3001\u30BD\u30FC\u30B9\u00B7\u30D5\u30A1\u30A4\u30EB\u304C\u7834\u640D\u3057\u3066\u3044\u308B
Verify-Verify=\u30C7\u30FC\u30BF\u691C\u8A3C
-FR-Designer-Widget-Style_Title_Format=\u6A19\u984C\u66F8\u5F0F
-FR-Designer_Edit_String_To_Formula=\u30AD\u30E3\u30E9\u30AF\u30BF\u30FC\u6587\u5B57\u5217\u3092\u7DE8\u96C6\u3057\u3066\u516C\u5F0F\u3068\u3059\u308B\u304B\u5426\u304B
-FR-Base_UnSignIn=\ \u672A\u30ED\u30B0\u30A4\u30F3
-Every=\u6BCF
-CellWrite-Preview_Cell_Content=\u30BB\u30EB\u306E\u5185\u5BB9\u3092\u30D7\u30EC\u30D3\u30E5\u30FC\u3059\u308B
-FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
\ No newline at end of file
+FR-Designer-Widget-Style_Title_Format=\u30BF\u30A4\u30C8\u30EB\u66F8\u5F0F
+FR-Designer_Edit_String_To_Formula=\u6587\u5B57\u5217\u3092\u6570\u5F0F\u306B\u7DE8\u96C6\u3059\u308B\u304B
+FR-Base_UnSignIn=\ \u672A\u30ED\u30B0\u30A4\u30F3
+Every=\u6BCE
+CellWrite-Preview_Cell_Content=\u30BB\u30EB\u5185\u5BB9
+FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
+FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
+FR-Designer_Permissions=\u6A29\u9650
+FR-Designer_Form_Button=\u30DC\u30BF\u30F3
+FR-Designer_WF_Name=\u540D
+FR-Designer_Role=\u5F79\u5272
+FR-Designer_Double=\u5C0F\u6570
+FR-Designer_Query=\u30AF\u30A8\u30EA
+FR-Designer_Font=\u30D5\u30A9\u30F3\u30C8
+FR-Designer_Confirm=OK
+FR-Designer_Parameter=\u30D1\u30E9\u30E1\u30FC\u30BF
+FR-Designer-Plugin_Plugin=\u30D7\u30E9\u30B0\u30A4\u30F3
+FR-Designer_Background=\u80CC\u666F
+Template=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8
+FR-Designer_Original_Marked_Filed=\u521D\u671F\u30DE\u30FC\u30AF\u30D5\u30A3\u30FC\u30EB\u30C9
+FR-Designer_Build_Tree_Accord_Marked_Filed_Length=\u30DE\u30FC\u30AF\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u9577\u3055\u3088\u308A\u30C4\u30EA\u30FC\u3092\u69CB\u7BC9\u3059\u308B
+FR-Designer_Tree_Data_Field=\u30C4\u30EA\u30FC\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
+FR-Designer_Parent_Marked_Field=\u89AA\u30DE\u30FC\u30AF\u30D5\u30A3\u30FC\u30EB\u30C9
+FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=\u89AA\u30DE\u30FC\u30AF\u30D5\u30A3\u30FC\u30EB\u30C9\u3088\u308A\u30C4\u30EA\u30FC\u3092\u69CB\u7BC9\u3059\u308B
+FR-Product_Demo=\u88FD\u54C1\u30C7\u30E2
+FR-Designer_Data_Filter=\u30C7\u30FC\u30BF\u30D5\u30A3\u30EB\u30BF
+FR-Designer_Can_not_use_FormatBursh=\u9023\u7D9A\u3057\u306A\u3044\u8907\u6570\u9818\u57DF\u3067\u306F\u66F8\u5F0F\u30B3\u30D4\u30FC\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
+Default=\u65E2\u5B9A
+FR-Base-Load_Resource_File=\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u30ED\u30FC\u30C9
+
+FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
+FR-Designer_Cell_Element=\u30BB\u30EB\u8981\u7D20
+FR-Designer_Cell_Attributes=\u30BB\u30EB\u5C5E\u6027
+FR-Designer_Float_Element=\u30D5\u30ED\u30FC\u30C8\u8981\u7D20
+FR-Designer_Widget_Library=
+FR-Designer_No_Settings_Available=
+FR-Designer_Configured_Roles=\u69CB\u6210\u3055\u308C\u305F\u5F79\u5272
+FR-Designer_Scale_EnlargeOrReduce=
+FR-Designer_Scale_selfAdaptButton=\
+FR-Designer_Scale_customButton=\
+FR-Designer_FRFont_Subscript=\
+FR-Designer_FRFont_Superscript=\
+FR-Designer_FRFont_Shadow=\
+FR-Designer_FRFont_Strikethrough=\
+FR-Designer_FRFont_Underline=\
+FR-Designer_FRFont_bold=\
+FR-Designer_FRFont_italic=\
+FR-Designer_FRFont_Foreground=\
+FR-Designer_FRFont_Style=\
+FR-Designer_FRFont_plain=\
+FR-Designer_FRFont_bolditalic=\
+FR-Designer_outBorder=\
+FR-Designer_inBorder=\
+FR-Designer_ExpandD_Up_Father_Cell=\
+FR-Designer_ExpandD_Expand_Direction=\
+FR-Designer_Expand=\
+FR-Designer_ExpendSort=\
+FR-Designer_ExpandD_Expandable=\
+FR-Designer_Read_failure=\
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties
index 43c9eb1bcb..527dc632e4 100644
--- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties
+++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties
@@ -446,7 +446,6 @@ FR-Designer_WLayout-Absolute-ToolTips=\uC790\uC720\uC2DD\uB808\uC774\uC544\uC6C3
FR-Designer_Add_all=\uBAA8\uB450\uCD94\uAC00
FR-Designer_Reset=
FR-Designer_Language_Change_Successful=
-FR-Designer_Template_Web_Attributes=
FR-Designer_Basic=\uAE30\uBCF8
FR-Designer_Printers(Server)=\uD504\uB9B0\uD130(\uC11C\uBC84)
FR-Designer_Pagination_Setting=\uD398\uC774\uC9C0\uB098\uB204\uAE30\uBBF8\uB9AC\uBCF4\uAE30\uC124\uC815
@@ -1982,4 +1981,55 @@ FR-Designer_Edit_String_To_Formula=\uBB38\uC790\uC5F4\uC744\uC218\uC2DD\uC73C\uB
FR-Base_UnSignIn=\uC544\uC9C1 \uB4F1\uB85D
Every=\uAC01
CellWrite-Preview_Cell_Content=\uC140\uB0B4\uC6A9\uBBF8\uB9AC\uBCF4\uAE30
-FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
\ No newline at end of file
+FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
+FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
+FR-Designer_Permissions=
+FR-Designer_Form_Button=
+FR-Designer_WF_Name=
+FR-Designer_Role=
+FR-Designer_Double=\uC18C\uC218
+FR-Designer_Query=\uCC3E\uC544\uBCF4\uAE30
+FR-Designer_Font=\uAE00\uAF34
+FR-Designer_Confirm=\uD655\uC778
+FR-Designer_Parameter=\uB9E4\uAC1C\uBCC0\uC218
+FR-Designer-Plugin_Plugin=\uD50C\uB7EC\uADF8\uC778
+FR-Designer_Background=\uBC30\uACBD
+Template=\uD15C\uD50C\uB9BF
+
+FR-Designer_Original_Marked_Filed=\uCD08\uAE30\uD0DC\uADF8\uD544\uB4DC
+FR-Designer_Build_Tree_Accord_Marked_Filed_Length=\uC120\uD0DD\uD55C\uB370\uC774\uD130\uC138\uD2B8\uC758\uD0DC\uADF8\uD544\uB4DC\uAE38\uC774\uC5D0\uB530\uB77C\uD2B8\uB9AC\uC0DD\uC131
+FR-Designer_Tree_Data_Field=\uD2B8\uB9AC\uB370\uC774\uD130\uD544\uB4DC
+FR-Designer_Parent_Marked_Field=\uBD80\uBAA8\uD0DC\uADF8\uD544\uB4DC
+FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=\uC120\uD0DD\uD55C\uB370\uC774\uD130\uC138\uD2B8\uC758\uBD80\uBAA8\uD0DC\uADF8\uD544\uB4DC\uC5D0\uB530\uB77C\uD2B8\uB9AC\uC0DD\uC131
+FR-Product_Demo=\uC81C\uD488\uC2DC\uC5F0
+FR-Designer_Data_Filter=\uB370\uC774\uD130\uC120\uBCC4
+Default=\uAE30\uBCF8
+FR-Base-Load_Resource_File=\uB85C\uB529\uAD6C\uC131\uD30C\uC77C
+FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
+FR-Designer_Cell_Element=\uC140\uC694\uC18C
+FR-Designer_Cell_Attributes=\uC140\uC18D\uC131
+FR-Designer_Float_Element=\uD638\uBC84\uC694\uC18C
+FR-Designer_Widget_Library=
+FR-Designer_No_Settings_Available=
+FR-Designer_Configured_Roles=\uC5ED\uD560\uC774\uAD6C\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+FR-Designer_Scale_EnlargeOrReduce=
+FR-Designer_Scale_selfAdaptButton=\
+FR-Designer_FRFont_Subscript=\
+FR-Designer_FRFont_Superscript=\
+FR-Designer_FRFont_Shadow=\
+FR-Designer_FRFont_Strikethrough=\
+FR-Designer_FRFont_Underline=\
+FR-Designer_FRFont_bold=\
+FR-Designer_FRFont_italic=\
+FR-Designer_FRFont_Foreground=\
+FR-Designer_FRFont_Style=\
+FR-Designer_FRFont_plain=\
+FR-Designer_FRFont_bolditalic=\
+FR-Designer_outBorder=\
+FR-Designer_inBorder=\
+FR-Designer_ExpandD_Up_Father_Cell=\
+FR-Designer_ExpandD_Expand_Direction=\
+FR-Designer_Expand=\
+FR-Designer_ExpendSort=\
+FR-Designer_ExpandD_Expandable=\
+FR-Designer_Read_failure=\
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties
index 9e5a80bfa9..788d283cf8 100644
--- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties
+++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties
@@ -1997,9 +1997,57 @@ FR-Designer_AlphaFine_ShowAll=\u663E\u793A\u5168\u90E8
FR-Designer_AlphaFine_Recommend=\u731C\u60A8\u9700\u8981
FR-Designer_AlphaFine_Latest=\u672C\u5730\u5E38\u7528
FR-Designer_AlphaFine_ShowLess=\u6536\u8D77
-FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22
+FR-Designer_AlphaFine=AlphaFine\u667A\u80FD\u641C\u7D22
FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A
FR-Designer_AlphaFine_NoResult=\u6682\u65E0\u76F8\u5173\u5185\u5BB9
FR-Designer_ConnectionFailed=\u94FE\u63A5\u5931\u8D25
FR-Designer_NoResult=\u6682\u4E0D\u652F\u6301\u663E\u793A
FR-Designer-AlphaFine_SetShortcuts=\u8BF7\u76F4\u63A5\u5728\u952E\u76D8\u4E0A\u6309\u4E24\u4E2A\u7EC4\u5408\u952E
+FR-Designer_Write_Enhance_Preview=\u65B0\u586B\u62A5\u9884\u89C8
+FR-Designer_Double=\u5C0F\u6570
+FR-Designer_Query=\u67E5\u8BE2
+FR-Designer_Font=\u5B57\u4F53
+FR-Designer_Confirm=\u786E\u8BA4
+FR-Designer_Parameter=\u53C2\u6570
+FR-Designer-Plugin_Plugin=\u63D2\u4EF6
+FR-Designer_Background=\u80CC\u666F
+Template=\u6A21\u7248
+
+FR-Designer_Original_Marked_Filed=\u539F\u59CB\u6807\u8BB0\u5B57\u6BB5
+FR-Designer_Build_Tree_Accord_Marked_Filed_Length=\u4F9D\u8D56\u6240\u9009\u6570\u636E\u96C6\u7684\u6807\u8BB0\u5B57\u6BB5\u7684\u957F\u5EA6\u6784\u5EFA\u6811
+FR-Designer_Tree_Data_Field=\u6811\u6570\u636E\u5B57\u6BB5
+FR-Designer_Parent_Marked_Field=\u7236\u6807\u8BB0\u5B57\u6BB5
+FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=\u4F9D\u8D56\u6240\u9009\u6570\u636E\u96C6\u7684\u7236\u6807\u8BB0\u5B57\u6BB5\u6784\u5EFA\u6811
+FR-Product_Demo=\u4EA7\u54C1\u6F14\u793A
+FR-Designer_Data_Filter=\u6570\u636E\u7B5B\u9009
+Default=\u9ED8\u8BA4
+FR-Base-Load_Resource_File=\u52A0\u8F7D\u914D\u7F6E\u6587\u4EF6
+
+FR-Designer_Cell_Element=\u5355\u5143\u683C\u5143\u7D20
+FR-Designer_Cell_Attributes=\u5355\u5143\u683C\u5C5E\u6027
+FR-Designer_Float_Element=\u60AC\u6D6E\u5143\u7D20
+FR-Designer_Widget_Library=\u7EC4\u4EF6\u5E93
+FR-Designer_No_Settings_Available=\u65E0\u53EF\u7528\u914D\u7F6E\u9879\uFF01
+FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272
+FR-Designer_Scale_EnlargeOrReduce=\u7F29\u653E
+FR-Designer_Scale_selfAdaptButton=\u6070\u597D\u5BB9\u7EB3\u9009\u5B9A\u533A\u57DF
+FR-Designer_Scale_customButton=\u81EA\u5B9A\u4E49
+FR-Designer_FRFont_Subscript=\u4E0B\u6807
+FR-Designer_FRFont_Superscript=\u4E0A\u6807
+FR-Designer_FRFont_Shadow=\u9634\u5F71
+FR-Designer_FRFont_Strikethrough=\u5220\u9664\u7EBF
+FR-Designer_FRFont_Underline=\u4E0B\u5212\u7EBF
+FR-Designer_FRFont_bold=\u52A0\u7C97
+FR-Designer_FRFont_italic=\u659C\u4F53
+FR-Designer_FRFont_Foreground=\u989C\u8272
+FR-Designer_FRFont_Style=\u5B57\u5F62
+FR-Designer_FRFont_plain=\u5E38\u89C4
+FR-Designer_FRFont_bolditalic=\u52A0\u7C97\u503E\u659C
+FR-Designer_outBorder=\u5916\u8FB9\u6846
+FR-Designer_inBorder=\u5185\u8FB9\u6846
+FR-Designer_ExpandD_Up_Father_Cell=\u4E0A\u7236\u683C
+FR-Designer_ExpandD_Expand_Direction=\u6269\u5C55\u65B9\u5411
+FR-Designer_Expand=\u6269\u5C55
+FR-Designer_ExpendSort=\u6269\u5C55\u540E\u6392\u5E8F
+FR-Designer_ExpandD_Expandable=\u53EF\u4F38\u5C55\u6027
+FR-Designer_Read_failure=\u8BFB\u53D6\u5931\u8D25\uFF0C\u53EF\u80FD\u6E90\u6587\u4EF6\u5DF2\u635F\u574F
diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties
index 313e867403..dad46b8623 100644
--- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties
+++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties
@@ -1997,10 +1997,58 @@ FR-Designer_Templates=\u6A21\u677F
FR-Designer_Templates_Content=\u6A21\u677F\u5167\u5BB9
FR-Designer_AlphaFine_Latest=\u6700\u8FD1\u5E38\u7528
FR-Designer_AlphaFine_ShowLess=\u6536\u8D77
-FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22
+FR-Designer_AlphaFine=AlphaFine\u667A\u80FD\u641C\u7D22
FR-Designer_AlphaFine_ShowAll=\u986F\u793A\u5168\u90E8
FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A
FR-Designer_AlphaFine_NoResult=\u66AB\u7121\u76F8\u95DC\u5167\u5BB9
FR-Designer_ConnectionFailed=\u93C8\u63A5\u5931\u6557
FR-Designer_NoResult=\u66AB\u4E0D\u652F\u6301\u986F\u793A
FR-Designer-AlphaFine_SetShortcuts=\u8ACB\u76F4\u63A5\u5728\u9375\u76E4\u4E0A\u6309\u5169\u500B\u7D44\u5408\u9375
+FR-Designer_Write_Enhance_Preview=\u65B0\u586B\u5831\u9810\u89BD
+FR-Designer_Double=\u5C0F\u6578
+FR-Designer_Query=\u67E5\u8A62
+FR-Designer_Font=\u5B57\u9AD4
+FR-Designer_Confirm=\u78BA\u8A8D
+FR-Designer_Parameter=\u53C3\u6578
+FR-Designer-Plugin_Plugin=\u63D2\u4EF6
+FR-Designer_Background=\u586B\u6EFF\u8272\u5F69
+Template=\u7BC4\u672C
+
+FR-Designer_Original_Marked_Filed=\u539F\u59CB\u6A19\u8A18\u6B04\u4F4D
+FR-Designer_Build_Tree_Accord_Marked_Filed_Length=\u4F9D\u8CF4\u6240\u9078\u8CC7\u6599\u96C6\u7684\u6A19\u8A18\u6B04\u4F4D\u7684\u9577\u5EA6\u69CB\u5EFA\u6A39\u72C0
+FR-Designer_Can_not_use_FormatBursh=\u7121\u6CD5\u4F7F\u7528\u8907\u88FD\u683C\u5F0F
+FR-Designer_Tree_Data_Field=\u6A39\u72C0\u8CC7\u6599\u6B04\u4F4D
+FR-Designer_Parent_Marked_Field=\u7236\u6A19\u8A18\u6B04\u4F4D
+FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=\u4F9D\u8CF4\u6240\u9078\u8CC7\u6599\u96C6\u7684\u7236\u6A19\u8A18\u6B04\u4F4D\u69CB\u5EFA\u6A39
+FR-Product_Demo=\u529F\u80FD\u5C55\u793A
+FR-Designer_Data_Filter=\u8CC7\u6599\u7BE9\u9078
+Default=\u9810\u8A2D
+FR-Base-Load_Resource_File=\u52A0\u8F09\u914D\u7F6E\u6A94\u6848
+
+FR-Designer_Cell_Element=\u5132\u5B58\u683C\u5143\u7D20
+FR-Designer_Cell_Attributes=\u5132\u5B58\u683C\u5C6C\u6027
+FR-Designer_Float_Element=\u61F8\u6D6E\u5143\u7D20
+FR-Designer_Widget_Library=\u7D44\u4EF6\u5EAB
+FR-Designer_No_Settings_Available=\u7121\u53EF\u7528\u914D\u5BD8\u9805\uFF01
+FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272
+FR-Designer_Scale_selfAdaptButton=\
+FR-Designer_Scale_customButton=\
+FR-Designer_FRFont_Subscript=\
+FR-Designer_FRFont_Superscript=\
+FR-Designer_FRFont_Shadow=\
+FR-Designer_FRFont_Strikethrough=\
+FR-Designer_FRFont_Underline=\
+FR-Designer_FRFont_bold=\
+FR-Designer_FRFont_italic=\
+FR-Designer_FRFont_Foreground=\
+FR-Designer_FRFont_Style=\
+FR-Designer_FRFont_plain=\
+FR-Designer_FRFont_bolditalic=\
+FR-Designer_outBorder=\
+FR-Designer_inBorder=\
+FR-Designer_ExpandD_Up_Father_Cell=\
+FR-Designer_ExpandD_Expand_Direction=\
+FR-Designer_Expand=\
+FR-Designer_ExpendSort=\
+FR-Designer_ExpandD_Expandable=\
+FR-Designer_Read_failure=\
diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java
index 91f9c12fb8..f28c43de77 100644
--- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java
+++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java
@@ -255,6 +255,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
basePane.add(centerPane, BorderLayout.CENTER);
laoyoutWestPane();
+// JPanel eastRegionPane = new JPanel(new BorderLayout());
+// eastRegionPane.add(EastRegionContainerPane.getInstance(), BorderLayout.CENTER);
+// eastRegionPane.add(JSliderPane.getInstance(), BorderLayout.SOUTH);
+// basePane.add(eastRegionPane, BorderLayout.EAST);
+
basePane.add(EastRegionContainerPane.getInstance(), BorderLayout.EAST);
basePane.setBounds(0, 0, contentWidth, contentHeight);
@@ -421,10 +426,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
BaseUtils.setAuthorityEditing(false);
WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
- EastRegionContainerPane.getInstance().replaceUpPane(
- HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEastUpPane());
- EastRegionContainerPane.getInstance().replaceDownPane(
- HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEastDownPane());
+ HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
DesignerContext.getDesignerFrame().resetToolkitByPlus(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus());
needToAddAuhtorityPaint();
diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java
index e792cba108..a0a3b8828d 100644
--- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java
+++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java
@@ -1,11 +1,61 @@
package com.fr.design.mainframe;
+import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
-import com.fr.design.gui.icontainer.UIResizableContainer;
-import com.fr.stable.Constants;
+import com.fr.design.constants.UIConstants;
+import com.fr.design.gui.ibutton.UIButton;
+import com.fr.design.gui.icontainer.UIEastResizableContainer;
+import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.layout.VerticalFlowLayout;
+import com.fr.design.utils.gui.GUICoreUtils;
+import com.fr.general.ComparatorUtils;
+import com.fr.general.FRFont;
+import com.fr.general.Inter;
+import com.fr.stable.StringUtils;
+import com.fr.third.fr.pdf.kernel.utils.CompareTool;
-public class EastRegionContainerPane extends UIResizableContainer {
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import java.util.List;
+
+public class EastRegionContainerPane extends UIEastResizableContainer {
private static EastRegionContainerPane THIS;
+ private Map propertyItemMap;
+ private CardLayout propertyCard;
+ private JPanel leftPane;
+ private JPanel rightPane;
+ private static final int CONTAINER_WIDTH = 260;
+ private static final int TAB_WIDTH = 40;
+ private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH;
+ private static final int POPUP_TOOLPANE_HEIGHT = 25;
+ private static final int ARROW_RANGE_START = CONTENT_WIDTH - 30;
+ private static final String KEY_CELL_ELEMENT = "cellElement";
+ private static final String KEY_CELL_ATTR = "cellAttr";
+ private static final String KEY_FLOAT_ELEMENT = "floatElement";
+ private static final String KEY_WIDGET_SETTINGS = "widgetSettings";
+ private static final String KEY_CONDITION_ATTR = "conditionAttr";
+ private static final String KEY_HYPERLINK = "hyperlink";
+ private static final String KEY_WIDGET_LIB = "widgetLib";
+ private static final String KEY_AUTHORITY_EDITION = "authorityEdition";
+ private static final String KEY_CONFIGURED_ROLES = "editedRoles";
+ private static final String DEFAULT_PANE = "defaultPane"; // "无可用配置项"面板
+
+ public enum PropertyMode {
+ REPORT, // 报表
+ REPORT_PARA, // 报表参数面板
+ REPORT_FLOAT, // 报表悬浮元素
+ FORM, // 表单
+ FORM_REPORT, // 表单报表块
+ POLY, // 聚合报表
+ POLY_REPORT, // 聚合报表-报表块
+ POLY_CHART, // 聚合报表-图表块
+ AUTHORITY_EDITION // 权限编辑
+ }
+ private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板)
+
/**
* 得到实例
@@ -15,24 +65,816 @@ public class EastRegionContainerPane extends UIResizableContainer {
public static final EastRegionContainerPane getInstance() {
if (THIS == null) {
THIS = new EastRegionContainerPane();
- THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastEastRegionToolPaneY());
+// THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastEastRegionToolPaneY());
THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth());
}
return THIS;
}
public EastRegionContainerPane() {
- super(Constants.LEFT);
- setVerticalDragEnabled(false);
- setContainerWidth(260);
+ super();
+// setVerticalDragEnabled(false);
+ initPropertyItemList();
+ switchMode(PropertyMode.REPORT);
+// initContentPane();
+// super(leftPane, rightPane);
+ setContainerWidth(CONTAINER_WIDTH);
+ }
+
+ private void initPropertyItemList() {
+ propertyItemMap = new LinkedHashMap<>(); // 有序map
+ // 单元格元素
+ PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, Inter.getLocText("FR-Designer_Cell_Element"),
+ "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
+ new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
+ // 单元格属性
+ PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, Inter.getLocText("FR-Designer_Cell_Attributes"),
+ "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
+ new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
+ // 悬浮元素
+ PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, Inter.getLocText("FR-Designer_Float_Element"),
+ "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
+ new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT});
+ // 控件设置
+ PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, Inter.getLocText("FR-Designer-Widget_Settings"),
+ "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY},
+ new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART});
+ // 条件属性
+ PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, Inter.getLocText("FR-Designer_Condition_Attributes"),
+ "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
+ new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
+ // 超级链接
+ PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, Inter.getLocText("FR-Designer_Hyperlink"),
+ "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
+ new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
+ // 组件库
+ PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"),
+ "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.FORM},
+ new PropertyMode[]{PropertyMode.FORM});
+ // 权限编辑
+ PropertyItem authorityEdition = new PropertyItem(KEY_AUTHORITY_EDITION, Inter.getLocText("FR-Designer_Permissions_Edition"),
+ "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION},
+ new PropertyMode[]{PropertyMode.AUTHORITY_EDITION});
+ // 已配置角色
+ PropertyItem configuredRoles = new PropertyItem(KEY_CONFIGURED_ROLES, Inter.getLocText("FR-Designer_Configured_Roles"),
+ "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION},
+ new PropertyMode[]{PropertyMode.AUTHORITY_EDITION});
+
+ propertyItemMap.put(KEY_CELL_ELEMENT, cellElement);
+ propertyItemMap.put(KEY_CELL_ATTR, cellAttr);
+ propertyItemMap.put(KEY_FLOAT_ELEMENT, floatElement);
+ propertyItemMap.put(KEY_WIDGET_SETTINGS, widgetSettings);
+ propertyItemMap.put(KEY_CONDITION_ATTR, conditionAttr);
+ propertyItemMap.put(KEY_HYPERLINK, hyperlink);
+ propertyItemMap.put(KEY_WIDGET_LIB, widgetLib);
+ propertyItemMap.put(KEY_AUTHORITY_EDITION, authorityEdition);
+ propertyItemMap.put(KEY_CONFIGURED_ROLES, configuredRoles);
+ }
+
+ // "无可用配置项"面板
+ private JPanel getDefaultPane() {
+ JPanel defaultPane = new JPanel();
+ UILabel label = new UILabel(Inter.getLocText("FR-Designer_No_Settings_Available"));
+ defaultPane.setLayout(new BorderLayout());
+ defaultPane.add(label, BorderLayout.CENTER);
+ return defaultPane;
+ }
+
+ private void initContentPane() {
+ initRightPane();
+ initLeftPane();
+ }
+
+ // 右侧属性面板
+ private void initRightPane() {
+ rightPane = new JPanel();
+ propertyCard = new CardLayout();
+ rightPane.setBackground(Color.green);
+ rightPane.setLayout(propertyCard);
+ for (PropertyItem item : propertyItemMap.values()) {
+ if (item.isPoppedOut() || !item.isVisible()) {
+ continue;
+ }
+ rightPane.add(item.getName(), item.getPropertyPanel());
+ }
+ rightPane.add(DEFAULT_PANE, getDefaultPane());
+
+ replaceRightPane(rightPane);
+ refreshRightPane();
+ }
+
+ // 左侧按钮面板
+ private void initLeftPane() {
+ leftPane = new JPanel();
+ leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0));
+ for (PropertyItem item : propertyItemMap.values()) {
+ if (item.isPoppedOut() || !item.isVisible()) {
+ continue;
+ }
+ leftPane.add(item.getButton());
+ }
+
+// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS));
+ leftPane.setBackground(new Color(210, 210, 210));
+ replaceLeftPane(leftPane);
+ }
+
+ public void switchMode(PropertyMode mode) {
+ if (currentMode != null && currentMode.equals(mode)) {
+ return;
+ }
+ currentMode = mode;
+ updateAllPropertyPane();
+ }
+
+ public void updateAllPropertyPane() {
+ updatePropertyItemMap();
+ initContentPane();
+ }
+
+ private void updatePropertyItemMap() {
+ for (PropertyItem item : propertyItemMap.values()) {
+ item.updateStatus();
+ }
+ }
+
+ // 弹出面板时,更新框架内容
+ private void removeItem(PropertyItem propertyItem) {
+ leftPane.remove(propertyItem.getButton());
+ rightPane.remove(propertyItem.getPropertyPanel());
+ refreshRightPane();
+ refreshContainer();
+ }
+
+ @Override
+ public void onResize() {
+ for (PropertyItem item : propertyItemMap.values()) {
+ item.onResize();
+ }
+ }
+
+ public EastRegionContainerPane(JPanel leftPane, JPanel rightPane) {
+ super(leftPane, rightPane);
+// setVerticalDragEnabled(false);
+// setContainerWidth(260);
+ }
+
+ public void replaceUpPane(JComponent pane) {
+ replaceCellElementPane(pane);
+ }
+
+ public void replaceDownPane(JComponent pane) {
+ replaceCellAttrPane(pane);
+ }
+
+ public JComponent getUpPane() {
+ return getCellElementPane();
+ }
+
+ public JComponent getDownPane() {
+ return getCellAttrPane();
+ }
+
+ public void replaceCellElementPane(JComponent pane) {
+ propertyItemMap.get(KEY_CELL_ELEMENT).replaceContentPane(pane);
+ }
+
+ public JComponent getCellElementPane() {
+ return propertyItemMap.get(KEY_CELL_ELEMENT).getContentPane();
+ }
+
+ public void replaceCellAttrPane(JComponent pane) {
+ propertyItemMap.get(KEY_CELL_ATTR).replaceContentPane(pane);
+ }
+
+ public JComponent getCellAttrPane() {
+ return propertyItemMap.get(KEY_CELL_ATTR).getContentPane();
+ }
+
+ public void replaceFloatElementPane(JComponent pane) {
+ propertyItemMap.get(KEY_FLOAT_ELEMENT).replaceContentPane(pane);
+ }
+
+ public JComponent getFloatElementPane() {
+ return propertyItemMap.get(KEY_FLOAT_ELEMENT).getContentPane();
+ }
+
+ public void replaceWidgetSettingsPane(JComponent pane) {
+ propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceContentPane(pane);
+ }
+
+ public JComponent getWidgetSettingsPane() {
+ return propertyItemMap.get(KEY_WIDGET_SETTINGS).getContentPane();
+ }
+
+ public void replaceHyperlinkPane(JComponent pane) {
+ propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(pane);
+ }
+
+ public JComponent getHyperlinkPane() {
+ return propertyItemMap.get(KEY_HYPERLINK).getContentPane();
+ }
+
+ public void replaceWidgetLibPane(JComponent pane) {
+ propertyItemMap.get(KEY_WIDGET_LIB).replaceContentPane(pane);
+ }
+
+ public JComponent getWidgetLibPane() {
+ return propertyItemMap.get(KEY_WIDGET_LIB).getContentPane();
+ }
+
+ public void replaceAuthorityEditionPane(JComponent pane) {
+ propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane);
+ }
+
+ public JComponent getAuthorityEditionPane() {
+ return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane();
+ }
+
+ public void replaceConfiguredRolesPane(JComponent pane) {
+ propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane);
+ }
+
+ public JComponent getConfiguredRolesPane() {
+ return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane();
+ }
+
+ public void addParameterPane(JComponent paraPane) {
+// propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(paraPane);
+ }
+
+ public void setParameterHeight(int height) {
+ // stub
+ }
+
+ public static void main(String[] args){
+ JFrame jf = new JFrame("test");
+// jf = new JFrame("test");
+
+ jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ JPanel cc = new JPanel();
+ cc.setBackground(Color.white);
+// JPanel leftPane = new JPanel();
+// leftPane.setBackground(Color.yellow);
+// JPanel rightPane = new JPanel();
+// rightPane.setBackground(Color.green);
+//
+// JButton b1, b2;
+// b1 = new JButton("b1");
+// b2 = new JButton("b2");
+// b1.setPreferredSize(new Dimension(40, 40));
+// b2.setPreferredSize(new Dimension(40, 40));
+// leftPane.add(b1);
+// leftPane.add(b2);
+// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS));
+
+ JPanel content = (JPanel)jf.getContentPane();
+// content.setLayout(null);
+ content.add(cc, BorderLayout.CENTER);
+ content.add(new EastRegionContainerPane(), BorderLayout.EAST);
+ GUICoreUtils.centerWindow(jf);
+ jf.setSize(400, 400);
+ jf.setVisible(true);
+ }
+
+ public void removeParameterPane() {
+
}
/**
- * 刷新下面板
+ * 刷新右面板
*/
+ public void refreshRightPane() {
+ boolean hasAvailableTab = false;
+ for (String name : propertyItemMap.keySet()) {
+ PropertyItem propertyItem = propertyItemMap.get(name);
+ if (propertyItem.isVisible() && !propertyItem.isPoppedOut() && propertyItem.isEnabled()) {
+ propertyCard.show(rightPane, name); // 显示第一个可用tab
+ hasAvailableTab = true;
+ break;
+ }
+ }
+ if (!hasAvailableTab) {
+ propertyCard.show(rightPane, DEFAULT_PANE);
+ }
+
+// if (this.getRightPane() instanceof DockingView) {
+// ((DockingView) this.getRightPane()).refreshDockingView();
+// }
+ }
+
public void refreshDownPane() {
- if (this.getDownPane() instanceof DockingView) {
- ((DockingView) this.getDownPane()).refreshDockingView();
+// JComponent pane = propertyItemList.get(1).getContentPane();
+// if (pane instanceof DockingView) {
+// ((DockingView) pane).refreshDockingView();
+// }
+ }
+
+ private void refreshContainer() {
+ validate();
+ repaint();
+ revalidate();
+ }
+
+ public int getToolPaneY() {
+ return 0;
+ }
+
+
+
+ class PropertyItem {
+ private UIButton button;
+ private String name; // 用于 card 切换
+ private String title; // 用于显示
+ private JComponent propertyPanel;
+ private JComponent contentPane;
+ private FixedPopupPane popupPane; // 左侧固定弹出框
+ private PopupToolPane popupToolPane; // 弹出工具条
+ private PopupDialog popupDialog; // 弹出框
+ private boolean isPoppedOut = false; // 是否弹出
+ private boolean isVisible = true; // 是否可见
+ private boolean isEnabled = true; // 是否可用
+ private Set visibleModes;
+ private Set enableModes;
+
+ public PropertyItem(String name, String title, String btnUrl, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
+ this.name = name;
+ this.title = title;
+ initButton(btnUrl);
+ initPropertyPanel();
+// this.visibleModes = new ArrayList(visibleModes);
+ initModes(visibleModes, enableModes);
+ }
+
+ private void initModes(PropertyMode[] visibleModes, PropertyMode[] enableModes) {
+ this.enableModes = new HashSet<>();
+ this.visibleModes = new HashSet<>();
+ for (PropertyMode enableMode : enableModes) {
+ this.enableModes.add(enableMode);
+ }
+ for (PropertyMode visibleMode : visibleModes) {
+ this.visibleModes.add(visibleMode);
+ }
+ this.visibleModes.addAll(this.enableModes); // 可用必可见
+ }
+
+ public void updateStatus() {
+ setEnabled(enableModes.contains(currentMode));
+ setVisible(visibleModes.contains(currentMode));
+ }
+
+ public boolean isVisible() {
+ return isVisible;
+ }
+
+ public void setVisible(boolean isVisible) {
+ this.isVisible = isVisible;
+ }
+
+ public boolean isEnabled() {
+ return isEnabled;
+ }
+
+ // 选项不可用
+ public void setEnabled(boolean isEnabled) {
+ this.isEnabled = isEnabled;
+ button.setEnabled(isEnabled);
+ }
+
+ private void initPropertyPanel() {
+ propertyPanel = new JPanel();
+ propertyPanel.setBackground(Color.pink);
+ contentPane = generateContentPane();
+ popupToolPane = new PopupToolPane(this, PopupToolPane.DOWN_BUTTON);
+ propertyPanel.setLayout(new BorderLayout());
+ propertyPanel.add(popupToolPane, BorderLayout.NORTH);
+ propertyPanel.add(contentPane, BorderLayout.CENTER);
+ }
+
+ public boolean isPoppedOut() {
+ return isPoppedOut;
+ }
+
+ public JComponent generateContentPane() {
+ JComponent contentPane = new JPanel();
+ UIButton testBtn = new UIButton(name);
+ testBtn.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ setEnabled(!button.isEnabled());
+ }
+ });
+ contentPane.add(testBtn);
+ return contentPane;
+ }
+
+ public void replaceContentPane(JComponent pane) {
+ propertyPanel.remove(this.contentPane);
+ propertyPanel.add(this.contentPane = pane);
+ if (popupDialog != null && isPoppedOut) {
+ popupDialog.replaceContentPane(contentPane);
+ }
+ if (popupPane != null && !isRightPaneVisible()) {
+ popupPane.replaceContentPane(contentPane);
+ }
+
+ refreshContainer();
+ }
+
+ public JComponent getContentPane() {
+ return contentPane;
+ }
+
+ public void onResize() {
+ if (isRightPaneVisible()) {
+ replaceContentPane(contentPane);
+ } else if(popupPane != null) {
+ popupPane.replaceContentPane(contentPane);
+ }
+ }
+
+// private void refreshContainer() {
+// propertyPanel.validate();
+// propertyPanel.repaint();
+// propertyPanel.revalidate();
+// }
+
+ private void initButton(String btnUrl) {
+ button = new UIButton(BaseUtils.readIcon(btnUrl)) {
+ public Dimension getPreferredSize() {
+ return new Dimension(TAB_WIDTH, TAB_WIDTH);
+ }
+ };
+ button.set4LargeToolbarButton();
+ button.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (isRightPaneVisible()) {
+ propertyCard.show(rightPane, name);
+ } else {
+ popupFixedPane();
+ }
+ }
+ });
+ }
+
+ public UIButton getButton() {
+ return button;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public JComponent getPropertyPanel() {
+ return propertyPanel;
+ }
+
+ // 固定弹窗
+ public void popupFixedPane() {
+ if (popupPane == null) {
+ popupPane = new FixedPopupPane(this);
+ }
+ GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0);
+ }
+
+ // 弹出对话框
+ public void popupDialog() {
+// setIsPoppedOut(true);
+ if (isPoppedOut) {
+ return;
+ }
+ isPoppedOut = true;
+ if (popupDialog == null) {
+ popupDialog = new PopupDialog(this);
+ } else {
+ popupDialog.replaceContentPane(contentPane);
+ popupDialog.setVisible(true);
+ }
+// initContentPane();
+// refreshContainer();
+ removeItem(this);
+ }
+
+ public void popToFrame() {
+ if (isPoppedOut) {
+ isPoppedOut = false;
+// popupDialog.dispose();
+ popupDialog.setVisible(false);
+ initContentPane();
+ onResize();
+ refreshContainer();
+ }
+ }
+ }
+
+ private class FixedPopupPane extends JPopupMenu {
+ private JComponent contentPane;
+// private PopupToolPane popupToolPane;
+ private int fixedHeight;
+ FixedPopupPane(PropertyItem propertyItem) {
+ contentPane = propertyItem.getContentPane();
+ this.setLayout(new BorderLayout());
+// popupToolPane = ;
+ this.add(new PopupToolPane(propertyItem), BorderLayout.NORTH);
+ this.add(contentPane, BorderLayout.CENTER);
+ this.setOpaque(false);
+ fixedHeight = getPreferredSize().height - contentPane.getPreferredSize().height;
+ updateSize();
+ }
+
+ private void updateSize() {
+ int newHeight = fixedHeight + contentPane.getPreferredSize().height;
+ this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight));
+ }
+
+ public JComponent getContentPane() {
+ return contentPane;
+ }
+
+ public void replaceContentPane(JComponent pane) {
+// remove(pane);
+ this.remove(this.contentPane);
+ this.add(this.contentPane = pane);
+ updateSize();
+ refreshContainer();
+ }
+
+ private void refreshContainer() {
+ validate();
+ repaint();
+ revalidate();
+ }
+ }
+
+ // 弹出属性面板的工具条
+ private class PopupToolPane extends JPanel {
+ private int model = UIConstants.MODEL_NORMAL;
+ private String title;
+ private JComponent contentPane;
+ private PropertyItem propertyItem;
+ private String buttonType;
+ private JDialog parentDialog; // 如果不在对话框中,值为null
+ private Color originColor; // 初始背景
+ private boolean isMovable = false;
+ private Point mouseDownCompCoords; // 存储按下左键的位置,移动对话框时会用到
+
+ private static final int MIN_X = -150;
+ private static final int MAX_X_SHIFT = 50;
+ private static final int MAX_Y_SHIFT = 50;
+
+ private static final String NO_BUTTON = "NoButton";
+ private static final String UP_BUTTON = "UpButton";
+ private static final String DOWN_BUTTON = "DownButton";
+
+ private MouseListener mouseListener = new MouseAdapter() {
+ @Override
+ public void mouseExited(MouseEvent e) {
+ setCursor(Cursor.getDefaultCursor());
+ if (mouseDownCompCoords == null) {
+ setBackground(originColor);
+ }
+ model = UIConstants.MODEL_NORMAL;
+ repaint();
+ }
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ if (e.getX() >= ARROW_RANGE_START) {
+ onPop();
+ }
+ }
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ mouseDownCompCoords = null;
+ if (!getBounds().contains(e.getPoint())) {
+ setBackground(originColor);
+ }
+ }
+ @Override
+ public void mousePressed(MouseEvent e) {
+ if (e.getX() < ARROW_RANGE_START) {
+ mouseDownCompCoords = e.getPoint();
+ }
+ }
+ };
+
+ private MouseMotionListener mouseMotionListener = new MouseMotionListener() {
+ @Override
+ public void mouseMoved(MouseEvent e) {
+ if (e.getX() >= ARROW_RANGE_START) {
+ setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ model = UIConstants.MODEL_PRESS;
+ } else if (isMovable) {
+ setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
+ setBackground(Color.pink);
+ } else {
+ setCursor(Cursor.getDefaultCursor());
+ model = UIConstants.MODEL_NORMAL;
+ }
+ repaint();
+ }
+ @Override
+ public void mouseDragged(MouseEvent e) {
+ if (isMovable && mouseDownCompCoords != null) {
+ Point currCoords = e.getLocationOnScreen();
+ int x = currCoords.x - mouseDownCompCoords.x;
+ int y = currCoords.y - mouseDownCompCoords.y;
+ //屏幕可用区域
+ Rectangle screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
+
+ int minY = screen.y;
+ int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - MAX_X_SHIFT;
+ int maxY = Toolkit.getDefaultToolkit().getScreenSize().height - MAX_Y_SHIFT;
+ if (x < MIN_X) {
+ x = MIN_X;
+ } else if (x > maxX) {
+ x = maxX;
+ }
+ if (y < minY) {
+ y = minY;
+ } else if (y > maxY) {
+ y = maxY;
+ }
+ // 移动到屏幕边缘时,需要校正位置
+ parentDialog.setLocation(x, y);
+ }
+ }
+ };
+
+ public PopupToolPane(PropertyItem propertyItem) {
+ this(propertyItem, NO_BUTTON);
+ }
+
+ public PopupToolPane(PropertyItem propertyItem, String buttonType) {
+ super();
+ this.propertyItem = propertyItem;
+ this.title = propertyItem.getTitle();
+ this.contentPane = propertyItem.getContentPane();
+ originColor = getBackground();
+ setLayout(new BorderLayout());
+ UILabel label = new UILabel(title);
+ label.setForeground(new Color(69, 135, 255));
+ add(label, BorderLayout.WEST);
+ setBorder(new EmptyBorder(5, 10, 0, 0));
+
+ initToolButton(buttonType);
+ }
+
+ public void setParentDialog(JDialog parentDialog) {
+ this.parentDialog = parentDialog;
+ isMovable = true;
+ }
+
+ private void initToolButton(final String buttonType) {
+ this.buttonType = buttonType;
+ if (StringUtils.isEmpty(buttonType) || buttonType.equals(NO_BUTTON)) {
+ return;
+ }
+ // validate
+ if (!buttonType.equals(UP_BUTTON) && !buttonType.equals(DOWN_BUTTON)) {
+ throw new IllegalArgumentException("unknown button type: " + buttonType);
+ }
+ addMouseMotionListener(mouseMotionListener);
+ addMouseListener(mouseListener);
+ }
+
+ // 触发弹入、弹出
+ private void onPop() {
+ if (buttonType.equals(DOWN_BUTTON)) {
+ propertyItem.popupDialog();
+ } else if (buttonType.equals(UP_BUTTON)) {
+ propertyItem.popToFrame();
+ }
+ }
+
+ @Override
+ public Dimension getPreferredSize() {
+ return new Dimension(super.getPreferredSize().width, POPUP_TOOLPANE_HEIGHT);
+ }
+
+ @Override
+ public void paint(Graphics g) {
+ super.paint(g);
+ Image button;
+ g.setColor(new Color(69, 135, 255));
+ g.setFont(FRFont.getInstance().applySize(14));
+// g.drawString(title, 5, 20);
+// g.drawImage(UIConstants.DRAG_BAR, 0, 0, CONTENT_WIDTH, POPUP_TOOLPANE_HEIGHT, null);
+
+ if (buttonType.equals(NO_BUTTON)) {
+ return;
+ }
+ if (buttonType.equals(DOWN_BUTTON)) {
+ if (model == UIConstants.MODEL_NORMAL) {
+ button = UIConstants.DRAG_LEFT_NORMAL;
+ } else {
+ button = UIConstants.DRAG_LEFT_PRESS;
+ }
+ } else {
+ if (model == UIConstants.MODEL_NORMAL) {
+ button = UIConstants.DRAG_RIGHT_NORMAL;
+ } else {
+ button = UIConstants.DRAG_RIGHT_PRESS;
+ }
+ }
+// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null);
+ g.drawImage(button, ARROW_RANGE_START + 12, 7, 5, 5, null);
+ }
+ }
+
+ private class PopupDialog extends JDialog {
+ private Container container;
+ private static final int RESIZE_RANGE = 4;
+ private Cursor originCursor;
+ private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
+ private Point mouseDownCompCoords;
+ private int minHeight; // 对话框最小高度
+ private JComponent contentPane;
+ public PopupDialog(PropertyItem propertyItem) {
+ super(DesignerContext.getDesignerFrame());
+ container = getContentPane();
+ setUndecorated(true);
+ PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.UP_BUTTON);
+ popupToolPane.setParentDialog(this);
+ contentPane = propertyItem.getContentPane();
+ container.add(popupToolPane, BorderLayout.NORTH);
+ container.add(contentPane, BorderLayout.CENTER);
+ minHeight = container.getPreferredSize().height;
+ setSize(CONTENT_WIDTH, minHeight);
+// validate();
+ Point btnCoords = propertyItem.getButton().getLocationOnScreen();
+ this.setLocation(btnCoords.x - CONTENT_WIDTH, btnCoords.y);
+
+ initListener();
+ this.setVisible(true);
+ }
+ public void replaceContentPane(JComponent contentPane) {
+ container.remove(this.contentPane);
+ container.add(this.contentPane = contentPane);
+// pack();
+ if (getSize().height < container.getPreferredSize().height) {
+ setSize(CONTENT_WIDTH, container.getPreferredSize().height);
+ }
+ refreshContainer();
+ }
+
+ private void refreshContainer() {
+ validate();
+ repaint();
+ revalidate();
+ }
+
+ private void initListener() {
+ addMouseMotionListener(new MouseMotionListener() {
+ @Override
+ public void mouseDragged(MouseEvent e) {
+ if (mouseDownCompCoords != null) {
+ Rectangle bounds = getBounds();
+ Point currCoords = e.getLocationOnScreen();
+ bounds.height = currCoords.y - mouseDownCompCoords.y + bounds.height;
+ // 校正位置
+ if (bounds.height < minHeight) {
+ bounds.height = minHeight;
+ }
+ mouseDownCompCoords.y = currCoords.y;
+ setBounds(bounds);
+ }
+ }
+
+ @Override
+ public void mouseMoved(MouseEvent e) {
+ if (originCursor == null) { // 记录最初的光标
+ originCursor = getCursor();
+ }
+ if (e.getY() > getHeight() - RESIZE_RANGE) {
+ setCursor(southResizeCursor);
+ } else {
+ // 还原
+ if (mouseDownCompCoords == null && getCursor().equals(southResizeCursor)) {
+ setCursor(originCursor);
+ }
+ }
+
+ repaint();
+ }
+ });
+ addMouseListener(new MouseAdapter() {
+ @Override
+ public void mousePressed(MouseEvent e) {
+ if (getCursor().equals(southResizeCursor)) {
+ mouseDownCompCoords = e.getLocationOnScreen();
+ }
+ }
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ mouseDownCompCoords = null;
+ }
+ });
}
}
}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/mainframe/JFormSliderPane.java b/designer_base/src/com/fr/design/mainframe/JFormSliderPane.java
new file mode 100644
index 0000000000..d34de50bcc
--- /dev/null
+++ b/designer_base/src/com/fr/design/mainframe/JFormSliderPane.java
@@ -0,0 +1,370 @@
+package com.fr.design.mainframe;
+
+import com.fr.base.BaseUtils;
+import com.fr.design.gui.ibutton.UIButton;
+import com.fr.design.gui.ibutton.UIRadioButton;
+import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.gui.islider.UISlider;
+import com.fr.design.gui.ispinner.UIBasicSpinner;
+import com.fr.design.gui.itextfield.UITextField;
+import com.fr.design.layout.TableLayout;
+import com.fr.design.layout.TableLayoutHelper;
+import com.fr.design.utils.gui.GUICoreUtils;
+import com.fr.general.Inter;
+
+import javax.swing.*;
+import javax.swing.border.MatteBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.math.BigDecimal;
+
+/**
+ * Created by MoMeak on 2017/7/13.
+ */
+public class JFormSliderPane extends JPanel {
+
+ private static final double ONEPOINTEIGHT = 1.8;
+ private static final int SIX = 6;
+ private static final int TEN = 10;
+ private static final int ONE_EIGHT = 18;
+ private static final int FONT_SIZE = 14;
+ private static final int SPINNER_WIDTH = 45;
+ private static final int SPINNER_HEIGHT = 20;
+ private static final int HALF_HUNDRED = 50;
+ private static final int HUNDRED = 100;
+ private static final int TWO_HUNDRED = 200;
+ private static final int THREE_HUNDRED = 300;
+ private static final int FOUR_HUNDRED = 400;
+ private static final int DIALOG_WIDTH = 150;
+ private static final int DIALOG_HEIGHT = 240;
+ private static final int SHOWVALBUTTON_WIDTH = 70;
+ private static final int SHOWVALBUTTON_HEIGHTH = 25;
+ public int showValue = 100;
+ public double resolutionTimes = 1.0;
+ private static JFormSliderPane THIS;
+ private UITextField showVal;
+ private JSpinner showValSpinner;
+ private UISlider slider;
+ private int times;
+ private int sliderValue;
+ private UIButton downButton;
+ private UIButton upButton;
+ private UIButton showValButton;
+ private UIRadioButton twoHundredButton;
+ private UIRadioButton oneHundredButton;
+ private UIRadioButton SevenFiveButton;
+ private UIRadioButton fiveTenButton;
+ private UIRadioButton twoFiveButton;
+ private UIRadioButton selfAdaptButton;
+ private UIRadioButton customButton;
+ //拖动条处理和button、直接输入不一样
+ private boolean isButtonOrIsTxt = true;
+ private FormPopupPane dialog;
+ private int upButtonX;
+ private JPanel dialogContentPanel;
+
+
+ public JFormSliderPane() {
+ this.setLayout(new BorderLayout());
+ slider = new UISlider(0, HUNDRED, HALF_HUNDRED);
+ slider.setUI(new JSliderPaneUI(slider));
+ slider.addChangeListener(listener);
+
+ showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1));
+ showValSpinner.setEnabled(true);
+ showValSpinner.addChangeListener(showValSpinnerChangeListener);
+ showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));
+ //MoMeak:控制只能输入10-400,但是用起来感觉不舒服,先注释掉吧
+// JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0");
+// showValSpinner.setEditor(editor);
+// JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
+// textField.setEditable(true);
+// DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory();
+// NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
+// formatter.setAllowsInvalid(false);
+ downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png"));
+ upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png"));
+ downButton.setActionCommand("less");
+ upButton.setActionCommand("more");
+ downButton.addActionListener(buttonActionListener);
+ upButton.addActionListener(buttonActionListener);
+
+ showValButton = new UIButton(showValSpinner.getValue() + "%");
+ showValButton.setBorderPainted(false);
+ showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
+ showValButton.addActionListener(showValButtonActionListener);
+
+ initUIRadioButton();
+ initPane();
+ JPanel panel = new JPanel(new FlowLayout(1, 1, 0));
+ panel.add(downButton);
+ panel.add(slider);
+ panel.add(upButton);
+ panel.add(showValButton);
+ this.add(panel, BorderLayout.NORTH);
+ this.setBounds(0, 0, THREE_HUNDRED, ONE_EIGHT);
+ }
+
+ public static final JFormSliderPane getInstance() {
+// if (THIS == null) {
+// THIS = new JFormSliderPane();
+// }
+ THIS = new JFormSliderPane();
+ return THIS;
+ }
+
+ private void initUIRadioButton() {
+ twoHundredButton = new UIRadioButton("200%");
+ oneHundredButton = new UIRadioButton("100%");
+ SevenFiveButton = new UIRadioButton("75%");
+ fiveTenButton = new UIRadioButton("50%");
+ twoFiveButton = new UIRadioButton("25%");
+// selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
+ customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton"));
+ twoHundredButton.addItemListener(radioButtonItemListener);
+ oneHundredButton.addItemListener(radioButtonItemListener);
+ SevenFiveButton.addItemListener(radioButtonItemListener);
+ fiveTenButton.addItemListener(radioButtonItemListener);
+ twoFiveButton.addItemListener(radioButtonItemListener);
+ //TODO
+// selfAdaptButton.addItemListener();
+
+ ButtonGroup bg = new ButtonGroup();// 初始化按钮组
+ bg.add(twoHundredButton);// 加入按钮组
+ bg.add(oneHundredButton);
+ bg.add(SevenFiveButton);
+ bg.add(fiveTenButton);
+ bg.add(twoFiveButton);
+// bg.add(selfAdaptButton);
+ bg.add(customButton);
+ customButton.setSelected(true);
+ }
+
+ private void initPane() {
+ double p = TableLayout.PREFERRED;
+ double f = TableLayout.FILL;
+ double[] columnSize = {p, f};
+ double[] rowSize = {p, p, p, p, p, p, p};
+ Component[][] components = new Component[][]{
+ new Component[]{twoHundredButton, null},
+ new Component[]{oneHundredButton, null},
+ new Component[]{SevenFiveButton, null},
+ new Component[]{fiveTenButton, null},
+ new Component[]{twoFiveButton, null},
+// new Component[]{selfAdaptButton,null},
+ new Component[]{customButton, createSpinnerPanel()}
+ };
+ dialogContentPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
+ }
+
+ private JPanel createSpinnerPanel() {
+ JPanel spinnerPanel = new JPanel(new FlowLayout());
+ spinnerPanel.add(showValSpinner);
+ UILabel percent = new UILabel("%");
+ percent.setFont(new Font("Dialog", Font.PLAIN, FONT_SIZE));
+ spinnerPanel.add(percent);
+ return spinnerPanel;
+ }
+
+ ActionListener showValButtonActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ popupDialog();
+ }
+ };
+
+ ChangeListener showValSpinnerChangeListener = new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
+ isButtonOrIsTxt = true;
+ resolutionTimes = divide(showValue, 100, 2);
+ if (val > FOUR_HUNDRED) {
+ showValSpinner.setValue(FOUR_HUNDRED);
+ val = FOUR_HUNDRED;
+ }
+ if (val < TEN) {
+ showValSpinner.setValue(TEN);
+ val = TEN;
+ }
+ refreshSlider(val);
+ refreshBottun(val);
+ }
+ };
+
+
+ //定义一个监听器,用于监听所有滑动条
+ ChangeListener listener = new ChangeListener() {
+ public void stateChanged(ChangeEvent event) {
+ //取出滑动条的值,并在文本中显示出来
+ if (!isButtonOrIsTxt) {
+ customButton.setSelected(true);
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ sliderValue = slider.getValue();
+ getTimes(sliderValue);
+ showValue = times;
+ showValSpinner.setValue(times);
+ }
+ });
+ } else {
+ isButtonOrIsTxt = false;
+ }
+ }
+ };
+
+ ItemListener radioButtonItemListener = new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ JRadioButton temp = (JRadioButton) e.getSource();
+ if (temp.isSelected()) {
+ showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%"))));
+ }
+ }
+ };
+
+ private void refreshSlider(int val) {
+ showValue = val;
+ if (showValue > HUNDRED) {
+ slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
+ } else if (showValue < HUNDRED) {
+ slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
+ } else if (showValue == HUNDRED) {
+ slider.setValue(HALF_HUNDRED);
+ }
+ }
+
+
+ private void refreshBottun(int val) {
+ showValButton.setText(val + "%");
+ }
+
+ public double getResolutionTimes() {
+ return this.resolutionTimes;
+ }
+
+ public int getshowValue() {
+ return this.showValue;
+ }
+
+ public static double divide(double v1, double v2, int scale) {
+ BigDecimal b1 = new BigDecimal(Double.toString(v1));
+ BigDecimal b2 = new BigDecimal(Double.toString(v2));
+ return b1.divide(b2, scale).doubleValue();
+ }
+
+ ActionListener buttonActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ showValue = (int) showValSpinner.getValue();
+ isButtonOrIsTxt = true;
+ if (e.getActionCommand().equals("less")) {
+ int newDownVal = showValue - TEN;
+ if (newDownVal >= TEN) {
+ showValue = newDownVal;
+ showValSpinner.setValue(newDownVal);
+ } else {
+ showValue = newDownVal;
+ showValSpinner.setValue(TEN);
+ }
+ }
+ if (e.getActionCommand().equals("more")) {
+ int newUpVal = showValue + TEN;
+ if (newUpVal <= FOUR_HUNDRED) {
+ showValue = newUpVal;
+ showValSpinner.setValue(newUpVal);
+ } else {
+ showValue = newUpVal;
+ showValSpinner.setValue(FOUR_HUNDRED);
+ }
+ }
+ isButtonOrIsTxt = true;
+ customButton.setSelected(true);
+ }
+ };
+
+
+ private void getTimes(int value) {
+ if (value == HALF_HUNDRED) {
+ times = HUNDRED;
+ } else if (value < HALF_HUNDRED) {
+ times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
+ } else {
+ times = (int) (SIX * value - TWO_HUNDRED);
+ }
+ }
+
+
+ public JSpinner getShowVal() {
+ return this.showValSpinner;
+ }
+
+ public UIRadioButton getSelfAdaptButton() {
+ return this.selfAdaptButton;
+ }
+
+ private void popupDialog() {
+ Point btnCoords = upButton.getLocationOnScreen();
+ if (dialog == null) {
+ dialog = new FormPopupPane(upButton, dialogContentPanel);
+ if (upButtonX == 0) {
+ upButtonX = btnCoords.x;
+ GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
+ }
+ } else {
+ if (upButtonX == 0) {
+ upButtonX = btnCoords.x;
+ GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
+ } else {
+ GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ JFrame jf = new JFrame("test");
+ jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ JPanel content = (JPanel) jf.getContentPane();
+ content.setLayout(new BorderLayout());
+ content.add(JFormSliderPane.getInstance(), BorderLayout.CENTER);
+ GUICoreUtils.centerWindow(jf);
+ jf.setSize(400, 80);
+ jf.setVisible(true);
+
+ }
+}
+
+
+class FormPopupPane extends JPopupMenu {
+ private JComponent contentPane;
+ private static final int UPLABEL_HEIGHT = 25;
+ private static final int DIALOG_WIDTH = 150;
+ private static final int DIALOG_HEIGHT = 220;
+ private static final int UPLABEL_WIDTH = 300;
+ private JComponent centerPane;
+ private UILabel upLabel;
+
+ FormPopupPane(UIButton b, JPanel dialogContentPanel) {
+ contentPane = new JPanel(new BorderLayout());
+ centerPane = new JPanel(new BorderLayout());
+ upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
+ upLabel.setOpaque(true);
+ upLabel.setPreferredSize(new Dimension(UPLABEL_WIDTH, UPLABEL_HEIGHT));
+ upLabel.setBackground(Color.LIGHT_GRAY);
+ upLabel.setBorder(new MatteBorder(0, 0, 1, 0, Color.gray));
+ centerPane.add(dialogContentPanel, BorderLayout.NORTH);
+ contentPane.add(upLabel, BorderLayout.NORTH);
+ contentPane.add(centerPane, BorderLayout.CENTER);
+// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
+ this.add(contentPane, BorderLayout.CENTER);
+ this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
+ this.setOpaque(false);
+ }
+
+
+}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/mainframe/JSliderPane.java b/designer_base/src/com/fr/design/mainframe/JSliderPane.java
new file mode 100644
index 0000000000..3feba5efa4
--- /dev/null
+++ b/designer_base/src/com/fr/design/mainframe/JSliderPane.java
@@ -0,0 +1,436 @@
+package com.fr.design.mainframe;
+
+import com.fr.base.BaseUtils;
+import com.fr.design.gui.ibutton.UIButton;
+import com.fr.design.gui.ibutton.UIRadioButton;
+import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.gui.islider.UISlider;
+import com.fr.design.gui.ispinner.UIBasicSpinner;
+import com.fr.design.gui.itextfield.UITextField;
+import com.fr.design.layout.TableLayout;
+import com.fr.design.layout.TableLayoutHelper;
+import com.fr.design.utils.gui.GUICoreUtils;
+import com.fr.general.Inter;
+
+import javax.swing.*;
+import javax.swing.border.MatteBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.plaf.basic.BasicSliderUI;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.math.BigDecimal;
+
+/**
+ * Created by MoMeak on 2017/7/13.
+ */
+public class JSliderPane extends JPanel {
+
+ private static final double ONEPOINTEIGHT = 1.8;
+ private static final int SIX = 6;
+ private static final int TEN = 10;
+ private static final int ONE_EIGHT = 18;
+ private static final int FONT_SIZE = 14;
+ private static final int SPINNER_WIDTH = 45;
+ private static final int SPINNER_HEIGHT = 20;
+ private static final int HALF_HUNDRED = 50;
+ private static final int HUNDRED = 100;
+ private static final int TWO_HUNDRED = 200;
+ private static final int THREE_HUNDRED = 300;
+ private static final int FOUR_HUNDRED = 400;
+ private static final int DIALOG_WIDTH = 150;
+ private static final int DIALOG_HEIGHT = 240;
+ private static final int SHOWVALBUTTON_WIDTH = 70;
+ private static final int SHOWVALBUTTON_HEIGHTH = 25;
+ public int showValue = 100;
+ public double resolutionTimes = 1.0;
+ private static JSliderPane THIS;
+ private UITextField showVal;
+ private JSpinner showValSpinner;
+ private UISlider slider;
+ private int times;
+ private int sliderValue;
+ private UIButton downButton;
+ private UIButton upButton;
+ private UIButton showValButton;
+ private UIRadioButton twoHundredButton;
+ private UIRadioButton oneHundredButton;
+ private UIRadioButton SevenFiveButton;
+ private UIRadioButton fiveTenButton;
+ private UIRadioButton twoFiveButton;
+ private UIRadioButton selfAdaptButton;
+ private UIRadioButton customButton;
+ //拖动条处理和button、直接输入不一样
+ private boolean isButtonOrIsTxt = true;
+ private PopupPane dialog;
+ private int upButtonX;
+ private JPanel dialogContentPanel;
+
+
+ public JSliderPane() {
+ this.setLayout(new BorderLayout());
+ slider = new UISlider(0, HUNDRED, HALF_HUNDRED);
+ slider.setUI(new JSliderPaneUI(slider));
+ slider.addChangeListener(listener);
+
+ showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1));
+ showValSpinner.setEnabled(true);
+ showValSpinner.addChangeListener(showValSpinnerChangeListener);
+ showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));
+ //MoMeak:控制只能输入10-400,但是用起来感觉不舒服,先注释掉吧
+// JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0");
+// showValSpinner.setEditor(editor);
+// JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
+// textField.setEditable(true);
+// DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory();
+// NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
+// formatter.setAllowsInvalid(false);
+ downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png"));
+ upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png"));
+ downButton.setActionCommand("less");
+ upButton.setActionCommand("more");
+ downButton.addActionListener(buttonActionListener);
+ upButton.addActionListener(buttonActionListener);
+
+ showValButton = new UIButton(showValSpinner.getValue() + "%");
+ showValButton.setBorderPainted(false);
+ showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
+ showValButton.addActionListener(showValButtonActionListener);
+ initUIRadioButton();
+ initPane();
+ JPanel panel = new JPanel(new FlowLayout(1, 1, 0));
+ panel.add(downButton);
+ panel.add(slider);
+ panel.add(upButton);
+ panel.add(showValButton);
+ this.add(panel, BorderLayout.NORTH);
+ this.setBounds(0, 0, THREE_HUNDRED, ONE_EIGHT);
+ }
+
+ public static final JSliderPane getInstance() {
+// if (THIS == null) {
+// THIS = new JSliderPane();
+// }
+ THIS = new JSliderPane();
+ return THIS;
+ }
+
+ private void initUIRadioButton() {
+ twoHundredButton = new UIRadioButton("200%");
+ oneHundredButton = new UIRadioButton("100%");
+ SevenFiveButton = new UIRadioButton("75%");
+ fiveTenButton = new UIRadioButton("50%");
+ twoFiveButton = new UIRadioButton("25%");
+ selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
+ customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton"));
+ twoHundredButton.addItemListener(radioButtonItemListener);
+ oneHundredButton.addItemListener(radioButtonItemListener);
+ SevenFiveButton.addItemListener(radioButtonItemListener);
+ fiveTenButton.addItemListener(radioButtonItemListener);
+ twoFiveButton.addItemListener(radioButtonItemListener);
+ //TODO
+// selfAdaptButton.addItemListener();
+
+ ButtonGroup bg = new ButtonGroup();// 初始化按钮组
+ bg.add(twoHundredButton);// 加入按钮组
+ bg.add(oneHundredButton);
+ bg.add(SevenFiveButton);
+ bg.add(fiveTenButton);
+ bg.add(twoFiveButton);
+ bg.add(selfAdaptButton);
+ bg.add(customButton);
+ customButton.setSelected(true);
+ }
+
+ private void initPane() {
+ double p = TableLayout.PREFERRED;
+ double f = TableLayout.FILL;
+ double[] columnSize = {p, f};
+ double[] rowSize = {p, p, p, p, p, p, p};
+ Component[][] components = new Component[][]{
+ new Component[]{twoHundredButton, null},
+ new Component[]{oneHundredButton, null},
+ new Component[]{SevenFiveButton, null},
+ new Component[]{fiveTenButton, null},
+ new Component[]{twoFiveButton, null},
+ new Component[]{selfAdaptButton, null},
+ new Component[]{customButton, createSpinnerPanel()}
+ };
+ dialogContentPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
+ }
+
+ private JPanel createSpinnerPanel() {
+ JPanel spinnerPanel = new JPanel(new FlowLayout());
+ spinnerPanel.add(showValSpinner);
+ UILabel percent = new UILabel("%");
+ percent.setFont(new Font("Dialog", Font.PLAIN, FONT_SIZE));
+ spinnerPanel.add(percent);
+ return spinnerPanel;
+ }
+
+ ActionListener showValButtonActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ popupDialog();
+ }
+ };
+
+ ChangeListener showValSpinnerChangeListener = new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
+ isButtonOrIsTxt = true;
+ resolutionTimes = divide(showValue, 100, 2);
+ if (val > FOUR_HUNDRED) {
+ showValSpinner.setValue(FOUR_HUNDRED);
+ val = FOUR_HUNDRED;
+ }
+ if (val < TEN) {
+ showValSpinner.setValue(TEN);
+ val = TEN;
+ }
+ refreshSlider(val);
+ refreshBottun(val);
+ }
+ };
+
+
+ //定义一个监听器,用于监听所有滑动条
+ ChangeListener listener = new ChangeListener() {
+ public void stateChanged(ChangeEvent event) {
+ //取出滑动条的值,并在文本中显示出来
+ if (!isButtonOrIsTxt) {
+ customButton.setSelected(true);
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ sliderValue = slider.getValue();
+ getTimes(sliderValue);
+ showValue = times;
+ showValSpinner.setValue(times);
+ }
+ });
+ } else {
+ isButtonOrIsTxt = false;
+ }
+ }
+ };
+
+ ItemListener radioButtonItemListener = new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ JRadioButton temp = (JRadioButton) e.getSource();
+ if (temp.isSelected()) {
+ showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%"))));
+ }
+ }
+ };
+
+ private void refreshSlider(int val) {
+ showValue = val;
+ if (showValue > HUNDRED) {
+ slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
+ } else if (showValue < HUNDRED) {
+ slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
+ } else if (showValue == HUNDRED) {
+ slider.setValue(HALF_HUNDRED);
+ }
+ }
+
+
+ private void refreshBottun(int val) {
+ showValButton.setText(val + "%");
+ }
+
+ public double getResolutionTimes() {
+ return this.resolutionTimes;
+ }
+
+ public int getshowValue() {
+ return this.showValue;
+ }
+
+ public static double divide(double v1, double v2, int scale) {
+ BigDecimal b1 = new BigDecimal(Double.toString(v1));
+ BigDecimal b2 = new BigDecimal(Double.toString(v2));
+ return b1.divide(b2, scale).doubleValue();
+ }
+
+ ActionListener buttonActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ showValue = (int) showValSpinner.getValue();
+ isButtonOrIsTxt = true;
+ if (e.getActionCommand().equals("less")) {
+ int newDownVal = showValue - TEN;
+ if (newDownVal >= TEN) {
+ showValue = newDownVal;
+ showValSpinner.setValue(newDownVal);
+ } else {
+ showValue = newDownVal;
+ showValSpinner.setValue(TEN);
+ }
+ }
+ if (e.getActionCommand().equals("more")) {
+ int newUpVal = showValue + TEN;
+ if (newUpVal <= FOUR_HUNDRED) {
+ showValue = newUpVal;
+ showValSpinner.setValue(newUpVal);
+ } else {
+ showValue = newUpVal;
+ showValSpinner.setValue(FOUR_HUNDRED);
+ }
+ }
+ isButtonOrIsTxt = true;
+ customButton.setSelected(true);
+ }
+ };
+
+
+ private void getTimes(int value) {
+ if (value == HALF_HUNDRED) {
+ times = HUNDRED;
+ } else if (value < HALF_HUNDRED) {
+ times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
+ } else {
+ times = (int) (SIX * value - TWO_HUNDRED);
+ }
+ }
+
+
+ public JSpinner getShowVal() {
+ return this.showValSpinner;
+ }
+
+ public UIRadioButton getSelfAdaptButton() {
+ return this.selfAdaptButton;
+ }
+
+ private void popupDialog() {
+ Point btnCoords = upButton.getLocationOnScreen();
+ if (dialog == null) {
+ dialog = new PopupPane(upButton, dialogContentPanel);
+ if (upButtonX == 0) {
+ upButtonX = btnCoords.x;
+ GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
+ }
+ } else {
+ if (upButtonX == 0) {
+ upButtonX = btnCoords.x;
+ GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
+ } else {
+ GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ JFrame jf = new JFrame("test");
+ jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ JPanel content = (JPanel) jf.getContentPane();
+ content.setLayout(new BorderLayout());
+ content.add(JSliderPane.getInstance(), BorderLayout.CENTER);
+ GUICoreUtils.centerWindow(jf);
+ jf.setSize(400, 80);
+ jf.setVisible(true);
+
+ }
+}
+
+class JSliderPaneUI extends BasicSliderUI {
+
+ private static final int VERTICAL_WIDTH = 11;
+ private static final int VERTICAL_HEIGHT = 16;
+ private static final int FOUR = 4;
+ private static final int FIVE = 5;
+ private static final int SIX = 6;
+
+ public JSliderPaneUI(UISlider b) {
+ super(b);
+ }
+
+ /** */
+ /**
+ * 绘制指示物
+ */
+
+ public Dimension getThumbSize() {
+ Dimension size = new Dimension();
+
+ if (slider.getOrientation() == JSlider.VERTICAL) {
+ size.width = VERTICAL_WIDTH;
+ size.height = VERTICAL_HEIGHT;
+ } else {
+ size.width = VERTICAL_WIDTH;
+ size.height = VERTICAL_HEIGHT;
+ }
+
+ return size;
+ }
+
+ public void paintThumb(Graphics g) {
+ Rectangle knobBounds = thumbRect;
+ int w = knobBounds.width;
+ int h = knobBounds.height;
+
+ g.translate(knobBounds.x, knobBounds.y);
+ if (slider.isEnabled()) {
+ g.setColor(slider.getBackground());
+ } else {
+ g.setColor(slider.getBackground().darker());
+ }
+ g.setColor(Color.darkGray);
+ g.fillRect(0, 1, w - SIX, h + 1);
+ }
+
+ /** */
+ /**
+ * 绘制刻度轨迹
+ */
+ public void paintTrack(Graphics g) {
+ int cy, cw;
+ Rectangle trackBounds = trackRect;
+ if (slider.getOrientation() == UISlider.HORIZONTAL) {
+ Graphics2D g2 = (Graphics2D) g;
+ cy = (trackBounds.height / 2);
+ cw = trackBounds.width;
+ g.setColor(Color.lightGray);
+ g.drawLine(0, cy, cw + FIVE, cy);
+ g.drawLine(FIVE + cw / 2, cy - FOUR, FIVE + cw / 2, cy + FOUR);
+ } else {
+ super.paintTrack(g);
+ }
+ }
+
+}
+
+class PopupPane extends JPopupMenu {
+ private JComponent contentPane;
+ private static final int UPLABEL_HEIGHT = 25;
+ private static final int DIALOG_WIDTH = 150;
+ private static final int DIALOG_HEIGHT = 240;
+ private static final int UPLABEL_WIDTH = 300;
+ private JComponent centerPane;
+ private UILabel upLabel;
+
+ PopupPane(UIButton b, JPanel dialogContentPanel) {
+ contentPane = new JPanel(new BorderLayout());
+ centerPane = new JPanel(new BorderLayout());
+ upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
+ upLabel.setOpaque(true);
+ upLabel.setPreferredSize(new Dimension(UPLABEL_WIDTH, UPLABEL_HEIGHT));
+ upLabel.setBackground(Color.LIGHT_GRAY);
+ upLabel.setBorder(new MatteBorder(0, 0, 1, 0, Color.gray));
+ centerPane.add(dialogContentPanel, BorderLayout.NORTH);
+ contentPane.add(upLabel, BorderLayout.NORTH);
+ contentPane.add(centerPane, BorderLayout.CENTER);
+// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
+ this.add(contentPane, BorderLayout.CENTER);
+ this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
+ this.setOpaque(false);
+ }
+
+
+}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java
index a275d3d5df..8f64ce9718 100644
--- a/designer_base/src/com/fr/design/mainframe/JTemplate.java
+++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java
@@ -1,9 +1,6 @@
package com.fr.design.mainframe;
-import com.fr.base.BaseUtils;
-import com.fr.base.ConfigManager;
-import com.fr.base.FRContext;
-import com.fr.base.Parameter;
+import com.fr.base.*;
import com.fr.base.io.IOFile;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
@@ -51,6 +48,7 @@ import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
+import javax.swing.Icon;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager;
import java.awt.*;
@@ -82,6 +80,7 @@ public abstract class JTemplate> ex
private long openTime = 0L; // 打开模板的时间点(包括新建模板)
private TemplateInfoCollector tic = TemplateInfoCollector.getInstance();
private StringBuilder process = new StringBuilder(""); // 制作模板的过程
+ public int resolution = ScreenResolution.getScreenResolution();
public JTemplate(T t, String defaultFileName) {
this(t, new MemFILE(newTemplateNameByIndex(defaultFileName)), true);
@@ -109,6 +108,9 @@ public abstract class JTemplate> ex
}
}
+ // 刷新右侧属性面板
+ public abstract void refreshEastPropertiesPane();
+
// 为收集模版信息作准备
private void initForCollect() {
template.initTemplateID(); // 为新模板设置 templateID 属性
@@ -141,6 +143,14 @@ public abstract class JTemplate> ex
return undoState;
}
+ /**
+ * set/get 模板屏幕分辨率
+ */
+ public abstract void setJTemplateResolution(int resolution);
+
+ public abstract int getJTemplateResolution();
+
+
/**
* 初始化权限细粒度撤销状态
*/
@@ -210,6 +220,18 @@ public abstract class JTemplate> ex
*/
public abstract void removeParameterPaneSelection();
+ /**
+ * 缩放参数
+ */
+ public abstract void setScale(int resolution);
+
+ public abstract int getScale();
+
+ /**
+ * 缩放参数自适应
+ */
+ public abstract int selfAdaptUpdate();
+
protected abstract DesignModelAdapter createDesignModel();
/**
@@ -860,9 +882,7 @@ public abstract class JTemplate> ex
* 返回当前支持的超链界面pane
* @return 超链连接界面
*/
- public HyperlinkGroupPane getHyperLinkPane() {
- return new HyperlinkGroupPane();
- }
+ public abstract HyperlinkGroupPane getHyperLinkPane();
/**
* 是否是图表
diff --git a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppender.java b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppender.java
new file mode 100644
index 0000000000..0531748af2
--- /dev/null
+++ b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppender.java
@@ -0,0 +1,42 @@
+package com.fr.design.mainframe.loghandler;
+
+import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.Level;
+import org.apache.log4j.spi.LoggingEvent;
+
+import java.util.Date;
+
+/**
+ * Created by Administrator on 2017/7/18 0018.
+ */
+public class DesignerLogAppender extends AppenderSkeleton {
+
+ public DesignerLogAppender() {
+ this.layout = new org.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n");
+ }
+
+ protected void append(LoggingEvent event) {
+ this.subAppend(event);
+ }
+
+ public boolean requiresLayout() {
+ return true;
+ }
+
+ public synchronized void close() {
+ if (this.closed) {
+ return;
+ }
+ this.closed = true;
+
+ }
+
+ public void subAppend(LoggingEvent event) {
+ synchronized (DesignerLogHandler.getInstance()) {
+ Level level = event.getLevel();
+ String msg = this.layout.format(event);
+ DesignerLogHandler.getInstance().printRemoteLog(msg, level, new Date());
+ }
+ }
+}
+
diff --git a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
index e45ade484a..a844fd3a2e 100644
--- a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
+++ b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
@@ -6,11 +6,10 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.layout.FRGUIPaneFactory;
-import com.fr.general.ComparatorUtils;
-import com.fr.general.FRLogLevel;
-import com.fr.general.Inter;
-import com.fr.general.LogRecordTime;
+import com.fr.general.*;
+import com.fr.stable.EnvChangedListener;
import com.fr.stable.xml.LogRecordTimeProvider;
+import org.apache.log4j.Level;
import javax.swing.*;
import javax.swing.text.*;
@@ -18,20 +17,29 @@ import java.awt.*;
import java.awt.event.*;
import java.text.SimpleDateFormat;
import java.util.Date;
-import java.util.logging.Handler;
import java.util.logging.LogRecord;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class DesignerLogHandler {
- protected static final int INFO_INT = FRLogLevel.INFO.intValue();
- protected static final int ERRO_INT = FRLogLevel.ERROR.intValue();
- protected static final int SERVER_INT = FRLogLevel.SEVERE.intValue();
+ protected static final int INFO_INT = FRLogLevel.INFO.toInt();
+ protected static final int ERRO_INT = FRLogLevel.ERROR.toInt();
+ protected static final int SERVER_INT = FRLogLevel.SEVERE.toInt();
private static final int GAP_X = -150;
private static final int INFO_GAP_Y = -60;
private static final int ERRO_GAP_Y = -40;
private static final int SERVER_GAP_Y = -20;
+ static {
+ GeneralContext.addEnvChangedListener(new EnvChangedListener() {
+ @Override
+ public void envChanged() {
+ // envchange后需要重新读取webinf里的log4j配置, 重新添加appender
+ FRLogger.getLogger().addLogAppender(new DesignerLogAppender());
+ }
+ });
+ }
+
public static DesignerLogHandler getInstance() {
return HOLDER.singleton;
}
@@ -91,7 +99,7 @@ public class DesignerLogHandler {
@Override
public void actionPerformed(ActionEvent e) {
JPopupMenu showsetPopup = new JPopupMenu();
- int logLevelvalue = DesignerEnvManager.getEnvManager().getLogLevel().intValue();
+ int logLevelvalue = DesignerEnvManager.getEnvManager().getLogLevel().toInt();
if (logLevelvalue <= INFO_INT) {
showsetPopup.add(showInfo);
showsetPopup.add(showError);
@@ -117,8 +125,8 @@ public class DesignerLogHandler {
return caption;
}
- public void printRemoteLog(LogRecordTime logRecordTime) {
- logHandlerArea.printStackTrace(logRecordTime);
+ public void printRemoteLog(String message, Level level, Date date) {
+ logHandlerArea.printStackTrace(message, level, date);
}
private class LogHandlerArea extends JPanel {
@@ -169,21 +177,6 @@ public class DesignerLogHandler {
}
}
});
-
- // 写到日志面板上面的Log和日志工具栏
- FRContext.getLogger().addLogHandler(new Handler() {
- public void publish(LogRecord logRecord) {
- Date date = new Date();
- LogRecordTime logRecordTime = new LogRecordTime(date, logRecord);
- printStackTrace(logRecordTime);
- }
-
- public void flush() {
- }
-
- public void close() {
- }
- });
}
private JTextPane initLogJTextArea() {
@@ -217,6 +210,22 @@ public class DesignerLogHandler {
}
+ public void printStackTrace(String message, Level level, Date date) {
+ int logLevelvalue = level.toInt();
+ if (logLevelvalue == INFO_INT && showInfo.isSelected()) {
+ printMessage(message, logLevelvalue, date);
+ } else if (logLevelvalue == ERRO_INT && showError.isSelected()) {
+ printMessage(message, logLevelvalue, date);
+ } else if (logLevelvalue == SERVER_INT && showServer.isSelected()) {
+ printMessage(message, logLevelvalue, date);
+ }
+
+ }
+
+ private void printMessage(String message, int logLevelvalue, Date date) {
+ printMessage(message, logLevelvalue, date, null);
+ }
+
private void printMessage(String messange, int logLevelvalue, Date date, Throwable e) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
this.log(simpleDateFormat.format(date) + "\n", 0);
diff --git a/designer_base/src/com/fr/design/mainframe/loghandler/LogHandlerBar.java b/designer_base/src/com/fr/design/mainframe/loghandler/LogHandlerBar.java
index eeba6c2fd6..f0caeb6e42 100644
--- a/designer_base/src/com/fr/design/mainframe/loghandler/LogHandlerBar.java
+++ b/designer_base/src/com/fr/design/mainframe/loghandler/LogHandlerBar.java
@@ -1,23 +1,16 @@
package com.fr.design.mainframe.loghandler;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Insets;
-import java.awt.ItemSelectable;
-import java.awt.LayoutManager;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-
-import javax.swing.BorderFactory;
-import javax.swing.JPanel;
-import javax.swing.Timer;
-
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Inter;
+import com.fr.stable.script.Atom;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.concurrent.atomic.AtomicBoolean;
public class LogHandlerBar extends JPanel implements ItemSelectable {
@@ -33,8 +26,6 @@ public class LogHandlerBar extends JPanel implements ItemSelectable {
private int SERVERNUM = 0;
private boolean isWithSerious;
- private int i;
- private Timer timer;
public LogHandlerBar() {
this(null);
@@ -48,17 +39,17 @@ public class LogHandlerBar extends JPanel implements ItemSelectable {
clear.setMargin(null);
clear.setOpaque(false);
clear.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
- clear.setToolTipText(Inter.getLocText("Clear_All"));
+ clear.setToolTipText(Inter.getLocText("FR-Designer_Clear_All"));
selectedall = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/selectedall.png"));
selectedall.setMargin(null);
selectedall.setOpaque(false);
selectedall.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
- selectedall.setToolTipText(Inter.getLocText("Select_All"));
+ selectedall.setToolTipText(Inter.getLocText("FR-Designer_Select_All"));
set = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/setting.png"));
set.setMargin(null);
set.setOpaque(false);
set.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
- set.setToolTipText(Inter.getLocText("Set"));
+ set.setToolTipText(Inter.getLocText("FR-Designer_Set"));
this.add(clear);
this.add(selectedall);
@@ -94,29 +85,14 @@ public class LogHandlerBar extends JPanel implements ItemSelectable {
timerPaint();
}
- public synchronized void timerPaint() {
- isWithSerious = true;
- timer = new Timer(500, null);
- ActionListener taskAction = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (i < 5) {
- isWithSerious = i % 2 == 0 ? true : false;
- repaint();
- } else if (i == 5) {
- if (timer == null)
- return;
- timer.stop();
- timer = null;
- i = 0;
- isWithSerious = true;
- return;
- }
- i++;
- }
- };
- if (timer != null) {
- timer.addActionListener(taskAction);
- timer.start();
+
+ private AtomicBoolean painting = new AtomicBoolean(false);
+
+ public void timerPaint() {
+ if(!painting.get()) {
+ painting.set(true);
+ repaint();
+ painting.set(false);
}
}
@@ -197,11 +173,16 @@ public class LogHandlerBar extends JPanel implements ItemSelectable {
Insets insets = target.getInsets();
int top = insets.top;
int right = target.getWidth() - insets.right;
- clear.setBounds(right - 130, top + 4, clear.getPreferredSize().width, clear.getPreferredSize().height);
- selectedall.setBounds(right - 100, top + 4, selectedall.getPreferredSize().width, selectedall.getPreferredSize().height);
- set.setBounds(right - 70, top + 4, set.getPreferredSize().width, set.getPreferredSize().height);
+ clear.setBounds(right - CLEAR_OFFSET, top + TOP_OFFSET, clear.getPreferredSize().width, clear.getPreferredSize().height);
+ selectedall.setBounds(right - SELECT_OFFSET, top + TOP_OFFSET, selectedall.getPreferredSize().width, selectedall.getPreferredSize().height);
+ set.setBounds(right - SET_OFFSET, top + TOP_OFFSET, set.getPreferredSize().width, set.getPreferredSize().height);
}
+
+ private static final int CLEAR_OFFSET = 130;
+ private static final int TOP_OFFSET = 4;
+ private static final int SELECT_OFFSET = 100;
+ private static final int SET_OFFSET = 70;
}
}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/menu/MenuManager.java b/designer_base/src/com/fr/design/menu/MenuManager.java
index e2019449c0..18d6b0e022 100644
--- a/designer_base/src/com/fr/design/menu/MenuManager.java
+++ b/designer_base/src/com/fr/design/menu/MenuManager.java
@@ -4,7 +4,6 @@ import com.fr.design.DesignState;
import com.fr.design.actions.MenuAction;
import com.fr.file.XMLFileManager;
import com.fr.general.FRLogger;
-import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
@@ -140,7 +139,7 @@ public class MenuManager extends XMLFileManager {
return;
}
try {
- MenuAction action = (MenuAction) GeneralUtils.classForName(name).newInstance();
+ MenuAction action = (MenuAction) reader.getAttrAsClass().newInstance();
menu.addShortCut(action);
} catch (Exception exp) {
FRLogger.getLogger().error(exp.getMessage(), exp);
diff --git a/designer_base/src/com/fr/design/module/DesignModule.java b/designer_base/src/com/fr/design/module/DesignModule.java
index f04aa54741..6fb9b2ac56 100644
--- a/designer_base/src/com/fr/design/module/DesignModule.java
+++ b/designer_base/src/com/fr/design/module/DesignModule.java
@@ -16,7 +16,6 @@ import com.fr.general.Inter;
import com.fr.general.ModuleContext;
import com.fr.js.*;
import com.fr.module.TopModule;
-import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
diff --git a/designer_base/src/com/fr/design/preview/WriteEnhancePreview.java b/designer_base/src/com/fr/design/preview/WriteEnhancePreview.java
new file mode 100644
index 0000000000..71705e9634
--- /dev/null
+++ b/designer_base/src/com/fr/design/preview/WriteEnhancePreview.java
@@ -0,0 +1,40 @@
+package com.fr.design.preview;
+
+import com.fr.base.io.IOFile;
+import com.fr.design.fun.impl.AbstractPreviewProvider;
+import com.fr.general.Inter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by loy on 2017/7/7.
+ */
+public class WriteEnhancePreview extends AbstractPreviewProvider {
+ @Override
+ public String nameForPopupItem() {
+ return Inter.getLocText("FR-Designer_Write_Enhance_Preview");
+ }
+
+ @Override
+ public String iconPathForPopupItem() {
+ return "com/fr/design/images/buttonicon/writes.png";
+ }
+
+ @Override
+ public String iconPathForLarge() {
+ return "com/fr/design/images/buttonicon/writeb24.png";
+ }
+
+ @Override
+ public int previewTypeCode() {
+ return IOFile.WRITE_PREVIEW_TYPE;
+ }
+
+ @Override
+ public Map parametersForPreview() {
+ Map map = new HashMap();
+ map.put("op", "write_ex");
+ return map;
+ }
+}
diff --git a/designer_base/src/com/fr/design/roleAuthority/RoleTree.java b/designer_base/src/com/fr/design/roleAuthority/RoleTree.java
index 1af8c1caa0..ce6102fe31 100644
--- a/designer_base/src/com/fr/design/roleAuthority/RoleTree.java
+++ b/designer_base/src/com/fr/design/roleAuthority/RoleTree.java
@@ -1 +1 @@
-package com.fr.design.roleAuthority;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.itree.checkboxtree.CheckBoxTree;
import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeSelectionModel;
import com.fr.general.NameObject;
import com.fr.design.constants.UIConstants;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.UserObjectRefreshJTree;
import com.fr.design.mainframe.AuthorityPropertyPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.SwingUtilities;
import javax.swing.JTree;
import javax.swing.JComponent;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import java.awt.Component;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
/**
* Author : daisy
* Time: 下午3:32
* Date: 13-8-30
*/
public class RoleTree extends UserObjectRefreshJTree {
private static final long serialVersionUID = 2L;
private String roleName = null;
public RoleTree() {
super();
this.setCellRenderer(roleTreeRenderer);
this.setEnabled(true);
this.setEditable(true);
this.setRowHeight(20);
this.setDigIn(true);
Handler handler = createHandlerForRoleTree();
this.replaceMouseListener(this, handler, 0);
this.replaceKeyListener(this, handler, 0);
this.addTreeSelectionListener(handler);
// this.removeMouseListener(treeMouseListener);
// this.addTreeSelectionListener(new TreeSelectionListener() {
// public void valueChanged(TreeSelectionEvent e) {
// doWithValueChanged(e);
// }
// });
}
public boolean isCheckBoxVisible(TreePath path) {
return true;
}
/**
* Creates the mouse listener and key listener used by RoleTree.
*
* @return the Handler.
*/
protected Handler createHandlerForRoleTree() {
return new Handler(this);
}
protected static class Handler implements MouseListener, KeyListener, TreeSelectionListener {
protected RoleTree _tree;
int _hotspot = new UICheckBox().getPreferredSize().width;
private int _toggleCount = -1;
public Handler(RoleTree tree) {
_tree = tree;
}
protected TreePath getTreePathForMouseEvent(MouseEvent e) {
if (!SwingUtilities.isLeftMouseButton(e)) {
return null;
}
if (!_tree.isCheckBoxEnabled()) {
return null;
}
TreePath path = _tree.getPathForLocation(e.getX(), e.getY());
if (path == null) {
return null;
}
// if (clicksInCheckBox(e, path)) {
return path;
// } else {
// return null;
// }
}
// protected boolean clicksInCheckBox(MouseEvent e, TreePath path) {
// if (!_tree.isCheckBoxVisible(path)) {
// return false;
// } else {
// Rectangle bounds = _tree.getPathBounds(path);
// if (_tree.getComponentOrientation().isLeftToRight()) {
// return e.getX() < bounds.x + _hotspot;
// } else {
// return e.getX() > bounds.x + bounds.width - _hotspot;
// }
// }
// }
private TreePath preventToggleEvent(MouseEvent e) {
TreePath pathForMouseEvent = getTreePathForMouseEvent(e);
if (pathForMouseEvent != null) {
int toggleCount = _tree.getToggleClickCount();
if (toggleCount != -1) {
_toggleCount = toggleCount;
_tree.setToggleClickCount(-1);
}
}
return pathForMouseEvent;
}
public void mouseClicked(MouseEvent e) {
preventToggleEvent(e);
}
public void mousePressed(MouseEvent e) {
TreePath path = preventToggleEvent(e);
if (path != null) {
toggleSelection(path);
e.consume();
}
}
public void mouseReleased(MouseEvent e) {
TreePath path = preventToggleEvent(e);
if (path != null) {
e.consume();
}
if (_toggleCount != -1) {
_tree.setToggleClickCount(_toggleCount);
}
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
public void keyPressed(KeyEvent e) {
if (e.isConsumed()) {
return;
}
if (!_tree.isCheckBoxEnabled()) {
return;
}
if (e.getModifiers() == 0 && e.getKeyChar() == KeyEvent.VK_SPACE) {
toggleSelections();
}
}
public void keyTyped(KeyEvent e) {
}
public void keyReleased(KeyEvent e) {
}
public void valueChanged(TreeSelectionEvent e) {
_tree.treeDidChange();
_tree.doWithValueChanged(e);
}
private void toggleSelection(TreePath path) {
if (!_tree.isEnabled() || !_tree.isCheckBoxEnabled(path)) {
return;
}
CheckBoxTreeSelectionModel selectionModel = _tree.getCheckBoxTreeSelectionModel();
boolean selected = selectionModel.isPathSelected(path, selectionModel.isDigIn());
selectionModel.removeTreeSelectionListener(this);
try {
if (!selectionModel.isSingleEventMode()) {
selectionModel.setBatchMode(true);
}
if (selected)
selectionModel.removeSelectionPath(path);
else
selectionModel.addSelectionPath(path);
} finally {
if (!selectionModel.isSingleEventMode()) {
selectionModel.setBatchMode(false);
}
selectionModel.addTreeSelectionListener(this);
_tree.treeDidChange();
_tree.doWithValueChanged(path);
}
}
protected void toggleSelections() {
TreePath[] treePaths = _tree.getSelectionPaths();
if (treePaths == null) {
return;
}
for (int i = 0, length = treePaths.length; i < length; i++) {
TreePath tmpTreePath = treePaths[i];
toggleSelection(tmpTreePath);
}
// for (TreePath treePath : treePaths) {
// toggleSelection(treePath);
// }
}
}
/**
* 更新UI
*/
public void updateUI() {
super.updateUI();
setUI(new UIRoleTreeUI());
}
/**
* @param e 选中事件
*/
protected void doWithValueChanged(TreeSelectionEvent e) {
if (e.getNewLeadSelectionPath() != null) {
if (!e.getNewLeadSelectionPath().getLastPathComponent().toString().equals(Inter.getLocText("FR-Designer_Role"))) {
roleName = e.getNewLeadSelectionPath().getLastPathComponent().toString();
setTabRoleName(roleName);
refreshRoleTree(roleName);
refreshElementAndAuthorityPane();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().judgeSheetAuthority(roleName);
}
}
}
/**
* @param treepath 所选的节点路径
*/
protected void doWithValueChanged(TreePath treepath) {
if (treepath != null && !treepath.getLastPathComponent().toString().equals(Inter.getLocText("FR-Designer_Role"))) {
roleName = treepath.getLastPathComponent().toString();
setTabRoleName(roleName);
refreshRoleTree(roleName);
refreshElementAndAuthorityPane();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().judgeSheetAuthority(roleName);
}
}
protected void setTabRoleName(String roleName) {
}
/**
* 刷新角色树
*
* @param selectedRole 角色
*/
public void refreshRoleTree(String selectedRole) {
if (EastRegionContainerPane.getInstance().getUpPane() instanceof AuthorityPropertyPane) {
AuthorityPropertyPane authorityPropertyPane = (AuthorityPropertyPane) EastRegionContainerPane.getInstance().getUpPane();
authorityPropertyPane.populate();
EastRegionContainerPane.getInstance().replaceUpPane(authorityPropertyPane);
}
}
public void setSelectedRole(String selectedRole, TreePath parent) {
ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent();
if (node.children() != null && node.getChildCount() >= 0) {
for (Enumeration e = node.children(); e.hasMoreElements(); ) {
ExpandMutableTreeNode n = (ExpandMutableTreeNode) e.nextElement();
Object userObj = n.getUserObject();
String chilld = null;
if (userObj instanceof String) {
chilld = (String) userObj;
} else if (userObj instanceof NameObject) {
NameObject nameObject = (NameObject) userObj;
chilld = nameObject.getName();
}
if (ComparatorUtils.equals(chilld, selectedRole)) {
this.setSelectionPath(parent.pathByAddingChild(n));
return;
} else {
setSelectedRole(selectedRole, parent.pathByAddingChild(n));
}
}
}
}
private void refreshElementAndAuthorityPane() {
JComponent authorityToolBar = DesignerContext.getDesignerFrame().getToolbarComponent();
if (authorityToolBar instanceof BasicBeanPane) {
//说明是工具栏的
((BasicBeanPane) authorityToolBar).populateAuthority();
}
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().repaint();
}
public String getSelectedRoleName() {
return roleName;
}
public void setSelectedRoleName(String name) {
roleName = name;
}
private DefaultTreeCellRenderer roleTreeRenderer = new DefaultTreeCellRenderer() {
private static final long serialVersionUID = 2L;
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);
ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) value;
Object userObj = treeNode.getUserObject();
if (userObj instanceof String) {
// p:这个是column field.
this.setIcon(null);
this.setText((String) userObj);
} else if (userObj instanceof NameObject) {
NameObject nameObject = (NameObject) userObj;
this.setText(nameObject.getName());
this.setIcon(null);
}
// 这里新建一个Label作为render是因为JTree在动态刷新的时候,节点上render画布的的宽度不会变,会使得一部分比较长的数据显示为"..."
this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND);
this.setForeground(UIConstants.FONT_COLOR);
this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE);
return this;
}
};
/**
* 去除不需要的鼠标监听器
*
* @param component 组件
* @param l 所需的鼠标监听器
* @param index 插入的索引
*/
private void replaceMouseListener(Component component, MouseListener l, int index) {
component.removeMouseListener(treeMouseListener);
MouseListener[] listeners = component.getMouseListeners();
for (int i = 0, length = listeners.length; i < length; i++) {
component.removeMouseListener(listeners[i]);
}
// for (MouseListener listener : listeners) {
// component.removeMouseListener(listener);
// }
for (int i = 0; i < listeners.length; i++) {
MouseListener listener = listeners[i];
if (index == i) {
component.addMouseListener(l);
}
if (listener instanceof CheckBoxTree.Handler) {
continue;
}
component.addMouseListener(listener);
}
// index is too large, add to the end.
if (index > listeners.length - 1) {
component.addMouseListener(l);
}
}
/**
* 去除一些不需要的键盘监听器
*
* @param component 组件
* @param l 所需的键盘监听器
* @param index 插入的索引
*/
private void replaceKeyListener(Component component, KeyListener l, int index) {
KeyListener[] listeners = component.getKeyListeners();
for (int i = 0, length = listeners.length; i < length; i++) {
component.removeKeyListener(listeners[i]);
}
// for (MouseListener listener : listeners) {
// component.removeMouseListener(listener);
// }
for (int i = 0; i < listeners.length; i++) {
KeyListener listener = listeners[i];
if (index == i) {
component.addKeyListener(l);
}
if (listener instanceof CheckBoxTree.Handler) {
continue;
}
component.addKeyListener(listener);
}
// index is too large, add to the end.
if (index > listeners.length - 1) {
component.addKeyListener(l);
}
}
/*
* p:获得选中的NameObject = name + role.
*/
public NameObject getSelectedNameObject() {
TreePath selectedTreePath = this.getSelectionPath();
if (selectedTreePath == null) {
return null;
}
ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent();
Object selectedUserObject = selectedTreeNode.getUserObject();
return new NameObject(selectedUserObject.toString(), "");
}
/**
* p:添加一个NameObject节点
*
* @param no 需要添加的节点
*/
public void addNameObject(NameObject no) {
if (no == null) {
return;
}
DefaultTreeModel treeModel = (DefaultTreeModel) this.getModel();
// 新建一个放着NameObject的newChildTreeNode,加到Root下面
ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot();
ExpandMutableTreeNode newChildTreeNode = new ExpandMutableTreeNode(no);
root.add(newChildTreeNode);
newChildTreeNode.add(new ExpandMutableTreeNode());
treeModel.reload(root);
}
/**
* 刷新树节点
*/
public void refreshTreeNode() {
DefaultTreeModel treeModel = (DefaultTreeModel) this.getModel();
ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot();
if (interceptRefresh(root)) {
return;
}
ExpandMutableTreeNode[] new_nodes = loadChildTreeNodes(root);
List childTreeNodeList = new ArrayList();
for (int i = 0, len = root.getChildCount(); i < len; i++) {
if (root.getChildAt(i) instanceof ExpandMutableTreeNode) {
childTreeNodeList.add((ExpandMutableTreeNode) root.getChildAt(i));
} else {
childTreeNodeList.add((DefaultMutableTreeNode) root.getChildAt(i));
}
}
root.removeAllChildren();
for (int ci = 0; ci < new_nodes.length; ci++) {
Object cUserObject = new_nodes[ci].getUserObject();
for (int ni = 0, nlen = childTreeNodeList.size(); ni < nlen; ni++) {
ExpandMutableTreeNode cTreeNode = (ExpandMutableTreeNode) childTreeNodeList.get(ni);
if (ComparatorUtils.equals(cTreeNode.getUserObject(), cUserObject)) {
new_nodes[ci].setExpanded(cTreeNode.isExpanded());
if (cTreeNode.getFirstChild() instanceof ExpandMutableTreeNode && cTreeNode.isExpanded()) {
checkChildNodes(cTreeNode, new_nodes[ci]);
}
break;
}
}
root.add(new_nodes[ci]);
}
}
protected void checkChildNodes(ExpandMutableTreeNode oldNode, ExpandMutableTreeNode newNode) {
for (int i = 0; i < oldNode.getChildCount(); i++) {
ExpandMutableTreeNode oldChild = (ExpandMutableTreeNode) oldNode.getChildAt(i);
for (int j = 0; j < newNode.getChildCount(); j++) {
ExpandMutableTreeNode newChild = (ExpandMutableTreeNode) newNode.getChildAt(j);
ExpandMutableTreeNode[] nodes = RoleTree.this.loadChildTreeNodes(newChild);
for (int k = 0; k < nodes.length; k++) {
newChild.add(nodes[k]);
}
if (newChild.getChildCount() > 1 && ((ExpandMutableTreeNode) newChild.getFirstChild()).getUserObject() == PENDING) {
newChild.remove(0);
}
if (ComparatorUtils.equals(oldChild.getUserObject(), newChild.getUserObject())) {
newChild.setExpanded(oldChild.isExpanded());
}
}
}
}
public NameObject getRealSelectedNameObject() {
TreePath selectedTreePath = this.getSelectionPath();
if (selectedTreePath == null) {
return null;
}
ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent();
Object selectedUserObject = selectedTreeNode.getUserObject();
if (selectedUserObject instanceof NameObject) {
return (NameObject) selectedUserObject;
}
selectedTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent();
selectedUserObject = selectedTreeNode.getUserObject();
if (selectedUserObject instanceof NameObject) {
return (NameObject) selectedUserObject;
}
return null;
}
}
\ No newline at end of file
+package com.fr.design.roleAuthority;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.itree.checkboxtree.CheckBoxTree;
import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeSelectionModel;
import com.fr.general.NameObject;
import com.fr.design.constants.UIConstants;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.UserObjectRefreshJTree;
import com.fr.design.mainframe.AuthorityPropertyPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.SwingUtilities;
import javax.swing.JTree;
import javax.swing.JComponent;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import java.awt.Component;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
/**
* Author : daisy
* Time: 下午3:32
* Date: 13-8-30
*/
public class RoleTree extends UserObjectRefreshJTree {
private static final long serialVersionUID = 2L;
private String roleName = null;
public RoleTree() {
super();
this.setCellRenderer(roleTreeRenderer);
this.setEnabled(true);
this.setEditable(true);
this.setRowHeight(20);
this.setDigIn(true);
Handler handler = createHandlerForRoleTree();
this.replaceMouseListener(this, handler, 0);
this.replaceKeyListener(this, handler, 0);
this.addTreeSelectionListener(handler);
// this.removeMouseListener(treeMouseListener);
// this.addTreeSelectionListener(new TreeSelectionListener() {
// public void valueChanged(TreeSelectionEvent e) {
// doWithValueChanged(e);
// }
// });
}
public boolean isCheckBoxVisible(TreePath path) {
return true;
}
/**
* Creates the mouse listener and key listener used by RoleTree.
*
* @return the Handler.
*/
protected Handler createHandlerForRoleTree() {
return new Handler(this);
}
protected static class Handler implements MouseListener, KeyListener, TreeSelectionListener {
protected RoleTree _tree;
int _hotspot = new UICheckBox().getPreferredSize().width;
private int _toggleCount = -1;
public Handler(RoleTree tree) {
_tree = tree;
}
protected TreePath getTreePathForMouseEvent(MouseEvent e) {
if (!SwingUtilities.isLeftMouseButton(e)) {
return null;
}
if (!_tree.isCheckBoxEnabled()) {
return null;
}
TreePath path = _tree.getPathForLocation(e.getX(), e.getY());
if (path == null) {
return null;
}
// if (clicksInCheckBox(e, path)) {
return path;
// } else {
// return null;
// }
}
// protected boolean clicksInCheckBox(MouseEvent e, TreePath path) {
// if (!_tree.isCheckBoxVisible(path)) {
// return false;
// } else {
// Rectangle bounds = _tree.getPathBounds(path);
// if (_tree.getComponentOrientation().isLeftToRight()) {
// return e.getX() < bounds.x + _hotspot;
// } else {
// return e.getX() > bounds.x + bounds.width - _hotspot;
// }
// }
// }
private TreePath preventToggleEvent(MouseEvent e) {
TreePath pathForMouseEvent = getTreePathForMouseEvent(e);
if (pathForMouseEvent != null) {
int toggleCount = _tree.getToggleClickCount();
if (toggleCount != -1) {
_toggleCount = toggleCount;
_tree.setToggleClickCount(-1);
}
}
return pathForMouseEvent;
}
public void mouseClicked(MouseEvent e) {
preventToggleEvent(e);
}
public void mousePressed(MouseEvent e) {
TreePath path = preventToggleEvent(e);
if (path != null) {
toggleSelection(path);
e.consume();
}
}
public void mouseReleased(MouseEvent e) {
TreePath path = preventToggleEvent(e);
if (path != null) {
e.consume();
}
if (_toggleCount != -1) {
_tree.setToggleClickCount(_toggleCount);
}
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
public void keyPressed(KeyEvent e) {
if (e.isConsumed()) {
return;
}
if (!_tree.isCheckBoxEnabled()) {
return;
}
if (e.getModifiers() == 0 && e.getKeyChar() == KeyEvent.VK_SPACE) {
toggleSelections();
}
}
public void keyTyped(KeyEvent e) {
}
public void keyReleased(KeyEvent e) {
}
public void valueChanged(TreeSelectionEvent e) {
_tree.treeDidChange();
_tree.doWithValueChanged(e);
}
private void toggleSelection(TreePath path) {
if (!_tree.isEnabled() || !_tree.isCheckBoxEnabled(path)) {
return;
}
CheckBoxTreeSelectionModel selectionModel = _tree.getCheckBoxTreeSelectionModel();
boolean selected = selectionModel.isPathSelected(path, selectionModel.isDigIn());
selectionModel.removeTreeSelectionListener(this);
try {
if (!selectionModel.isSingleEventMode()) {
selectionModel.setBatchMode(true);
}
if (selected)
selectionModel.removeSelectionPath(path);
else
selectionModel.addSelectionPath(path);
} finally {
if (!selectionModel.isSingleEventMode()) {
selectionModel.setBatchMode(false);
}
selectionModel.addTreeSelectionListener(this);
_tree.treeDidChange();
_tree.doWithValueChanged(path);
}
}
protected void toggleSelections() {
TreePath[] treePaths = _tree.getSelectionPaths();
if (treePaths == null) {
return;
}
for (int i = 0, length = treePaths.length; i < length; i++) {
TreePath tmpTreePath = treePaths[i];
toggleSelection(tmpTreePath);
}
// for (TreePath treePath : treePaths) {
// toggleSelection(treePath);
// }
}
}
/**
* 更新UI
*/
public void updateUI() {
super.updateUI();
setUI(new UIRoleTreeUI());
}
/**
* @param e 选中事件
*/
protected void doWithValueChanged(TreeSelectionEvent e) {
if (e.getNewLeadSelectionPath() != null) {
if (!e.getNewLeadSelectionPath().getLastPathComponent().toString().equals(Inter.getLocText("FR-Designer_Role"))) {
roleName = e.getNewLeadSelectionPath().getLastPathComponent().toString();
setTabRoleName(roleName);
refreshRoleTree(roleName);
refreshElementAndAuthorityPane();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().judgeSheetAuthority(roleName);
}
}
}
/**
* @param treepath 所选的节点路径
*/
protected void doWithValueChanged(TreePath treepath) {
if (treepath != null && !treepath.getLastPathComponent().toString().equals(Inter.getLocText("FR-Designer_Role"))) {
roleName = treepath.getLastPathComponent().toString();
setTabRoleName(roleName);
refreshRoleTree(roleName);
refreshElementAndAuthorityPane();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().judgeSheetAuthority(roleName);
}
}
protected void setTabRoleName(String roleName) {
}
/**
* 刷新角色树
*
* @param selectedRole 角色
*/
public void refreshRoleTree(String selectedRole) {
if (EastRegionContainerPane.getInstance().getAuthorityEditionPane() instanceof AuthorityPropertyPane) {
AuthorityPropertyPane authorityPropertyPane = (AuthorityPropertyPane) EastRegionContainerPane.getInstance().getAuthorityEditionPane();
authorityPropertyPane.populate();
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(authorityPropertyPane);
}
}
public void setSelectedRole(String selectedRole, TreePath parent) {
ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent();
if (node.children() != null && node.getChildCount() >= 0) {
for (Enumeration e = node.children(); e.hasMoreElements(); ) {
ExpandMutableTreeNode n = (ExpandMutableTreeNode) e.nextElement();
Object userObj = n.getUserObject();
String chilld = null;
if (userObj instanceof String) {
chilld = (String) userObj;
} else if (userObj instanceof NameObject) {
NameObject nameObject = (NameObject) userObj;
chilld = nameObject.getName();
}
if (ComparatorUtils.equals(chilld, selectedRole)) {
this.setSelectionPath(parent.pathByAddingChild(n));
return;
} else {
setSelectedRole(selectedRole, parent.pathByAddingChild(n));
}
}
}
}
private void refreshElementAndAuthorityPane() {
JComponent authorityToolBar = DesignerContext.getDesignerFrame().getToolbarComponent();
if (authorityToolBar instanceof BasicBeanPane) {
//说明是工具栏的
((BasicBeanPane) authorityToolBar).populateAuthority();
}
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().repaint();
}
public String getSelectedRoleName() {
return roleName;
}
public void setSelectedRoleName(String name) {
roleName = name;
}
private DefaultTreeCellRenderer roleTreeRenderer = new DefaultTreeCellRenderer() {
private static final long serialVersionUID = 2L;
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);
ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) value;
Object userObj = treeNode.getUserObject();
if (userObj instanceof String) {
// p:这个是column field.
this.setIcon(null);
this.setText((String) userObj);
} else if (userObj instanceof NameObject) {
NameObject nameObject = (NameObject) userObj;
this.setText(nameObject.getName());
this.setIcon(null);
}
// 这里新建一个Label作为render是因为JTree在动态刷新的时候,节点上render画布的的宽度不会变,会使得一部分比较长的数据显示为"..."
this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND);
this.setForeground(UIConstants.FONT_COLOR);
this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE);
return this;
}
};
/**
* 去除不需要的鼠标监听器
*
* @param component 组件
* @param l 所需的鼠标监听器
* @param index 插入的索引
*/
private void replaceMouseListener(Component component, MouseListener l, int index) {
component.removeMouseListener(treeMouseListener);
MouseListener[] listeners = component.getMouseListeners();
for (int i = 0, length = listeners.length; i < length; i++) {
component.removeMouseListener(listeners[i]);
}
// for (MouseListener listener : listeners) {
// component.removeMouseListener(listener);
// }
for (int i = 0; i < listeners.length; i++) {
MouseListener listener = listeners[i];
if (index == i) {
component.addMouseListener(l);
}
if (listener instanceof CheckBoxTree.Handler) {
continue;
}
component.addMouseListener(listener);
}
// index is too large, add to the end.
if (index > listeners.length - 1) {
component.addMouseListener(l);
}
}
/**
* 去除一些不需要的键盘监听器
*
* @param component 组件
* @param l 所需的键盘监听器
* @param index 插入的索引
*/
private void replaceKeyListener(Component component, KeyListener l, int index) {
KeyListener[] listeners = component.getKeyListeners();
for (int i = 0, length = listeners.length; i < length; i++) {
component.removeKeyListener(listeners[i]);
}
// for (MouseListener listener : listeners) {
// component.removeMouseListener(listener);
// }
for (int i = 0; i < listeners.length; i++) {
KeyListener listener = listeners[i];
if (index == i) {
component.addKeyListener(l);
}
if (listener instanceof CheckBoxTree.Handler) {
continue;
}
component.addKeyListener(listener);
}
// index is too large, add to the end.
if (index > listeners.length - 1) {
component.addKeyListener(l);
}
}
/*
* p:获得选中的NameObject = name + role.
*/
public NameObject getSelectedNameObject() {
TreePath selectedTreePath = this.getSelectionPath();
if (selectedTreePath == null) {
return null;
}
ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent();
Object selectedUserObject = selectedTreeNode.getUserObject();
return new NameObject(selectedUserObject.toString(), "");
}
/**
* p:添加一个NameObject节点
*
* @param no 需要添加的节点
*/
public void addNameObject(NameObject no) {
if (no == null) {
return;
}
DefaultTreeModel treeModel = (DefaultTreeModel) this.getModel();
// 新建一个放着NameObject的newChildTreeNode,加到Root下面
ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot();
ExpandMutableTreeNode newChildTreeNode = new ExpandMutableTreeNode(no);
root.add(newChildTreeNode);
newChildTreeNode.add(new ExpandMutableTreeNode());
treeModel.reload(root);
}
/**
* 刷新树节点
*/
public void refreshTreeNode() {
DefaultTreeModel treeModel = (DefaultTreeModel) this.getModel();
ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot();
if (interceptRefresh(root)) {
return;
}
ExpandMutableTreeNode[] new_nodes = loadChildTreeNodes(root);
List childTreeNodeList = new ArrayList();
for (int i = 0, len = root.getChildCount(); i < len; i++) {
if (root.getChildAt(i) instanceof ExpandMutableTreeNode) {
childTreeNodeList.add((ExpandMutableTreeNode) root.getChildAt(i));
} else {
childTreeNodeList.add((DefaultMutableTreeNode) root.getChildAt(i));
}
}
root.removeAllChildren();
for (int ci = 0; ci < new_nodes.length; ci++) {
Object cUserObject = new_nodes[ci].getUserObject();
for (int ni = 0, nlen = childTreeNodeList.size(); ni < nlen; ni++) {
ExpandMutableTreeNode cTreeNode = (ExpandMutableTreeNode) childTreeNodeList.get(ni);
if (ComparatorUtils.equals(cTreeNode.getUserObject(), cUserObject)) {
new_nodes[ci].setExpanded(cTreeNode.isExpanded());
if (cTreeNode.getFirstChild() instanceof ExpandMutableTreeNode && cTreeNode.isExpanded()) {
checkChildNodes(cTreeNode, new_nodes[ci]);
}
break;
}
}
root.add(new_nodes[ci]);
}
}
protected void checkChildNodes(ExpandMutableTreeNode oldNode, ExpandMutableTreeNode newNode) {
for (int i = 0; i < oldNode.getChildCount(); i++) {
ExpandMutableTreeNode oldChild = (ExpandMutableTreeNode) oldNode.getChildAt(i);
for (int j = 0; j < newNode.getChildCount(); j++) {
ExpandMutableTreeNode newChild = (ExpandMutableTreeNode) newNode.getChildAt(j);
ExpandMutableTreeNode[] nodes = RoleTree.this.loadChildTreeNodes(newChild);
for (int k = 0; k < nodes.length; k++) {
newChild.add(nodes[k]);
}
if (newChild.getChildCount() > 1 && ((ExpandMutableTreeNode) newChild.getFirstChild()).getUserObject() == PENDING) {
newChild.remove(0);
}
if (ComparatorUtils.equals(oldChild.getUserObject(), newChild.getUserObject())) {
newChild.setExpanded(oldChild.isExpanded());
}
}
}
}
public NameObject getRealSelectedNameObject() {
TreePath selectedTreePath = this.getSelectionPath();
if (selectedTreePath == null) {
return null;
}
ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent();
Object selectedUserObject = selectedTreeNode.getUserObject();
if (selectedUserObject instanceof NameObject) {
return (NameObject) selectedUserObject;
}
selectedTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent();
selectedUserObject = selectedTreeNode.getUserObject();
if (selectedUserObject instanceof NameObject) {
return (NameObject) selectedUserObject;
}
return null;
}
}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java
index a178150921..8fd63a18ec 100644
--- a/designer_base/src/com/fr/env/RemoteEnv.java
+++ b/designer_base/src/com/fr/env/RemoteEnv.java
@@ -17,7 +17,6 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
-import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.file.CacheManager;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
@@ -1788,8 +1787,7 @@ public class RemoteEnv extends AbstractEnv {
}
LogRecordTime[] records = DavXMLUtils.readXMLLogRecords(input);
for (LogRecordTime logRecordTime : records) {
- DesignerLogHandler.getInstance().printRemoteLog(logRecordTime);
-
+ //TODO
}
}
@@ -2181,7 +2179,7 @@ public class RemoteEnv extends AbstractEnv {
try {
HashMap para = new HashMap();
para.put("op", "plugin");
- para.put("cmd", "get_states");
+ para.put("cmd", "get_status");
para.put("current_uid", this.createUserID());
para.put("currentUsername", this.getUser());
diff --git a/designer_base/src/com/fr/start/BaseDesigner.java b/designer_base/src/com/fr/start/BaseDesigner.java
index f0036c329a..eb44ec0e3e 100644
--- a/designer_base/src/com/fr/start/BaseDesigner.java
+++ b/designer_base/src/com/fr/start/BaseDesigner.java
@@ -17,13 +17,15 @@ import com.fr.design.fun.impl.GlobalListenerProviderManager;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.TemplatePane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
-import com.fr.design.module.DesignModule;
import com.fr.design.utils.DesignUtils;
import com.fr.env.SignIn;
import com.fr.file.FILE;
import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
-import com.fr.general.*;
+import com.fr.general.ComparatorUtils;
+import com.fr.general.FRLogger;
+import com.fr.general.Inter;
+import com.fr.general.ModuleContext;
import com.fr.plugin.PluginCollector;
import com.fr.plugin.manage.PluginManager;
import com.fr.stable.*;
@@ -66,9 +68,6 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
//下面这两句的位置不能随便调换,因为会影响语言切换的问题
initLanguage();
- // 先加载设计器的国际化文件
- Inter.loadLocaleFile(GeneralContext.getLocale(), DesignModule.LOCALE_FILE_PATH);
-
SplashWindow splashWindow = new SplashWindow(createSplashPane());
if (args != null) {
for (String arg : args) {
diff --git a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
index 5ce350450b..127f640d2d 100644
--- a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
+++ b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
@@ -13,6 +13,7 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.design.chart.gui.active.ActiveGlyph;
import com.fr.design.chart.gui.active.ChartActiveGlyph;
+import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeListener;
@@ -41,7 +42,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
private int chartWidth = -1;
private int chartHeight = -1;
private Point point;
-
+ private int resolution = ScreenResolution.getScreenResolution();
private ActiveGlyph activeGlyph;
private boolean supportEdit = true;
@@ -171,7 +172,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
g2d.setPaint(Color.white);
g2d.fillRect(0, 0, this.getBounds().width, this.getBounds().height);
g2d.setPaint(oldPaint);
-
+
g2d.translate(ChartConstants.PREGAP4BOUNDS/2, ChartConstants.PREGAP4BOUNDS/2);
if (needRefreshChartGlyph()) {
@@ -315,7 +316,13 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
//不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单
//其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边
//处理画图事件
- Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution(), this, null);
+
+ resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
+ if (resolution == 0){
+ resolution = ScreenResolution.getScreenResolution();
+ }
+ Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,resolution, this, null);
+
g2d.drawImage(chartImage, 0, 0, null);
}
}
diff --git a/designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane.java b/designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane.java
index 5a2f3a4b93..e9aef9d973 100644
--- a/designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane.java
+++ b/designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane.java
@@ -74,6 +74,12 @@ public class GisMapTableDataContentPane extends FurtherBasicBeanPane(new String[]{Inter.getLocText("Chart-Gis_Address"), Inter.getLocText("Chart-Gis_LatLng")});
lnglatOrder = new UIButtonGroup(new String[]{Inter.getLocText("Chart-Lng_First"),Inter.getLocText("Chart-Lat_First")});
+ addressType.addChangeListener(new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ orderPane.setVisible(addressType.getSelectedIndex() == 1);
+ }
+ });
addressBox = new UIComboBox();
addressNameBox = new UIComboBox();
double p = TableLayout.PREFERRED;
diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartsConfigPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartsConfigPane.java
index bebf6d2c23..1bf04c4399 100644
--- a/designer_chart/src/com/fr/design/mainframe/chart/ChartsConfigPane.java
+++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartsConfigPane.java
@@ -14,11 +14,11 @@ public abstract class ChartsConfigPane extends AbstractChartA
public final static String CHART_STYLE_TITLE = Inter.getLocText("Chart-Style_Name");
- public abstract Class extends Charts> accptType();
+ public abstract Class extends Charts> acceptType();
@Override
public void populate(ChartCollection collection) {
- if (StableUtils.classInstanceOf(collection.getSelectedChart().getClass(),accptType())) {
+ if (StableUtils.classInstanceOf(collection.getSelectedChart().getClass(), acceptType())) {
populate(collection, (T)collection.getSelectedChart());
}
}
@@ -27,7 +27,7 @@ public abstract class ChartsConfigPane extends AbstractChartA
@Override
public void update(ChartCollection collection) {
- if (StableUtils.classInstanceOf(collection.getSelectedChart().getClass(),accptType())) {
+ if (StableUtils.classInstanceOf(collection.getSelectedChart().getClass(), acceptType())) {
update(collection, (T)collection.getSelectedChart());
}
}
diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java
index b447c7d098..1e07a587d4 100644
--- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java
+++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java
@@ -24,7 +24,7 @@ import java.awt.*;
public class MeterPlotReportDataContentPane extends AbstractReportDataContentPane {
private static final String CATENAME = Inter.getLocText(new String[]{"ChartF-Meter", "StyleFormat-Category", "WF-Name"});
- private static final String NVALUE = Inter.getLocText("Needle Value");
+ private static final String NVALUE = Inter.getLocText("Chart-Pointer_Value");
private TinyFormulaPane singCatePane;
private TinyFormulaPane singValuePane;
@@ -59,7 +59,7 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
double[] cs = {p};
components = new Component[][]{
new Component[]{new JSeparator()},
- new Component[]{new BoldFontTextLabel(Inter.getLocText("Data_Filter"))},
+ new Component[]{new BoldFontTextLabel(Inter.getLocText("FR-Designer_Data_Filter"))},
new Component[]{filterPane = new ChartDataFilterPane(new MeterPlot(), parent)},
};
JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSize, cs);
diff --git a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
index 589be7e83d..73ca39f2e7 100644
--- a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
+++ b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
@@ -109,12 +109,13 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
*/
public void initBeforeUpEdit() {
WidgetToolBarPane.getInstance(this);
- EastRegionContainerPane.getInstance().replaceDownPane(
+ EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA);
+ EastRegionContainerPane.getInstance().replaceWidgetLibPane(
FormWidgetDetailPane.getInstance(this));
if (!BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this));
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height);
- EastRegionContainerPane.getInstance().replaceUpPane(
+ EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(
WidgetPropertyPane.getInstance(this));
} else {
EastRegionContainerPane.getInstance().removeParameterPane();
diff --git a/designer_form/src/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java b/designer_form/src/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java
index 773446f5af..61b0c7aa96 100644
--- a/designer_form/src/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java
+++ b/designer_form/src/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java
@@ -8,8 +8,20 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.js.EmailJavaScript;
-public class FormHyperlinkGroupPane extends HyperlinkGroupPane{
-
+public class FormHyperlinkGroupPane extends HyperlinkGroupPane{
+ private static FormHyperlinkGroupPane singleton;
+
+ private FormHyperlinkGroupPane() {
+ super();
+ }
+
+ public synchronized static FormHyperlinkGroupPane getInstance() {
+ if (singleton == null) {
+ singleton = new FormHyperlinkGroupPane();
+ }
+ return singleton;
+ }
+
/**
* 生成添加按钮的NameableCreator
* 由于表单报表块的单元格超链和单元格条件属性超链中的emailPane都要用表单的emailPane,这里调整下
diff --git a/designer_form/src/com/fr/design/gui/xpane/ToolTipEditor.java b/designer_form/src/com/fr/design/gui/xpane/ToolTipEditor.java
index 8306bb9d67..6fbc858b06 100644
--- a/designer_form/src/com/fr/design/gui/xpane/ToolTipEditor.java
+++ b/designer_form/src/com/fr/design/gui/xpane/ToolTipEditor.java
@@ -17,6 +17,12 @@ import com.fr.form.ui.EditorHolder;
import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetValue;
import com.fr.general.Background;
+import com.fr.general.GeneralContext;
+import com.fr.plugin.context.PluginContext;
+import com.fr.plugin.injectable.PluginModule;
+import com.fr.plugin.manage.PluginFilter;
+import com.fr.plugin.observer.PluginEvent;
+import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.ArrayUtils;
import javax.swing.*;
@@ -27,12 +33,31 @@ import java.awt.event.MouseEvent;
import java.awt.geom.RoundRectangle2D;
public class ToolTipEditor extends JWindow {
-
- private static ToolTipEditor editor = new ToolTipEditor();
-
- public static ToolTipEditor getInstance() {
- return editor;
- }
+
+ private static volatile ToolTipEditor editor = new ToolTipEditor();
+
+ static {
+ GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
+
+ @Override
+ public void on(PluginEvent event) {
+
+ editor = new ToolTipEditor();
+ }
+ }, new PluginFilter() {
+
+ @Override
+ public boolean accept(PluginContext context) {
+
+ return context.contain(PluginModule.ExtraDesign);
+ }
+ });
+ }
+
+ public static ToolTipEditor getInstance() {
+
+ return editor;
+ }
private XEditorHolder holder;
private Border buttonBorder = new UIRoundedBorder(new Color(149, 149, 149), 1, 5);
diff --git a/designer_form/src/com/fr/design/mainframe/FormArea.java b/designer_form/src/com/fr/design/mainframe/FormArea.java
index 51867ba6f1..6c59130df6 100644
--- a/designer_form/src/com/fr/design/mainframe/FormArea.java
+++ b/designer_form/src/com/fr/design/mainframe/FormArea.java
@@ -9,18 +9,17 @@ import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-import java.awt.event.MouseEvent;
+import java.awt.event.*;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import com.fr.base.ScreenResolution;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
@@ -29,6 +28,7 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.UINumberSlidePane;
import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@@ -45,27 +45,31 @@ import com.fr.general.Inter;
public class FormArea extends JComponent implements ScrollRulerComponent {
- private static final double SLIDER_FLOAT = 120.0;
- private static final double SLIDER_MIN = 60.0;
+ private static final double SLIDER_FLOAT = 400.0;
+ private static final double SLIDER_MIN = 10.0;
public static final double DEFAULT_SLIDER = 100.0;
- private static final int ROTATIONS = 50;
- private FormDesigner designer;
- private int horizontalValue = 0;
- private int verticalValue = 0;
- private int verticalMax = 0;
- private int horicalMax = 0;
- private FormScrollBar verScrollBar;
+ private static final int ROTATIONS = 50;
+ private static final int SHOWVALMAX = 400;
+ private static final int SHOWVALMIN = 10;
+ private FormDesigner designer;
+ private int horizontalValue = 0;
+ private int verticalValue = 0;
+ private int verticalMax = 0;
+ private int horicalMax = 0;
+ private FormScrollBar verScrollBar;
private FormScrollBar horScrollBar;
- //显示和设置表单界面大小的控件
- private UINumberField widthPane;
- private UINumberField heightPane;
- private UINumberSlidePane slidePane;
- private boolean isValid = true;
- // 初始时滑块值为100,托动后的值设为START_VALUE;
- private double START_VALUE = DEFAULT_SLIDER;
- private double screenValue;
-
- public FormScrollBar getHorScrollBar() {
+ //显示和设置表单界面大小的控件
+ private UINumberField widthPane;
+ private UINumberField heightPane;
+ private JFormSliderPane slidePane;
+ private boolean isValid = true;
+ // 初始时滑块值为100,托动后的值设为START_VALUE;
+ private double START_VALUE = DEFAULT_SLIDER;
+ private int resolution = ScreenResolution.getScreenResolution();
+ private double screenValue;
+ private boolean isCtrl = false;
+
+ public FormScrollBar getHorScrollBar() {
return horScrollBar;
}
@@ -73,179 +77,224 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
this.horScrollBar = horScrollBar;
}
- public FormArea(FormDesigner designer) {
- this(designer, true);
- }
-
- public FormArea(FormDesigner designer, boolean useScrollBar) {
- this.designer = designer;
- this.designer.setParent(this);
- isValid = useScrollBar;
- verScrollBar = new FormScrollBar(Adjustable.VERTICAL, this);
- horScrollBar = new FormScrollBar(Adjustable.HORIZONTAL, this);
- if (useScrollBar) {
- this.setLayout(new FormRulerLayout());
- designer.setBorder(new LineBorder(new Color(198,198,198)));
- this.add(FormRulerLayout.CENTER, designer);
- addFormSize();
- this.add(FormRulerLayout.VERTICAL, verScrollBar);
- this.add(FormRulerLayout.HIRIZONTAL, horScrollBar);
- enableEvents(AWTEvent.MOUSE_WHEEL_EVENT_MASK);
- } else {
- // 报表参数界面只要标尺和中心pane
- this.setLayout(new RulerLayout());
- this.add(RulerLayout.CENTER, designer);
- addFormRuler();
- }
- this.setFocusTraversalKeysEnabled(false);
- }
-
- /**
- * 增加表单的页面大小控制界面,包括手动修改和滑块拖动
- */
- private void addFormSize() {
- double f = TableLayout.FILL;
+ public FormArea(FormDesigner designer) {
+ this(designer, true);
+ }
+
+ public FormArea(FormDesigner designer, boolean useScrollBar) {
+ this.designer = designer;
+ this.designer.setParent(this);
+ isValid = useScrollBar;
+ verScrollBar = new FormScrollBar(Adjustable.VERTICAL, this);
+ horScrollBar = new FormScrollBar(Adjustable.HORIZONTAL, this);
+ if (useScrollBar) {
+ this.setLayout(new FormRulerLayout());
+ designer.setBorder(new LineBorder(new Color(198,198,198)));
+ this.add(FormRulerLayout.CENTER, designer);
+ addFormSize();
+ this.add(FormRulerLayout.VERTICAL, verScrollBar);
+ this.add(FormRulerLayout.HIRIZONTAL, horScrollBar);
+ enableEvents(AWTEvent.MOUSE_WHEEL_EVENT_MASK);
+ } else {
+ // 报表参数界面只要标尺和中心pane
+ this.setLayout(new RulerLayout());
+ this.add(RulerLayout.CENTER, designer);
+ addFormRuler();
+ }
+ this.setFocusTraversalKeysEnabled(false);
+ this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener);
+ this.designer.addKeyListener(showValSpinnerKeyListener);
+ }
+
+
+ KeyListener showValSpinnerKeyListener = new KeyListener() {
+ @Override
+ public void keyTyped(KeyEvent e) {
+
+ }
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if( e.isControlDown()){
+ isCtrl = true ;
+ }
+ }
+ @Override
+ public void keyReleased(KeyEvent e) {
+ isCtrl = false ;
+ }
+ };
+
+ MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
+ @Override
+ public void mouseWheelMoved(MouseWheelEvent e) {
+ if (isCtrl){
+ int dir = e.getWheelRotation();
+ int old_resolution = (int) slidePane.getShowVal().getValue();
+ slidePane.getShowVal().setValue(old_resolution - (dir * SHOWVALMIN));
+ }
+ }
+ };
+
+ /**
+ * 增加表单的页面大小控制界面,包括手动修改和滑块拖动
+ */
+ private void addFormSize() {
+ double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {f};
double[] columnSize = { p, f, p, p, p, p, p, f, p};
UILabel tipsPane = new UILabel("form");
tipsPane.setPreferredSize(new Dimension(200, 0));
- widthPane = new UINumberField();
- widthPane.setPreferredSize(new Dimension(60, 0));
- heightPane = new UINumberField();
- heightPane.setPreferredSize(new Dimension(60, 0));
- slidePane = new UINumberSlidePane(SLIDER_MIN, SLIDER_FLOAT);
- slidePane.setPreferredSize(new Dimension(200,0));
- JPanel resizePane =TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{
- {tipsPane, new UILabel(), widthPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel("x"),
- heightPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel(), slidePane}},
- rowSize, columnSize, 8);
- this.add(FormRulerLayout.BOTTOM, resizePane);
- setWidgetsConfig();
- // 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小
- slidePane.setEnabled(false);
- slidePane.setVisible(false);
-// initTransparent();
- initCalculateSize();
- }
-
- private void setWidgetsConfig() {
- widthPane.setHorizontalAlignment(widthPane.CENTER);
- heightPane.setHorizontalAlignment(heightPane.CENTER);
- widthPane.setMaxDecimalLength(0);
- heightPane.setMaxDecimalLength(0);
- //控件初始值就是根节点组件初始的宽和高
- widthPane.setValue(designer.getRootComponent().getWidth());
- heightPane.setValue(designer.getRootComponent().getHeight());
- addWidthPaneListener();
- addHeightPaneListener();
- }
-
- private void initTransparent() {
- initCalculateSize();
- slidePane.addChangeListener(new ChangeListener() {
- public void stateChanged(ChangeEvent e) {
- double value = ((UINumberSlidePane) e.getSource()).getValue();
- reCalculateRoot(value, true);
- JTemplate form = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
- if(form != null){
- form.fireTargetModified();
- }
- }
- });
- }
-
- /**
- * 返回当前的屏幕分辨率对应的百分比值
- * @return 缩放的百分比值
- */
- public double getScreenValue() {
+ widthPane = new UINumberField();
+ widthPane.setPreferredSize(new Dimension(60, 0));
+ heightPane = new UINumberField();
+ heightPane.setPreferredSize(new Dimension(60, 0));
+
+// slidePane = new UINumberSlidePane(SLIDER_MIN, SLIDER_FLOAT);
+// slidePane.setPreferredSize(new Dimension(260,20));
+ slidePane = JFormSliderPane.getInstance();
+ slidePane.setPreferredSize(new Dimension(350,20));
+
+
+ JPanel resizePane =TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{
+ {tipsPane, new UILabel(), widthPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel("x"),
+ heightPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel(), slidePane}},
+ rowSize, columnSize, 8);
+ this.add(FormRulerLayout.BOTTOM, resizePane);
+ setWidgetsConfig();
+ // 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小
+ slidePane.setEnabled(false);
+ slidePane.setVisible(true);
+ initTransparent();
+ initCalculateSize();
+ }
+
+ private void setWidgetsConfig() {
+ widthPane.setHorizontalAlignment(widthPane.CENTER);
+ heightPane.setHorizontalAlignment(heightPane.CENTER);
+ widthPane.setMaxDecimalLength(0);
+ heightPane.setMaxDecimalLength(0);
+ //控件初始值就是根节点组件初始的宽和高
+ widthPane.setValue(designer.getRootComponent().getWidth());
+ heightPane.setValue(designer.getRootComponent().getHeight());
+ addWidthPaneListener();
+ addHeightPaneListener();
+ }
+
+ private void initTransparent() {
+ initCalculateSize();
+ slidePane.getShowVal().addChangeListener(showValSpinnerChangeListener);
+ }
+
+ ChangeListener showValSpinnerChangeListener = new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ double value = (int) ((UIBasicSpinner)e.getSource()).getValue();
+ value = value>SHOWVALMAX ? SHOWVALMAX : value;
+ value = value= designer.getRootComponent().getWidth();
- }
-
- /**
- * 设置界面内的组件可见以及水平垂直滚动条的值
- * (除了根容器,拖入组件进来时如果大小超过当前界面大小,必须设置滚动条值,否则滚动条默认不显示)
- *
- * @param creator 控件
- */
- public void scrollPathToVisible(XCreator creator) {
- creator.seleteRelatedComponent(creator);
-
- if (!ComponentUtils.isComponentVisible(creator) && !designer.isRoot(creator) && (creator.toData()).isVisible()) {
- designer.makeVisible(creator);
- }
-
- if (shouldSetScrollValue(creator)) {
- return;
- }
- //获取在容器的绝对位置
- Rectangle rec = ComponentUtils.getRelativeBounds(creator);
- int dWidth = getDesignerWidth();
- if (rec.width <= dWidth&&rec.x < getHorizontalValue()) {
- //在边界内部且x位置小于水平滚动条的值
- horScrollBar.setValue(rec.x);
- } else if (rec.x + rec.width > dWidth + horizontalValue) {
- //超出边界宽度
- horScrollBar.setValue(rec.x + rec.width - dWidth);
- }
- int dHeight = getDesignerHeight();
- if (rec.height < dHeight && rec.y < getVerticalValue()) {
- //在边界内部且y位置小于竖直滚动条的值
- verScrollBar.setValue(rec.y);
- } else if (rec.y + rec.height > dHeight + verticalValue) {
- //超出边界高度
- verScrollBar.setValue(rec.y + rec.height - dHeight);
- }
- }
-
-
- /**
- * 容器布局
- */
- public void doLayout() {
- layout();
- if (isValid) {
- XLayoutContainer root = designer.getRootComponent();
- setScrollBarProperties(root.getWidth()-designer.getWidth(), horScrollBar);
- //计算滚动条值的时候应该算上参数面板的高度
- setScrollBarProperties(designer.getParaHeight() + root.getHeight()-designer.getHeight(), verScrollBar);
- }
- }
-
- /**
- * 设置滚动条的属性
- */
- private void setScrollBarProperties(int value, FormScrollBar bar) {
- if (value == 0 && isScrollNotVisible(bar)) {
- return;
- }
- if (value <= 0) {
- // 界面有滚动条时,手动缩小容器宽度到界面内,重置滚动条值和max
- setScrollBarMax(0, bar);
- bar.setMaximum(0);
- bar.setValue(0);
- bar.setEnabled(false);
- } else {
- //参数面板拖拽过程中value一直为当前value
- int oldValue = verticalValue;
- setScrollBarMax(value, bar);
- bar.setEnabled(true);
- bar.setMaximum(value);
- bar.setValue(value);
- bar.setValue(oldValue);
- }
- }
-
- private boolean isScrollNotVisible(FormScrollBar bar) {
- if (bar.getOrientation() == Adjustable.VERTICAL ) {
- return verticalMax == 0;
- } else {
- return horicalMax == 0;
- }
- }
-
- private void setScrollBarMax( int max, FormScrollBar bar) {
- if (bar.getOrientation() == Adjustable.VERTICAL ) {
- verticalMax = max;
- } else {
- horicalMax = max;
- }
- }
-
- /**
- *返回designer的最小高度
- *
- * @return int
- */
- public int getMinHeight() {
- return designer.getDesignerMode().getMinDesignHeight();
- }
-
- /**
- *返回designer的最小宽度
- *
- * @return int
- */
- public int getMinWidth() {
- return designer.getDesignerMode().getMinDesignWidth();
- }
-
- /**
- * getRulerLengthUnit
- *
- * @return short
- */
- public short getRulerLengthUnit() {
- return -1;
- }
-
- /**
- * 返回水平滚动条的value
- *
- * @return int
- */
- public int getHorizontalValue() {
- return horizontalValue;
- }
-
- /**
- * 设置水平滚动条的value
- *
- * @param newValue
- */
- public void setHorizontalValue(int newValue) {
- this.horizontalValue = newValue;
- }
-
- /**
- * 返回竖直滚动条的value
- *
- * @return
- */
- public int getVerticalValue() {
- return verticalValue;
- }
-
- /**
- * 竖直滚动条赋值
- *
- * @param newValue
- */
- public void setVerticalValue(int newValue) {
- this.verticalValue = newValue;
- }
-
- /**
- * 返回当前designer的高度
- *
- * @return height
- */
- public int getDesignerHeight() {
- return designer.getHeight();
- }
-
- /**
- * 返回当前designer的宽度
- *
- * @return
- */
- public int getDesignerWidth() {
- return designer.getWidth();
- }
-
- /**
- * 返回宽度控件的value
- *
- * @return 宽度
- */
- public double getWidthPaneValue() {
- return widthPane.getValue();
- }
-
- /**
- * 设置宽度值
- * @param value 值
- */
- public void setWidthPaneValue(int value) {
- widthPane.setValue(value);
- }
-
- /**
- * 设置高度值
- * @param value 值
- */
- public void setHeightPaneValue(int value) {
- heightPane.setValue(value);
- }
-
- /**
- * 返回高度控件的value
- *
- * @return 高度
- */
- public double getHeightPaneValue() {
- return heightPane.getValue();
- }
-
- /**
- * 返回界面大小的百分比值
- *
- * @return 百分比值
- */
- public double getSlideValue() {
+ }
+
+ /**
+ * 返回表单容器的中心designer
+ * getFormEditor.
+ */
+ public FormDesigner getFormEditor() {
+ return designer;
+ }
+
+ private boolean shouldSetScrollValue(XCreator creator) {
+ return !isValid || designer.isRoot(creator) || getDesignerWidth() >= designer.getRootComponent().getWidth();
+ }
+
+ /**
+ * 设置界面内的组件可见以及水平垂直滚动条的值
+ * (除了根容器,拖入组件进来时如果大小超过当前界面大小,必须设置滚动条值,否则滚动条默认不显示)
+ *
+ * @param creator 控件
+ */
+ public void scrollPathToVisible(XCreator creator) {
+ creator.seleteRelatedComponent(creator);
+
+ if (!ComponentUtils.isComponentVisible(creator) && !designer.isRoot(creator) && (creator.toData()).isVisible()) {
+ designer.makeVisible(creator);
+ }
+
+ if (shouldSetScrollValue(creator)) {
+ return;
+ }
+ //获取在容器的绝对位置
+ Rectangle rec = ComponentUtils.getRelativeBounds(creator);
+ int dWidth = getDesignerWidth();
+ if (rec.width <= dWidth&&rec.x < getHorizontalValue()) {
+ //在边界内部且x位置小于水平滚动条的值
+ horScrollBar.setValue(rec.x);
+ } else if (rec.x + rec.width > dWidth + horizontalValue) {
+ //超出边界宽度
+ horScrollBar.setValue(rec.x + rec.width - dWidth);
+ }
+ int dHeight = getDesignerHeight();
+ if (rec.height < dHeight && rec.y < getVerticalValue()) {
+ //在边界内部且y位置小于竖直滚动条的值
+ verScrollBar.setValue(rec.y);
+ } else if (rec.y + rec.height > dHeight + verticalValue) {
+ //超出边界高度
+ verScrollBar.setValue(rec.y + rec.height - dHeight);
+ }
+ }
+
+
+ /**
+ * 容器布局
+ */
+ public void doLayout() {
+ layout();
+ if (isValid) {
+ XLayoutContainer root = designer.getRootComponent();
+ setScrollBarProperties(root.getWidth()-designer.getWidth(), horScrollBar);
+ //计算滚动条值的时候应该算上参数面板的高度
+ setScrollBarProperties(designer.getParaHeight() + root.getHeight()-designer.getHeight(), verScrollBar);
+ }
+ }
+
+ /**
+ * 设置滚动条的属性
+ */
+ private void setScrollBarProperties(int value, FormScrollBar bar) {
+ if (value == 0 && isScrollNotVisible(bar)) {
+ return;
+ }
+ if (value <= 0) {
+ // 界面有滚动条时,手动缩小容器宽度到界面内,重置滚动条值和max
+ setScrollBarMax(0, bar);
+ bar.setMaximum(0);
+ bar.setValue(0);
+ bar.setEnabled(false);
+ } else {
+ //参数面板拖拽过程中value一直为当前value
+ int oldValue = verticalValue;
+ setScrollBarMax(value, bar);
+ bar.setEnabled(true);
+ bar.setMaximum(value);
+ bar.setValue(value);
+ bar.setValue(oldValue);
+ }
+ }
+
+ private boolean isScrollNotVisible(FormScrollBar bar) {
+ if (bar.getOrientation() == Adjustable.VERTICAL ) {
+ return verticalMax == 0;
+ } else {
+ return horicalMax == 0;
+ }
+ }
+
+ private void setScrollBarMax( int max, FormScrollBar bar) {
+ if (bar.getOrientation() == Adjustable.VERTICAL ) {
+ verticalMax = max;
+ } else {
+ horicalMax = max;
+ }
+ }
+
+ /**
+ *返回designer的最小高度
+ *
+ * @return int
+ */
+ public int getMinHeight() {
+ return designer.getDesignerMode().getMinDesignHeight();
+ }
+
+ /**
+ *返回designer的最小宽度
+ *
+ * @return int
+ */
+ public int getMinWidth() {
+ return designer.getDesignerMode().getMinDesignWidth();
+ }
+
+ /**
+ * getRulerLengthUnit
+ *
+ * @return short
+ */
+ public short getRulerLengthUnit() {
+ return -1;
+ }
+
+ /**
+ * 返回水平滚动条的value
+ *
+ * @return int
+ */
+ public int getHorizontalValue() {
+ return horizontalValue;
+ }
+
+ /**
+ * 设置水平滚动条的value
+ *
+ * @param newValue
+ */
+ public void setHorizontalValue(int newValue) {
+ this.horizontalValue = newValue;
+ }
+
+ /**
+ * 返回竖直滚动条的value
+ *
+ * @return
+ */
+ public int getVerticalValue() {
+ return verticalValue;
+ }
+
+ /**
+ * 竖直滚动条赋值
+ *
+ * @param newValue
+ */
+ public void setVerticalValue(int newValue) {
+ this.verticalValue = newValue;
+ }
+
+ /**
+ * 返回当前designer的高度
+ *
+ * @return height
+ */
+ public int getDesignerHeight() {
+ return designer.getHeight();
+ }
+
+ /**
+ * 返回当前designer的宽度
+ *
+ * @return
+ */
+ public int getDesignerWidth() {
+ return designer.getWidth();
+ }
+
+ /**
+ * 返回宽度控件的value
+ *
+ * @return 宽度
+ */
+ public double getWidthPaneValue() {
+ return widthPane.getValue();
+ }
+
+ /**
+ * 设置宽度值
+ * @param value 值
+ */
+ public void setWidthPaneValue(int value) {
+ widthPane.setValue(value);
+ }
+
+ /**
+ * 设置高度值
+ * @param value 值
+ */
+ public void setHeightPaneValue(int value) {
+ heightPane.setValue(value);
+ }
+
+ /**
+ * 返回高度控件的value
+ *
+ * @return 高度
+ */
+ public double getHeightPaneValue() {
+ return heightPane.getValue();
+ }
+
+ /**
+ * 返回界面大小的百分比值
+ *
+ * @return 百分比值
+ */
+ public double getSlideValue() {
// return slidePane.updateBean();
- //7.1.1不加缩放滑块
- return this.screenValue;
- }
-
- /**
- * 返回界面区域大小
- *
- * @return Dimension
- */
- public Dimension getAreaSize() {
- return new Dimension(horScrollBar.getMaximum(), verScrollBar.getMaximum());
- }
-
- /**
- * setAreaSize
- *
- * @param totalSize
- * @param horizontalValue
- * @param verticalValue
- */
- public void setAreaSize(Dimension totalSize, int horizontalValue, int verticalValue, double width, double height, double slide) {
- this.verticalMax = (int) totalSize.getHeight();
- this.horicalMax = (int) totalSize.getHeight();
- // 撤销时会refreshRoot,导致layout大小变为默认大小
- // 按照之前设置的宽高和百分比重置下容器size
- if (width != widthPane.getValue()) {
- widthPane.setValue(width);
- reCalculateWidth((int) width);
- }
- if (height != heightPane.getValue()) {
- heightPane.setValue(height);
- reCalculateHeight((int) height);
- }
- if (designer.getRootComponent().acceptType(XWFitLayout.class) && slide == DEFAULT_SLIDER) {
- XWFitLayout layout = (XWFitLayout) designer.getRootComponent();
- // 撤销时先refreshRoot了,此处去掉内边距再增加间隔
- layout.moveContainerMargin();
- layout.addCompInterval(layout.getAcualInterval());
- } else if (designer.getRootComponent().acceptType(XWFitLayout.class)){
- START_VALUE = DEFAULT_SLIDER;
- reCalculateRoot(slide, true);
+ //7.1.1不加缩放滑块
+ return this.screenValue;
+ }
+
+ /**
+ * 返回界面区域大小
+ *
+ * @return Dimension
+ */
+ public Dimension getAreaSize() {
+ return new Dimension(horScrollBar.getMaximum(), verScrollBar.getMaximum());
+ }
+
+ /**
+ * setAreaSize
+ *
+ * @param totalSize
+ * @param horizontalValue
+ * @param verticalValue
+ */
+ public void setAreaSize(Dimension totalSize, int horizontalValue, int verticalValue, double width, double height, double slide) {
+ this.verticalMax = (int) totalSize.getHeight();
+ this.horicalMax = (int) totalSize.getHeight();
+ // 撤销时会refreshRoot,导致layout大小变为默认大小
+ // 按照之前设置的宽高和百分比重置下容器size
+ if (width != widthPane.getValue()) {
+ widthPane.setValue(width);
+ reCalculateWidth((int) width);
+ }
+ if (height != heightPane.getValue()) {
+ heightPane.setValue(height);
+ reCalculateHeight((int) height);
+ }
+ if (designer.getRootComponent().acceptType(XWFitLayout.class) && slide == DEFAULT_SLIDER) {
+ XWFitLayout layout = (XWFitLayout) designer.getRootComponent();
+ // 撤销时先refreshRoot了,此处去掉内边距再增加间隔
+ layout.moveContainerMargin();
+ layout.addCompInterval(layout.getAcualInterval());
+ } else if (designer.getRootComponent().acceptType(XWFitLayout.class)){
+ START_VALUE = DEFAULT_SLIDER;
+ reCalculateRoot(slide, true);
// slidePane.populateBean(slide);
- }
- }
-
- /**
- * 计算滚动条的值和max
- * @param oldmax 之前最大值
- * @param max 当前最大值
- * @param newValue 当前value
- * @param oldValue 之前value
- * @param visi designer的大小
- * @param orientation 滚动条方向
- * @return 计算后的值和max
- */
- @Override
- public Point calculateScroll(int oldmax, int max, int newValue, int oldValue, int visi, int orientation) {
- int scrollMax = orientation==1 ? verticalMax : horicalMax;
- //防止滚动条到达低端还可以继续点击移动(滚动条最大范围不变时,newValue要在范围之内)
- if ( oldmax == scrollMax+visi && newValue>scrollMax ) {
- return new Point(oldValue, oldmax);
- }
+ }
+ }
+
+ /**
+ * 计算滚动条的值和max
+ * @param oldmax 之前最大值
+ * @param max 当前最大值
+ * @param newValue 当前value
+ * @param oldValue 之前value
+ * @param visi designer的大小
+ * @param orientation 滚动条方向
+ * @return 计算后的值和max
+ */
+ @Override
+ public Point calculateScroll(int oldmax, int max, int newValue, int oldValue, int visi, int orientation) {
+ int scrollMax = orientation==1 ? verticalMax : horicalMax;
+ //防止滚动条到达低端还可以继续点击移动(滚动条最大范围不变时,newValue要在范围之内)
+ if ( oldmax == scrollMax+visi && newValue>scrollMax ) {
+ return new Point(oldValue, oldmax);
+ }
return new Point(newValue, max);
}
private class FormRulerLayout extends RulerLayout{
- private int DESIGNERWIDTH = 960;
- private int DESIGNERHEIGHT =540;
- private int TOPGAP = 8;
-
- public FormRulerLayout(){
- super();
- }
-
- /**
- * 表单用的layout,当前不需要标尺
- */
- public void layoutContainer(Container target) {
- synchronized (target.getTreeLock()) {
- Insets insets = target.getInsets();
- int top = insets.top;
- int left = insets.left;
- int bottom = target.getHeight() - insets.bottom;
- int right = target.getWidth() - insets.right;
- Dimension resize = resizePane.getPreferredSize();
- Dimension hbarPreferredSize = null;
- Dimension vbarPreferredSize = null;
-
- resizePane.setBounds(left, bottom - resize.height, right, resize.height);
- if(horScrollBar != null) {
- hbarPreferredSize = horScrollBar.getPreferredSize();
- vbarPreferredSize = verScrollBar.getPreferredSize();
- horScrollBar.setBounds(left , bottom - hbarPreferredSize.height-resize.height, right - BARSIZE, hbarPreferredSize.height);
- verScrollBar.setBounds(right - vbarPreferredSize.width, top, vbarPreferredSize.width, bottom - BARSIZE-resize.height);
- }
- FormDesigner dg = ((FormDesigner) designer);
- XLayoutContainer root = dg.getRootComponent();
- if (root.acceptType(XWFitLayout.class)) {
- DESIGNERWIDTH = root.getWidth();
- DESIGNERHEIGHT = dg.hasWAbsoluteLayout() ? root.getHeight()+dg.getParaHeight() : root.getHeight();
- }
- Rectangle rec = new Rectangle(left+(right - DESIGNERWIDTH)/2, TOPGAP, right, bottom);
- //是否为表单
- if (isValid ){
- int maxHeight = bottom - hbarPreferredSize.height - resize.height -TOPGAP*2;
- int maxWidth = right - vbarPreferredSize.width;
- DESIGNERWIDTH = DESIGNERWIDTH> maxWidth ? maxWidth : DESIGNERWIDTH;
- DESIGNERHEIGHT = DESIGNERHEIGHT > maxHeight ? maxHeight : DESIGNERHEIGHT;
- int designerLeft = left+(verScrollBar.getX() - DESIGNERWIDTH)/2;
- rec = new Rectangle(designerLeft, TOPGAP, DESIGNERWIDTH, DESIGNERHEIGHT);
- }
- // designer是整个表单设计界面中的面板部分,目前只放自适应布局和参数界面。
- designer.setBounds(rec);
- }
- }
-
- }
+ private int DESIGNERWIDTH = 960;
+ private int DESIGNERHEIGHT =540;
+ private int TOPGAP = 8;
+
+ public FormRulerLayout(){
+ super();
+ }
+
+ /**
+ * 表单用的layout,当前不需要标尺
+ */
+ public void layoutContainer(Container target) {
+ synchronized (target.getTreeLock()) {
+ Insets insets = target.getInsets();
+ int top = insets.top;
+ int left = insets.left;
+ int bottom = target.getHeight() - insets.bottom;
+ int right = target.getWidth() - insets.right;
+ Dimension resize = resizePane.getPreferredSize();
+ Dimension hbarPreferredSize = null;
+ Dimension vbarPreferredSize = null;
+
+ resizePane.setBounds(left, bottom - resize.height, right, resize.height);
+ if(horScrollBar != null) {
+ hbarPreferredSize = horScrollBar.getPreferredSize();
+ vbarPreferredSize = verScrollBar.getPreferredSize();
+ horScrollBar.setBounds(left , bottom - hbarPreferredSize.height-resize.height, right - BARSIZE, hbarPreferredSize.height);
+ verScrollBar.setBounds(right - vbarPreferredSize.width, top, vbarPreferredSize.width, bottom - BARSIZE-resize.height);
+ }
+ FormDesigner dg = ((FormDesigner) designer);
+ XLayoutContainer root = dg.getRootComponent();
+ if (root.acceptType(XWFitLayout.class)) {
+ DESIGNERWIDTH = root.getWidth();
+ DESIGNERHEIGHT = dg.hasWAbsoluteLayout() ? root.getHeight()+dg.getParaHeight() : root.getHeight();
+ }
+ Rectangle rec = new Rectangle(left+(right - DESIGNERWIDTH)/2, TOPGAP, right, bottom);
+ //是否为表单
+ if (isValid ){
+ int maxHeight = bottom - hbarPreferredSize.height - resize.height -TOPGAP*2;
+ int maxWidth = right - vbarPreferredSize.width;
+ DESIGNERWIDTH = DESIGNERWIDTH> maxWidth ? maxWidth : DESIGNERWIDTH;
+ DESIGNERHEIGHT = DESIGNERHEIGHT > maxHeight ? maxHeight : DESIGNERHEIGHT;
+ int designerLeft = left+(verScrollBar.getX() - DESIGNERWIDTH)/2;
+ rec = new Rectangle(designerLeft, TOPGAP, DESIGNERWIDTH, DESIGNERHEIGHT);
+ }
+ // designer是整个表单设计界面中的面板部分,目前只放自适应布局和参数界面。
+ designer.setBounds(rec);
+ }
+ }
+
+ }
}
\ No newline at end of file
diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java
index 3aa9e24ee1..986b91f0ba 100644
--- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java
+++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java
@@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.Parameter;
+import com.fr.base.ScreenResolution;
import com.fr.design.DesignState;
import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.AdapterBus;
@@ -47,6 +48,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
+import com.fr.stable.CoreGraphHelper;
import com.fr.stable.bridge.StableFactory;
import javax.swing.*;
@@ -103,6 +105,7 @@ public class FormDesigner extends TargetComponent