xiaohu 9 years ago
parent
commit
22f15fc5f3
  1. 2
      designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java
  2. 6
      designer/src/com/fr/design/mainframe/InformationCollector.java
  3. 117
      designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java
  4. 4
      designer/src/com/fr/design/present/ConditionAttributesGroupPane.java
  5. 4
      designer/src/com/fr/design/present/StyleArrayPane.java
  6. 70
      designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java
  7. 12
      designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java
  8. 4
      designer/src/com/fr/design/report/share/ConfusionManagerPane.java
  9. 3
      designer/src/com/fr/design/webattr/ReportWebAttrPane.java
  10. 4
      designer/src/com/fr/design/widget/WidgetConfigPane.java
  11. 2
      designer/src/com/fr/start/Designer.java
  12. 31
      designer_base/.classpath
  13. 2
      designer_base/designer_base.iml
  14. 96
      designer_base/src/com/fr/design/ExtraDesignClassManager.java
  15. 74
      designer_base/src/com/fr/design/actions/community/BBSAction.java
  16. 72
      designer_base/src/com/fr/design/actions/community/BugAction.java
  17. 70
      designer_base/src/com/fr/design/actions/community/NeedAction.java
  18. 69
      designer_base/src/com/fr/design/actions/community/QuestionAction.java
  19. 70
      designer_base/src/com/fr/design/actions/community/SignAction.java
  20. 70
      designer_base/src/com/fr/design/actions/community/UpAction.java
  21. 70
      designer_base/src/com/fr/design/actions/community/VideoAction.java
  22. 9
      designer_base/src/com/fr/design/actions/help/TutorialAction.java
  23. 2
      designer_base/src/com/fr/design/condition/LiteConditionPane.java
  24. 14
      designer_base/src/com/fr/design/data/datapane/ReportTableDataPane.java
  25. 62
      designer_base/src/com/fr/design/data/datapane/TableDataPaneController.java
  26. 31
      designer_base/src/com/fr/design/data/datapane/TableDataPaneListPane.java
  27. 4
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  28. 4
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java
  29. 4
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureListPane.java
  30. 36
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java
  31. 10
      designer_base/src/com/fr/design/extra/PluginShopDialog.java
  32. 23
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  33. 35
      designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java
  34. 4
      designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java
  35. 4
      designer_base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java
  36. 6
      designer_base/src/com/fr/design/extra/exe/UninstallExecutor.java
  37. 19
      designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java
  38. 4
      designer_base/src/com/fr/design/formula/FunctionManagerPane.java
  39. 22
      designer_base/src/com/fr/design/fun/BackgroundQuickUIProvider.java
  40. 34
      designer_base/src/com/fr/design/fun/BackgroundUIProvider.java
  41. 21
      designer_base/src/com/fr/design/fun/ElementUIProvider.java
  42. 13
      designer_base/src/com/fr/design/fun/ExportToolBarProvider.java
  43. 6
      designer_base/src/com/fr/design/fun/GlobalListenerProvider.java
  44. 6
      designer_base/src/com/fr/design/fun/HighlightProvider.java
  45. 3
      designer_base/src/com/fr/design/fun/ServerTableDataDefineProvider.java
  46. 14
      designer_base/src/com/fr/design/fun/TableDataDefineProvider.java
  47. 36
      designer_base/src/com/fr/design/fun/TableDataPaneProcessor.java
  48. 23
      designer_base/src/com/fr/design/fun/TableDataTreePaneProcessor.java
  49. 20
      designer_base/src/com/fr/design/fun/impl/AbstractBackgroundQuickUIProvider.java
  50. 20
      designer_base/src/com/fr/design/fun/impl/AbstractBackgroundUIProvider.java
  51. 4
      designer_base/src/com/fr/design/fun/impl/AbstractTDPaneProcessor.java
  52. 978
      designer_base/src/com/fr/design/gui/controlpane/JControlPane.java
  53. 966
      designer_base/src/com/fr/design/gui/controlpane/JListControlPane.java
  54. 2
      designer_base/src/com/fr/design/gui/controlpane/ObjectJControlPane.java
  55. 4
      designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  56. 25
      designer_base/src/com/fr/design/gui/style/BackgroundNoImagePane.java
  57. 79
      designer_base/src/com/fr/design/gui/style/BackgroundPane.java
  58. 28
      designer_base/src/com/fr/design/gui/style/BackgroundSpecialPane.java
  59. BIN
      designer_base/src/com/fr/design/images/bbs.png
  60. BIN
      designer_base/src/com/fr/design/images/bug.png
  61. BIN
      designer_base/src/com/fr/design/images/help.png
  62. BIN
      designer_base/src/com/fr/design/images/need.png
  63. BIN
      designer_base/src/com/fr/design/images/questions.png
  64. BIN
      designer_base/src/com/fr/design/images/signature.png
  65. BIN
      designer_base/src/com/fr/design/images/update.png
  66. BIN
      designer_base/src/com/fr/design/images/video.png
  67. 2
      designer_base/src/com/fr/design/mainframe/backgroundpane/BackgroundQuickPane.java
  68. 4
      designer_base/src/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java
  69. 11
      designer_base/src/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java
  70. 8
      designer_base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java
  71. 2
      designer_base/src/com/fr/design/mainframe/backgroundpane/NullBackgroundQuickPane.java
  72. 14
      designer_base/src/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java
  73. 10
      designer_base/src/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java
  74. 48
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  75. 6
      designer_base/src/com/fr/design/mingche.java
  76. 4
      designer_base/src/com/fr/design/parameter/ParameterArrayPane.java
  77. 6
      designer_base/src/com/fr/design/style/AbstractPopBox.java
  78. 18
      designer_base/src/com/fr/design/style/background/BackgroundDetailPane.java
  79. 121
      designer_base/src/com/fr/design/style/background/BackgroundFactory.java
  80. 897
      designer_base/src/com/fr/design/style/background/BackgroundPane.java
  81. 51
      designer_base/src/com/fr/design/style/background/BackgroundPane4Browser.java
  82. 5
      designer_base/src/com/fr/design/style/background/BackgroundSelectPane.java
  83. 49
      designer_base/src/com/fr/design/style/background/BackgroundUIWrapper.java
  84. 6
      designer_base/src/com/fr/design/style/background/gradient/GradientBackgroundPane.java
  85. 46
      designer_base/src/com/fr/design/style/background/impl/BPane.java
  86. 42
      designer_base/src/com/fr/design/style/background/impl/ColorBackgroundPane.java
  87. 230
      designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java
  88. 25
      designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java
  89. 39
      designer_base/src/com/fr/design/style/background/impl/NullBackgroundPane.java
  90. 208
      designer_base/src/com/fr/design/style/background/impl/PatternBackgroundPane.java
  91. 24
      designer_base/src/com/fr/design/style/background/impl/PatternBackgroundPaneNoFore.java
  92. 197
      designer_base/src/com/fr/design/style/background/impl/TextureBackgroundPane.java
  93. 6
      designer_base/src/com/fr/design/style/background/pattern/PatternSelectPane.java
  94. 6
      designer_base/src/com/fr/design/style/background/texture/TextureSelectPane.java
  95. 4
      designer_base/src/com/fr/env/EnvListPane.java
  96. 4
      designer_chart/src/com/fr/design/chart/ChartControlPane.java
  97. 4
      designer_chart/src/com/fr/design/chart/axis/ChartAlertLinePane.java
  98. 2
      designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java
  99. 6
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java
  100. 4
      designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrPane.java
  101. Some files were not shown because too many files have changed in this diff Show More

2
designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java

File diff suppressed because one or more lines are too long

6
designer/src/com/fr/design/mainframe/InformationCollector.java

@ -35,8 +35,8 @@ import java.util.*;
*/ */
public class InformationCollector implements XMLReadable, XMLWriter { public class InformationCollector implements XMLReadable, XMLWriter {
//3天上传一次 // 24小时上传一次
private static final long DELTA = 3 * 24 * 3600 * 1000L; private static final long DELTA = 24 * 3600 * 1000L;
private static final long SEND_DELAY = 30 * 1000L; private static final long SEND_DELAY = 30 * 1000L;
private static final String FILE_NAME = "fr.info"; private static final String FILE_NAME = "fr.info";
private static final String XML_START_STOP_LIST = "StartStopList"; private static final String XML_START_STOP_LIST = "StartStopList";
@ -203,8 +203,6 @@ public class InformationCollector implements XMLReadable, XMLWriter {
//服务器返回true, 说明已经获取成功, 清空当前记录的信息 //服务器返回true, 说明已经获取成功, 清空当前记录的信息
if (success) { if (success) {
deleteLogDB(conn, table); deleteLogDB(conn, table);
//收集设计器信息的服务器下线了, 目测还要一段时间, 不在那边一起setLastTime了.
this.lastTime = dateToString();
} }
} }

117
designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java

@ -9,11 +9,9 @@ import com.fr.design.gui.ipasswordfield.UIPassWordField;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.*;
import com.fr.general.FRFont;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -24,8 +22,10 @@ import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URI; import java.net.URI;
import java.net.URLEncoder;
/** /**
* @author richie * @author richie
@ -36,12 +36,8 @@ public class BBSLoginDialog extends UIDialog {
private static final int DIALOG_WIDTH = 400; private static final int DIALOG_WIDTH = 400;
private static final int DIALOG_HEIGHT = 200; private static final int DIALOG_HEIGHT = 200;
private static final String URL = "http://bbs.finereport.com/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1";
private static final String PASSWORD_RESET_URL = "http://bbs.finereport.com/portal.php?mod=topic&topicid=2";
private static final String REGISTER_URL = "http://bbs.finereport.com/member.php?mod=register";
private static final String LOGIN_SUCCESS_FLAG = "http://bbs.finereport.com"; private static final String LOGIN_SUCCESS_FLAG = "http://bbs.finereport.com";
private static final Font DEFAULT_FONT = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, 0, 14); private static final Font DEFAULT_FONT = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, 0, 14);
private static final String TEST_CONNECTION_URL = "http://bbs.finereport.com/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1&username=test&password=123456";
private static final int TIME_OUT = 10000; private static final int TIME_OUT = 10000;
private static final int BUTTON_WIDTH = 90; private static final int BUTTON_WIDTH = 90;
@ -63,14 +59,14 @@ public class BBSLoginDialog extends UIDialog {
private BoxCenterAligmentPane registerLabel; private BoxCenterAligmentPane registerLabel;
private KeyListener keyListener = new KeyAdapter() { private KeyListener keyListener = new KeyAdapter() {
public void keyPressed(KeyEvent e){ public void keyPressed(KeyEvent e) {
int code = e.getKeyCode(); int code = e.getKeyCode();
if(KeyEvent.VK_ESCAPE == code){ if (KeyEvent.VK_ESCAPE == code) {
BBSLoginDialog.this.setVisible(false); BBSLoginDialog.this.setVisible(false);
return; return;
} }
if(KeyEvent.VK_ENTER == code){ if (KeyEvent.VK_ENTER == code) {
login(); login();
} }
} }
@ -91,27 +87,28 @@ public class BBSLoginDialog extends UIDialog {
/** /**
* 构造函数 * 构造函数
*
* @param parent 父窗口 * @param parent 父窗口
* @param userInfoLabel 登录状态label * @param userInfoLabel 登录状态label
*/ */
public BBSLoginDialog(Frame parent,UserInfoLabel userInfoLabel) { public BBSLoginDialog(Frame parent, UserInfoLabel userInfoLabel) {
super(parent); super(parent);
JPanel panel = (JPanel) getContentPane(); JPanel panel = (JPanel) getContentPane();
initComponents(panel); initComponents(panel);
this.userInfoLabel = userInfoLabel; this.userInfoLabel = userInfoLabel;
setSize(new Dimension(DIALOG_WIDTH,DIALOG_HEIGHT)); setSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
} }
private void initComponents(JPanel contentPane) { private void initComponents(JPanel contentPane) {
this.setTitle(Inter.getLocText("FR-Designer-BBSLogin_Login-Title")); this.setTitle(Inter.getLocText("FR-Designer-BBSLogin_Login-Title"));
tipLabel = new UILabel(Inter.getLocText("FR-Designer-BBSLogin_Login-Failure-Tip")); tipLabel = new UILabel(Inter.getLocText("FR-Designer-BBSLogin_Login-Failure-Tip"));
userLabel = new UILabel(Inter.getLocText("FR-Designer-BBSLogin_Account")+":"); userLabel = new UILabel(Inter.getLocText("FR-Designer-BBSLogin_Account") + ":");
passLabel = new UILabel(Inter.getLocText("FR-Designer-BBSLogin_Password")+":"); passLabel = new UILabel(Inter.getLocText("FR-Designer-BBSLogin_Password") + ":");
nameField = new UITextField(); nameField = new UITextField();
passField = new UIPassWordField(); passField = new UIPassWordField();
loginButton = new UIButton(Inter.getLocText("FR-Designer-BBSLogin_Login")); loginButton = new UIButton(Inter.getLocText("FR-Designer-BBSLogin_Login"));
passwordReset = getURLActionLabel(PASSWORD_RESET_URL); passwordReset = getURLActionLabel(SiteCenter.getInstance().acquireUrlByKind("bbs.reset"));
registerLabel = getURLActionLabel(REGISTER_URL); registerLabel = getURLActionLabel(SiteCenter.getInstance().acquireUrlByKind("bbs.register"));
loginButton.addActionListener(new ActionListener() { loginButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent arg0) { public void actionPerformed(ActionEvent arg0) {
@ -130,7 +127,7 @@ public class BBSLoginDialog extends UIDialog {
contentPane.setLayout(new BorderLayout()); contentPane.setLayout(new BorderLayout());
JPanel mainPane = new JPanel(); JPanel mainPane = new JPanel();
mainPane.setLayout(new BorderLayout(0,V_GAP)); mainPane.setLayout(new BorderLayout(0, V_GAP));
initNorthPane(mainPane); initNorthPane(mainPane);
@ -138,81 +135,81 @@ public class BBSLoginDialog extends UIDialog {
initSouthPane(mainPane); initSouthPane(mainPane);
contentPane.add(mainPane,BorderLayout.NORTH); contentPane.add(mainPane, BorderLayout.NORTH);
this.setResizable(false); this.setResizable(false);
} }
private void login(){ private void login() {
if(nameField.getText().isEmpty()){ if (nameField.getText().isEmpty()) {
tipForUsernameEmpty(); tipForUsernameEmpty();
nameField.requestFocus(); nameField.requestFocus();
return; return;
} }
if(String.valueOf(passField.getPassword()).isEmpty()){ if (String.valueOf(passField.getPassword()).isEmpty()) {
tipForPasswordEmpty(); tipForPasswordEmpty();
passField.requestFocus(); passField.requestFocus();
return; return;
} }
if(!testConnection()){ if (!testConnection()) {
connectionFailue(); connectionFailue();
return; return;
} }
if(login(nameField.getText(),String.valueOf(passField.getPassword()))){ if (login(nameField.getText(), String.valueOf(passField.getPassword()))) {
loginSuccess(); loginSuccess();
}else{ } else {
loginFailure(); loginFailure();
} }
} }
private boolean testConnection(){ private boolean testConnection() {
HttpClient client = new HttpClient(TEST_CONNECTION_URL); HttpClient client = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.test"));
return client.isServerAlive(); return client.isServerAlive();
} }
private void initNorthPane(JPanel mainPane){ private void initNorthPane(JPanel mainPane) {
JPanel northPane = new JPanel(); JPanel northPane = new JPanel();
northPane.setPreferredSize(new Dimension(DIALOG_WIDTH,NORTH_PANE_HEIGHT)); northPane.setPreferredSize(new Dimension(DIALOG_WIDTH, NORTH_PANE_HEIGHT));
northPane.add(tipLabel); northPane.add(tipLabel);
mainPane.add(northPane,BorderLayout.NORTH); mainPane.add(northPane, BorderLayout.NORTH);
} }
private void initCenterPane(JPanel mainPane){ private void initCenterPane(JPanel mainPane) {
JPanel loginPane = new JPanel(); JPanel loginPane = new JPanel();
loginPane.setLayout(new GridLayout(2,1,0,V_GAP)); loginPane.setLayout(new GridLayout(2, 1, 0, V_GAP));
JPanel namePane = new JPanel(); JPanel namePane = new JPanel();
namePane.setLayout(new FlowLayout(FlowLayout.RIGHT,FLOWLAYOUT_H_GAP,0)); namePane.setLayout(new FlowLayout(FlowLayout.RIGHT, FLOWLAYOUT_H_GAP, 0));
namePane.add(userLabel); namePane.add(userLabel);
nameField.setPreferredSize(new Dimension(FIELD_WIDTH,FIELD_HEIGHT)); nameField.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT));
namePane.add(nameField); namePane.add(nameField);
namePane.add(passwordReset); namePane.add(passwordReset);
loginPane.add(namePane); loginPane.add(namePane);
JPanel passPane = new JPanel(); JPanel passPane = new JPanel();
passPane.setLayout(new FlowLayout(FlowLayout.RIGHT,FLOWLAYOUT_H_GAP,0)); passPane.setLayout(new FlowLayout(FlowLayout.RIGHT, FLOWLAYOUT_H_GAP, 0));
passPane.add(passLabel); passPane.add(passLabel);
passPane.add(passField); passPane.add(passField);
passField.setPreferredSize(new Dimension(FIELD_WIDTH,FIELD_HEIGHT)); passField.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT));
passPane.add(registerLabel); passPane.add(registerLabel);
loginPane.add(passPane); loginPane.add(passPane);
mainPane.add(loginPane,BorderLayout.CENTER); mainPane.add(loginPane, BorderLayout.CENTER);
} }
private void initSouthPane(JPanel mainPane){ private void initSouthPane(JPanel mainPane) {
JPanel southPane = new JPanel(); JPanel southPane = new JPanel();
southPane.setLayout(new FlowLayout(FlowLayout.RIGHT,BUTTON_H_GAP,0)); southPane.setLayout(new FlowLayout(FlowLayout.RIGHT, BUTTON_H_GAP, 0));
loginButton.setPreferredSize(new Dimension(BUTTON_WIDTH,FIELD_HEIGHT)); loginButton.setPreferredSize(new Dimension(BUTTON_WIDTH, FIELD_HEIGHT));
loginButton.setFont(DEFAULT_FONT); loginButton.setFont(DEFAULT_FONT);
southPane.add(loginButton); southPane.add(loginButton);
mainPane.add(southPane,BorderLayout.SOUTH); mainPane.add(southPane, BorderLayout.SOUTH);
} }
// 登录成功 // 登录成功
private void loginSuccess(){ private void loginSuccess() {
DesignerEnvManager.getEnvManager().setBBSPassword(String.valueOf(passField.getPassword())); DesignerEnvManager.getEnvManager().setBBSPassword(String.valueOf(passField.getPassword()));
userInfoLabel.setUserName(nameField.getText()); userInfoLabel.setUserName(nameField.getText());
userInfoLabel.getUserInfoPane().markSignIn(nameField.getText()); userInfoLabel.getUserInfoPane().markSignIn(nameField.getText());
@ -221,11 +218,11 @@ public class BBSLoginDialog extends UIDialog {
} }
// 登录失败 // 登录失败
private void loginFailure(){ private void loginFailure() {
setLoginFailureTxt(Inter.getLocText("FR-Designer-BBSLogin_Login-Failure-Tip")); setLoginFailureTxt(Inter.getLocText("FR-Designer-BBSLogin_Login-Failure-Tip"));
} }
private void tipForUsernameEmpty(){ private void tipForUsernameEmpty() {
setLoginFailureTxt(Inter.getLocText("FR-Designer-BBSLogin_Username-Empty-Tip")); setLoginFailureTxt(Inter.getLocText("FR-Designer-BBSLogin_Username-Empty-Tip"));
} }
@ -233,11 +230,11 @@ public class BBSLoginDialog extends UIDialog {
setLoginFailureTxt(Inter.getLocText("FR-Designer-BBSLogin_Download-Unlogin-Tip")); setLoginFailureTxt(Inter.getLocText("FR-Designer-BBSLogin_Download-Unlogin-Tip"));
} }
private void tipForPasswordEmpty(){ private void tipForPasswordEmpty() {
setLoginFailureTxt(Inter.getLocText("FR-Designer-BBSLogin_Password-Empty-Tip")); setLoginFailureTxt(Inter.getLocText("FR-Designer-BBSLogin_Password-Empty-Tip"));
} }
private void setLoginFailureTxt(String errorTxt){ private void setLoginFailureTxt(String errorTxt) {
tipLabel.setText(errorTxt); tipLabel.setText(errorTxt);
tipLabel.setForeground(Color.RED); tipLabel.setForeground(Color.RED);
tipLabel.repaint(); tipLabel.repaint();
@ -245,14 +242,14 @@ public class BBSLoginDialog extends UIDialog {
} }
// 连接失败 // 连接失败
private void connectionFailue(){ private void connectionFailue() {
setLoginFailureTxt(Inter.getLocText("FR-Designer-BBSLogin_Connection-Failure")); setLoginFailureTxt(Inter.getLocText("FR-Designer-BBSLogin_Connection-Failure"));
} }
/** /**
* 清楚登录信息 * 清楚登录信息
*/ */
public void clearLoginInformation(){ public void clearLoginInformation() {
tipLabel.setText(StringUtils.EMPTY); tipLabel.setText(StringUtils.EMPTY);
nameField.setText(StringUtils.EMPTY); nameField.setText(StringUtils.EMPTY);
passField.setText(StringUtils.EMPTY); passField.setText(StringUtils.EMPTY);
@ -261,7 +258,7 @@ public class BBSLoginDialog extends UIDialog {
/** /**
* 显示登录窗口 * 显示登录窗口
*/ */
public void showWindow(){ public void showWindow() {
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
setVisible(true); setVisible(true);
} }
@ -276,18 +273,24 @@ public class BBSLoginDialog extends UIDialog {
/** /**
* 是否登陆成功 * 是否登陆成功
*
* @param username 用户名 * @param username 用户名
* @param password 密码 * @param password 密码
* @return 同上 * @return 同上
*/ */
public static boolean login(String username,String password){ public static boolean login(String username, String password) {
String url = URL + "&username=" + username + "&password=" + password; try {
username = URLEncoder.encode(username, EncodeConstants.ENCODING_GBK);
} catch (UnsupportedEncodingException e) {
FRLogger.getLogger().error(e.getMessage());
}
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.login") + "&username=" + username + "&password=" + password;
HttpClient client = new HttpClient(url); HttpClient client = new HttpClient(url);
client.setTimeout(TIME_OUT); client.setTimeout(TIME_OUT);
if(client.getResponseCodeNoException() == HttpURLConnection.HTTP_OK){ if (client.getResponseCodeNoException() == HttpURLConnection.HTTP_OK) {
try { try {
String res = client.getResponseText("GBK"); String res = client.getResponseText(EncodeConstants.ENCODING_GBK);
if(res.contains(LOGIN_SUCCESS_FLAG)){ if (res.contains(LOGIN_SUCCESS_FLAG)) {
return true; return true;
} }
} catch (Exception e) { } catch (Exception e) {
@ -297,11 +300,11 @@ public class BBSLoginDialog extends UIDialog {
return false; return false;
} }
private BoxCenterAligmentPane getURLActionLabel(final String url){ private BoxCenterAligmentPane getURLActionLabel(final String url) {
ActionLabel actionLabel = new ActionLabel(url); ActionLabel actionLabel = new ActionLabel(url);
if(ComparatorUtils.equals(url, PASSWORD_RESET_URL)){ if (ComparatorUtils.equals(url, SiteCenter.getInstance().acquireUrlByKind("bbs.reset"))) {
actionLabel.setText(Inter.getLocText("FR-Designer-BBSLogin_Forgot-Password")); actionLabel.setText(Inter.getLocText("FR-Designer-BBSLogin_Forgot-Password"));
}else{ } else {
actionLabel.setText(Inter.getLocText("FR-Designer-BBSLogin_Register-Account")); actionLabel.setText(Inter.getLocText("FR-Designer-BBSLogin_Register-Account"));
} }

4
designer/src/com/fr/design/present/ConditionAttributesGroupPane.java

@ -6,7 +6,7 @@ import java.util.List;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.design.condition.HighLightConditionAttributesPane; import com.fr.design.condition.HighLightConditionAttributesPane;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -15,7 +15,7 @@ import com.fr.report.cell.cellattr.highlight.Highlight;
import com.fr.report.cell.cellattr.highlight.HighlightGroup; import com.fr.report.cell.cellattr.highlight.HighlightGroup;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
public class ConditionAttributesGroupPane extends JControlPane { public class ConditionAttributesGroupPane extends JListControlPane {
@Override @Override
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {

4
designer/src/com/fr/design/present/StyleArrayPane.java

@ -2,7 +2,7 @@ package com.fr.design.present;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.gui.controlpane.AbstractNameableCreator; import com.fr.design.gui.controlpane.AbstractNameableCreator;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
@ -18,7 +18,7 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
public class StyleArrayPane extends JControlPane { public class StyleArrayPane extends JListControlPane {
/** /**
* Constructor. * Constructor.

70
designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java

@ -0,0 +1,70 @@
package com.fr.design.report.mobile;
import com.fr.design.beans.BasicBeanPane;
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.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class MobileRadioCheckPane extends BasicBeanPane<Boolean> {
private List<UICheckBox> checkBoxes = new ArrayList<UICheckBox>();
public MobileRadioCheckPane(String title) {
initComponents(title);
}
private void initComponents(String title) {
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {p,p};
UICheckBox checkBox = new UICheckBox(Inter.getLocText("FR-Designer_Mobile-Open"));
checkBox.setSelected(true);
checkBoxes.add(checkBox);
Component[][] components = new Component[][]{
new Component[]{new UILabel(title), checkBox}
};
JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
this.add(fitOpsPane);
}
public int getCurrentState() {
return checkBoxes.get(0).isSelected() ? 0 : 1;
}
/**
* 设置按钮状态
*/
public void setEnabled(boolean enabled) {
for (UICheckBox checkBox : checkBoxes) {
checkBox.setEnabled(enabled);
}
}
@Override
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
@Override
public void populateBean(Boolean ob) {
checkBoxes.get(0).setSelected(ob);
}
@Override
public Boolean updateBean() {
int state = getCurrentState();
return state == 0 ? true : false;
}
}

12
designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java

@ -18,6 +18,8 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr> {
private MobileRadioGroupPane horizionPane; private MobileRadioGroupPane horizionPane;
//竖屏设置面板 //竖屏设置面板
private MobileRadioGroupPane verticalPane; private MobileRadioGroupPane verticalPane;
//缩放设置面板
private MobileRadioCheckPane radioCheckPane;
public ReportMobileAttrPane() { public ReportMobileAttrPane() {
initComponents(); initComponents();
@ -30,9 +32,10 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr> {
JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
horizionPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Horizontal")); horizionPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Horizontal"));
verticalPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Vertical")); verticalPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Vertical"));
radioCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Zoom"));
fitOpsPane.add(horizionPane, BorderLayout.NORTH); fitOpsPane.add(horizionPane, BorderLayout.NORTH);
fitOpsPane.add(verticalPane, BorderLayout.SOUTH); fitOpsPane.add(verticalPane, BorderLayout.CENTER);
fitOpsPane.add(radioCheckPane, BorderLayout.SOUTH);
borderPane.add(fitOpsPane); borderPane.add(fitOpsPane);
this.add(borderPane); this.add(borderPane);
} }
@ -45,14 +48,15 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr> {
horizionPane.populateBean(ob.getHorziontalAttr()); horizionPane.populateBean(ob.getHorziontalAttr());
verticalPane.populateBean(ob.getVerticalAttr()); verticalPane.populateBean(ob.getVerticalAttr());
radioCheckPane.populateBean(ob.isZoom());
} }
@Override @Override
public ElementCaseMobileAttr updateBean() { public ElementCaseMobileAttr updateBean() {
MobileFitAttrState horizonState = horizionPane.updateBean(); MobileFitAttrState horizonState = horizionPane.updateBean();
MobileFitAttrState verticalState = verticalPane.updateBean(); MobileFitAttrState verticalState = verticalPane.updateBean();
boolean isZoom = radioCheckPane.updateBean();
return new ElementCaseMobileAttr(horizonState, verticalState); return new ElementCaseMobileAttr(horizonState, verticalState, isZoom);
} }
@Override @Override

4
designer/src/com/fr/design/report/share/ConfusionManagerPane.java

@ -10,7 +10,7 @@ import java.util.List;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.EmbeddedTableData;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.ShortCut4JControlPane;
@ -23,7 +23,7 @@ import com.fr.general.NameObject;
* *
* @date: 2015-3-9-上午9:10:20 * @date: 2015-3-9-上午9:10:20
*/ */
public class ConfusionManagerPane extends JControlPane { public class ConfusionManagerPane extends JListControlPane {
/** /**
* 获取当前面板的编辑对象 * 获取当前面板的编辑对象

3
designer/src/com/fr/design/webattr/ReportWebAttrPane.java

@ -10,6 +10,7 @@ import javax.swing.JPanel;
import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundPane4Browser;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.style.background.BackgroundPane; import com.fr.design.style.background.BackgroundPane;
import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebAttr;
@ -50,7 +51,7 @@ public class ReportWebAttrPane extends LoadingBasicPane {
tabbedPane.add(Inter.getLocText("WEB-Write_Setting"), writeWeb = new WriteWebSettingPane()); tabbedPane.add(Inter.getLocText("WEB-Write_Setting"), writeWeb = new WriteWebSettingPane());
tabbedPane.add(Inter.getLocText("M-Data_Analysis_Settings"), viewWeb = new ViewWebSettingPane()); tabbedPane.add(Inter.getLocText("M-Data_Analysis_Settings"), viewWeb = new ViewWebSettingPane());
tabbedPane.addTab(Inter.getLocText("ReportServerP-Browser_Background"), backgroundPane = new BackgroundPane(true)); tabbedPane.addTab(Inter.getLocText("ReportServerP-Browser_Background"), backgroundPane = new BackgroundPane4Browser());
tabbedPane.addTab(Inter.getLocText("ReportServerP-Import_Css"), cssPane = new WebCssPane()); tabbedPane.addTab(Inter.getLocText("ReportServerP-Import_Css"), cssPane = new WebCssPane());
tabbedPane.addTab(Inter.getLocText("ReportServerP-Import_JavaScript"), jsPane = new WebJsPane()); tabbedPane.addTab(Inter.getLocText("ReportServerP-Import_JavaScript"), jsPane = new WebJsPane());
} }

4
designer/src/com/fr/design/widget/WidgetConfigPane.java

@ -1,6 +1,6 @@
package com.fr.design.widget; package com.fr.design.widget;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.core.WidgetConstants; import com.fr.design.gui.core.WidgetConstants;
@ -17,7 +17,7 @@ import java.util.List;
/** /**
* Widget配置面板 * Widget配置面板
*/ */
public class WidgetConfigPane extends JControlPane { public class WidgetConfigPane extends JListControlPane {
/** /**
* 创建用户自定义widget组件 * 创建用户自定义widget组件

2
designer/src/com/fr/start/Designer.java

@ -35,6 +35,7 @@ import com.fr.general.Inter;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.web.ServletContext;
import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLTools;
import javax.swing.*; import javax.swing.*;
@ -431,6 +432,7 @@ public class Designer extends BaseDesigner {
InformationCollector collector = InformationCollector.getInstance(); InformationCollector collector = InformationCollector.getInstance();
collector.collectStopTime(); collector.collectStopTime();
collector.saveXMLFile(); collector.saveXMLFile();
ServletContext.fireServletStopListener();
} }
} }

31
designer_base/.classpath

@ -1,33 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6u35"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/lib"/> <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/lib"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/base"/> <classpathentry kind="lib" path="D:/Program Files/Git/finereport/lib/report/fr-core-8.0.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/base-stable"/> <classpathentry kind="lib" path="D:/Program Files/Git/finereport/lib/report/fr-third-8.0.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/base-basic"/> <classpathentry kind="lib" path="D:/Program Files/Git/finereport/lib/jetty/org.mortbay.jetty.jar"/>
<classpathentry kind="lib" path="/lib/jetty/activation.jar"/>
<classpathentry kind="lib" path="/lib/jetty/commons-el.jar"/>
<classpathentry kind="lib" path="/lib/jetty/commons-logging.jar"/>
<classpathentry kind="lib" path="/lib/jetty/jasper-compiler.jar"/>
<classpathentry kind="lib" path="/lib/jetty/jasper-runtime.jar"/>
<classpathentry kind="lib" path="/lib/jetty/javax.servlet.jar"/>
<classpathentry kind="lib" path="/lib/jetty/jaxrpc.jar"/>
<classpathentry kind="lib" path="/lib/jetty/mail.jar"/>
<classpathentry kind="lib" path="/lib/jetty/mx4j-remote.jar"/>
<classpathentry kind="lib" path="/lib/jetty/mx4j-tools.jar"/>
<classpathentry kind="lib" path="/lib/jetty/mx4j.jar"/>
<classpathentry kind="lib" path="/lib/jetty/org.mortbay.jetty.jar"/>
<classpathentry kind="lib" path="/lib/jetty/org.mortbay.jmx.jar"/>
<classpathentry kind="lib" path="/lib/jetty/saaj.jar"/>
<classpathentry kind="lib" path="/lib/jetty/xercesImpl.jar"/>
<classpathentry kind="lib" path="/lib/jetty/xml-apis.jar"/>
<classpathentry kind="lib" path="/lib/jetty/xmlParserAPIs.jar"/>
<classpathentry kind="lib" path="/lib/3rd.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/base-calculate"/>
<classpathentry kind="lib" path="/lib/junit.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/base-data"/>
<classpathentry kind="lib" path="/lib/olap4j-1.1.0.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/base-file"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

2
designer_base/designer_base.iml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4"> <module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../../env/8.0/WebReport/WEB-INF/classes" /> <output url="file://$MODULE_DIR$/../../env/WebReport/WEB-INF/classes" />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content> </content>

96
designer_base/src/com/fr/design/ExtraDesignClassManager.java

@ -126,7 +126,7 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
private DesignerEnvProcessor envProcessor; private DesignerEnvProcessor envProcessor;
private TableDataTreePaneProcessor tableDataTreePaneProcessor; private TableDataPaneProcessor tableDataPaneProcessor;
private Set<ElementUIProvider> elementUIProviders; private Set<ElementUIProvider> elementUIProviders;
@ -136,6 +136,10 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
private WidgetDesignHandler widgetDesignHandler; private WidgetDesignHandler widgetDesignHandler;
private Set<BackgroundQuickUIProvider> backgroundQuickUIProviders;
private Set<BackgroundUIProvider> backgroundUIProviders;
public WidgetDesignHandler getWidgetDesignHandler() { public WidgetDesignHandler getWidgetDesignHandler() {
return widgetDesignHandler; return widgetDesignHandler;
} }
@ -144,13 +148,13 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
widgetDesignHandler = (WidgetDesignHandler) level; widgetDesignHandler = (WidgetDesignHandler) level;
} }
public TableDataTreePaneProcessor getTableDataTreePaneProcessor() { public TableDataPaneProcessor getTableDataPaneProcessor() {
return tableDataTreePaneProcessor; return tableDataPaneProcessor;
} }
public void setTableDataSourceOPProcessor(Level level, PluginSimplify simplify) { public void setTableDataPaneProcessor(Level level, PluginSimplify simplify) {
validAPILevel(level, TableDataTreePaneProcessor.CURRENT_LEVEL, simplify.getPluginName()); validAPILevel(level, TableDataPaneProcessor.CURRENT_LEVEL, simplify.getPluginName());
tableDataTreePaneProcessor = (TableDataTreePaneProcessor) level; tableDataPaneProcessor = (TableDataPaneProcessor) level;
} }
public DesignerEnvProcessor getEnvProcessor() { public DesignerEnvProcessor getEnvProcessor() {
@ -765,6 +769,51 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
widgetAttrProviders.add((WidgetPropertyUIProvider) level); widgetAttrProviders.add((WidgetPropertyUIProvider) level);
} }
public ExportAttrTabProvider[] getExportAttrTabProviders() {
if (exportAttrTabProviders == null) {
return new ExportAttrTabProvider[0];
}
return exportAttrTabProviders.toArray(new ExportAttrTabProvider[exportAttrTabProviders.size()]);
}
public void addExportAttrTabProvider(Level level, PluginSimplify simplify) throws Exception {
if (exportAttrTabProviders == null) {
exportAttrTabProviders = new HashSet<ExportAttrTabProvider>();
}
validAPILevel(level, ExportAttrTabProvider.CURRENT_LEVEL, simplify.getPluginName());
exportAttrTabProviders.add((ExportAttrTabProvider) level);
}
public BackgroundQuickUIProvider[] getBackgroundQuickUIProviders() {
if (backgroundQuickUIProviders == null) {
return new BackgroundQuickUIProvider[0];
}
return backgroundQuickUIProviders.toArray(new BackgroundQuickUIProvider[backgroundQuickUIProviders.size()]);
}
public void addBackgroundQuickUIProvider(Level level, PluginSimplify simplify) throws Exception {
if (backgroundQuickUIProviders == null) {
backgroundQuickUIProviders = new HashSet<>();
}
validAPILevel(level, BackgroundQuickUIProvider.CURRENT_LEVEL, simplify.getPluginName());
backgroundQuickUIProviders.add((BackgroundQuickUIProvider) level);
}
public BackgroundUIProvider[] getBackgroundUIProviders() {
if (backgroundUIProviders == null) {
return new BackgroundUIProvider[0];
}
return backgroundUIProviders.toArray(new BackgroundUIProvider[backgroundUIProviders.size()]);
}
public void addBackgroundUIProvider(Level level, PluginSimplify simplify) throws Exception {
if (backgroundUIProviders == null) {
backgroundUIProviders = new HashSet<>();
}
validAPILevel(level, BackgroundUIProvider.CURRENT_LEVEL, simplify.getPluginName());
backgroundUIProviders.add((BackgroundUIProvider) level);
}
/** /**
* 文件名 * 文件名
* *
@ -819,6 +868,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
readWidgetRelated(tagName, impl, simplify); readWidgetRelated(tagName, impl, simplify);
//数据集, 数据连接 //数据集, 数据连接
readTableDataRelated(tagName, className, simplify); readTableDataRelated(tagName, className, simplify);
// 样式相关的
readStyleRelated(tagName, impl, simplify);
if (tagName.equals(ParameterWidgetOptionProvider.XML_TAG)) { if (tagName.equals(ParameterWidgetOptionProvider.XML_TAG)) {
addParameterWidgetOption(impl, simplify); addParameterWidgetOption(impl, simplify);
} else if (tagName.equals(PreviewProvider.MARK_STRING)) { } else if (tagName.equals(PreviewProvider.MARK_STRING)) {
@ -853,13 +904,13 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
addSupportDesignApps(impl, simplify); addSupportDesignApps(impl, simplify);
} else if (tagName.equals(DesignerEnvProcessor.XML_TAG)) { } else if (tagName.equals(DesignerEnvProcessor.XML_TAG)) {
setEnvProcessor(impl, simplify); setEnvProcessor(impl, simplify);
} else if (tagName.equals(TableDataTreePaneProcessor.XML_TAG)) {
setTableDataSourceOPProcessor(impl, simplify);
} else if (tagName.equals(ElementUIProvider.MARK_STRING)) {
addElementUIProvider(impl, simplify);
} else if (tagName.equals(WidgetDesignHandler.XML_TAG)) { } else if (tagName.equals(WidgetDesignHandler.XML_TAG)) {
setWidgetDesignHandler(impl, simplify); setWidgetDesignHandler(impl, simplify);
}else if (tagName.equals(WidgetPropertyUIProvider.XML_TAG)) { } else if (tagName.equals(TableDataPaneProcessor.XML_TAG)) {
setTableDataPaneProcessor(impl, simplify);
} else if (tagName.equals(ElementUIProvider.MARK_STRING)) {
addElementUIProvider(impl, simplify);
} else if (tagName.equals(WidgetPropertyUIProvider.XML_TAG)) {
addWidgetAttrProvider(impl, simplify); addWidgetAttrProvider(impl, simplify);
} else if (tagName.equals(ExportAttrTabProvider.XML_TAG)) { } else if (tagName.equals(ExportAttrTabProvider.XML_TAG)) {
addExportAttrTabProvider(impl, simplify); addExportAttrTabProvider(impl, simplify);
@ -871,21 +922,6 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
} }
} }
public ExportAttrTabProvider[] getExportAttrTabProviders() {
if (exportAttrTabProviders == null) {
return new ExportAttrTabProvider[0];
}
return exportAttrTabProviders.toArray(new ExportAttrTabProvider[exportAttrTabProviders.size()]);
}
public void addExportAttrTabProvider(Level level, PluginSimplify simplify) throws Exception {
if (exportAttrTabProviders == null) {
exportAttrTabProviders = new HashSet<ExportAttrTabProvider>();
}
validAPILevel(level, ExportAttrTabProvider.CURRENT_LEVEL, simplify.getPluginName());
exportAttrTabProviders.add((ExportAttrTabProvider) level);
}
private void readTableDataRelated(String tagName, String className, PluginSimplify simplify) { private void readTableDataRelated(String tagName, String className, PluginSimplify simplify) {
if (tagName.equals(TableDataCreatorProvider.XML_TAG)) { if (tagName.equals(TableDataCreatorProvider.XML_TAG)) {
setTableDataCreatorProvider(className); setTableDataCreatorProvider(className);
@ -910,6 +946,14 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
} }
} }
private void readStyleRelated(String tagName, Level impl, PluginSimplify simplify) throws Exception {
if (tagName.equals(BackgroundQuickUIProvider.MARK_STRING)) {
addBackgroundQuickUIProvider(impl, simplify);
} else if (tagName.equals(BackgroundUIProvider.MARK_STRING)) {
addBackgroundUIProvider(impl, simplify);
}
}
/** /**
* 写xml * 写xml
* *

74
designer_base/src/com/fr/design/actions/community/BBSAction.java

@ -0,0 +1,74 @@
package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.stable.StringUtils;
public class BBSAction extends UpdateAction
{
public BBSAction()
{
this.setMenuKeySet(BBS);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs.png"));
}
/**
* 动作
* @param e 事件
*/
@Override
public void actionPerformed(ActionEvent arg0)
{
String url = SiteCenter.getInstance().acquireUrlByKind("bbs");
if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
}
}
public static final MenuKeySet BBS = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'B';
}
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_COMMUNITY_BBS");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

72
designer_base/src/com/fr/design/actions/community/BugAction.java

@ -0,0 +1,72 @@
package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.stable.StringUtils;
public class BugAction extends UpdateAction
{
public BugAction()
{ this.setMenuKeySet(BUG);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bug.png"));
}
@Override
public void actionPerformed(ActionEvent arg0)
{
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.bugs");
if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
}
}
public static final MenuKeySet BUG = new MenuKeySet() {
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_COMMUNITY_BUG");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
@Override
public char getMnemonic()
{
return 'U';
}
};
}

70
designer_base/src/com/fr/design/actions/community/NeedAction.java

@ -0,0 +1,70 @@
package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.stable.StringUtils;
public class NeedAction extends UpdateAction
{
public NeedAction()
{
this.setMenuKeySet(NEED);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/need.png"));
}
@Override
public void actionPerformed(ActionEvent arg0)
{
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.needs");
if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
}
}
public static final MenuKeySet NEED = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'N';
}
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_COMMUNITY_NEED");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

69
designer_base/src/com/fr/design/actions/community/QuestionAction.java

@ -0,0 +1,69 @@
package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.stable.StringUtils;
public class QuestionAction extends UpdateAction
{
public QuestionAction()
{ this.setMenuKeySet(QUESTIONS);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/questions.png"));
}
@Override
public void actionPerformed(ActionEvent arg0)
{
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.questions");
if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
}
}
public static final MenuKeySet QUESTIONS = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'Q';
}
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_COMMUNITY_QUESTIONS");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

70
designer_base/src/com/fr/design/actions/community/SignAction.java

@ -0,0 +1,70 @@
package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.stable.StringUtils;
public class SignAction extends UpdateAction
{
public SignAction()
{
this.setMenuKeySet(SIGN);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/signature.png"));
}
@Override
public void actionPerformed(ActionEvent arg0)
{
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.aut");
if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
}
}
public static final MenuKeySet SIGN = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'S';
}
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_COMMUNITY_SIGN");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

70
designer_base/src/com/fr/design/actions/community/UpAction.java

@ -0,0 +1,70 @@
package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.stable.StringUtils;
public class UpAction extends UpdateAction
{
public UpAction()
{
this.setMenuKeySet(UPDATE);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/update.png"));
}
@Override
public void actionPerformed(ActionEvent arg0)
{
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.update");
if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
}
}
public static final MenuKeySet UPDATE = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'U';
}
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_COMMUNITY_UPDATE");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

70
designer_base/src/com/fr/design/actions/community/VideoAction.java

@ -0,0 +1,70 @@
package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.stable.StringUtils;
public class VideoAction extends UpdateAction
{
public VideoAction()
{
this.setMenuKeySet(VIDEO);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/video.png"));
}
@Override
public void actionPerformed(ActionEvent arg0)
{
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.video");
if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
}
}
public static final MenuKeySet VIDEO = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'V';
}
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_COMMUNITY_VIDEO");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

9
designer_base/src/com/fr/design/actions/help/TutorialAction.java

@ -17,6 +17,7 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
@ -28,7 +29,7 @@ public class TutorialAction extends UpdateAction {
this.setMenuKeySet(HELP_TUTORIAL); this.setMenuKeySet(HELP_TUTORIAL);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_help/help.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/help.png"));
this.setAccelerator(getMenuKeySet().getKeyStroke()); this.setAccelerator(getMenuKeySet().getKeyStroke());
} }
@ -60,10 +61,10 @@ public class TutorialAction extends UpdateAction {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
Locale locale = FRContext.getLocale(); Locale locale = FRContext.getLocale();
if (ComparatorUtils.equals(locale, Locale.CHINA) || ComparatorUtils.equals(locale, Locale.TAIWAN)){ if (ComparatorUtils.equals(locale, Locale.CHINA) || ComparatorUtils.equals(locale, Locale.TAIWAN)){
HttpClient client = new HttpClient(ProductConstants.HELP_URL); HttpClient client = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("help"));
if(client.getResponseCode() != -1) { if(client.getResponseCode() != -1) {
try { try {
Desktop.getDesktop().browse(new URI(ProductConstants.HELP_URL)); Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("help")));
return; return;
} catch (Exception e) { } catch (Exception e) {
//出了异常的话, 依然打开本地教程 //出了异常的话, 依然打开本地教程
@ -86,7 +87,7 @@ public class TutorialAction extends UpdateAction {
@Override @Override
public String getMenuName() { public String getMenuName() {
return Inter.getLocText("M_Help-Tutorial"); return Inter.getLocText("FR-Designer_COMMUNITY_HELP");
} }
@Override @Override

2
designer_base/src/com/fr/design/condition/LiteConditionPane.java

@ -517,6 +517,8 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
// formulaPane // formulaPane
JPanel formulaPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel formulaPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
// 95106 公式区域限定宽高, 显示两行即可, 在新窗口编辑.
formulaPane.setPreferredSize(new Dimension(450, 40));
formulaConditionPane.add(formulaPane, BorderLayout.CENTER); formulaConditionPane.add(formulaPane, BorderLayout.CENTER);
formulaPane.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 2)); formulaPane.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 2));
formulaPane.add(GUICoreUtils.createBorderPane(new UILabel(Inter.getLocText("FR-Designer_LiteCondition_Formula") + "="), BorderLayout.NORTH), BorderLayout.WEST); formulaPane.add(GUICoreUtils.createBorderPane(new UILabel(Inter.getLocText("FR-Designer_LiteCondition_Formula") + "="), BorderLayout.NORTH), BorderLayout.WEST);

14
designer_base/src/com/fr/design/data/datapane/ReportTableDataPane.java

@ -19,19 +19,19 @@ import java.util.Map;
* 创建于2011-6-14 * 创建于2011-6-14
*/ */
public class ReportTableDataPane extends LoadingBasicPane { public class ReportTableDataPane extends LoadingBasicPane {
private TableDataListPane tdListPane; private TableDataPaneController tdPane;
@Override @Override
protected void initComponents(JPanel container) { protected void initComponents(JPanel container) {
container.setLayout(FRGUIPaneFactory.createBorderLayout()); container.setLayout(FRGUIPaneFactory.createBorderLayout());
this.tdListPane = new TableDataListPane() { tdPane = new TableDataPaneListPane() {
@Override @Override
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
return TableDataCreatorProducer.getInstance().createReportTableDataCreator(); return TableDataCreatorProducer.getInstance().createReportTableDataCreator();
} }
}; };
container.add(tdListPane, BorderLayout.CENTER); container.add(tdPane.getPanel(), BorderLayout.CENTER);
} }
@Override @Override
@ -40,11 +40,11 @@ public class ReportTableDataPane extends LoadingBasicPane {
} }
public void populate(TableDataSource tds) { public void populate(TableDataSource tds) {
tdListPane.populate(tds); tdPane.populate(tds);
} }
public void update(TableDataSource tds) { public void update(TableDataSource tds) {
tdListPane.update(tds); tdPane.update(tds);
} }
/** /**
@ -53,10 +53,10 @@ public class ReportTableDataPane extends LoadingBasicPane {
* @throws Exception 异常 * @throws Exception 异常
*/ */
public void checkValid() throws Exception { public void checkValid() throws Exception {
this.tdListPane.checkValid(); this.tdPane.checkValid();
} }
public Map<String, String> getDsNameChangedMap() { public Map<String, String> getDsNameChangedMap() {
return tdListPane.getDsNameChangedMap(); return tdPane.getDsNameChangedMap();
} }
} }

62
designer_base/src/com/fr/design/data/datapane/TableDataPaneController.java

@ -0,0 +1,62 @@
package com.fr.design.data.datapane;
import com.fr.data.TableDataSource;
import com.fr.file.DatasourceManagerProvider;
import javax.swing.*;
import java.util.Map;
/**
* Coder: zack
* Date: 2016/5/18
* Time: 10:13
*/
public interface TableDataPaneController {
/**
* 获取数据集名字变更集合
*
* @return
*/
Map<String, String> getDsNameChangedMap();
/**
* 数据集重命名
*
* @param oldName
* @param newName
*/
void rename(String oldName, String newName);
/**
* 是否合法
* @throws Exception
*/
void checkValid() throws Exception;
/**
* 名字是否允许
* @return
*/
boolean isNamePermitted();
void populate(DatasourceManagerProvider datasourceManagerProvider);
void update(DatasourceManagerProvider datasourceManagerProvider);
void populate(TableDataSource datasourceManagerProvider);
void update(TableDataSource datasourceManagerProvider);
/**
* 设置选中项
* @param index
*/
void setSelectedIndex(int index);
/**
* 返回当前数据集面板
* @return
*/
JPanel getPanel();
}

31
designer_base/src/com/fr/design/data/datapane/TableDataListPane.java → designer_base/src/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -4,7 +4,7 @@ import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
@ -21,11 +21,11 @@ import java.util.*;
/** /**
* TableDataList Pane. * TableDataList Pane.
*/ */
public class TableDataListPane extends JControlPane { public class TableDataPaneListPane extends JListControlPane implements TableDataPaneController {
private Map<String, String> dsNameChangedMap = new HashMap<String, String>();
private boolean isNamePermitted = true; private boolean isNamePermitted = true;
private Map<String, String> dsNameChangedMap = new HashMap<String, String>();
public TableDataListPane() { public TableDataPaneListPane() {
super(); super();
dsNameChangedMap.clear(); dsNameChangedMap.clear();
this.addEditingListner(new PropertyChangeAdapter() { this.addEditingListner(new PropertyChangeAdapter() {
@ -43,7 +43,7 @@ public class TableDataListPane extends JControlPane {
String[] sign = new String[]{",", "!"}; String[] sign = new String[]{",", "!"};
isNamePermitted = false; isNamePermitted = false;
nameableList.stopEditing(); nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataListPane.this), Inter.getLocText(warning, sign)); JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Inter.getLocText(warning, sign));
setWarnigText(editingIndex); setWarnigText(editingIndex);
return; return;
} }
@ -54,14 +54,14 @@ public class TableDataListPane extends JControlPane {
String[] sign = new String[]{"", tempName + ",", "!"}; String[] sign = new String[]{"", tempName + ",", "!"};
isNamePermitted = false; isNamePermitted = false;
nameableList.stopEditing(); nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataListPane.this), Inter.getLocText(waning, sign)); JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Inter.getLocText(waning, sign));
setWarnigText(editingIndex); setWarnigText(editingIndex);
} else if (editingType instanceof StoreProcedure && isIncludeUnderline(tempName)) { } else if (editingType instanceof StoreProcedure && isIncludeUnderline(tempName)) {
String[] datasource_underline = new String[]{"Datasource-Stored_Procedure", "Name", "can_not_include_underline"}; String[] datasource_underline = new String[]{"Datasource-Stored_Procedure", "Name", "can_not_include_underline"};
String[] sign = new String[]{"", "", "!"}; String[] sign = new String[]{"", "", "!"};
isNamePermitted = false; isNamePermitted = false;
nameableList.stopEditing(); nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataListPane.this), Inter.getLocText(datasource_underline, sign)); JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Inter.getLocText(datasource_underline, sign));
setWarnigText(editingIndex); setWarnigText(editingIndex);
} }
if (nameableList.getSelectedValue() instanceof ListModelElement) { if (nameableList.getSelectedValue() instanceof ListModelElement) {
@ -75,7 +75,8 @@ public class TableDataListPane extends JControlPane {
}); });
} }
protected void rename(String oldName, String newName) { @Override
public void rename(String oldName, String newName) {
dsNameChangedMap.put(oldName, newName); dsNameChangedMap.put(oldName, newName);
} }
@ -84,6 +85,7 @@ public class TableDataListPane extends JControlPane {
* *
* @return / * @return /
*/ */
@Override
public boolean isNamePermitted() { public boolean isNamePermitted() {
return isNamePermitted; return isNamePermitted;
} }
@ -92,6 +94,7 @@ public class TableDataListPane extends JControlPane {
/** /**
* 检查按钮可用状态 Check button enabled. * 检查按钮可用状态 Check button enabled.
*/ */
@Override
public void checkButtonEnabled() { public void checkButtonEnabled() {
super.checkButtonEnabled(); super.checkButtonEnabled();
isNamePermitted = !isContainsRename(); isNamePermitted = !isContainsRename();
@ -106,6 +109,7 @@ public class TableDataListPane extends JControlPane {
* *
* @return 数组 * @return 数组
*/ */
@Override
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
return TableDataCreatorProducer.getInstance().createServerTableDataCreator(); return TableDataCreatorProducer.getInstance().createServerTableDataCreator();
} }
@ -166,6 +170,7 @@ public class TableDataListPane extends JControlPane {
/** /**
* Populate. * Populate.
*/ */
@Override
public void populate(TableDataSource tds) { public void populate(TableDataSource tds) {
List<NameObject> nameObjectList = new ArrayList<NameObject>(); List<NameObject> nameObjectList = new ArrayList<NameObject>();
@ -185,6 +190,7 @@ public class TableDataListPane extends JControlPane {
/** /**
* Populate. * Populate.
*/ */
@Override
public void populate(DatasourceManagerProvider datasourceManager) { public void populate(DatasourceManagerProvider datasourceManager) {
Iterator<String> nameIt = datasourceManager.getTableDataNameIterator(); Iterator<String> nameIt = datasourceManager.getTableDataNameIterator();
Iterator<String> procedurenameIt = datasourceManager.getProcedureNameIterator(); Iterator<String> procedurenameIt = datasourceManager.getProcedureNameIterator();
@ -201,6 +207,7 @@ public class TableDataListPane extends JControlPane {
populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
} }
@Override
public void update(DatasourceManagerProvider datasourceManager) { public void update(DatasourceManagerProvider datasourceManager) {
datasourceManager.clearAllTableData(); datasourceManager.clearAllTableData();
datasourceManager.clearAllProcedure(); datasourceManager.clearAllProcedure();
@ -211,6 +218,7 @@ public class TableDataListPane extends JControlPane {
} }
} }
@Override
public void update(TableDataSource tds) { public void update(TableDataSource tds) {
tds.clearAllTableData(); tds.clearAllTableData();
@ -224,6 +232,7 @@ public class TableDataListPane extends JControlPane {
/** /**
* 判断数据集是否重名 * 判断数据集是否重名
*/ */
@Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
List<String> exsitTableDataNameList = new ArrayList<String>(); List<String> exsitTableDataNameList = new ArrayList<String>();
// _denny: 判断是否有重复的数据集名 // _denny: 判断是否有重复的数据集名
@ -255,7 +264,13 @@ public class TableDataListPane extends JControlPane {
this.setSelectedName(name); this.setSelectedName(name);
} }
@Override
public Map<String, String> getDsNameChangedMap() { public Map<String, String> getDsNameChangedMap() {
return this.dsNameChangedMap; return this.dsNameChangedMap;
} }
@Override
public JPanel getPanel() {
return this;
}
} }

4
designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java

@ -14,7 +14,7 @@ import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.fun.TableDataTreePaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
@ -47,7 +47,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
public synchronized static BasicTableDataTreePane getInstance(DesignModelAdapter<?, ?> tc) { public synchronized static BasicTableDataTreePane getInstance(DesignModelAdapter<?, ?> tc) {
TableDataTreePaneProcessor treePaneProcessor = ExtraDesignClassManager.getInstance().getTableDataTreePaneProcessor(); TableDataPaneProcessor treePaneProcessor = ExtraDesignClassManager.getInstance().getTableDataPaneProcessor();
if (treePaneProcessor != null) { if (treePaneProcessor != null) {
return treePaneProcessor.createTableDataTreePane(tc); return treePaneProcessor.createTableDataTreePane(tc);
} }

4
designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -4,7 +4,7 @@ import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
@ -22,7 +22,7 @@ import java.util.*;
/** /**
* Connection List Pane. * Connection List Pane.
*/ */
public class ConnectionListPane extends JControlPane { public class ConnectionListPane extends JListControlPane {
public static final String TITLE_NAME = Inter.getLocText("Server-Define_Data_Connection"); public static final String TITLE_NAME = Inter.getLocText("Server-Define_Data_Connection");
private boolean isNamePermitted = true; private boolean isNamePermitted = true;
private HashMap<String, String> renameMap = new HashMap<String, String>(); private HashMap<String, String> renameMap = new HashMap<String, String>();

4
designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureListPane.java

@ -3,7 +3,7 @@ package com.fr.design.data.tabledata.tabledatapane;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
@ -19,7 +19,7 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
public class ProcedureListPane extends JControlPane { public class ProcedureListPane extends JListControlPane {
public ProcedureListPane() { public ProcedureListPane() {
super(); super();
this.addEditingListner(new PropertyChangeAdapter() { this.addEditingListner(new PropertyChangeAdapter() {

36
designer_base/src/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java

@ -1,7 +1,11 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.data.datapane.TableDataListPane; import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.data.datapane.TableDataPaneController;
import com.fr.design.data.datapane.TableDataPaneListPane;
import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
@ -18,7 +22,7 @@ import java.util.Map;
public class TableDataManagerPane extends LoadingBasicPane { public class TableDataManagerPane extends LoadingBasicPane {
private UITextField tableDataTextField; private UITextField tableDataTextField;
private TableDataListPane tableDataListPane; private TableDataPaneController tableDataPane;
@Override @Override
protected void initComponents(JPanel container) { protected void initComponents(JPanel container) {
@ -36,13 +40,19 @@ public class TableDataManagerPane extends LoadingBasicPane {
this.tableDataTextField = new UITextField(); this.tableDataTextField = new UITextField();
tableDataPathPane.add(tableDataTextField, BorderLayout.CENTER); tableDataPathPane.add(tableDataTextField, BorderLayout.CENTER);
this.tableDataTextField.setEditable(false); this.tableDataTextField.setEditable(false);
tableDataListPane = new TableDataListPane(){ TableDataPaneProcessor paneProcessor = ExtraDesignClassManager.getInstance().getTableDataPaneProcessor();
protected void rename(String oldName,String newName){ TableDataPaneController pane = null;
super.rename(oldName,newName); if (paneProcessor != null) {
pane = paneProcessor.createServerTableDataPane(DesignModelAdapter.getCurrentModelAdapter()
);
}
tableDataPane = pane == null ? new TableDataPaneListPane() {
public void rename(String oldName, String newName) {
super.rename(oldName, newName);
renameConnection(oldName, newName); renameConnection(oldName, newName);
} }
}; } : pane;
container.add(tableDataListPane, BorderLayout.CENTER); container.add(tableDataPane.getPanel(), BorderLayout.CENTER);
} }
@ -51,7 +61,7 @@ public class TableDataManagerPane extends LoadingBasicPane {
* @return 是则返回true * @return 是则返回true
*/ */
public boolean isNamePermitted(){ public boolean isNamePermitted(){
return tableDataListPane.isNamePermitted(); return tableDataPane.isNamePermitted();
} }
/** /**
@ -59,7 +69,7 @@ public class TableDataManagerPane extends LoadingBasicPane {
* @throws Exception 异常 * @throws Exception 异常
*/ */
public void checkValid() throws Exception { public void checkValid() throws Exception {
tableDataListPane.checkValid(); tableDataPane.checkValid();
} }
@Override @Override
@ -70,15 +80,15 @@ public class TableDataManagerPane extends LoadingBasicPane {
public void populate(DatasourceManagerProvider datasourceManager) { public void populate(DatasourceManagerProvider datasourceManager) {
this.tableDataTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME this.tableDataTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME
+ File.separator + datasourceManager.fileName()); + File.separator + datasourceManager.fileName());
this.tableDataListPane.populate(datasourceManager); this.tableDataPane.populate(datasourceManager);
} }
public void update(DatasourceManagerProvider datasourceManager) { public void update(DatasourceManagerProvider datasourceManager) {
this.tableDataListPane.update(datasourceManager); this.tableDataPane.update(datasourceManager);
} }
public Map<String, String> getDsChangedNameMap () { public Map<String, String> getDsChangedNameMap () {
return this.tableDataListPane.getDsNameChangedMap(); return this.tableDataPane.getDsNameChangedMap();
} }
/** /**
@ -87,6 +97,6 @@ public class TableDataManagerPane extends LoadingBasicPane {
* @param index 选中项的序列号 * @param index 选中项的序列号
*/ */
public void setSelectedIndex(int index) { public void setSelectedIndex(int index) {
this.tableDataListPane.setSelectedIndex(index); this.tableDataPane.setSelectedIndex(index);
} }
} }

10
designer_base/src/com/fr/design/extra/PluginShopDialog.java

@ -4,17 +4,23 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javafx.embed.swing.JFXPanel;
import javax.swing.*;
import java.awt.*; import java.awt.*;
/** /**
* Created by vito on 16/4/18. * Created by vito on 16/4/18.
*/ */
public class PluginShopDialog extends UIDialog { public class PluginShopDialog extends UIDialog {
private static final Dimension DEFAULT_SHOP = new Dimension(900, 684); private static final Dimension DEFAULT_SHOP = new Dimension(900, 700);
public PluginShopDialog(Frame frame, BasicPane pane) { public PluginShopDialog(Frame frame, BasicPane pane) {
super(frame, pane, false); super(frame);
setUndecorated(true);
JPanel panel = (JPanel) getContentPane();
panel.setLayout(new BorderLayout());
add(pane, BorderLayout.CENTER);
setSize(DEFAULT_SHOP); setSize(DEFAULT_SHOP);
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
setResizable(false); setResizable(false);

23
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -36,8 +36,6 @@ public class PluginWebBridge {
private UIDialog uiDialog; private UIDialog uiDialog;
public static final String PLUGIN_SHOP = SiteCenter.getInstance().acquireUrlByKind("plugin.plist");
public static PluginWebBridge getHelper() { public static PluginWebBridge getHelper() {
if (helper != null) { if (helper != null) {
return helper; return helper;
@ -153,6 +151,7 @@ public class PluginWebBridge {
* @param des 过滤文件描述 * @param des 过滤文件描述
* @param filter 文件的后缀 * @param filter 文件的后缀
* @return 选择的文件的路径 * @return 选择的文件的路径
* 这里换用JFileChooser会卡死,不知道为什么
*/ */
public String showFileChooserWithFilter(String des, String filter) { public String showFileChooserWithFilter(String des, String filter) {
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();
@ -243,6 +242,16 @@ public class PluginWebBridge {
new Thread(task).start(); new Thread(task).start();
} }
/**
* 在线获取插件分类
*
* @param callback 回调函数
*/
public void getPluginCategories(final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginCategoriesExecutor());
new Thread(task).start();
}
/** /**
* 展示一个重启的对话框(少用,莫名其妙会有bug) * 展示一个重启的对话框(少用,莫名其妙会有bug)
* *
@ -274,6 +283,16 @@ public class PluginWebBridge {
} }
} }
/**
* 窗口是否无装饰(判断是否使用系统标题栏)
*/
public boolean isCustomTitleBar() {
if (uiDialog != null) {
return uiDialog.isUndecorated();
}
return false;
}
/** /**
* 在本地浏览器里打开url * 在本地浏览器里打开url
* tips:重载的时候,需要给js调用的方法需要放在前面,否则可能不会被调用(此乃坑) * tips:重载的时候,需要给js调用的方法需要放在前面,否则可能不会被调用(此乃坑)

35
designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java

@ -0,0 +1,35 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.Process;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
/**
* Created by vito on 16/5/16.
*/
public class GetPluginCategoriesExecutor implements Executor {
private String result = "[]";
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return null;
}
@Override
public void run(Process<String> process) {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.category"));
result = httpClient.getResponseText();
}
}
};
}
}

4
designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

@ -1,8 +1,8 @@
package com.fr.design.extra.exe; package com.fr.design.extra.exe;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -38,7 +38,7 @@ public class GetPluginFromStoreExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
StringBuilder url = new StringBuilder(PluginWebBridge.PLUGIN_SHOP); StringBuilder url = new StringBuilder(SiteCenter.getInstance().acquireUrlByKind("plugin.plist"));
if (StringUtils.isNotBlank(category)) { if (StringUtils.isNotBlank(category)) {
url.append("&cid=").append(category.split("-")[1]); url.append("&cid=").append(category.split("-")[1]);
} }

4
designer_base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java

@ -1,8 +1,8 @@
package com.fr.design.extra.exe; package com.fr.design.extra.exe;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -34,7 +34,7 @@ public class SearchOnlineExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
try { try {
HttpClient httpClient = new HttpClient(PluginWebBridge.PLUGIN_SHOP + "&keyword=" + keyword); HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.plist") + "&keyword=" + keyword);
result = httpClient.getResponseText(); result = httpClient.getResponseText();
} catch (Exception e) { } catch (Exception e) {

6
designer_base/src/com/fr/design/extra/exe/UninstallExecutor.java

@ -16,6 +16,7 @@ import javax.swing.*;
public class UninstallExecutor implements Executor { public class UninstallExecutor implements Executor {
private String[] pluginIDs; private String[] pluginIDs;
private String result = "undo";
public UninstallExecutor(String[] pluginIDs) { public UninstallExecutor(String[] pluginIDs) {
this.pluginIDs = pluginIDs; this.pluginIDs = pluginIDs;
@ -23,7 +24,7 @@ public class UninstallExecutor implements Executor {
@Override @Override
public String getTaskFinishMessage() { public String getTaskFinishMessage() {
return "插件已卸载完毕,重启后生效"; return result;
} }
@Override @Override
@ -32,7 +33,7 @@ public class UninstallExecutor implements Executor {
new Command() { new Command() {
@Override @Override
public String getExecuteMessage() { public String getExecuteMessage() {
return "删除成功"; return null;
} }
@Override @Override
@ -62,6 +63,7 @@ public class UninstallExecutor implements Executor {
JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }
result = "done";
if (rv == JOptionPane.OK_OPTION) { if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart(); RestartHelper.restart();
} }

19
designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java

@ -10,6 +10,7 @@ import com.fr.design.extra.Process;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.Plugin; import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginLoader;
import com.fr.plugin.PluginVerifyException;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -43,11 +44,13 @@ public class UpdateOnlineExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
if(StringUtils.isBlank(DesignerEnvManager.getEnvManager().getBBSName())){ if (StringUtils.isBlank(DesignerEnvManager.getEnvManager().getBBSName())) {
LoginCheckContext.fireLoginCheckListener(); LoginCheckContext.fireLoginCheckListener();
} }
if(StringUtils.isNotBlank(DesignerEnvManager.getEnvManager().getBBSName())){ if (StringUtils.isNotBlank(DesignerEnvManager.getEnvManager().getBBSName())) {
try {
for (int i = 0; i < pluginIDs.length; i++) { for (int i = 0; i < pluginIDs.length; i++) {
try {
Plugin plugin = PluginLoader.getLoader().getPluginById(pluginIDs[i]); Plugin plugin = PluginLoader.getLoader().getPluginById(pluginIDs[i]);
String id = null; String id = null;
if (plugin != null) { if (plugin != null) {
@ -55,7 +58,6 @@ public class UpdateOnlineExecutor implements Executor {
} }
String username = DesignerEnvManager.getEnvManager().getBBSName(); String username = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword(); String password = DesignerEnvManager.getEnvManager().getBBSPassword();
try {
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() { PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() {
@Override @Override
public void process(Double integer) { public void process(Double integer) {
@ -63,6 +65,8 @@ public class UpdateOnlineExecutor implements Executor {
}); });
updateFileFromDisk(PluginHelper.getDownloadTempFile()); updateFileFromDisk(PluginHelper.getDownloadTempFile());
process.process(PERCENT_100 / pluginIDs.length * (i + 1) + "%"); process.process(PERCENT_100 / pluginIDs.length * (i + 1) + "%");
} catch (PluginVerifyException e) {
throw e;
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }
@ -82,14 +86,16 @@ public class UpdateOnlineExecutor implements Executor {
if (rv == JOptionPane.OK_OPTION) { if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart(); RestartHelper.restart();
} }
} catch (PluginVerifyException e) {
JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
} }
} }
} }
}; };
} }
private void updateFileFromDisk(File fileOnDisk) { private void updateFileFromDisk(File fileOnDisk) throws Exception {
try {
Plugin plugin = PluginHelper.readPlugin(fileOnDisk); Plugin plugin = PluginHelper.readPlugin(fileOnDisk);
if (plugin == null) { if (plugin == null) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Illegal_Plugin_Zip"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Illegal_Plugin_Zip"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
@ -106,8 +112,5 @@ public class UpdateOnlineExecutor implements Executor {
} else { } else {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Cannot_Update_Not_Install"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Cannot_Update_Not_Install"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} catch (Exception e1) {
JOptionPane.showMessageDialog(null, e1.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
} }
} }

4
designer_base/src/com/fr/design/formula/FunctionManagerPane.java

@ -6,7 +6,7 @@ import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -97,7 +97,7 @@ public class FunctionManagerPane extends BasicPane {
/** /**
* CellRenderer. * CellRenderer.
*/ */
class FunctionControlPane extends JControlPane { class FunctionControlPane extends JListControlPane {
public FunctionControlPane() { public FunctionControlPane() {
super(); super();

22
designer_base/src/com/fr/design/fun/BackgroundQuickUIProvider.java

@ -0,0 +1,22 @@
package com.fr.design.fun;
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane;
import com.fr.stable.fun.Level;
import com.fr.stable.fun.Provider;
/**
* Created by richie on 16/5/18.
* 背景设置界面接口,用于扩展设置更多类型的背景
*/
public interface BackgroundQuickUIProvider extends Level, Provider {
String MARK_STRING = "BackgroundQuickUIProvider";
int CURRENT_LEVEL = 1;
/**
* 背景设置界面
* @return 设置界面
*/
BackgroundQuickPane appearanceForBackground();
}

34
designer_base/src/com/fr/design/fun/BackgroundUIProvider.java

@ -0,0 +1,34 @@
package com.fr.design.fun;
import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.general.Background;
import com.fr.stable.fun.Level;
import com.fr.stable.fun.Provider;
/**
* Created by richie on 16/5/18.
*/
public interface BackgroundUIProvider extends Level, Provider {
String MARK_STRING = "BackgroundUIProvider";
int CURRENT_LEVEL = 1;
/**
* 对应的背景具体类型
* @return 背景
*/
Class<? extends Background> targetClass();
/**
* 背景设置界面
* @return 界面
*/
Class<? extends BackgroundDetailPane> targetUIClass();
/**
* 标题
* @return 在设计界面上这个选项的显示标题
*/
String targetTitle();
}

21
designer_base/src/com/fr/design/fun/ElementUIProvider.java

@ -7,6 +7,7 @@ import com.fr.stable.fun.Level;
/** /**
* Created by richie on 16/4/25. * Created by richie on 16/4/25.
* 单元格元素和悬浮元素扩展,通过实现这个接口,可以在单元格中添加更多类型的元素.
*/ */
public interface ElementUIProvider extends Level { public interface ElementUIProvider extends Level {
@ -14,13 +15,33 @@ public interface ElementUIProvider extends Level {
int CURRENT_LEVEL = 1; int CURRENT_LEVEL = 1;
/**
* 单元格元素编辑器
* @return 编辑器
*/
Class<?> targetCellEditorClass(); Class<?> targetCellEditorClass();
/**
* 单元格内容
* @return 单元格内容
*/
Class<?> targetObjectClass(); Class<?> targetObjectClass();
/**
* 右侧的快速编辑器
* @return 编辑器
*/
QuickEditor<?> quickEditor(); QuickEditor<?> quickEditor();
/**
* 插件单元格元素
* @return 插入操作类
*/
Class<? extends UpdateAction> actionForInsertCellElement(); Class<? extends UpdateAction> actionForInsertCellElement();
/**
* 插入悬浮元素
* @return 插入操作类
*/
Class<? extends UpdateAction> actionForInsertFloatElement(); Class<? extends UpdateAction> actionForInsertFloatElement();
} }

13
designer_base/src/com/fr/design/fun/ExportToolBarProvider.java

@ -6,9 +6,6 @@ import javax.swing.*;
/** /**
* 导出菜单设计器端拓展用于控制该菜单是否在web端显示 * 导出菜单设计器端拓展用于控制该菜单是否在web端显示
* @author focus
* @date Jul 2, 2015
* @since 8.0
*/ */
public interface ExportToolBarProvider extends Level{ public interface ExportToolBarProvider extends Level{
@ -16,8 +13,6 @@ public interface ExportToolBarProvider extends Level{
int CURRENT_LEVEL = 1; int CURRENT_LEVEL = 1;
/** /**
* *
* 用于添加 控制web端是否显示该菜单的checkbox的面板 * 用于添加 控制web端是否显示该菜单的checkbox的面板
@ -28,16 +23,12 @@ public interface ExportToolBarProvider extends Level{
JPanel updateCenterPane(JPanel pane); JPanel updateCenterPane(JPanel pane);
/** /**
* 根据xml里面存的web段按钮显示状态更新对应的checkbox * 更新界面
*
*/ */
void populate(); void populate();
/** /**
* 根据checkbox控制web段菜单是否显示 * 保存界面设置
*
* @return
*/ */
void update(); void update();
} }

6
designer_base/src/com/fr/design/fun/GlobalListenerProvider.java

@ -7,6 +7,7 @@ import java.awt.event.AWTEventListener;
/** /**
* Created by zack on 2015/8/17. * Created by zack on 2015/8/17.
* 全局事件监听
*/ */
public interface GlobalListenerProvider extends Level{ public interface GlobalListenerProvider extends Level{
@ -14,6 +15,9 @@ public interface GlobalListenerProvider extends Level{
int CURRENT_LEVEL = 1; int CURRENT_LEVEL = 1;
/**
* 返回一个AWT监听事件给系统注册
* @return AWT监听事件
*/
AWTEventListener listener(); AWTEventListener listener();
} }

6
designer_base/src/com/fr/design/fun/HighlightProvider.java

@ -5,10 +5,7 @@ import com.fr.design.condition.ConditionAttributesPane;
import com.fr.stable.fun.Level; import com.fr.stable.fun.Level;
/** /**
* @author richie * 条件属性界面设计接口
* @date 2015-03-26
* @since 8.0
* 条件属性接口
*/ */
public interface HighlightProvider extends Level{ public interface HighlightProvider extends Level{
@ -16,7 +13,6 @@ public interface HighlightProvider extends Level{
int CURRENT_LEVEL = 1; int CURRENT_LEVEL = 1;
/** /**
* 条件属性的实现类 * 条件属性的实现类
* @return 实现类 * @return 实现类

3
designer_base/src/com/fr/design/fun/ServerTableDataDefineProvider.java

@ -7,6 +7,5 @@ package com.fr.design.fun;
*/ */
public interface ServerTableDataDefineProvider extends TableDataDefineProvider { public interface ServerTableDataDefineProvider extends TableDataDefineProvider {
public static final String XML_TAG = "ServerTableDataDefineProvider"; String XML_TAG = "ServerTableDataDefineProvider";
} }

14
designer_base/src/com/fr/design/fun/TableDataDefineProvider.java

@ -11,7 +11,7 @@ import com.fr.stable.fun.Level;
*/ */
public interface TableDataDefineProvider extends Level { public interface TableDataDefineProvider extends Level {
public static final String XML_TAG = "TableDataDefineProvider"; String XML_TAG = "TableDataDefineProvider";
int CURRENT_LEVEL = 1; int CURRENT_LEVEL = 1;
@ -19,35 +19,35 @@ public interface TableDataDefineProvider extends Level {
* 自定义的数据集设置界面所对应的数据集类型 * 自定义的数据集设置界面所对应的数据集类型
* @return 数据集的类型 * @return 数据集的类型
*/ */
public Class<? extends TableData> classForTableData(); Class<? extends TableData> classForTableData();
/** /**
* 自定义数据集设置界面所对应的初始化数据集类型在一种数据集有多个实现的时候有效 * 自定义数据集设置界面所对应的初始化数据集类型在一种数据集有多个实现的时候有效
* @return 数据集类型 * @return 数据集类型
*/ */
public Class<? extends TableData> classForInitTableData(); Class<? extends TableData> classForInitTableData();
/** /**
* 自定义的数据集设置界面所对应的界面类型 * 自定义的数据集设置界面所对应的界面类型
* @return 数据集界面类型 * @return 数据集界面类型
*/ */
public Class<? extends AbstractTableDataPane> appearanceForTableData(); Class<? extends AbstractTableDataPane> appearanceForTableData();
/** /**
* 自定义数据集设置界面在菜单上的现实名字 * 自定义数据集设置界面在菜单上的现实名字
* @return 名字 * @return 名字
*/ */
public String nameForTableData(); String nameForTableData();
/** /**
* 自定义数据集在新建的时候名字前缀 * 自定义数据集在新建的时候名字前缀
* @return 名字前缀 * @return 名字前缀
*/ */
public String prefixForTableData(); String prefixForTableData();
/** /**
* 自定义数据集在菜单上现实的图标 * 自定义数据集在菜单上现实的图标
* @return 图标 * @return 图标
*/ */
public String iconPathForTableData(); String iconPathForTableData();
} }

36
designer_base/src/com/fr/design/fun/TableDataPaneProcessor.java

@ -0,0 +1,36 @@
package com.fr.design.fun;
import com.fr.design.DesignModelAdapter;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.datapane.TableDataPaneController;
import com.fr.design.menu.ShortCut;
import com.fr.stable.fun.Level;
/**
* 自定义的模板服务器数据集的树样式接口 el:分组样式
* Coder: zack
* Date: 2016/4/18
* Time: 9:04
*/
public interface TableDataPaneProcessor extends Level {
String XML_TAG = "TableDataPaneProcessor";
int CURRENT_LEVEL = 1;
/**
* 创建数据集面板
* @return 数据集面板
*/
BasicTableDataTreePane createTableDataTreePane(DesignModelAdapter<?, ?> tc);
/**
* 服务器数据集面板(模板数据集面板)
* @return 服务器数据集面板
*/
TableDataPaneController createServerTableDataPane(DesignModelAdapter<?, ?> tc);
/**
* 自定义服务器数据集菜单项
* @return
*/
ShortCut createServerTDAction();
}

23
designer_base/src/com/fr/design/fun/TableDataTreePaneProcessor.java

@ -1,23 +0,0 @@
package com.fr.design.fun;
import com.fr.design.DesignModelAdapter;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.stable.fun.Level;
/**
* 自定义的模板服务器数据集的树样式接口 el:分组样式
* Coder: zack
* Date: 2016/4/18
* Time: 9:04
*/
public interface TableDataTreePaneProcessor extends Level {
String XML_TAG = "TableDataTreePaneProcessor";
int CURRENT_LEVEL = 1;
/**
* 创建数据集面板
* @return 数据集面板
*/
BasicTableDataTreePane createTableDataTreePane(DesignModelAdapter<?, ?> tc);
}

20
designer_base/src/com/fr/design/fun/impl/AbstractBackgroundQuickUIProvider.java

@ -0,0 +1,20 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.BackgroundQuickUIProvider;
import com.fr.stable.fun.impl.AbstractProvider;
/**
* Created by richie on 16/5/18.
*/
public abstract class AbstractBackgroundQuickUIProvider extends AbstractProvider implements BackgroundQuickUIProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

20
designer_base/src/com/fr/design/fun/impl/AbstractBackgroundUIProvider.java

@ -0,0 +1,20 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.BackgroundUIProvider;
import com.fr.stable.fun.impl.AbstractProvider;
/**
* Created by richie on 16/5/18.
*/
public abstract class AbstractBackgroundUIProvider extends AbstractProvider implements BackgroundUIProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

4
designer_base/src/com/fr/design/fun/impl/AbstractTDTreePaneProcessor.java → designer_base/src/com/fr/design/fun/impl/AbstractTDPaneProcessor.java

@ -1,13 +1,13 @@
package com.fr.design.fun.impl; package com.fr.design.fun.impl;
import com.fr.design.fun.TableDataTreePaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
/** /**
* Coder: zack * Coder: zack
* Date: 2016/4/18 * Date: 2016/4/18
* Time: 10:30 * Time: 10:30
*/ */
public abstract class AbstractTDTreePaneProcessor implements TableDataTreePaneProcessor { public abstract class AbstractTDPaneProcessor implements TableDataPaneProcessor {
@Override @Override
public int currentAPILevel() { public int currentAPILevel() {
return CURRENT_LEVEL; return CURRENT_LEVEL;

978
designer_base/src/com/fr/design/gui/controlpane/JControlPane.java

File diff suppressed because it is too large Load Diff

966
designer_base/src/com/fr/design/gui/controlpane/JListControlPane.java

@ -0,0 +1,966 @@
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.icontainer.UIScrollPane;
import com.fr.design.gui.ilist.JNameEdList;
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 javax.swing.*;
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;
public abstract class JListControlPane extends JControlPane {
public static final String LIST_NAME = "JControl_List";
protected JNameEdList nameableList;
protected int editingIndex;
protected String selectedName;
private boolean isNameRepeated = false;
public JListControlPane() {
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) JListControlPane.this.controlUpdatePane).update();
((JControlUpdatePane) JListControlPane.this.controlUpdatePane).populate();
JListControlPane.this.checkButtonEnabled();
}
}
});
}
public JNameEdList createJNameList() {
JNameEdList nameEdList = new JNameEdList(new DefaultListModel()) {
@Override
protected void doAfterLostFocus() {
JListControlPane.this.updateControlUpdatePane();
}
};
nameEdList.setCellRenderer(new NameableListCellRenderer());
return nameEdList;
}
public void updateControlUpdatePane() {
((JControlUpdatePane) controlUpdatePane).update();
}
protected void doWhenPopulate(BasicBeanPane beanPane) {
}
@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<Nameable> res = new java.util.ArrayList<Nameable>();
((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) JListControlPane.this.controlUpdatePane).populate();
}
/**
* 根据name,选中JNameEdList中的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) {
JNameEdList nameEdList = JListControlPane.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) JListControlPane.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++;
}
}
/**
* 增加项的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(JListControlPane.this);
JListControlPane.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);
}
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(JListControlPane.this);
JListControlPane.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 {
JListControlPane.this.nameableList.getCellEditor()
.stopCellEditing();
} catch (Exception ignored) {
}
// bug:在选中一个NameObject并删除,会遗留下Name.
doBeforeRemove();
if (GUICoreUtils.removeJListSelectedNodes(SwingUtilities
.getWindowAncestor(JListControlPane.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()));
JListControlPane.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<Nameable> nameableComparator = new Comparator<Nameable>() {
@Override
public int compare(Nameable o1, Nameable o2) {
return -ComparatorUtils.compare(o1.getName(), o2
.getName());
}
};
isAtoZ = !isAtoZ;
Arrays.sort(nameableArray, nameableComparator);
} else {
Comparator<Nameable> nameableComparator = new Comparator<Nameable>() {
@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();
}
}
/*
* JNameEdList的鼠标事件
*/
private MouseListener listMouseListener = new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent evt) {
nameableList.stopEditing();
if (evt.getClickCount() >= 2
&& SwingUtilities.isLeftMouseButton(evt)) {
editingIndex = nameableList.getSelectedIndex();
selectedName = nameableList.getNameAt(editingIndex);
nameableList.editItemAt(nameableList.getSelectedIndex());
}
// 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();
}
}
/*
* Nameable的ListCellRenerer
*/
private 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 ListModelElement) {
Nameable wrappee = ((ListModelElement) value).wrapper;
this.setText(((ListModelElement) value).wrapper.getName());
boolean iconSet = false;
for (NameableCreator creator : JListControlPane.this.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;
}
}
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
&& JListControlPane.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
&& JListControlPane.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
&& JListControlPane.this.nameableList.getSelectedIndex() < JListControlPane.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) JListControlPane.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));
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 = JListControlPane.this.getInValidIndex();
if (isAdd || nameableList.getSelectedIndex() != idx) {
try {
checkValid();
} catch (Exception exp) {
JOptionPane.showMessageDialog(JListControlPane.this, exp.getMessage());
nameableList.setSelectedIndex(idx);
return true;
}
}
return false;
}
/**
* 设置选中项
*
* @param index 选中项的序列号
*/
public void setSelectedIndex(int index) {
nameableList.setSelectedIndex(index);
}
}

2
designer_base/src/com/fr/design/gui/controlpane/ObjectJControlPane.java

@ -11,7 +11,7 @@ import com.fr.design.beans.BasicBeanPane;
* @author zhou * @author zhou
* @since 2012-4-5上午9:29:20 * @since 2012-4-5上午9:29:20
*/ */
public abstract class ObjectJControlPane extends JControlPane { public abstract class ObjectJControlPane extends JListControlPane {
private Object object; private Object object;
public ObjectJControlPane() { public ObjectJControlPane() {

4
designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -4,7 +4,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.HyperlinkPluginAction; import com.fr.design.actions.HyperlinkPluginAction;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.fun.HyperlinkProvider; import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -25,7 +25,7 @@ import java.util.List;
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-6-25 上午11:17:57 * @version 创建时间2013-6-25 上午11:17:57
*/ */
public class HyperlinkGroupPane extends JControlPane { public class HyperlinkGroupPane extends JListControlPane {
/** /**
* 生成添加按钮的NameableCreator * 生成添加按钮的NameableCreator

25
designer_base/src/com/fr/design/gui/style/BackgroundNoImagePane.java

@ -1,10 +1,10 @@
package com.fr.design.gui.style; package com.fr.design.gui.style;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.mainframe.backgroundpane.BackgroundSettingPane; import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundPane; import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundPane; import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import java.util.ArrayList; import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -18,8 +18,9 @@ public class BackgroundNoImagePane extends BackgroundPane{
super(); super();
} }
protected void initPaneList(){ @Override
ColorBackgroundPane colorBackgroundPane = new ColorBackgroundPane(); protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {
ColorBackgroundQuickPane colorBackgroundPane = new ColorBackgroundQuickPane();
colorBackgroundPane.registerChangeListener(new UIObserverListener() { colorBackgroundPane.registerChangeListener(new UIObserverListener() {
@Override @Override
@ -27,7 +28,7 @@ public class BackgroundNoImagePane extends BackgroundPane{
fireStateChanged(); fireStateChanged();
} }
}); });
GradientPane gradientPane = new GradientPane(); GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() { gradientPane.registerChangeListener(new UIObserverListener() {
@Override @Override
@ -35,10 +36,10 @@ public class BackgroundNoImagePane extends BackgroundPane{
fireStateChanged(); fireStateChanged();
} }
}); });
paneList = new ArrayList<BackgroundSettingPane>(); return new BackgroundQuickPane[]{
paneList.add(new NullBackgroundPane()); new NullBackgroundQuickPane(),
paneList.add(colorBackgroundPane); colorBackgroundPane,
paneList.add(gradientPane); gradientPane
};
} }
} }

79
designer_base/src/com/fr/design/gui/style/BackgroundPane.java

@ -1,34 +1,22 @@
package com.fr.design.gui.style; package com.fr.design.gui.style;
/*
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.BackgroundQuickUIProvider;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.mainframe.backgroundpane.BackgroundSettingPane; import com.fr.design.mainframe.backgroundpane.*;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundPane;
import com.fr.design.mainframe.backgroundpane.ImageBackgroundPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundPane;
import com.fr.design.mainframe.backgroundpane.PatternBackgroundPane;
import com.fr.design.mainframe.backgroundpane.TextureBackgroundPane;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
/** /**
*
* @author zhou * @author zhou
* @since 2012-5-28下午6:22:09 * @since 2012-5-28下午6:22:09
*/ */
@ -36,7 +24,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
private UIComboBox typeComboBox; private UIComboBox typeComboBox;
protected List<BackgroundSettingPane> paneList; protected BackgroundQuickPane[] paneList;
public BackgroundPane() { public BackgroundPane() {
this.initComponents(); this.initComponents();
@ -48,16 +36,16 @@ public class BackgroundPane extends AbstractBasicStylePane {
final CardLayout cardlayout = new CardLayout(); final CardLayout cardlayout = new CardLayout();
this.add(typeComboBox, BorderLayout.NORTH); this.add(typeComboBox, BorderLayout.NORTH);
initPaneList(); paneList = supportKindsOfBackgroundUI();
final JPanel centerPane = new JPanel(cardlayout) { final JPanel centerPane = new JPanel(cardlayout) {
@Override @Override
public Dimension getPreferredSize() {// AUGUST:使用当前面板的的高度 public Dimension getPreferredSize() {// AUGUST:使用当前面板的的高度
int index = typeComboBox.getSelectedIndex(); int index = typeComboBox.getSelectedIndex();
return new Dimension(super.getPreferredSize().width, paneList.get(index).getPreferredSize().height); return new Dimension(super.getPreferredSize().width, paneList[index].getPreferredSize().height);
} }
}; };
for (int i = 0; i < paneList.size(); i++) { for (BackgroundQuickPane pane : paneList) {
BackgroundSettingPane pane = paneList.get(i);
typeComboBox.addItem(pane.title4PopupWindow()); typeComboBox.addItem(pane.title4PopupWindow());
centerPane.add(pane, pane.title4PopupWindow()); centerPane.add(pane, pane.title4PopupWindow());
} }
@ -66,24 +54,32 @@ public class BackgroundPane extends AbstractBasicStylePane {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
cardlayout.show(centerPane, (String)typeComboBox.getSelectedItem()); cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem());
fireStateChanged(); fireStateChanged();
} }
}); });
} }
protected void initPaneList(){ protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {
paneList = new ArrayList<BackgroundSettingPane>(); java.util.List<BackgroundQuickPane> kinds = new ArrayList<>();
paneList.add(new NullBackgroundPane()); kinds.add(new NullBackgroundQuickPane());
paneList.add(new ColorBackgroundPane()); kinds.add(new ColorBackgroundQuickPane());
paneList.add(new TextureBackgroundPane()); kinds.add(new TextureBackgroundQuickPane());
paneList.add(new PatternBackgroundPane()); kinds.add(new PatternBackgroundQuickPane());
paneList.add(new ImageBackgroundPane()); kinds.add(new ImageBackgroundQuickPane());
paneList.add(new GradientPane()); kinds.add(new GradientBackgroundQuickPane());
BackgroundQuickUIProvider[] providers = ExtraDesignClassManager.getInstance().getBackgroundQuickUIProviders();
for (BackgroundQuickUIProvider provider : providers) {
kinds.add(provider.appearanceForBackground());
}
return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
} }
/** /**
* 事件监听 * 事件监听
*
* @param changeListener 事件 * @param changeListener 事件
*/ */
public void addChangeListener(ChangeListener changeListener) { public void addChangeListener(ChangeListener changeListener) {
@ -101,13 +97,14 @@ public class BackgroundPane extends AbstractBasicStylePane {
if (e == null) { if (e == null) {
e = new ChangeEvent(this); e = new ChangeEvent(this);
} }
((ChangeListener)listeners[i + 1]).stateChanged(e); ((ChangeListener) listeners[i + 1]).stateChanged(e);
} }
} }
} }
/** /**
* 名称 * 名称
*
* @return 名称 * @return 名称
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
@ -118,8 +115,8 @@ public class BackgroundPane extends AbstractBasicStylePane {
* Populate background. * Populate background.
*/ */
public void populateBean(Background background) { public void populateBean(Background background) {
for (int i = 0; i < paneList.size(); i++) { for (int i = 0; i < paneList.length; i++) {
BackgroundSettingPane pane = paneList.get(i); BackgroundQuickPane pane = paneList[i];
if (pane.accept(background)) { if (pane.accept(background)) {
pane.populateBean(background); pane.populateBean(background);
typeComboBox.setSelectedIndex(i); typeComboBox.setSelectedIndex(i);
@ -132,7 +129,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
* Update background. * Update background.
*/ */
public Background update() { public Background update() {
return paneList.get(typeComboBox.getSelectedIndex()).updateBean(); return paneList[typeComboBox.getSelectedIndex()].updateBean();
} }
@Override @Override

28
designer_base/src/com/fr/design/gui/style/BackgroundSpecialPane.java

@ -1,12 +1,7 @@
package com.fr.design.gui.style; package com.fr.design.gui.style;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.mainframe.backgroundpane.BackgroundSettingPane; import com.fr.design.mainframe.backgroundpane.*;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundPane;
import com.fr.design.mainframe.backgroundpane.ImageBackgroundPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundPane;
import java.util.ArrayList;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -20,8 +15,9 @@ public class BackgroundSpecialPane extends BackgroundPane{
super(); super();
} }
protected void initPaneList(){ @Override
ColorBackgroundPane colorBackgroundPane = new ColorBackgroundPane(); protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {
ColorBackgroundQuickPane colorBackgroundPane = new ColorBackgroundQuickPane();
colorBackgroundPane.registerChangeListener(new UIObserverListener() { colorBackgroundPane.registerChangeListener(new UIObserverListener() {
@Override @Override
@ -29,7 +25,7 @@ public class BackgroundSpecialPane extends BackgroundPane{
fireStateChanged(); fireStateChanged();
} }
}); });
ImageBackgroundPane imageBackgroundPane = new ImageBackgroundPane(); ImageBackgroundQuickPane imageBackgroundPane = new ImageBackgroundQuickPane();
imageBackgroundPane.registerChangeListener(new UIObserverListener() { imageBackgroundPane.registerChangeListener(new UIObserverListener() {
@Override @Override
@ -37,18 +33,18 @@ public class BackgroundSpecialPane extends BackgroundPane{
fireStateChanged(); fireStateChanged();
} }
}); });
GradientPane gradientPane = new GradientPane(); GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() { gradientPane.registerChangeListener(new UIObserverListener() {
@Override @Override
public void doChange() { public void doChange() {
fireStateChanged(); fireStateChanged();
} }
}); });
paneList = new ArrayList<BackgroundSettingPane>(); return new BackgroundQuickPane[] {
paneList.add(new NullBackgroundPane()); new NullBackgroundQuickPane(),
paneList.add(colorBackgroundPane); colorBackgroundPane,
paneList.add(imageBackgroundPane); imageBackgroundPane,
paneList.add(gradientPane); gradientPane
};
} }
} }

BIN
designer_base/src/com/fr/design/images/bbs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
designer_base/src/com/fr/design/images/bug.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
designer_base/src/com/fr/design/images/help.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

BIN
designer_base/src/com/fr/design/images/need.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
designer_base/src/com/fr/design/images/questions.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
designer_base/src/com/fr/design/images/signature.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

BIN
designer_base/src/com/fr/design/images/update.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
designer_base/src/com/fr/design/images/video.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

2
designer_base/src/com/fr/design/mainframe/backgroundpane/BackgroundSettingPane.java → designer_base/src/com/fr/design/mainframe/backgroundpane/BackgroundQuickPane.java

@ -8,7 +8,7 @@ import com.fr.general.Background;
* @author zhou * @author zhou
* @since 2012-5-29下午1:12:28 * @since 2012-5-29下午1:12:28
*/ */
public abstract class BackgroundSettingPane extends BasicBeanPane<Background> implements UIObserver { public abstract class BackgroundQuickPane extends BasicBeanPane<Background> implements UIObserver {
public abstract boolean accept(Background background); public abstract boolean accept(Background background);

4
designer_base/src/com/fr/design/mainframe/backgroundpane/ColorBackgroundPane.java → designer_base/src/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java

@ -15,11 +15,11 @@ import java.awt.*;
* @author zhou * @author zhou
* @since 2012-5-29下午1:12:14 * @since 2012-5-29下午1:12:14
*/ */
public class ColorBackgroundPane extends BackgroundSettingPane { public class ColorBackgroundQuickPane extends BackgroundQuickPane {
private NewColorSelectPane detailColorSelectPane; private NewColorSelectPane detailColorSelectPane;
public ColorBackgroundPane() { public ColorBackgroundQuickPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
detailColorSelectPane = new NewColorSelectPane(); detailColorSelectPane = new NewColorSelectPane();

11
designer_base/src/com/fr/design/gui/style/GradientPane.java → designer_base/src/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java

@ -1,4 +1,4 @@
package com.fr.design.gui.style; package com.fr.design.mainframe.backgroundpane;
import com.fr.base.background.GradientBackground; import com.fr.base.background.GradientBackground;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -6,10 +6,9 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.BackgroundSettingPane; import com.fr.design.style.background.gradient.GradientBar;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.style.background.gradient.GradientBar;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -20,7 +19,7 @@ import java.awt.*;
* @author zhou * @author zhou
* @since 2012-5-30上午10:36:21 * @since 2012-5-30上午10:36:21
*/ */
public class GradientPane extends BackgroundSettingPane { public class GradientBackgroundQuickPane extends BackgroundQuickPane {
private static final long serialVersionUID = -6854603990673031897L; private static final long serialVersionUID = -6854603990673031897L;
private static final int DEFAULT_GRADIENT_WIDTH = 185; private static final int DEFAULT_GRADIENT_WIDTH = 185;
@ -30,11 +29,11 @@ public class GradientPane extends BackgroundSettingPane {
private GradientBar gradientBar; private GradientBar gradientBar;
private UIButtonGroup<Integer> directionPane; private UIButtonGroup<Integer> directionPane;
public GradientPane() { public GradientBackgroundQuickPane() {
constructPane(); constructPane();
} }
public GradientPane(int gradientBarWidth) { public GradientBackgroundQuickPane(int gradientBarWidth) {
this.gradientBarWidth = gradientBarWidth; this.gradientBarWidth = gradientBarWidth;
constructPane(); constructPane();
} }

8
designer_base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundPane.java → designer_base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java

@ -28,7 +28,7 @@ import java.io.File;
* @author zhou * @author zhou
* @since 2012-5-29下午1:12:06 * @since 2012-5-29下午1:12:06
*/ */
public class ImageBackgroundPane extends BackgroundSettingPane { public class ImageBackgroundQuickPane extends BackgroundQuickPane {
private ImagePreviewPane previewPane; private ImagePreviewPane previewPane;
private Style imageStyle = null; private Style imageStyle = null;
@ -37,11 +37,11 @@ public class ImageBackgroundPane extends BackgroundSettingPane {
private UIButtonGroup<Byte> imageLayoutPane; private UIButtonGroup<Byte> imageLayoutPane;
public ImageBackgroundPane() { public ImageBackgroundQuickPane() {
this(true); this(true);
} }
public ImageBackgroundPane(boolean hasImageLayout) { public ImageBackgroundQuickPane(boolean hasImageLayout) {
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 4));
String[] nameArray = {Inter.getLocText("FR-Background_Image_Default"), Inter.getLocText("FR-Background_Image_Titled"), Inter.getLocText("FR-Background_Image_Adjust"), Inter.getLocText("FR-Background_Image_Extend")}; String[] nameArray = {Inter.getLocText("FR-Background_Image_Default"), Inter.getLocText("FR-Background_Image_Titled"), Inter.getLocText("FR-Background_Image_Adjust"), Inter.getLocText("FR-Background_Image_Extend")};
Byte[] valueArray = {Constants.IMAGE_CENTER, Constants.IMAGE_TILED, Constants.IMAGE_EXTEND, Constants.IMAGE_ADJUST}; Byte[] valueArray = {Constants.IMAGE_CENTER, Constants.IMAGE_TILED, Constants.IMAGE_EXTEND, Constants.IMAGE_ADJUST};
@ -121,7 +121,7 @@ public class ImageBackgroundPane extends BackgroundSettingPane {
imageLayoutPane.setSelectedItem((byte) imageBackground.getLayout()); imageLayoutPane.setSelectedItem((byte) imageBackground.getLayout());
Style.DEFAULT_STYLE.deriveImageLayout(imageBackground.getLayout()); Style.DEFAULT_STYLE.deriveImageLayout(imageBackground.getLayout());
previewPane.setImageStyle(ImageBackgroundPane.this.imageStyle); previewPane.setImageStyle(ImageBackgroundQuickPane.this.imageStyle);
previewPane.setImage(imageBackground.getImage()); previewPane.setImage(imageBackground.getImage());
previewPane.repaint(); previewPane.repaint();
} }

2
designer_base/src/com/fr/design/mainframe/backgroundpane/NullBackgroundPane.java → designer_base/src/com/fr/design/mainframe/backgroundpane/NullBackgroundQuickPane.java

@ -10,7 +10,7 @@ import java.awt.*;
* @author zhou * @author zhou
* @since 2012-5-29下午1:12:24 * @since 2012-5-29下午1:12:24
*/ */
public class NullBackgroundPane extends BackgroundSettingPane { public class NullBackgroundQuickPane extends BackgroundQuickPane {
public Dimension getPreferredSize(){ public Dimension getPreferredSize(){
return new Dimension(0,0); return new Dimension(0,0);

14
designer_base/src/com/fr/design/mainframe/backgroundpane/PatternBackgroundPane.java → designer_base/src/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java

@ -23,14 +23,14 @@ import java.awt.geom.Rectangle2D;
* @author zhou * @author zhou
* @since 2012-5-29下午1:12:33 * @since 2012-5-29下午1:12:33
*/ */
public class PatternBackgroundPane extends BackgroundSettingPane { public class PatternBackgroundQuickPane extends BackgroundQuickPane {
private int patternIndex = 0; // pattern index. private int patternIndex = 0; // pattern setIndex.
private ColorSelectBox foregroundColorPane; private ColorSelectBox foregroundColorPane;
private ColorSelectBox backgroundColorPane; private ColorSelectBox backgroundColorPane;
private PatternButton[] patternButtonArray; private PatternButton[] patternButtonArray;
public PatternBackgroundPane() { public PatternBackgroundQuickPane() {
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 4));
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
@ -132,7 +132,7 @@ public class PatternBackgroundPane extends BackgroundSettingPane {
patternButtonArray[i].setPatternBackground(backgroundColorPane.getSelectObject()); patternButtonArray[i].setPatternBackground(backgroundColorPane.getSelectObject());
} }
PatternBackgroundPane.this.repaint();// repaint PatternBackgroundQuickPane.this.repaint();// repaint
} }
}; };
@ -175,13 +175,13 @@ public class PatternBackgroundPane extends BackgroundSettingPane {
} }
/** /**
* set Pattern index. * set Pattern setIndex.
*/ */
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
PatternBackgroundPane.this.patternIndex = pIndex; PatternBackgroundQuickPane.this.patternIndex = pIndex;
fireChagneListener(); fireChagneListener();
PatternBackgroundPane.this.repaint();// repaint PatternBackgroundQuickPane.this.repaint();// repaint
} }
public void addChangeListener(ChangeListener changeListener) { public void addChangeListener(ChangeListener changeListener) {

10
designer_base/src/com/fr/design/mainframe/backgroundpane/TextureBackgroundPane.java → designer_base/src/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java

@ -18,12 +18,12 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
public class TextureBackgroundPane extends BackgroundSettingPane { public class TextureBackgroundQuickPane extends BackgroundQuickPane {
private TexturePaint texturePaint; private TexturePaint texturePaint;
private TextureButton[] textureButtonArray; private TextureButton[] textureButtonArray;
public TextureBackgroundPane() { public TextureBackgroundQuickPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -122,13 +122,13 @@ public class TextureBackgroundPane extends BackgroundSettingPane {
} }
/** /**
* set Pattern index. * set Pattern setIndex.
*/ */
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
TextureBackgroundPane.this.texturePaint = this.getTexturePaint(); TextureBackgroundQuickPane.this.texturePaint = this.getTexturePaint();
fireChagneListener(); fireChagneListener();
TextureBackgroundPane.this.repaint(); // repaint. TextureBackgroundQuickPane.this.repaint(); // repaint.
} }
public void addChangeListener(ChangeListener changeListener) { public void addChangeListener(ChangeListener changeListener) {

48
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -8,6 +8,13 @@ import com.fr.base.FRContext;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.community.BBSAction;
import com.fr.design.actions.community.BugAction;
import com.fr.design.actions.community.NeedAction;
import com.fr.design.actions.community.QuestionAction;
import com.fr.design.actions.community.SignAction;
import com.fr.design.actions.community.UpAction;
import com.fr.design.actions.community.VideoAction;
import com.fr.design.actions.file.CloseCurrentTemplateAction; import com.fr.design.actions.file.CloseCurrentTemplateAction;
import com.fr.design.actions.file.ExitDesignerAction; import com.fr.design.actions.file.ExitDesignerAction;
import com.fr.design.actions.file.OpenRecentReportMenuDef; import com.fr.design.actions.file.OpenRecentReportMenuDef;
@ -28,6 +35,7 @@ import com.fr.design.actions.server.PlatformManagerAction;
import com.fr.design.actions.server.PluginManagerAction; import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.file.NewTemplatePane; import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenu; import com.fr.design.gui.imenu.UIMenu;
@ -148,6 +156,8 @@ public abstract class ToolBarMenuDock {
// 添加帮助菜单 // 添加帮助菜单
menuList.add(createHelpMenuDef()); menuList.add(createHelpMenuDef());
// 添加社区菜单
menuList.add(createCommunityMenuDef());
return menuList.toArray(new MenuDef[menuList.size()]); return menuList.toArray(new MenuDef[menuList.size()]);
} }
@ -263,7 +273,7 @@ public abstract class ToolBarMenuDock {
if (!BaseUtils.isAuthorityEditing()) { if (!BaseUtils.isAuthorityEditing()) {
menuDef.addShortCut( menuDef.addShortCut(
new ConnectionListAction(), new ConnectionListAction(),
new GlobalTableDataAction() createGlobalTDAction()
); );
} }
@ -288,6 +298,11 @@ public abstract class ToolBarMenuDock {
return menuDef; return menuDef;
} }
private ShortCut createGlobalTDAction() {
TableDataPaneProcessor processor = ExtraDesignClassManager.getInstance().getTableDataPaneProcessor();
return processor == null ? new GlobalTableDataAction() : processor.createServerTDAction();
}
private boolean shouldShowPlugin() { private boolean shouldShowPlugin() {
return FRContext.isChineseEnv() || ComparatorUtils.equals(GeneralContext.getLocale(), Locale.TAIWAN); return FRContext.isChineseEnv() || ComparatorUtils.equals(GeneralContext.getLocale(), Locale.TAIWAN);
} }
@ -300,14 +315,14 @@ public abstract class ToolBarMenuDock {
java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>(); java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
shortCuts.add(new WebDemoAction()); shortCuts.add(new WebDemoAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new TutorialAction()); //shortCuts.add(new TutorialAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
if (ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)) { if (ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)) {
shortCuts.add(new FeedBackAction()); shortCuts.add(new FeedBackAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new SupportQQAction()); shortCuts.add(new SupportQQAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new ForumAction()); // shortCuts.add(new ForumAction());
} }
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new AboutAction()); shortCuts.add(new AboutAction());
@ -315,7 +330,22 @@ public abstract class ToolBarMenuDock {
return shortCuts.toArray(new ShortCut[shortCuts.size()]); return shortCuts.toArray(new ShortCut[shortCuts.size()]);
} }
/**
* 创建社区子菜单
* @return 社区菜单的子菜单
*/
public ShortCut[] createCommunityShortCuts() {
java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
shortCuts.add(new BBSAction());
shortCuts.add(new VideoAction());
shortCuts.add(new TutorialAction());
shortCuts.add(new QuestionAction());
shortCuts.add(new UpAction());
shortCuts.add(new NeedAction());
shortCuts.add(new BugAction());
shortCuts.add(new SignAction());
return shortCuts.toArray(new ShortCut[shortCuts.size()]);
}
private MenuDef createHelpMenuDef() { private MenuDef createHelpMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_Help"), 'H'); MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_Help"), 'H');
ShortCut[] otherHelpShortCuts = createHelpShortCuts(); ShortCut[] otherHelpShortCuts = createHelpShortCuts();
@ -325,7 +355,15 @@ public abstract class ToolBarMenuDock {
insertMenu(menuDef, MenuHandler.HELP); insertMenu(menuDef, MenuHandler.HELP);
return menuDef; return menuDef;
} }
private MenuDef createCommunityMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_COMMUNITY"), 'C');
ShortCut[] otherCommunityShortCuts = createCommunityShortCuts();
for (ShortCut shortCut : otherCommunityShortCuts) {
menuDef.addShortCut(shortCut);
}
insertMenu(menuDef, MenuHandler.HELP);
return menuDef;
}
/** /**
* 生成工具栏 * 生成工具栏
* *

6
designer_base/src/com/fr/design/mingche.java

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

4
designer_base/src/com/fr/design/parameter/ParameterArrayPane.java

@ -2,7 +2,7 @@ package com.fr.design.parameter;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.NameableSelfCreator; import com.fr.design.gui.controlpane.NameableSelfCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
@ -18,7 +18,7 @@ import javax.swing.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class ParameterArrayPane extends JControlPane { public class ParameterArrayPane extends JListControlPane {
/** /**
* Constructor. * Constructor.
*/ */

6
designer_base/src/com/fr/design/style/AbstractPopBox.java

@ -2,7 +2,7 @@ package com.fr.design.style;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundJComponent; import com.fr.design.style.background.BackgroundJComponent;
import com.fr.design.style.background.gradient.GradientPane; import com.fr.design.style.background.gradient.GradientBackgroundPane;
import com.fr.general.Background; import com.fr.general.Background;
import javax.swing.*; import javax.swing.*;
@ -96,8 +96,8 @@ public abstract class AbstractPopBox extends JPanel {
mouseClick(evt); mouseClick(evt);
} }
}; };
if (!this.isWindowEventInit && SwingUtilities.getAncestorOfClass(GradientPane.class, this) != null) { if (!this.isWindowEventInit && SwingUtilities.getAncestorOfClass(GradientBackgroundPane.class, this) != null) {
SwingUtilities.getAncestorOfClass(GradientPane.class, this).addMouseListener(parentMouseListener); SwingUtilities.getAncestorOfClass(GradientBackgroundPane.class, this).addMouseListener(parentMouseListener);
this.isWindowEventInit = true; this.isWindowEventInit = true;
} }
} }

18
designer_base/src/com/fr/design/style/background/BackgroundDetailPane.java

@ -0,0 +1,18 @@
package com.fr.design.style.background;
import com.fr.general.Background;
import javax.swing.*;
import javax.swing.event.ChangeListener;
/**
* Created by richie on 16/5/18.
*/
public abstract class BackgroundDetailPane extends JPanel {
public abstract void populate(Background background);
public abstract Background update() throws Exception;
public abstract void addChangeListener(ChangeListener changeListener);
}

121
designer_base/src/com/fr/design/style/background/BackgroundFactory.java

@ -0,0 +1,121 @@
package com.fr.design.style.background;
import com.fr.base.background.*;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.BackgroundUIProvider;
import com.fr.design.style.background.gradient.GradientBackgroundPane;
import com.fr.design.style.background.impl.*;
import com.fr.general.Background;
import com.fr.general.Inter;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
/**
* Created by richie on 16/5/18.
*/
public class BackgroundFactory {
private static Map<Class<? extends Background>, BackgroundUIWrapper> map = new LinkedHashMap<>();
private static Map<Class<? extends Background>, BackgroundUIWrapper> browser = new LinkedHashMap<>();
static {
registerUniversal(map);
registerImageBackground(map);
registerUniversal(browser);
registerBrowserImageBackground(browser);
registerExtra(map);
registerExtra(browser);
}
private static void registerUniversal(Map<Class<? extends Background>, BackgroundUIWrapper> map) {
map.put(null, BackgroundUIWrapper.create()
.setType(NullBackgroundPane.class).setTitle(Inter.getLocText("Background-Null")));
map.put(ColorBackground.class, BackgroundUIWrapper.create()
.setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("Color")));
map.put(TextureBackground.class, BackgroundUIWrapper.create()
.setType(TextureBackgroundPane.class).setTitle(Inter.getLocText("Background-Texture")));
map.put(PatternBackground.class, BackgroundUIWrapper.create()
.setType(PatternBackgroundPane.class).setTitle(Inter.getLocText("Background-Pattern")));
map.put(GradientBackground.class, BackgroundUIWrapper.create()
.setType(GradientBackgroundPane.class).setTitle(Inter.getLocText("Gradient-Color")));
}
private static void registerImageBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map) {
map.put(ImageBackground.class, BackgroundUIWrapper.create()
.setType(ImageBackgroundPane.class).setTitle(Inter.getLocText("Image")));
}
private static void registerBrowserImageBackground(Map<Class<? extends Background>, BackgroundUIWrapper> map) {
map.put(ImageBackground.class, BackgroundUIWrapper.create()
.setType(ImageBackgroundPane4Browser.class).setTitle(Inter.getLocText("Image")));
}
private static void registerExtra(Map<Class<? extends Background>, BackgroundUIWrapper> map) {
for (BackgroundUIProvider provider : ExtraDesignClassManager.getInstance().getBackgroundUIProviders()) {
map.put(provider.targetClass(), BackgroundUIWrapper.create()
.setType(provider.targetUIClass()).setTitle(provider.targetTitle()));
}
}
public static Set<Class<? extends Background>> kindsOfKey() {
return map.keySet();
}
public static BackgroundUIWrapper getWrapper(Class<? extends Background> category) {
return map.get(category);
}
public static BackgroundDetailPane createIfAbsent(Class<? extends Background> category) {
BackgroundUIWrapper wrapper = map.get(category);
return createByWrapper(wrapper);
}
public static BackgroundDetailPane createIfAbsent(int index) {
for (BackgroundUIWrapper wrapper : map.values()) {
if (wrapper.getIndex() == index) {
return createByWrapper(wrapper);
}
}
return new NullBackgroundPane();
}
public static Set<Class<? extends Background>> browserKindsOfKey() {
return browser.keySet();
}
public static BackgroundUIWrapper getBrowserWrapper(Class<? extends Background> category) {
return browser.get(category);
}
public static BackgroundDetailPane createBrowserIfAbsent(Class<? extends Background> category) {
BackgroundUIWrapper wrapper = browser.get(category);
return createByWrapper(wrapper);
}
public static BackgroundDetailPane createBrowserIfAbsent(int index) {
for (BackgroundUIWrapper wrapper : browser.values()) {
if (wrapper.getIndex() == index) {
return createByWrapper(wrapper);
}
}
return new NullBackgroundPane();
}
private static BackgroundDetailPane createByWrapper(BackgroundUIWrapper wrapper) {
Class<? extends BackgroundDetailPane> clazz = wrapper.getType();
if (clazz == null) {
clazz = NullBackgroundPane.class;
}
BackgroundDetailPane quickPane;
try {
quickPane = clazz.newInstance();
} catch (Exception e) {
quickPane = new NullBackgroundPane();
}
return quickPane;
}
}

897
designer_base/src/com/fr/design/style/background/BackgroundPane.java

@ -4,87 +4,32 @@
package com.fr.design.style.background; package com.fr.design.style.background;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.util.HashMap;
import java.awt.Graphics2D; import java.util.Map;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.LayoutManager;
import java.awt.TexturePaint;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.Rectangle2D;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ButtonGroup;
import javax.swing.JFileChooser;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JToggleButton;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList; import javax.swing.event.EventListenerList;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
import com.fr.base.Style;
import com.fr.base.background.ColorBackground;
import com.fr.base.background.GradientBackground;
import com.fr.base.background.ImageBackground;
import com.fr.base.background.PatternBackground;
import com.fr.base.background.TextureBackground;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.design.style.background.gradient.GradientPane;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.DetailColorSelectPane;
import com.fr.design.utils.gui.GUICoreUtils;
public class BackgroundPane extends BasicPane { public class BackgroundPane extends BasicPane {
private static final int BACKGROUND_NULL = 0;
private static final int BACKGROUND_COLOR = 1;
private static final int BACKGROUND_TEXTURE = 2;
private static final int BACKGROUND_PATTERN = 3;
private static final int BACKGROUND_IMAGE = 4;
private static final int BACKGROUND_GRADIENT_COLOR = 5;
private UITabbedPane tabbedPane = null; protected UITabbedPane tabbedPane = null;
private NullBackgroundPane nullBackgroundPane = null;
private ColorBackgroundPane colorBackgroundPane = null;
private TextureBackgroundPane textureBackgroundPane = null;
private PatternBackgroundPane patternBackgroundPane = null;
private ImageBackgroundPane imageBackgroundPane = null;
private GradientPane gradientPane = null;
private EventListenerList eventChangeList = new EventListenerList(); private EventListenerList eventChangeList = new EventListenerList();
private static boolean isBrowserBackgroundPane; protected Map<Integer, BackgroundDetailPane> cacheMap = new HashMap<>();
public BackgroundPane(){
this(false);
}
//需求说: 如果是浏览器背景, 隐藏掉几个button //需求说: 如果是浏览器背景, 隐藏掉几个button
public BackgroundPane(boolean isBrowserBackgroundPane) { public BackgroundPane() {
BackgroundPane.isBrowserBackgroundPane = isBrowserBackgroundPane;
this.initComponents(); this.initComponents();
this.setPreferredSize(new Dimension(400, 300)); this.setPreferredSize(new Dimension(400, 300));
} }
@ -103,16 +48,21 @@ public class BackgroundPane extends BasicPane {
tabbedPane = new UITabbedPane(); tabbedPane = new UITabbedPane();
this.add(tabbedPane, BorderLayout.CENTER); this.add(tabbedPane, BorderLayout.CENTER);
tabbedPane.addTab(Inter.getLocText("Background-Null"), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane()); initTabPane();
tabbedPane.addTab(Inter.getLocText("Color"), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
tabbedPane.addTab(Inter.getLocText("Background-Texture"),FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
tabbedPane.addTab(Inter.getLocText("Background-Pattern"), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
tabbedPane.addTab(Inter.getLocText("Image"), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
tabbedPane.addTab(Inter.getLocText("Gradient-Color"), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
tabbedPane.addChangeListener(backgroundChangeListener); tabbedPane.addChangeListener(backgroundChangeListener);
tabbedPane.setPreferredSize(new Dimension(200, 210)); tabbedPane.setPreferredSize(new Dimension(200, 210));
} }
protected void initTabPane() {
int index = 0;
for (Class<? extends Background> key : BackgroundFactory.kindsOfKey()) {
BackgroundUIWrapper wrapper = BackgroundFactory.getWrapper(key);
wrapper.setIndex(index++);
tabbedPane.addTab(Inter.getLocText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
}
}
public void addChangeListener(ChangeListener changeListener) { public void addChangeListener(ChangeListener changeListener) {
eventChangeList.add(ChangeListener.class, changeListener); eventChangeList.add(ChangeListener.class, changeListener);
} }
@ -138,131 +88,65 @@ public class BackgroundPane extends BasicPane {
return Inter.getLocText("Background"); return Inter.getLocText("Background");
} }
private NullBackgroundPane getNullBackgroundPane() {
if (this.nullBackgroundPane == null) {
this.nullBackgroundPane = new NullBackgroundPane();
nullBackgroundPane.addChangeListener(backgroundChangeListener);
}
return this.nullBackgroundPane;
}
private ColorBackgroundPane getColorBackgroundPane() { protected BackgroundDetailPane getTabItemPane(Background background, int index) {
if (this.colorBackgroundPane == null) { BackgroundDetailPane quickPane = cacheMap.get(index);
this.colorBackgroundPane = new ColorBackgroundPane(); if (quickPane == null) {
colorBackgroundPane.addChangeListener(backgroundChangeListener); quickPane = BackgroundFactory.createIfAbsent(background == null ? null : background.getClass());
quickPane.addChangeListener(backgroundChangeListener);
cacheMap.put(index, quickPane);
} }
return this.colorBackgroundPane; tabbedPane.setComponentAt(index, quickPane);
tabbedPane.setSelectedIndex(index);
return quickPane;
} }
private TextureBackgroundPane getTextureBackgroundPane() { protected BackgroundDetailPane getTabItemPaneByIndex(int index) {
if (this.textureBackgroundPane == null) { BackgroundDetailPane quickPane = cacheMap.get(index);
this.textureBackgroundPane = new TextureBackgroundPane(); if (quickPane == null) {
textureBackgroundPane.addChangeListener(backgroundChangeListener); quickPane = BackgroundFactory.createIfAbsent(index);
tabbedPane.setComponentAt(index, quickPane);
cacheMap.put(index, quickPane);
quickPane.addChangeListener(backgroundChangeListener);
} }
return this.textureBackgroundPane; return quickPane;
} }
private PatternBackgroundPane getPatternBackgroundPane() {
if (this.patternBackgroundPane == null) {
this.patternBackgroundPane = new PatternBackgroundPane();
patternBackgroundPane.addChangeListener(backgroundChangeListener);
}
return this.patternBackgroundPane;
}
private ImageBackgroundPane getImageBackgroundPane() {
if (this.imageBackgroundPane == null) {
this.imageBackgroundPane = new ImageBackgroundPane();
imageBackgroundPane.addChangeListener(backgroundChangeListener);
}
return this.imageBackgroundPane;
}
private GradientPane getGradientPane() {
if (this.gradientPane == null) {
this.gradientPane = new GradientPane();
gradientPane.addChangeListener(backgroundChangeListener);
}
return this.gradientPane;
}
/** /**
* Populate background. * Populate background.
*/ */
public void populate(Background background) { public void populate(Background background) {
if (background == null) { BackgroundUIWrapper wrapper = getBackgroundUIWrapper(background);
tabbedPane.setComponentAt(0, this.getNullBackgroundPane()); int index = wrapper.getIndex();
tabbedPane.setSelectedIndex(0); BackgroundDetailPane quickPane = getTabItemPane(background, index);
nullBackgroundPane.populate(background); quickPane.populate(background);
} else {
if (background instanceof ColorBackground) {
tabbedPane.setComponentAt(1, this.getColorBackgroundPane());
tabbedPane.setSelectedIndex(1);
colorBackgroundPane.populate(background);
} else if (background instanceof TextureBackground) {
tabbedPane.setComponentAt(2, this.getTextureBackgroundPane());
tabbedPane.setSelectedIndex(2);
textureBackgroundPane.populate(background);
} else if (background instanceof PatternBackground) {
tabbedPane.setComponentAt(3, this.getPatternBackgroundPane());
tabbedPane.setSelectedIndex(3);
patternBackgroundPane.populate(background);
} else if (background instanceof ImageBackground) {
tabbedPane.setComponentAt(4, this.getImageBackgroundPane());
tabbedPane.setSelectedIndex(4);
imageBackgroundPane.populate(background);
} else if (background instanceof GradientBackground) {
tabbedPane.setComponentAt(5, this.getGradientPane());
tabbedPane.setSelectedIndex(5);
gradientPane.populate(background);
}
}
tabbedPane.doLayout(); tabbedPane.doLayout();
tabbedPane.validate(); tabbedPane.validate();
} }
protected BackgroundUIWrapper getBackgroundUIWrapper(Background background) {
return BackgroundFactory.getWrapper(background == null ? null : background.getClass());
}
/** /**
* Update background. * Update background.
*/ */
public Background update() { public Background update() {
int index = tabbedPane.getSelectedIndex();
BackgroundDetailPane quickPane = getTabItemPaneByIndex(index);
try { try {
Component selectComponent = tabbedPane.getSelectedComponent(); return quickPane.update();
if (selectComponent.getClass() == JPanel.class) {//需要初始化.
int selectedIndex = tabbedPane.getSelectedIndex();
if (selectedIndex == BACKGROUND_NULL) {
selectComponent = this.getNullBackgroundPane();
} else if (selectedIndex == BACKGROUND_COLOR) {
selectComponent = this.getColorBackgroundPane();
} else if (selectedIndex == BACKGROUND_TEXTURE) {
selectComponent = this.getTextureBackgroundPane();
} else if (selectedIndex == BACKGROUND_PATTERN) {
selectComponent = this.getPatternBackgroundPane();
} else if (selectedIndex == BACKGROUND_IMAGE) {
selectComponent = this.getImageBackgroundPane();
} else if (selectedIndex == BACKGROUND_GRADIENT_COLOR) {
selectComponent = this.getGradientPane();
}
tabbedPane.setComponentAt(selectedIndex, selectComponent);
}
if (selectComponent instanceof BackgroundSettingPane) {
return ((BackgroundSettingPane) selectComponent).update();
} else if (selectComponent instanceof GradientPane) {
return ((GradientPane) selectComponent).update();
}
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRLogger.getLogger().error(e.getMessage(), e);
} }
return null; return null;
} }
/** /**
* Change listener. * Change listener.
*/ */
private ChangeListener backgroundChangeListener = new ChangeListener() { protected ChangeListener backgroundChangeListener = new ChangeListener() {
public void stateChanged(ChangeEvent evt) { public void stateChanged(ChangeEvent evt) {
previewPane.setBackgroundObject(update()); previewPane.setBackgroundObject(update());
@ -271,687 +155,4 @@ public class BackgroundPane extends BasicPane {
}; };
private BackgroundPreviewLabel previewPane = null; private BackgroundPreviewLabel previewPane = null;
public static abstract class BackgroundSettingPane extends JPanel {
public abstract void populate(Background background);
public abstract Background update() throws Exception;
public abstract void addChangeListener(ChangeListener changeListener);
}
/**
* Null background pane.
*/
private static class NullBackgroundPane extends BackgroundSettingPane {
public NullBackgroundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel centerLabel = new UILabel(
Inter.getLocText("Background-Background_is_NULL") + "...");
this.add(centerLabel);
centerLabel.setHorizontalAlignment(SwingConstants.CENTER);
centerLabel.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
}
public void populate(Background background) {
// do nothing.
}
public Background update() throws Exception {
return null;
}
public void addChangeListener(ChangeListener changeListener) {
// do nothing.
}
}
/**
* Color background pane.
*/
private static class ColorBackgroundPane extends BackgroundSettingPane {
private DetailColorSelectPane detailColorSelectPane;
public ColorBackgroundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
detailColorSelectPane = new DetailColorSelectPane();
this.add(detailColorSelectPane, BorderLayout.CENTER);
}
public void populate(Background background) {
if (background instanceof ColorBackground) {
ColorBackground colorBackgroud = (ColorBackground) background;
this.detailColorSelectPane.populate(colorBackgroud.getColor());
} else {
this.detailColorSelectPane.populate(Color.white);
}
}
public Background update() throws Exception {
return ColorBackground.getInstance(this.detailColorSelectPane.update());
}
public void addChangeListener(ChangeListener changeListener) {
detailColorSelectPane.addChangeListener(changeListener);
}
}
private static abstract class BPane extends BackgroundSettingPane {
BPane(int nColumn) {
this.initComponents(nColumn);
}
private void initComponents(int nColumn) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
this.add(contentPane, BorderLayout.NORTH);
// contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
// type type.
JPanel typePane=FRGUIPaneFactory.createTitledBorderPane(titleOfTypePane());
contentPane.add(typePane);
JPanel typePane2 = new JPanel();
typePane.add(typePane2);
typePane2.setLayout(layoutOfTypePane(nColumn));
setChildrenOfTypePane(typePane2);
setChildrenOfContentPane(contentPane);
}
protected abstract String titleOfTypePane();
protected abstract LayoutManager layoutOfTypePane(int nColumn);
protected abstract void setChildrenOfTypePane(JPanel typePane2);
protected void setChildrenOfContentPane(JPanel contentPane) {}
}
/**
* Texture background pane. TODO kunsnat: 拆出去. 真特么的长..
*/
public static class TextureBackgroundPane extends BPane {
private TexturePaint texturePaint;
private TextureButton[] textureButtonArray;
public TextureBackgroundPane() {
super(8);// 默认的.
}
public TextureBackgroundPane(int colum) {
super(colum);// 自定义的.
}
protected LayoutManager layoutOfTypePane(int nColumn) {
return FRGUIPaneFactory.createNColumnGridLayout(nColumn);
}
protected String titleOfTypePane() {
return Inter.getLocText("Background-Texture");
}
protected void setChildrenOfTypePane(JPanel typePane2) {
ButtonGroup patternButtonGroup = new ButtonGroup();
textureButtonArray = new TextureButton[EMBED_TEXTURE_PAINT_ARRAY.length];
for (int i = 0; i < EMBED_TEXTURE_PAINT_ARRAY.length; i++) {
textureButtonArray[i] = new TextureButton(
EMBED_TEXTURE_PAINT_ARRAY[i], EMBED_TEXTURE_PAINT_DES_ARRAY[i]);
patternButtonGroup.add(textureButtonArray[i]);
typePane2.add(textureButtonArray[i]);
}
}
public void populate(Background background) {
if (background instanceof TextureBackground) {
TextureBackground textureBackground = (TextureBackground) background;
this.texturePaint = textureBackground.getTexturePaint();
for (int i = 0; i < textureButtonArray.length; i++) {
if (ComparatorUtils.equals(textureButtonArray[i].getTexturePaint(), this.texturePaint)) {
textureButtonArray[i].setSelected(true);
break;
}
}
} else {
this.textureButtonArray[0].setSelected(true);
this.texturePaint = textureButtonArray[0].getTexturePaint();
}
}
public Background update() throws Exception {
return new TextureBackground(this.texturePaint);
}
public void addChangeListener(ChangeListener changeListener) {
for (int i = 0; i < this.textureButtonArray.length; i++) {
this.textureButtonArray[i].addChangeListener(changeListener);
}
}
/**
* Texture type button.
*/
class TextureButton extends JToggleButton implements ActionListener {
private TexturePaint buttonTexturePaint;
public TextureButton(TexturePaint buttonTexturePaint, String tooltip) {
this.buttonTexturePaint = buttonTexturePaint;
this.setToolTipText(tooltip);
this.setCursor(new Cursor(Cursor.HAND_CURSOR));
this.addActionListener(this);
this.setBorder(null);
}
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
g2d.setPaint(this.buttonTexturePaint);
GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1,
d.height - 1));
if (ComparatorUtils.equals(texturePaint, this.buttonTexturePaint)) {// it's
// selected.
g2d.setPaint(Color.black);
} else {
g2d.setPaint(Color.gray);
}
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1,
d.height - 1));
}
public Dimension getPreferredSize() {
return new Dimension(36, 32);
}
public TexturePaint getTexturePaint() {
return this.buttonTexturePaint;
}
/**
* set Pattern index.
*/
public void actionPerformed(ActionEvent evt) {
TextureBackgroundPane.this.texturePaint = this.getTexturePaint();
fireChagneListener();
TextureBackgroundPane.this.repaint(); // repaint.
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
private void fireChagneListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
}
}
public static class PatternBackgroundPaneNoFore extends PatternBackgroundPane {
public PatternBackgroundPaneNoFore(int nColumn) {
super(nColumn);
}
// 重载 不加载两个前后按钮
protected void setChildrenOfContentPane(JPanel contentPane) {
foregroundColorPane = new ColorSelectBox(80);
backgroundColorPane = new ColorSelectBox(80);
foregroundColorPane.setSelectObject(Color.lightGray);
backgroundColorPane.setSelectObject(Color.black);
}
}
/**
* Pattern background pane.
*/
public static class PatternBackgroundPane extends BPane {
private int patternIndex = 0; // pattern index.
protected ColorSelectBox foregroundColorPane;
protected ColorSelectBox backgroundColorPane;
private PatternButton[] patternButtonArray;
public PatternBackgroundPane() {
super(12);
foregroundColorPane.addSelectChangeListener(colorChangeListener);
backgroundColorPane.addSelectChangeListener(colorChangeListener);
}
public PatternBackgroundPane(int nColumn) {
super(nColumn);
if(foregroundColorPane != null) {
foregroundColorPane.addSelectChangeListener(colorChangeListener);
}
if(backgroundColorPane != null) {
backgroundColorPane.addSelectChangeListener(colorChangeListener);
}
}
protected String titleOfTypePane() {
return Inter.getLocText("Background-Pattern");
}
protected LayoutManager layoutOfTypePane(int nColumn) {
return FRGUIPaneFactory.createNColumnGridLayout(nColumn);
}
protected void setChildrenOfTypePane(JPanel typePane2) {
ButtonGroup patternButtonGroup = new ButtonGroup();
patternButtonArray = new PatternButton[PatternBackground.PATTERN_COUNT];
for (int i = 0; i < PatternBackground.PATTERN_COUNT; i++) {
patternButtonArray[i] = new PatternButton(i);
patternButtonGroup.add(patternButtonArray[i]);
typePane2.add(patternButtonArray[i]);
}
}
protected void setChildrenOfContentPane(JPanel contentPane) {
// colors
JPanel colorPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Colors"));
contentPane.add(colorPane);
foregroundColorPane = new ColorSelectBox(80);
backgroundColorPane = new ColorSelectBox(80);
foregroundColorPane.setSelectObject(Color.lightGray);
backgroundColorPane.setSelectObject(Color.black);
colorPane.add(Box.createHorizontalStrut(2));
colorPane.add(this.createLabelColorPane(Inter.getLocText("Foreground")
+ ":", foregroundColorPane));
colorPane.add(Box.createHorizontalStrut(8));
colorPane.add(this.createLabelColorPane(Inter.getLocText("Background")
+ ":", backgroundColorPane));
}
private JPanel createLabelColorPane(String text,
ColorSelectBox colorPane) {
JPanel labelColorPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
labelColorPane.add(new UILabel(text));
labelColorPane.add(colorPane);
return labelColorPane;
}
public void populate(Background background) {
if (background != null && background instanceof PatternBackground) {
PatternBackground patternBackground = (PatternBackground) background;
int patternIndex = patternBackground.getPatternIndex();
if (patternIndex >= 0
&& patternIndex < this.patternButtonArray.length) {
this.patternButtonArray[patternIndex].setSelected(true);
this.patternIndex = patternIndex;
} else {
this.patternIndex = 0;
}
foregroundColorPane.setSelectObject(patternBackground.getForeground());
backgroundColorPane.setSelectObject(patternBackground.getBackground());
} else {
patternIndex = 0;
this.patternButtonArray[0].setSelected(true);
foregroundColorPane.setSelectObject(Color.lightGray);
backgroundColorPane.setSelectObject(Color.black);
}
}
public Background update() throws Exception {
return new PatternBackground(patternIndex, foregroundColorPane.getSelectObject(), backgroundColorPane.getSelectObject());
}
public void addChangeListener(ChangeListener changeListener) {
foregroundColorPane.addSelectChangeListener(changeListener);
backgroundColorPane.addSelectChangeListener(changeListener);
for (int i = 0; i < this.patternButtonArray.length; i++) {
this.patternButtonArray[i].addChangeListener(changeListener);
}
}
// Foreground or Background changed.
ChangeListener colorChangeListener = new ChangeListener() {
public void stateChanged(ChangeEvent e) {
for (int i = 0; i < patternButtonArray.length; i++) {
patternButtonArray[i].setPatternForeground(foregroundColorPane.getSelectObject());
patternButtonArray[i].setPatternBackground(backgroundColorPane.getSelectObject());
}
PatternBackgroundPane.this.repaint();// repaint
}
};
/**
* Pattern type button.
*/
class PatternButton extends JToggleButton implements ActionListener {
public PatternButton(int pIndex) {
this.pIndex = pIndex;
this.addActionListener(this);
this.setCursor(new Cursor(Cursor.HAND_CURSOR));
this.setBorder(null);
this.patternBackground = new PatternBackground(this.pIndex,
Color.lightGray, Color.black);
}
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0,
d.width - 1, d.height - 1));
if (this.pIndex == patternIndex) {// it's selected.
g2d.setPaint(new Color(255, 51, 0));
} else {
g2d.setPaint(Color.gray);
}
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1,
d.height - 1));
}
public Dimension getPreferredSize() {
return new Dimension(24, 24);
}
public void setPatternForeground(Color foreground) {
this.patternBackground.setForeground(foreground);
}
public void setPatternBackground(Color background) {
this.patternBackground.setBackground(background);
}
/**
* set Pattern index.
*/
public void actionPerformed(ActionEvent evt) {
PatternBackgroundPane.this.patternIndex = pIndex;
fireChagneListener();
PatternBackgroundPane.this.repaint();// repaint
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
private void fireChagneListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
private int pIndex = 0;
private PatternBackground patternBackground;
}
}
/**
* Image background pane.
*/
private static class ImageBackgroundPane extends BackgroundSettingPane {
private ImagePreviewPane previewPane = null;
private Style imageStyle = null;
private ChangeListener changeListener = null;
private ImageFileChooser imageFileChooser = null;
private UILabel imageSizeLabel = new UILabel();
private JRadioButton defaultRadioButton = null;
private JRadioButton tiledRadioButton = null;
private JRadioButton extendRadioButton = null;
private JRadioButton adjustRadioButton = null;
public ImageBackgroundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
// preview pane
JPanel previewContainerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(previewContainerPane, BorderLayout.CENTER);
JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Preview"));
previewOwnerPane.setLayout(new BorderLayout());
previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER);
previewPane = new ImagePreviewPane();
previewOwnerPane.add(new JScrollPane(previewPane));
previewPane.addChangeListener(imageSizeChangeListener);
JPanel selectFilePane = FRGUIPaneFactory.createBorderLayout_L_Pane();
previewContainerPane.add(selectFilePane, BorderLayout.EAST);
selectFilePane.setBorder(BorderFactory.createEmptyBorder(8, 2, 4, 0));
UIButton selectPictureButton = new UIButton(
Inter.getLocText("Image-Select_Picture"));
selectFilePane.add(selectPictureButton, BorderLayout.NORTH);
selectPictureButton.setMnemonic('S');
selectPictureButton.addActionListener(selectPictureActionListener);
JPanel layoutPane=FRGUIPaneFactory.createMediumHGapHighTopFlowInnerContainer_M_Pane();
selectFilePane.add(layoutPane, BorderLayout.CENTER);
//布局
defaultRadioButton = new UIRadioButton(Inter.getLocText("Default"));
tiledRadioButton = new UIRadioButton(Inter.getLocText("Image-Titled"));
extendRadioButton = new UIRadioButton(Inter.getLocText("Image-Extend"));
adjustRadioButton = new UIRadioButton(Inter.getLocText("Image-Adjust"));
defaultRadioButton.addActionListener(layoutActionListener);
tiledRadioButton.addActionListener(layoutActionListener);
extendRadioButton.addActionListener(layoutActionListener);
adjustRadioButton.addActionListener(layoutActionListener);
JPanel jp = new JPanel(new GridLayout(4, 1, 15, 15));
jp.add(defaultRadioButton);
jp.add(tiledRadioButton);
if(!isBrowserBackgroundPane){
jp.add(extendRadioButton);
jp.add(adjustRadioButton);
}
layoutPane.add(jp);
ButtonGroup layoutBG = new ButtonGroup();
layoutBG.add(defaultRadioButton);
layoutBG.add(tiledRadioButton);
layoutBG.add(extendRadioButton);
layoutBG.add(adjustRadioButton);
defaultRadioButton.setSelected(true);
// init image file chooser.
imageFileChooser = new ImageFileChooser();
imageFileChooser.setMultiSelectionEnabled(false);
}
/**
* Select picture.
*/
ActionListener selectPictureActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser.showOpenDialog(ImageBackgroundPane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath());
CoreGraphHelper.waitForImage(image);
previewPane.setImage(image);
setImageStyle();
previewPane.setImageStyle(imageStyle);
previewPane.repaint();
} else {
previewPane.setImage(null);
}
}
fireChagneListener();
}
};
private void setImageStyle(){
if(tiledRadioButton.isSelected()){
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);
}else if(adjustRadioButton.isSelected()){
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST);
}else if(extendRadioButton.isSelected()){
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND);
}else{
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
}
}
ActionListener layoutActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
setImageStyle();
changeImageStyle();
}
private void changeImageStyle() {
previewPane.setImageStyle(ImageBackgroundPane.this.imageStyle);
previewPane.repaint();
}
};
public void populate(Background background) {
if (background instanceof ImageBackground) {
ImageBackground imageBackground = (ImageBackground) background;
if (imageBackground.getLayout() == Constants.IMAGE_CENTER) {
defaultRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
}else if(imageBackground.getLayout() == Constants.IMAGE_EXTEND){
extendRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND);
}else if(imageBackground.getLayout() == Constants.IMAGE_ADJUST){
adjustRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST);
}else {
tiledRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);
}
previewPane.setImageStyle(ImageBackgroundPane.this.imageStyle);
if (imageBackground.getImage() != null) {
previewPane.setImage(imageBackground.getImage());
imageSizeLabel.setText(previewPane.getImage().getWidth(null)
+ " X " + previewPane.getImage().getHeight(null));
}
if (imageBackground.getImage() != null) {
previewPane.setImage(imageBackground.getImage());
}
} else {
previewPane.setImage(null);
tiledRadioButton.setSelected(true);
imageSizeLabel.setText("");
}
fireChagneListener();
}
public Background update() throws Exception {
ImageBackground imageBackground = new ImageBackground(previewPane.getImage());
setImageStyle();
imageBackground.setLayout(imageStyle.getImageLayout());
return imageBackground;
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
private void fireChagneListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
ChangeListener imageSizeChangeListener = new ChangeListener() {
public void stateChanged(ChangeEvent evt) {
Image image = ((ImagePreviewPane) evt.getSource()).getImage();
if (image == null) {
imageSizeLabel.setText("");
} else {
imageSizeLabel.setText(Inter.getLocText(new String[] {"Size", "px"}, new String[] {": " + image.getWidth(null) + "x" + image.getHeight(null)}));
}
}
};
}
public static final TexturePaint[] EMBED_TEXTURE_PAINT_ARRAY = new TexturePaint[]{
TextureBackground.NEWSPRINT_TEXTURE_PAINT,
TextureBackground.RECYCLED_PAPER_TEXTURE_PAINT,
TextureBackground.PARCHMENT_TEXTURE_PAINT,
TextureBackground.STATIONERY_TEXTURE_PAINT,
TextureBackground.GREEN_MARBLE_TEXTURE_PAINT,
TextureBackground.WHITE_MARBLE_TEXTURE_PAINT,
TextureBackground.BROWN_MARBLE_TEXTURE_PAINT,
TextureBackground.GRANITE_TEXTURE_PAINT,
TextureBackground.BLUE_TISSUE_PAPER_TEXTURE_PAINT,
TextureBackground.PINK_TISSUE_PAPER_TEXTURE_PAINT,
TextureBackground.PURPLE_MESH_TEXTURE_PAINT,
TextureBackground.BOUQUET_TEXTURE_PAINT,
TextureBackground.PAPYRUS_TEXTURE_PAINT,
TextureBackground.CANVAS_TEXTURE_PAINT,
TextureBackground.DENIM_TEXTURE_PAINT,
TextureBackground.WOVEN_MAT_TEXTURE_PAINT,
TextureBackground.WATER_DROPLETS_TEXTURE_PAINT,
TextureBackground.PAPER_BAG_TEXTURE_PAINT,
TextureBackground.FISH_FOSSIL_TEXTURE_PAINT,
TextureBackground.SAND_TEXTURE_PAINT,
TextureBackground.CORK_TEXTURE_PAINT,
TextureBackground.WALNUT_TEXTURE_PAINT,
TextureBackground.OAK_TEXTURE_PAINT,
TextureBackground.MEDIUM_WOOD_TEXTURE_PAINT};
private static final String[] EMBED_TEXTURE_PAINT_DES_ARRAY = new String[]{
Inter.getLocText("BackgroundTexture-Newsprint"),
Inter.getLocText("BackgroundTexture-RecycledPaper"),
Inter.getLocText("BackgroundTexture-Parchment"),
Inter.getLocText("BackgroundTexture-Stationery"),
Inter.getLocText("BackgroundTexture-GreenMarble"),
Inter.getLocText("BackgroundTexture-WhiteMarble"),
Inter.getLocText("BackgroundTexture-BrownMarble"),
Inter.getLocText("BackgroundTexture-Granite"),
Inter.getLocText("BackgroundTexture-BlueTissuePaper"),
Inter.getLocText("BackgroundTexture-PinkTissuePaper"),
Inter.getLocText("BackgroundTexture-PurpleMesh"),
Inter.getLocText("BackgroundTexture-Bouquet"),
Inter.getLocText("BackgroundTexture-Papyrus"),
Inter.getLocText("BackgroundTexture-Canvas"),
Inter.getLocText("BackgroundTexture-Denim"),
Inter.getLocText("BackgroundTexture-WovenMat"),
Inter.getLocText("BackgroundTexture-WaterDroplets"),
Inter.getLocText("BackgroundTexture-PaperBag"),
Inter.getLocText("BackgroundTexture-FishFossil"),
Inter.getLocText("BackgroundTexture-Sand"),
Inter.getLocText("BackgroundTexture-Cork"),
Inter.getLocText("BackgroundTexture-Walnut"),
Inter.getLocText("BackgroundTexture-Oak"),
Inter.getLocText("BackgroundTexture-MediumWood")
};
} }

51
designer_base/src/com/fr/design/style/background/BackgroundPane4Browser.java

@ -0,0 +1,51 @@
package com.fr.design.style.background;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Background;
import com.fr.general.Inter;
/**
* Created by richie on 16/5/18.
*/
public class BackgroundPane4Browser extends BackgroundPane {
public BackgroundPane4Browser() {
super();
}
protected void initTabPane() {
int index = 0;
for (Class<? extends Background> key : BackgroundFactory.browserKindsOfKey()) {
BackgroundUIWrapper wrapper = BackgroundFactory.getBrowserWrapper(key);
wrapper.setIndex(index++);
tabbedPane.addTab(Inter.getLocText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
}
}
protected BackgroundUIWrapper getBackgroundUIWrapper(Background background) {
return BackgroundFactory.getBrowserWrapper(background == null ? null : background.getClass());
}
protected BackgroundDetailPane getTabItemPane(Background background, int index) {
BackgroundDetailPane quickPane = cacheMap.get(index);
if (quickPane == null) {
quickPane = BackgroundFactory.createBrowserIfAbsent(background == null ? null : background.getClass());
quickPane.addChangeListener(backgroundChangeListener);
cacheMap.put(index, quickPane);
}
tabbedPane.setComponentAt(index, quickPane);
tabbedPane.setSelectedIndex(index);
return quickPane;
}
protected BackgroundDetailPane getTabItemPaneByIndex(int index) {
BackgroundDetailPane quickPane = cacheMap.get(index);
if (quickPane == null) {
quickPane = BackgroundFactory.createBrowserIfAbsent(index);
tabbedPane.setComponentAt(index, quickPane);
cacheMap.put(index, quickPane);
quickPane.addChangeListener(backgroundChangeListener);
}
return quickPane;
}
}

5
designer_base/src/com/fr/design/style/background/BackgroundSelectPane.java

@ -13,7 +13,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.style.background.BackgroundPane.BackgroundSettingPane;
/** /**
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
@ -26,9 +25,9 @@ public abstract class BackgroundSelectPane extends BasicPane {
private Background background; private Background background;
private ArrayList<ChangeListener> listenerList = new ArrayList<ChangeListener>(); private ArrayList<ChangeListener> listenerList = new ArrayList<ChangeListener>();
public abstract BackgroundSettingPane getShowPane(double preWidth); public abstract BackgroundDetailPane getShowPane(double preWidth);
protected void initBackgroundShowPane(final BackgroundSettingPane backgroundPane) { protected void initBackgroundShowPane(final BackgroundDetailPane backgroundPane) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
backgroundPane.addChangeListener(new ChangeListener() { backgroundPane.addChangeListener(new ChangeListener() {

49
designer_base/src/com/fr/design/style/background/BackgroundUIWrapper.java

@ -0,0 +1,49 @@
package com.fr.design.style.background;
/**
* Created by richie on 16/5/18.
*/
public class BackgroundUIWrapper {
public static BackgroundUIWrapper create() {
return new BackgroundUIWrapper();
}
private int index = -1;
private String title;
private Class<? extends BackgroundDetailPane> clazz;
private BackgroundUIWrapper() {
}
public Class<? extends BackgroundDetailPane> getType() {
return clazz;
}
public BackgroundUIWrapper setType(Class<? extends BackgroundDetailPane> clazz) {
this.clazz = clazz;
return this;
}
public String getTitle() {
return title;
}
public BackgroundUIWrapper setTitle(String title) {
this.title = title;
return this;
}
public int getIndex() {
return index;
}
public BackgroundUIWrapper setIndex(int index) {
if (this.index == -1) {
this.index = index;
}
return this;
}
}

6
designer_base/src/com/fr/design/style/background/gradient/GradientPane.java → designer_base/src/com/fr/design/style/background/gradient/GradientBackgroundPane.java

@ -18,20 +18,20 @@ import com.fr.base.background.GradientBackground;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.style.background.BackgroundPane.BackgroundSettingPane; import com.fr.design.style.background.BackgroundDetailPane;
/** /**
* 渐变色的面板不是很pp面板应用显得繁琐有写可以写成控件类型比如色彩选择的可以做得花哨点 * 渐变色的面板不是很pp面板应用显得繁琐有写可以写成控件类型比如色彩选择的可以做得花哨点
* @author ben * @author ben
*/ */
public class GradientPane extends BackgroundSettingPane { public class GradientBackgroundPane extends BackgroundDetailPane {
private static final long serialVersionUID = -6854603990673031897L; private static final long serialVersionUID = -6854603990673031897L;
private UIRadioButton left2right, top2bottom; private UIRadioButton left2right, top2bottom;
private GradientBar gradientBar; private GradientBar gradientBar;
private ChangeListener changeListener = null; private ChangeListener changeListener = null;
public GradientPane() { public GradientBackgroundPane() {
// bug 5452 简化GradientPane // bug 5452 简化GradientPane
JPanel jpanel = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText(new String[]{"Gradient-Color", "Set"})); JPanel jpanel = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText(new String[]{"Gradient-Color", "Set"}));

46
designer_base/src/com/fr/design/style/background/impl/BPane.java

@ -0,0 +1,46 @@
package com.fr.design.style.background.impl;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundDetailPane;
import javax.swing.*;
import java.awt.*;
/**
* Created by richie on 16/5/18.
*/
public abstract class BPane extends BackgroundDetailPane {
public BPane(int nColumn) {
this.initComponents(nColumn);
}
private void initComponents(int nColumn) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
this.add(contentPane, BorderLayout.NORTH);
// contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
// type type.
JPanel typePane = FRGUIPaneFactory.createTitledBorderPane(titleOfTypePane());
contentPane.add(typePane);
JPanel typePane2 = new JPanel();
typePane.add(typePane2);
typePane2.setLayout(layoutOfTypePane(nColumn));
setChildrenOfTypePane(typePane2);
setChildrenOfContentPane(contentPane);
}
protected abstract String titleOfTypePane();
protected abstract LayoutManager layoutOfTypePane(int nColumn);
protected abstract void setChildrenOfTypePane(JPanel typePane2);
protected void setChildrenOfContentPane(JPanel contentPane) {
}
}

42
designer_base/src/com/fr/design/style/background/impl/ColorBackgroundPane.java

@ -0,0 +1,42 @@
package com.fr.design.style.background.impl;
import com.fr.base.background.ColorBackground;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.design.style.color.DetailColorSelectPane;
import com.fr.general.Background;
import javax.swing.event.ChangeListener;
import java.awt.*;
/**
* Color background pane.
*/
public class ColorBackgroundPane extends BackgroundDetailPane {
private DetailColorSelectPane detailColorSelectPane;
public ColorBackgroundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
detailColorSelectPane = new DetailColorSelectPane();
this.add(detailColorSelectPane, BorderLayout.CENTER);
}
public void populate(Background background) {
if (background instanceof ColorBackground) {
ColorBackground colorBackgroud = (ColorBackground) background;
this.detailColorSelectPane.populate(colorBackgroud.getColor());
} else {
this.detailColorSelectPane.populate(Color.white);
}
}
public Background update() throws Exception {
return ColorBackground.getInstance(this.detailColorSelectPane.update());
}
public void addChangeListener(ChangeListener changeListener) {
detailColorSelectPane.addChangeListener(changeListener);
}
}

230
designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java

@ -0,0 +1,230 @@
package com.fr.design.style.background.impl;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.base.background.ImageBackground;
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.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.general.Background;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import javax.swing.*;
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.io.File;
/**
* Image background pane.
*/
public class ImageBackgroundPane extends BackgroundDetailPane {
private ImagePreviewPane previewPane = null;
private Style imageStyle = null;
private ChangeListener changeListener = null;
private ImageFileChooser imageFileChooser = null;
private UILabel imageSizeLabel = new UILabel();
protected JRadioButton defaultRadioButton = null;
protected JRadioButton tiledRadioButton = null;
private JRadioButton extendRadioButton = null;
private JRadioButton adjustRadioButton = null;
public ImageBackgroundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
// preview pane
JPanel previewContainerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(previewContainerPane, BorderLayout.CENTER);
JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Preview"));
previewOwnerPane.setLayout(new BorderLayout());
previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER);
previewPane = new ImagePreviewPane();
previewOwnerPane.add(new JScrollPane(previewPane));
previewPane.addChangeListener(imageSizeChangeListener);
JPanel selectFilePane = FRGUIPaneFactory.createBorderLayout_L_Pane();
previewContainerPane.add(selectFilePane, BorderLayout.EAST);
selectFilePane.setBorder(BorderFactory.createEmptyBorder(8, 2, 4, 0));
UIButton selectPictureButton = new UIButton(
Inter.getLocText("Image-Select_Picture"));
selectFilePane.add(selectPictureButton, BorderLayout.NORTH);
selectPictureButton.setMnemonic('S');
selectPictureButton.addActionListener(selectPictureActionListener);
JPanel layoutPane = FRGUIPaneFactory.createMediumHGapHighTopFlowInnerContainer_M_Pane();
selectFilePane.add(layoutPane, BorderLayout.CENTER);
//布局
defaultRadioButton = new UIRadioButton(Inter.getLocText("Default"));
tiledRadioButton = new UIRadioButton(Inter.getLocText("Image-Titled"));
extendRadioButton = new UIRadioButton(Inter.getLocText("Image-Extend"));
adjustRadioButton = new UIRadioButton(Inter.getLocText("Image-Adjust"));
defaultRadioButton.addActionListener(layoutActionListener);
tiledRadioButton.addActionListener(layoutActionListener);
extendRadioButton.addActionListener(layoutActionListener);
adjustRadioButton.addActionListener(layoutActionListener);
JPanel jp = new JPanel(new GridLayout(4, 1, 15, 15));
for (JRadioButton button : imageLayoutButtons()) {
jp.add(button);
}
layoutPane.add(jp);
ButtonGroup layoutBG = new ButtonGroup();
layoutBG.add(defaultRadioButton);
layoutBG.add(tiledRadioButton);
layoutBG.add(extendRadioButton);
layoutBG.add(adjustRadioButton);
defaultRadioButton.setSelected(true);
// init image file chooser.
imageFileChooser = new ImageFileChooser();
imageFileChooser.setMultiSelectionEnabled(false);
}
protected JRadioButton[] imageLayoutButtons() {
return new JRadioButton[]{
defaultRadioButton,
tiledRadioButton,
extendRadioButton,
adjustRadioButton
};
}
/**
* Select picture.
*/
ActionListener selectPictureActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser.showOpenDialog(ImageBackgroundPane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
Image image = BaseUtils.readImage(selectedFile.getPath());
CoreGraphHelper.waitForImage(image);
previewPane.setImage(image);
setImageStyle();
previewPane.setImageStyle(imageStyle);
previewPane.repaint();
} else {
previewPane.setImage(null);
}
}
fireChagneListener();
}
};
private void setImageStyle() {
if (tiledRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);
} else if (adjustRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST);
} else if (extendRadioButton.isSelected()) {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND);
} else {
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
}
}
ActionListener layoutActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
setImageStyle();
changeImageStyle();
}
private void changeImageStyle() {
previewPane.setImageStyle(ImageBackgroundPane.this.imageStyle);
previewPane.repaint();
}
};
public void populate(Background background) {
if (background instanceof ImageBackground) {
ImageBackground imageBackground = (ImageBackground) background;
if (imageBackground.getLayout() == Constants.IMAGE_CENTER) {
defaultRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER);
} else if (imageBackground.getLayout() == Constants.IMAGE_EXTEND) {
extendRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND);
} else if (imageBackground.getLayout() == Constants.IMAGE_ADJUST) {
adjustRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST);
} else {
tiledRadioButton.setSelected(true);
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED);
}
previewPane.setImageStyle(ImageBackgroundPane.this.imageStyle);
if (imageBackground.getImage() != null) {
previewPane.setImage(imageBackground.getImage());
imageSizeLabel.setText(previewPane.getImage().getWidth(null)
+ " X " + previewPane.getImage().getHeight(null));
}
if (imageBackground.getImage() != null) {
previewPane.setImage(imageBackground.getImage());
}
} else {
previewPane.setImage(null);
tiledRadioButton.setSelected(true);
imageSizeLabel.setText("");
}
fireChagneListener();
}
public Background update() throws Exception {
ImageBackground imageBackground = new ImageBackground(previewPane.getImage());
setImageStyle();
imageBackground.setLayout(imageStyle.getImageLayout());
return imageBackground;
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
private void fireChagneListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
ChangeListener imageSizeChangeListener = new ChangeListener() {
public void stateChanged(ChangeEvent evt) {
Image image = ((ImagePreviewPane) evt.getSource()).getImage();
if (image == null) {
imageSizeLabel.setText("");
} else {
imageSizeLabel.setText(Inter.getLocText(new String[]{"Size", "px"}, new String[]{": " + image.getWidth(null) + "x" + image.getHeight(null)}));
}
}
};
}

25
designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java

@ -0,0 +1,25 @@
package com.fr.design.style.background.impl;
import com.fr.stable.ArrayUtils;
import javax.swing.*;
/**
* Created by richie on 16/5/18.
*/
public class ImageBackgroundPane4Browser extends ImageBackgroundPane {
public ImageBackgroundPane4Browser() {
super();
}
@Override
protected JRadioButton[] imageLayoutButtons() {
return (JRadioButton[]) ArrayUtils.addAll(super.imageLayoutButtons(), new JRadioButton[] {
defaultRadioButton,
tiledRadioButton,
});
}
}

39
designer_base/src/com/fr/design/style/background/impl/NullBackgroundPane.java

@ -0,0 +1,39 @@
package com.fr.design.style.background.impl;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Background;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeListener;
/**
* Null background pane.
*/
public class NullBackgroundPane extends BackgroundDetailPane {
public NullBackgroundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel centerLabel = new UILabel(
Inter.getLocText("Background-Background_is_NULL") + "...");
this.add(centerLabel);
centerLabel.setHorizontalAlignment(SwingConstants.CENTER);
centerLabel.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
}
public void populate(Background background) {
// do nothing.
}
public Background update() throws Exception {
return null;
}
public void addChangeListener(ChangeListener changeListener) {
// do nothing.
}
}

208
designer_base/src/com/fr/design/style/background/impl/PatternBackgroundPane.java

@ -0,0 +1,208 @@
package com.fr.design.style.background.impl;
import com.fr.base.GraphHelper;
import com.fr.base.background.PatternBackground;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.Background;
import com.fr.general.Inter;
import javax.swing.*;
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.geom.Rectangle2D;
/**
* Pattern background pane.
*/
public class PatternBackgroundPane extends BPane {
private int patternIndex = 0; // pattern setIndex.
protected ColorSelectBox foregroundColorPane;
protected ColorSelectBox backgroundColorPane;
private PatternButton[] patternButtonArray;
public PatternBackgroundPane() {
super(12);
foregroundColorPane.addSelectChangeListener(colorChangeListener);
backgroundColorPane.addSelectChangeListener(colorChangeListener);
}
public PatternBackgroundPane(int nColumn) {
super(nColumn);
if(foregroundColorPane != null) {
foregroundColorPane.addSelectChangeListener(colorChangeListener);
}
if(backgroundColorPane != null) {
backgroundColorPane.addSelectChangeListener(colorChangeListener);
}
}
protected String titleOfTypePane() {
return Inter.getLocText("Background-Pattern");
}
protected LayoutManager layoutOfTypePane(int nColumn) {
return FRGUIPaneFactory.createNColumnGridLayout(nColumn);
}
protected void setChildrenOfTypePane(JPanel typePane2) {
ButtonGroup patternButtonGroup = new ButtonGroup();
patternButtonArray = new PatternButton[PatternBackground.PATTERN_COUNT];
for (int i = 0; i < PatternBackground.PATTERN_COUNT; i++) {
patternButtonArray[i] = new PatternButton(i);
patternButtonGroup.add(patternButtonArray[i]);
typePane2.add(patternButtonArray[i]);
}
}
protected void setChildrenOfContentPane(JPanel contentPane) {
// colors
JPanel colorPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Colors"));
contentPane.add(colorPane);
foregroundColorPane = new ColorSelectBox(80);
backgroundColorPane = new ColorSelectBox(80);
foregroundColorPane.setSelectObject(Color.lightGray);
backgroundColorPane.setSelectObject(Color.black);
colorPane.add(Box.createHorizontalStrut(2));
colorPane.add(this.createLabelColorPane(Inter.getLocText("Foreground")
+ ":", foregroundColorPane));
colorPane.add(Box.createHorizontalStrut(8));
colorPane.add(this.createLabelColorPane(Inter.getLocText("Background")
+ ":", backgroundColorPane));
}
private JPanel createLabelColorPane(String text,
ColorSelectBox colorPane) {
JPanel labelColorPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
labelColorPane.add(new UILabel(text));
labelColorPane.add(colorPane);
return labelColorPane;
}
public void populate(Background background) {
if (background != null && background instanceof PatternBackground) {
PatternBackground patternBackground = (PatternBackground) background;
int patternIndex = patternBackground.getPatternIndex();
if (patternIndex >= 0
&& patternIndex < this.patternButtonArray.length) {
this.patternButtonArray[patternIndex].setSelected(true);
this.patternIndex = patternIndex;
} else {
this.patternIndex = 0;
}
foregroundColorPane.setSelectObject(patternBackground.getForeground());
backgroundColorPane.setSelectObject(patternBackground.getBackground());
} else {
patternIndex = 0;
this.patternButtonArray[0].setSelected(true);
foregroundColorPane.setSelectObject(Color.lightGray);
backgroundColorPane.setSelectObject(Color.black);
}
}
public Background update() throws Exception {
return new PatternBackground(patternIndex, foregroundColorPane.getSelectObject(), backgroundColorPane.getSelectObject());
}
public void addChangeListener(ChangeListener changeListener) {
foregroundColorPane.addSelectChangeListener(changeListener);
backgroundColorPane.addSelectChangeListener(changeListener);
for (int i = 0; i < this.patternButtonArray.length; i++) {
this.patternButtonArray[i].addChangeListener(changeListener);
}
}
// Foreground or Background changed.
ChangeListener colorChangeListener = new ChangeListener() {
public void stateChanged(ChangeEvent e) {
for (int i = 0; i < patternButtonArray.length; i++) {
patternButtonArray[i].setPatternForeground(foregroundColorPane.getSelectObject());
patternButtonArray[i].setPatternBackground(backgroundColorPane.getSelectObject());
}
PatternBackgroundPane.this.repaint();// repaint
}
};
/**
* Pattern type button.
*/
class PatternButton extends JToggleButton implements ActionListener {
public PatternButton(int pIndex) {
this.pIndex = pIndex;
this.addActionListener(this);
this.setCursor(new Cursor(Cursor.HAND_CURSOR));
this.setBorder(null);
this.patternBackground = new PatternBackground(this.pIndex,
Color.lightGray, Color.black);
}
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0,
d.width - 1, d.height - 1));
if (this.pIndex == patternIndex) {// it's selected.
g2d.setPaint(new Color(255, 51, 0));
} else {
g2d.setPaint(Color.gray);
}
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1,
d.height - 1));
}
public Dimension getPreferredSize() {
return new Dimension(24, 24);
}
public void setPatternForeground(Color foreground) {
this.patternBackground.setForeground(foreground);
}
public void setPatternBackground(Color background) {
this.patternBackground.setBackground(background);
}
/**
* set Pattern setIndex.
*/
public void actionPerformed(ActionEvent evt) {
PatternBackgroundPane.this.patternIndex = pIndex;
fireChagneListener();
PatternBackgroundPane.this.repaint();// repaint
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
private void fireChagneListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
private int pIndex = 0;
private PatternBackground patternBackground;
}
}

24
designer_base/src/com/fr/design/style/background/impl/PatternBackgroundPaneNoFore.java

@ -0,0 +1,24 @@
package com.fr.design.style.background.impl;
import com.fr.design.style.color.ColorSelectBox;
import javax.swing.*;
import java.awt.*;
/**
* Created by richie on 16/5/18.
*/
public class PatternBackgroundPaneNoFore extends PatternBackgroundPane {
public PatternBackgroundPaneNoFore(int nColumn) {
super(nColumn);
}
// 重载 不加载两个前后按钮
protected void setChildrenOfContentPane(JPanel contentPane) {
foregroundColorPane = new ColorSelectBox(80);
backgroundColorPane = new ColorSelectBox(80);
foregroundColorPane.setSelectObject(Color.lightGray);
backgroundColorPane.setSelectObject(Color.black);
}
}

197
designer_base/src/com/fr/design/style/background/impl/TextureBackgroundPane.java

@ -0,0 +1,197 @@
package com.fr.design.style.background.impl;
import com.fr.base.GraphHelper;
import com.fr.base.background.TextureBackground;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.*;
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.geom.Rectangle2D;
/**
* Texture background pane. TODO kunsnat: 拆出去. 真特么的长..
*/
public class TextureBackgroundPane extends BPane {
private static final TexturePaint[] EMBED_TEXTURE_PAINT_ARRAY = new TexturePaint[]{
TextureBackground.NEWSPRINT_TEXTURE_PAINT,
TextureBackground.RECYCLED_PAPER_TEXTURE_PAINT,
TextureBackground.PARCHMENT_TEXTURE_PAINT,
TextureBackground.STATIONERY_TEXTURE_PAINT,
TextureBackground.GREEN_MARBLE_TEXTURE_PAINT,
TextureBackground.WHITE_MARBLE_TEXTURE_PAINT,
TextureBackground.BROWN_MARBLE_TEXTURE_PAINT,
TextureBackground.GRANITE_TEXTURE_PAINT,
TextureBackground.BLUE_TISSUE_PAPER_TEXTURE_PAINT,
TextureBackground.PINK_TISSUE_PAPER_TEXTURE_PAINT,
TextureBackground.PURPLE_MESH_TEXTURE_PAINT,
TextureBackground.BOUQUET_TEXTURE_PAINT,
TextureBackground.PAPYRUS_TEXTURE_PAINT,
TextureBackground.CANVAS_TEXTURE_PAINT,
TextureBackground.DENIM_TEXTURE_PAINT,
TextureBackground.WOVEN_MAT_TEXTURE_PAINT,
TextureBackground.WATER_DROPLETS_TEXTURE_PAINT,
TextureBackground.PAPER_BAG_TEXTURE_PAINT,
TextureBackground.FISH_FOSSIL_TEXTURE_PAINT,
TextureBackground.SAND_TEXTURE_PAINT,
TextureBackground.CORK_TEXTURE_PAINT,
TextureBackground.WALNUT_TEXTURE_PAINT,
TextureBackground.OAK_TEXTURE_PAINT,
TextureBackground.MEDIUM_WOOD_TEXTURE_PAINT};
private static final String[] EMBED_TEXTURE_PAINT_DES_ARRAY = new String[]{
Inter.getLocText("BackgroundTexture-Newsprint"),
Inter.getLocText("BackgroundTexture-RecycledPaper"),
Inter.getLocText("BackgroundTexture-Parchment"),
Inter.getLocText("BackgroundTexture-Stationery"),
Inter.getLocText("BackgroundTexture-GreenMarble"),
Inter.getLocText("BackgroundTexture-WhiteMarble"),
Inter.getLocText("BackgroundTexture-BrownMarble"),
Inter.getLocText("BackgroundTexture-Granite"),
Inter.getLocText("BackgroundTexture-BlueTissuePaper"),
Inter.getLocText("BackgroundTexture-PinkTissuePaper"),
Inter.getLocText("BackgroundTexture-PurpleMesh"),
Inter.getLocText("BackgroundTexture-Bouquet"),
Inter.getLocText("BackgroundTexture-Papyrus"),
Inter.getLocText("BackgroundTexture-Canvas"),
Inter.getLocText("BackgroundTexture-Denim"),
Inter.getLocText("BackgroundTexture-WovenMat"),
Inter.getLocText("BackgroundTexture-WaterDroplets"),
Inter.getLocText("BackgroundTexture-PaperBag"),
Inter.getLocText("BackgroundTexture-FishFossil"),
Inter.getLocText("BackgroundTexture-Sand"),
Inter.getLocText("BackgroundTexture-Cork"),
Inter.getLocText("BackgroundTexture-Walnut"),
Inter.getLocText("BackgroundTexture-Oak"),
Inter.getLocText("BackgroundTexture-MediumWood")
};
private TexturePaint texturePaint;
private TextureButton[] textureButtonArray;
public TextureBackgroundPane() {
super(8);// 默认的.
}
public TextureBackgroundPane(int colum) {
super(colum);// 自定义的.
}
protected LayoutManager layoutOfTypePane(int nColumn) {
return FRGUIPaneFactory.createNColumnGridLayout(nColumn);
}
protected String titleOfTypePane() {
return Inter.getLocText("Background-Texture");
}
protected void setChildrenOfTypePane(JPanel typePane2) {
ButtonGroup patternButtonGroup = new ButtonGroup();
textureButtonArray = new TextureButton[EMBED_TEXTURE_PAINT_ARRAY.length];
for (int i = 0; i < EMBED_TEXTURE_PAINT_ARRAY.length; i++) {
textureButtonArray[i] = new TextureButton(
EMBED_TEXTURE_PAINT_ARRAY[i], EMBED_TEXTURE_PAINT_DES_ARRAY[i]);
patternButtonGroup.add(textureButtonArray[i]);
typePane2.add(textureButtonArray[i]);
}
}
public void populate(Background background) {
if (background instanceof TextureBackground) {
TextureBackground textureBackground = (TextureBackground) background;
this.texturePaint = textureBackground.getTexturePaint();
for (int i = 0; i < textureButtonArray.length; i++) {
if (ComparatorUtils.equals(textureButtonArray[i].getTexturePaint(), this.texturePaint)) {
textureButtonArray[i].setSelected(true);
break;
}
}
} else {
this.textureButtonArray[0].setSelected(true);
this.texturePaint = textureButtonArray[0].getTexturePaint();
}
}
public Background update() throws Exception {
return new TextureBackground(this.texturePaint);
}
public void addChangeListener(ChangeListener changeListener) {
for (int i = 0; i < this.textureButtonArray.length; i++) {
this.textureButtonArray[i].addChangeListener(changeListener);
}
}
/**
* Texture type button.
*/
class TextureButton extends JToggleButton implements ActionListener {
private TexturePaint buttonTexturePaint;
public TextureButton(TexturePaint buttonTexturePaint, String tooltip) {
this.buttonTexturePaint = buttonTexturePaint;
this.setToolTipText(tooltip);
this.setCursor(new Cursor(Cursor.HAND_CURSOR));
this.addActionListener(this);
this.setBorder(null);
}
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
g2d.setPaint(this.buttonTexturePaint);
GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1,
d.height - 1));
if (ComparatorUtils.equals(texturePaint, this.buttonTexturePaint)) {// it's
// selected.
g2d.setPaint(Color.black);
} else {
g2d.setPaint(Color.gray);
}
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1,
d.height - 1));
}
public Dimension getPreferredSize() {
return new Dimension(36, 32);
}
public TexturePaint getTexturePaint() {
return this.buttonTexturePaint;
}
/**
* set Pattern setIndex.
*/
public void actionPerformed(ActionEvent evt) {
TextureBackgroundPane.this.texturePaint = this.getTexturePaint();
fireChagneListener();
TextureBackgroundPane.this.repaint(); // repaint.
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
private void fireChagneListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
}
}

6
designer_base/src/com/fr/design/style/background/pattern/PatternSelectPane.java

@ -1,8 +1,8 @@
package com.fr.design.style.background.pattern; package com.fr.design.style.background.pattern;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.style.background.BackgroundPane.BackgroundSettingPane; import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.design.style.background.BackgroundPane.PatternBackgroundPaneNoFore; import com.fr.design.style.background.impl.PatternBackgroundPaneNoFore;
import com.fr.design.style.background.BackgroundSelectPane; import com.fr.design.style.background.BackgroundSelectPane;
@ -20,7 +20,7 @@ public class PatternSelectPane extends BackgroundSelectPane {
} }
@Override @Override
public BackgroundSettingPane getShowPane(double preWidth) { public BackgroundDetailPane getShowPane(double preWidth) {
// 最少6个. 因为项目太多了. 会拉的很长 // 最少6个. 因为项目太多了. 会拉的很长
int column = Math.max((int)preWidth / 25, 6); int column = Math.max((int)preWidth / 25, 6);
return new PatternBackgroundPaneNoFore(column); return new PatternBackgroundPaneNoFore(column);

6
designer_base/src/com/fr/design/style/background/texture/TextureSelectPane.java

@ -1,8 +1,8 @@
package com.fr.design.style.background.texture; package com.fr.design.style.background.texture;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.style.background.BackgroundPane.BackgroundSettingPane; import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.design.style.background.BackgroundPane.TextureBackgroundPane; import com.fr.design.style.background.impl.TextureBackgroundPane;
import com.fr.design.style.background.BackgroundSelectPane; import com.fr.design.style.background.BackgroundSelectPane;
@ -19,7 +19,7 @@ public class TextureSelectPane extends BackgroundSelectPane {
initBackgroundShowPane(getShowPane(preWidth)); initBackgroundShowPane(getShowPane(preWidth));
} }
public BackgroundSettingPane getShowPane(double preWidth) { public BackgroundDetailPane getShowPane(double preWidth) {
// 计算合适的列. 至少4个. 最多8个. // 计算合适的列. 至少4个. 最多8个.
int column = Math.max((int)preWidth / 40, 4); int column = Math.max((int)preWidth / 40, 4);
return new TextureBackgroundPane(column); return new TextureBackgroundPane(column);

4
designer_base/src/com/fr/env/EnvListPane.java vendored

@ -41,7 +41,7 @@ import com.fr.dav.LocalEnv;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.InformationWarnPane; import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ipasswordfield.UIPassWordField; import com.fr.design.gui.ipasswordfield.UIPassWordField;
@ -63,7 +63,7 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
public class EnvListPane extends JControlPane { public class EnvListPane extends JListControlPane {
public EnvListPane() { public EnvListPane() {
super(); super();
addEditingListner(new PropertyChangeAdapter() { addEditingListner(new PropertyChangeAdapter() {

4
designer_chart/src/com/fr/design/chart/ChartControlPane.java

@ -3,7 +3,7 @@ package com.fr.design.chart;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -18,7 +18,7 @@ import java.util.HashMap;
* 管理图表类型Pane * 管理图表类型Pane
* @author kunsnat: ChartComponent移出. * @author kunsnat: ChartComponent移出.
*/ */
public class ChartControlPane extends JControlPane { public class ChartControlPane extends JListControlPane {
private static final long serialVersionUID = 7336270815128413184L; private static final long serialVersionUID = 7336270815128413184L;
public ChartControlPane() { public ChartControlPane() {

4
designer_chart/src/com/fr/design/chart/axis/ChartAlertLinePane.java

@ -4,14 +4,14 @@ import com.fr.general.Inter;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.chart.chartattr.ChartAlertValue; import com.fr.chart.chartattr.ChartAlertValue;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class ChartAlertLinePane extends JControlPane { public class ChartAlertLinePane extends JListControlPane {
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
return new NameableCreator[]{ return new NameableCreator[]{

2
designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java

@ -22,7 +22,7 @@ public interface IndependentChartUIProvider extends Level {
String XML_TAG = "IndependentChartUIProvider"; String XML_TAG = "IndependentChartUIProvider";
int CURRENT_API_LEVEL = 2; int CURRENT_API_LEVEL = 3;
/** /**
* 图表的类型定义界面类型就是属性表的第一个界面 * 图表的类型定义界面类型就是属性表的第一个界面

6
designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java

@ -15,9 +15,13 @@ import com.fr.general.ComparatorUtils;
* Created by Mitisky on 16/3/7. * Created by Mitisky on 16/3/7.
*/ */
public abstract class AbstractIndependentChartUIWithAPILevel implements IndependentChartUIProvider { public abstract class AbstractIndependentChartUIWithAPILevel implements IndependentChartUIProvider {
private static final int OLD_PLUGIN_LEVEL = -2;
@Override @Override
//以前的插件没有覆写这个方法,所以始终获取到-2,比当前level低,提示更新.
//新的插件编译进去的是当前LEVEL,当之后LEVEL增加,会比编译进去的LEVEL大,提示更新.
public int currentAPILevel() { public int currentAPILevel() {
return CURRENT_API_LEVEL; return OLD_PLUGIN_LEVEL;
} }
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){

4
designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrPane.java

@ -7,7 +7,7 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.design.chart.series.SeriesCondition.impl.DataSeriesConditionPaneFactory; import com.fr.design.chart.series.SeriesCondition.impl.DataSeriesConditionPaneFactory;
import com.fr.design.gui.controlpane.JControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
@ -20,7 +20,7 @@ import java.util.List;
* *
* @see DataSeriesConditionPane * @see DataSeriesConditionPane
*/ */
public class DataSeriesAttrPane extends JControlPane { public class DataSeriesAttrPane extends JListControlPane {
private static final long serialVersionUID = -7265389532959632525L; private static final long serialVersionUID = -7265389532959632525L;
private Plot plot; private Plot plot;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save