daniel 8 years ago
parent
commit
045ac762b3
  1. 1
      build.dev.gradle
  2. 20
      designer/src/com/fr/design/mainframe/SheetNameTabPane.java
  3. 4
      designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java
  4. 2
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  5. 12
      designer/src/com/fr/design/webattr/WriteToolBarPane.java
  6. 16
      designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java
  7. 2
      designer_base/build.dev.gradle
  8. 70
      designer_base/build.master.gradle
  9. 5
      designer_base/src/com/fr/design/DesignerEnvManager.java
  10. 13
      designer_base/src/com/fr/design/extra/PluginHelper.java
  11. 88
      designer_base/src/com/fr/design/extra/PluginsReaderFromStore.java
  12. 11
      designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java
  13. 37
      designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java
  14. 6
      designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java
  15. 183
      designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java
  16. 12
      designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java
  17. 59
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  18. 13
      designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java
  19. 44
      designer_base/src/com/fr/design/mainframe/HelpDialogManager.java
  20. 63
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  21. 2
      designer_base/src/com/fr/start/BaseDesigner.java
  22. 2
      designer_chart/build.dev.gradle
  23. 66
      designer_chart/build.master.gradle
  24. 198
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  25. 16
      designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
  26. 86
      designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java
  27. 54
      designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java
  28. 10
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  29. 2
      designer_form/src/com/fr/design/designer/beans/models/AddingModel.java
  30. 7
      designer_form/src/com/fr/design/designer/creator/XChartEditor.java
  31. 13
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  32. 3
      designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java
  33. 4
      designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java
  34. 11
      designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
  35. 2
      designer_form/src/com/fr/design/gui/core/FormWidgetOption.java
  36. 97
      designer_form/src/com/fr/design/mainframe/CoverPane.java
  37. 52
      designer_form/src/com/fr/design/mainframe/CoverReportPane.java
  38. 17
      designer_form/src/com/fr/design/mainframe/EditingMouseListener.java
  39. 2
      designer_form/src/com/fr/design/mainframe/FormArea.java
  40. 15
      designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java
  41. 62
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  42. 2
      sonar-project.properties

1
build.dev.gradle

@ -2,6 +2,7 @@ apply plugin: "java"
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = "UTF-8" options.encoding = "UTF-8"
} }
def basicDir="../../" def basicDir="../../"
def libDir="${basicDir}/finereport-lib-stable" def libDir="${basicDir}/finereport-lib-stable"
// //

20
designer/src/com/fr/design/mainframe/SheetNameTabPane.java

@ -274,6 +274,16 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
rightButton.setEnabled(buttonEnabled); rightButton.setEnabled(buttonEnabled);
} }
/**
* 抽出来方便OEM
* @return
*/
public Icon getAddWorkSheet(){
return ADD_WORK_SHEET;
}
public Icon getWorkSheetIcon(){
return WORK_SHEET_ICON;
}
@Override @Override
/** /**
* 画Tab * 画Tab
@ -290,7 +300,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
double textHeight = this.getSize().getHeight() - 1; double textHeight = this.getSize().getHeight() - 1;
widthArray = calculateWidthArray(); widthArray = calculateWidthArray();
int operationWidth = GRAP + ADD_WORK_SHEET.getIconWidth() + ICON_SEP_DISTANCE + ADD_POLY_SHEET.getIconWidth(); int operationWidth = GRAP + getAddWorkSheet().getIconWidth() + ICON_SEP_DISTANCE + ADD_POLY_SHEET.getIconWidth();
double maxWidth = getWidth() - operationWidth - buttonPane.getWidth();// 最大宽度 double maxWidth = getWidth() - operationWidth - buttonPane.getWidth();// 最大宽度
paintBackgroundAndLine(g2d, textHeight, maxWidth, charWidth, textAscent); paintBackgroundAndLine(g2d, textHeight, maxWidth, charWidth, textAscent);
checkButton(showCount < widthArray.length); checkButton(showCount < widthArray.length);
@ -321,7 +331,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName();
isNeedPaintedAuthority = templateReport.getWorkSheetPrivilegeControl().checkInvisible(selectedRoles); isNeedPaintedAuthority = templateReport.getWorkSheetPrivilegeControl().checkInvisible(selectedRoles);
} }
sheeticon = templateReport instanceof WorkSheet ? WORK_SHEET_ICON : POLY_SHEET_ICON; sheeticon = templateReport instanceof WorkSheet ? getWorkSheetIcon() : POLY_SHEET_ICON;
String sheetName = workBook.getReportName(i); String sheetName = workBook.getReportName(i);
if (i == selectedIndex) { if (i == selectedIndex) {
paintSelectedTab(g2d, sheeticon, textHeight, textX, sheetName, charWidth, textAscent, isNeedPaintedAuthority); paintSelectedTab(g2d, sheeticon, textHeight, textX, sheetName, charWidth, textAscent, isNeedPaintedAuthority);
@ -352,8 +362,8 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
} }
protected void paintAddButton(Graphics2D g2d){ protected void paintAddButton(Graphics2D g2d){
ADD_WORK_SHEET.paintIcon(this, g2d, iconLocation, 3); getAddWorkSheet().paintIcon(this, g2d, iconLocation, 3);
ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation + ADD_WORK_SHEET.getIconWidth() + ICON_SEP_DISTANCE, 3); ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation + getAddWorkSheet().getIconWidth() + ICON_SEP_DISTANCE, 3);
} }
/** /**
@ -757,7 +767,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
widthArray = calculateWidthArray(); widthArray = calculateWidthArray();
int width = widthArray[i]; int width = widthArray[i];
textX += width + 1; textX += width + 1;
int operationWidth = GRAP + ADD_WORK_SHEET.getIconWidth() + ICON_SEP_DISTANCE + ADD_POLY_SHEET.getIconWidth(); int operationWidth = GRAP + getAddWorkSheet().getIconWidth() + ICON_SEP_DISTANCE + ADD_POLY_SHEET.getIconWidth();
double maxWidth = getWidth() - operationWidth - buttonPane.getWidth();// 最大宽度 double maxWidth = getWidth() - operationWidth - buttonPane.getWidth();// 最大宽度
if (i < widthArray.length - 1 && textX + widthArray[i + 1] + 1 > maxWidth) { if (i < widthArray.length - 1 && textX + widthArray[i + 1] + 1 > maxWidth) {
isOvertakeWidth = true; isOvertakeWidth = true;

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

@ -36,7 +36,6 @@ 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 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 int TIME_OUT = 10000; private static final int TIME_OUT = 10000;
@ -284,12 +283,13 @@ public class BBSLoginDialog extends UIDialog {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error(e.getMessage());
} }
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.login") + "&username=" + username + "&password=" + password; String url = SiteCenter.getInstance().acquireUrlByKind("bbs.login") + "&username=" + username + "&password=" + password;
String loginSuccessFlag = SiteCenter.getInstance().acquireUrlByKind("bbs");
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(EncodeConstants.ENCODING_GBK); String res = client.getResponseText(EncodeConstants.ENCODING_GBK);
if (res.contains(LOGIN_SUCCESS_FLAG)) { if (res.contains(loginSuccessFlag)) {
return true; return true;
} }
} catch (Exception e) { } catch (Exception e) {

2
designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java

@ -99,7 +99,7 @@ public class UserInfoLabel extends UILabel{
} }
}); });
PluginWebBridge.getHelper().setUILabel(UserInfoLabel.this); //PluginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
QQLoginWebBridge.getHelper().setUILabelInPlugin(UserInfoLabel.this); QQLoginWebBridge.getHelper().setUILabelInPlugin(UserInfoLabel.this);
UserLoginContext.addLoginContextListener(new LoginContextListener() { UserLoginContext.addLoginContextListener(new LoginContextListener() {

12
designer/src/com/fr/design/webattr/WriteToolBarPane.java

@ -2,6 +2,7 @@ package com.fr.design.webattr;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
@ -22,10 +23,12 @@ import com.fr.stable.Constants;
import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
public class WriteToolBarPane extends AbstractEditToolBarPane { public class WriteToolBarPane extends AbstractEditToolBarPane {
@ -108,7 +111,7 @@ public class WriteToolBarPane extends AbstractEditToolBarPane {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final DragToolBarPane dragToolbarPane = new DragToolBarPane(); final DragToolBarPane dragToolbarPane = new DragToolBarPane();
dragToolbarPane.setDefaultToolBar(ToolBarManager.createDefaultWriteToolBar(), ReportWebWidgetConstants.getWriteToolBarInstance()); dragToolbarPane.setDefaultToolBar(ToolBarManager.createDefaultWriteToolBar(), getToolBarInstance());
dragToolbarPane.populateBean(WriteToolBarPane.this.toolBarManagers); dragToolbarPane.populateBean(WriteToolBarPane.this.toolBarManagers);
BasicDialog toobarDialog = dragToolbarPane.showWindow(SwingUtilities.getWindowAncestor(WriteToolBarPane.this)); BasicDialog toobarDialog = dragToolbarPane.showWindow(SwingUtilities.getWindowAncestor(WriteToolBarPane.this));
toobarDialog.addDialogActionListener(new DialogActionAdapter() { toobarDialog.addDialogActionListener(new DialogActionAdapter() {
@ -130,7 +133,12 @@ public class WriteToolBarPane extends AbstractEditToolBarPane {
@Override @Override
protected WidgetOption[] getToolBarInstance() { protected WidgetOption[] getToolBarInstance() {
return ReportWebWidgetConstants.getWriteToolBarInstance(); List<WidgetOption> defaultOptions = Arrays.asList(ReportWebWidgetConstants.getWriteToolBarInstance());
List<WidgetOption> extraOptions = Arrays.asList(ExtraDesignClassManager.getInstance().getWebWidgetOptions());
List<WidgetOption> options = new ArrayList<WidgetOption>();
options.addAll(defaultOptions);
options.addAll(extraOptions);
return options.toArray(new WidgetOption[options.size()]);
} }
@Override @Override

16
designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java

@ -1,18 +1,16 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.BorderLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.gui.frpane.TreeSettingPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.itree.refreshabletree.TreeRootPane; import com.fr.design.gui.itree.refreshabletree.TreeRootPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.gui.frpane.TreeSettingPane;
import com.fr.form.ui.TreeEditor; import com.fr.form.ui.TreeEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/* /*
* richer:tree editor * richer:tree editor
@ -31,12 +29,18 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> {
protected void populateSubFieldEditorBean(TreeEditor e) { protected void populateSubFieldEditorBean(TreeEditor e) {
this.treeSettingPane.populate(e); this.treeSettingPane.populate(e);
treeRootPane.populate(e.getTreeAttr()); treeRootPane.populate(e.getTreeAttr());
if (this.removeRepeatCheckBox != null) {
this.removeRepeatCheckBox.setSelected(e.isRemoveRepeat());
}
} }
@Override @Override
protected TreeEditor updateSubFieldEditorBean() { protected TreeEditor updateSubFieldEditorBean() {
TreeEditor editor = treeSettingPane.updateTreeEditor(); TreeEditor editor = treeSettingPane.updateTreeEditor();
editor.setTreeAttr(treeRootPane.update()); editor.setTreeAttr(treeRootPane.update());
if (this.removeRepeatCheckBox != null) {
editor.setRemoveRepeat(this.removeRepeatCheckBox.isSelected());
}
return editor; return editor;
} }

2
designer_base/build.dev.gradle

@ -4,7 +4,7 @@ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
//jdk版本 //jdk版本
sourceCompatibility=1.8 sourceCompatibility=1.7
//jar包版本 //jar包版本
version='8.0' version='8.0'
//jar包重命名 //jar包重命名

70
designer_base/build.master.gradle

@ -0,0 +1,70 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
//jdk版本
sourceCompatibility=1.7
//jar包版本
version='8.0'
//jar包重命名
jar{
baseName='fr-designer-core'
}
def srcDir="."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
}
}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
testCompile 'junit:junit:4.12'
}
//.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

5
designer_base/src/com/fr/design/DesignerEnvManager.java

@ -20,6 +20,7 @@ import com.fr.stable.xml.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.SwingWorker.StateValue; import javax.swing.SwingWorker.StateValue;
import java.awt.*; import java.awt.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
@ -28,6 +29,7 @@ import java.util.Map.Entry;
import java.util.logging.FileHandler; import java.util.logging.FileHandler;
import java.util.logging.Handler; import java.util.logging.Handler;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.SimpleFormatter; import java.util.logging.SimpleFormatter;
/** /**
@ -226,7 +228,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
StableUtils.makesureFileExist(new java.io.File(fileName)); StableUtils.makesureFileExist(new java.io.File(fileName));
} }
Handler handler = new FileHandler(fileName, true); Handler handler = new FileHandler(fileName, true);
handler.setFormatter(new SimpleFormatter());
handler.setFormatter(new FRLogFormatter());
FRContext.getLogger().addLogHandler(handler); FRContext.getLogger().addLogHandler(handler);
} catch (SecurityException e) { } catch (SecurityException e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);

13
designer_base/src/com/fr/design/extra/PluginHelper.java

@ -38,6 +38,7 @@ public class PluginHelper {
//插件依赖的下载位置 //插件依赖的下载位置
public static final String DEPENDENCE_DOWNLOAD_PATH = System.getProperty("user.dir") + "/download/dependence"; public static final String DEPENDENCE_DOWNLOAD_PATH = System.getProperty("user.dir") + "/download/dependence";
public static final String TEMP_FILE = "temp.zip"; public static final String TEMP_FILE = "temp.zip";
public static final String CONNECTION_404 = "404";
/** /**
* 下载插件 * 下载插件
@ -130,7 +131,7 @@ public class PluginHelper {
//将所有未配置好的资源文件依赖准备好 //将所有未配置好的资源文件依赖准备好
private static void checkDependenceEnv(Plugin plugin) throws PluginDependenceException { private static void checkDependenceEnv(Plugin plugin) throws PluginDependenceException {
PluginDependence dependence = plugin.getDependence(); PluginDependence dependence = plugin.getDependence();
if (dependence == null){ if (dependence == null) {
return; return;
} }
@ -138,14 +139,14 @@ public class PluginHelper {
String currentID = dependence.getCurrentPluginID(); String currentID = dependence.getCurrentPluginID();
List<PluginDependenceUnit> list = dependence.getDependPlugins(); List<PluginDependenceUnit> list = dependence.getDependPlugins();
for (int i = 0;list != null && i < list.size(); i++){ for (int i = 0; list != null && i < list.size(); i++) {
PluginDependenceUnit dependenceUnit = list.get(i); PluginDependenceUnit dependenceUnit = list.get(i);
if (!dependenceUnit.checkFileEnv()){ if (!dependenceUnit.checkFileEnv()) {
needInstallDependence.add(dependenceUnit); needInstallDependence.add(dependenceUnit);
} }
} }
if (needInstallDependence.isEmpty()){ if (needInstallDependence.isEmpty()) {
return; return;
} }
@ -155,14 +156,16 @@ public class PluginHelper {
/** /**
* 构造一个下载UI * 构造一个下载UI
*
* @param currentID * @param currentID
* @param list * @param list
* @throws PluginDependenceException * @throws PluginDependenceException
*/ */
private static void installDependenceOnline(String currentID, List<PluginDependenceUnit> list) throws PluginDependenceException{ private static void installDependenceOnline(String currentID, List<PluginDependenceUnit> list) throws PluginDependenceException {
DownLoadDependenceUI ui = new DownLoadDependenceUI(currentID, list); DownLoadDependenceUI ui = new DownLoadDependenceUI(currentID, list);
ui.installOnline(); ui.installOnline();
} }
/** /**
* 从选中的压缩文件中安装插件 * 从选中的压缩文件中安装插件
* *

88
designer_base/src/com/fr/design/extra/PluginsReaderFromStore.java

@ -31,30 +31,30 @@ public class PluginsReaderFromStore {
* @return 插件信息 * @return 插件信息
*/ */
public static Plugin[] readPlugins() throws Exception { public static Plugin[] readPlugins() throws Exception {
String resText; String resText;
try {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.store"));
resText = httpClient.getResponseText();
String charSet = EncodeConstants.ENCODING_UTF_8;
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet);
} catch (Exception e) {
throw new Exception(Inter.getLocText("FR-Designer-Plugin_PluginMarket_Coding"));
}
if (StringUtils.isNotEmpty(resText)) {
try { try {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.store")); plugins.clear();//先清空set
resText = httpClient.getResponseText(); JSONArray jsonArray = new JSONArray(resText);
String charSet = EncodeConstants.ENCODING_UTF_8; for (int i = 0, size = jsonArray.length(); i < size; i++) {
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet); Plugin plugin = new Plugin();
} catch (Exception e) { plugin.parseJSON(jsonArray.optJSONObject(i));
throw new Exception(Inter.getLocText("FR-Designer-Plugin_PluginMarket_Coding")); if (plugin.isValidate()) {
} plugins.add(plugin);
if (StringUtils.isNotEmpty(resText)) {
try {
plugins.clear();//先清空set
JSONArray jsonArray = new JSONArray(resText);
for (int i = 0, size = jsonArray.length(); i < size; i++) {
Plugin plugin = new Plugin();
plugin.parseJSON(jsonArray.optJSONObject(i));
if (plugin.isValidate()) {
plugins.add(plugin);
}
} }
} catch (JSONException e) {
throw new Exception(Inter.getLocText("FR-Designer-Plugin_Read_Plugin_List_Error"));
} }
} catch (JSONException e) {
throw new Exception(Inter.getLocText("FR-Designer-Plugin_Read_Plugin_List_Error"));
} }
}
return plugins.toArray(new Plugin[plugins.size()]); return plugins.toArray(new Plugin[plugins.size()]);
} }
@ -65,35 +65,33 @@ public class PluginsReaderFromStore {
* @return 插件信息 * @return 插件信息
*/ */
public static Plugin[] readPluginsForUpdate() throws Exception { public static Plugin[] readPluginsForUpdate() throws Exception {
String resText; String resText = null;
String url = SiteCenter.getInstance().acquireUrlByKind("plugin.update");
if (StringUtils.isNotEmpty(url)) {
HashMap<String, String> para = new HashMap<String, String>();
para.put("plugins", PluginLoader.getLoader().pluginsToString());
//只有当前设计器的jar高于插件新版本需要的jarTime时, 才提示更新该插件.
para.put("jarTime", GeneralUtils.readBuildNO());
HttpClient httpClient = new HttpClient(url, para);
resText = httpClient.getResponseText();
String charSet = EncodeConstants.ENCODING_UTF_8;
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet);
}
if (StringUtils.isNotEmpty(resText)) {
try { try {
HashMap<String, String> para = new HashMap<String, String>(); pluginsToUpdate.clear();
para.put("plugins", PluginLoader.getLoader().pluginsToString()); JSONArray jsonArray = new JSONArray(resText);
//只有当前设计器的jar高于插件新版本需要的jarTime时, 才提示更新该插件. for (int i = 0, size = jsonArray.length(); i < size; i++) {
para.put("jarTime", GeneralUtils.readBuildNO()); Plugin plugin = new Plugin();
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.update"), para); plugin.parseJSON(jsonArray.optJSONObject(i));
resText = httpClient.getResponseText(); if (plugin.isValidate()) {
String charSet = EncodeConstants.ENCODING_UTF_8; pluginsToUpdate.add(plugin);
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet);
} catch (Exception e) {
throw new Exception(Inter.getLocText("FR-Designer-Plugin_PluginMarket_Coding"));
}
if (StringUtils.isNotEmpty(resText)) {
try {
pluginsToUpdate.clear();
JSONArray jsonArray = new JSONArray(resText);
for (int i = 0, size = jsonArray.length(); i < size; i++) {
Plugin plugin = new Plugin();
plugin.parseJSON(jsonArray.optJSONObject(i));
if (plugin.isValidate()) {
pluginsToUpdate.add(plugin);
}
} }
} catch (JSONException e) {
throw new Exception(Inter.getLocText("FR-Designer-Plugin_Read_Plugin_List_Error"));
} }
} catch (JSONException e) {
throw new Exception(Inter.getLocText("FR-Designer-Plugin_Read_Plugin_List_Error"));
} }
}
return pluginsToUpdate.toArray(new Plugin[pluginsToUpdate.size()]); return pluginsToUpdate.toArray(new Plugin[pluginsToUpdate.size()]);
} }

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

@ -1,5 +1,6 @@
package com.fr.design.extra.exe; package com.fr.design.extra.exe;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
@ -26,8 +27,14 @@ public class GetPluginCategoriesExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.category")); String url = SiteCenter.getInstance().acquireUrlByKind("plugin.category");
result = httpClient.getResponseText(); if (url != null) {
HttpClient httpClient = new HttpClient(url);
result = httpClient.getResponseText();
} else {
result = PluginHelper.CONNECTION_404;
}
} }
} }
}; };

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

@ -1,5 +1,6 @@
package com.fr.design.extra.exe; package com.fr.design.extra.exe;
import com.fr.design.extra.PluginHelper;
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.SiteCenter;
@ -38,21 +39,27 @@ public class GetPluginFromStoreExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
StringBuilder url = new StringBuilder(SiteCenter.getInstance().acquireUrlByKind("plugin.plist")); String plistUrl = SiteCenter.getInstance().acquireUrlByKind("plugin.plist");
if (StringUtils.isNotBlank(category)) { if (StringUtils.isNotBlank(plistUrl)) {
url.append("&cid=").append(category.split("-")[1]); StringBuilder url = new StringBuilder();
} url.append(plistUrl);
if (StringUtils.isNotBlank(seller)) { if (StringUtils.isNotBlank(category)) {
url.append("&seller=").append(seller.split("-")[1]); url.append("&cid=").append(category.split("-")[1]);
} }
if (StringUtils.isNotBlank(fee)) { if (StringUtils.isNotBlank(seller)) {
url.append("&fee=").append(fee.split("-")[1]); url.append("&seller=").append(seller.split("-")[1]);
} }
try { if (StringUtils.isNotBlank(fee)) {
HttpClient httpClient = new HttpClient(url.toString()); url.append("&fee=").append(fee.split("-")[1]);
result = httpClient.getResponseText(); }
} catch (Exception e) { try {
FRLogger.getLogger().error(e.getMessage()); HttpClient httpClient = new HttpClient(url.toString());
result = httpClient.getResponseText();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
} else {
result = PluginHelper.CONNECTION_404;
} }
} }
} }

6
designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java

@ -265,7 +265,9 @@ public class DownLoadDependenceUI implements ActionListener {
} }
} }
private String showFileLength() { private String showFileLength(){
return totalSize == -1 ? "NAN" : totalSize / Math.pow(10, 6) + ""; double len = totalSize / Math.pow(10, 6);
String lenStr = String.format("%.2f", len);
return totalSize == -1 ? "NAN" : lenStr;
} }
} }

183
designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java

@ -1,52 +1,44 @@
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import java.awt.BorderLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import com.fr.data.impl.TreeNodeWrapper;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.*;
import com.fr.general.NameObject;
import com.fr.data.impl.TableDataDictionary; import com.fr.data.impl.TableDataDictionary;
import com.fr.data.impl.TreeAttr; import com.fr.data.impl.TreeAttr;
import com.fr.data.impl.TreeNodeAttr; import com.fr.data.impl.TreeNodeAttr;
import com.fr.data.impl.TreeNodeWrapper;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.dialog.BasicPane;
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.frpane.tree.layer.config.LayerDataControlPane;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.TreeDataCardPane; import com.fr.design.gui.itree.refreshabletree.TreeDataCardPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.form.ui.TreeComboBoxEditor; import com.fr.form.ui.TreeComboBoxEditor;
import com.fr.form.ui.TreeEditor; import com.fr.form.ui.TreeEditor;
import com.fr.form.ui.tree.LayerConfig;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.NameObject;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class TreeSettingPane extends BasicPane implements DataCreatorUI { public class TreeSettingPane extends BasicPane implements DataCreatorUI {
private JTreeControlPane controlPane; private JTreeControlPane controlPane;
private JTreeAutoBuildPane autoBuildPane; private JTreeAutoBuildPane autoBuildPane;
/**
* 新的分层构建方式
*/
private LayerDataControlPane layerDataControlPane;
private UIComboBox buildBox; private UIComboBox buildBox;
/** /**
* *
*/ */
private static final long serialVersionUID = 1762889323082827111L; private static final long serialVersionUID = 1762889323082827111L;
private String[] buildWay = new String[]{Inter.getLocText("FR-Designer_DataTable-Build"), private String[] buildWay = new String[] { Inter.getLocText("FR-Designer_Layer-Build"),
Inter.getLocText("FR-Designer_Auto-Build"), Inter.getLocText("FR-Designer_Layer-Build")}; Inter.getLocText("FR-Designer_Auto-Build") };
public TreeSettingPane(boolean isEditor) { public TreeSettingPane(boolean isEditor) {
this.initComponents(isEditor); this.initComponents(isEditor);
} }
private void initComponents(boolean isEditor) { private void initComponents(boolean isEditor) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -64,51 +56,35 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
buildWayPanel.add(buildBox); buildWayPanel.add(buildBox);
controlPane = new JTreeControlPane(new NameableCreator[] { treeNode }, controlPane = new JTreeControlPane(new NameableCreator[] { treeNode },
new TreeDataCardPane(), isEditor); new TreeDataCardPane(), isEditor);
autoBuildPane = new JTreeAutoBuildPane(); autoBuildPane = new JTreeAutoBuildPane();
layerDataControlPane = new LayerDataControlPane(); this.add(buildWayPanel, BorderLayout.NORTH);
this.add(buildWayPanel, BorderLayout.NORTH); cardChanged(0);
cardChanged(0); }
}
private void cardChanged(int index) { private void cardChanged(int index) {
this.remove(controlPane); this.remove(controlPane);
this.remove(autoBuildPane); this.remove(autoBuildPane);
this.remove(layerDataControlPane); this.add(index == 0 ? controlPane : autoBuildPane, BorderLayout.CENTER);
switch (index) { validate();
case 0: repaint();
this.add(layerDataControlPane); revalidate();
break; }
case 1:
this.add(autoBuildPane);
break;
case 2:
this.add(controlPane);
break;
default:
break;
}
validate();
repaint();
revalidate();
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Create_Tree"); return Inter.getLocText("FR-Designer_Create_Tree");
} }
@Override @Override
public JComponent toSwingComponent() { public JComponent toSwingComponent() {
return this; return this;
} }
NameableCreator treeNode = new NameObjectCreator( NameableCreator treeNode = new NameObjectCreator(
Inter.getLocText("FR-Designer_Gradation"), Inter.getLocText("FR-Designer_Gradation"),
"/com/fr/design/images/data/source/jdbcTableData.png", "/com/fr/design/images/data/source/jdbcTableData.png",
TreeNodeAttr.class); TreeNodeAttr.class);
/** /**
* *
@ -125,19 +101,10 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
buildBox.setSelectedIndex(1); buildBox.setSelectedIndex(1);
TableDataDictionary dictionary = treeEditor.getDictionary(); TableDataDictionary dictionary = treeEditor.getDictionary();
autoBuildPane.populate(dictionary); autoBuildPane.populate(dictionary);
} else if (treeEditor.isLayerBuild()) { } else {
buildBox.setSelectedIndex(0); buildBox.setSelectedIndex(0);
java.util.List<LayerConfig> layerConfigList = treeEditor.getLayerConfigs(); }
LayerConfig[] layerConfigs = new LayerConfig[layerConfigList.size()]; }
int i = 0;
for (LayerConfig layerConfig : layerConfigList) {
layerConfigs[i++] = layerConfig;
}
this.layerDataControlPane.populate(new NameObject("tree", layerConfigs));
} else {
buildBox.setSelectedIndex(2);
}
}
/** /**
* 视图树的update * 视图树的update
@ -156,46 +123,43 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
te.setAutoBuild(true); te.setAutoBuild(true);
te.setDictionary(dictionary); te.setDictionary(dictionary);
te.setNodeOrDict(dictionary); te.setNodeOrDict(dictionary);
} else if (buildBox.getSelectedIndex() == 2) { } else {
te.setAutoBuild(false); te.setAutoBuild(false);
NameObject no = this.controlPane.update(); NameObject no = this.controlPane.update();
if (no != null) { if (no != null) {
TreeEditor editor = (TreeEditor) no.getObject(); TreeEditor editor = (TreeEditor) no.getObject();
te.setAllowBlank(editor.isAllowBlank()); te.setAllowBlank(editor.isAllowBlank());
te.setEnabled(editor.isEnabled()); te.setEnabled(editor.isEnabled());
te.setDirectEdit(editor.isDirectEdit()); te.setDirectEdit(editor.isDirectEdit());
te.setErrorMessage(editor.getErrorMessage()); te.setErrorMessage(editor.getErrorMessage());
te.setWidgetName(editor.getWidgetName()); te.setWidgetName(editor.getWidgetName());
te.setVisible(editor.isVisible()); te.setVisible(editor.isVisible());
te.setWaterMark(editor.getWaterMark()); te.setWaterMark(editor.getWaterMark());
te.setRemoveRepeat(editor.isRemoveRepeat()); te.setRemoveRepeat(editor.isRemoveRepeat());
te.setTreeAttr(editor.getTreeAttr()); te.setTreeAttr(editor.getTreeAttr());
te.setTreeNodeAttr(editor.getTreeNodeAttr()); te.setTreeNodeAttr(editor.getTreeNodeAttr());
te.setNodeOrDict(editor.getTreeNodeAttr()); te.setNodeOrDict(editor.getTreeNodeAttr());
te.setPerformanceFirst(editor.isPerformanceFirst()); te.setPerformanceFirst(editor.isPerformanceFirst());
} }
} }
return te; return te;
} }
/** /**
* 树节点属性的update * 树节点属性的update
* @return * @return
*/ */
public Object updateTreeNodeAttrs() { public Object updateTreeNodeAttrs() {
if(buildBox.getSelectedIndex() == 0) {
if (buildBox.getSelectedIndex() == 2) { NameObject no = controlPane.update();
NameObject no = controlPane.update(); if (no != null) {
if (no != null) { return no.getObject();
return no.getObject();
} }
} else if (buildBox.getSelectedIndex() == 0) { } else {
return layerDataControlPane.update(); return autoBuildPane.update();
} else { }
return autoBuildPane.update(); return null;
} }
return null;
}
/** /**
* 下拉树的update * 下拉树的update
@ -208,7 +172,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
tcb.setAutoBuild(true); tcb.setAutoBuild(true);
tcb.setDictionary(dictionary); tcb.setDictionary(dictionary);
tcb.setNodeOrDict(dictionary); tcb.setNodeOrDict(dictionary);
} else if (buildBox.getSelectedIndex() == 2) { } else {
tcb.setAutoBuild(false); tcb.setAutoBuild(false);
NameObject no = this.controlPane.update(); NameObject no = this.controlPane.update();
if (no != null) { if (no != null) {
@ -240,15 +204,12 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
*/ */
public void populate(Object nodeOrDict) { public void populate(Object nodeOrDict) {
if(nodeOrDict instanceof TreeNodeAttr[] || nodeOrDict instanceof TreeNodeWrapper) { if(nodeOrDict instanceof TreeNodeAttr[] || nodeOrDict instanceof TreeNodeWrapper) {
buildBox.setSelectedIndex(2); buildBox.setSelectedIndex(0);
NameObject no = new NameObject("name", nodeOrDict); NameObject no = new NameObject("name", nodeOrDict);
controlPane.populate(no); controlPane.populate(no);
} else if(nodeOrDict instanceof TableDataDictionary) { } else if(nodeOrDict instanceof TableDataDictionary) {
buildBox.setSelectedIndex(1); buildBox.setSelectedIndex(1);
autoBuildPane.populate((TableDataDictionary)nodeOrDict); autoBuildPane.populate((TableDataDictionary)nodeOrDict);
} else if (nodeOrDict instanceof NameObject) { }
buildBox.setSelectedIndex(0); }
layerDataControlPane.populate((NameObject) nodeOrDict);
}
}
} }

12
designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java

@ -247,7 +247,17 @@ public class FRTreeComboBox extends UIComboBox {
} }
@Override @Override
protected UIButton createArrowButton() { protected UIButton createArrowButton() {
arrowButton = new UIButton(UIConstants.ARROW_DOWN_ICON); arrowButton = new UIButton(UIConstants.ARROW_DOWN_ICON){
/**
* 组件是否需要响应添加的观察者事件
*
* @return 如果需要响应观察者事件则返回true否则返回false
*/
@Override
public boolean shouldResponseChangeListener() {
return false;
}
};
((UIButton) arrowButton).setRoundBorder(true, Constants.LEFT); ((UIButton) arrowButton).setRoundBorder(true, Constants.LEFT);
arrowButton.addMouseListener(this); arrowButton.addMouseListener(this);
comboBox.addMouseListener(this); comboBox.addMouseListener(this);

59
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

@ -168,24 +168,48 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
/** /**
* Constructor. * 初始menuPane的方法 方便OEM时修改该组件
* @param ad
*/ */
protected void initMenuPane(){
menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH);
menuPane.add(initNorthEastPane(ad), BorderLayout.EAST);
basePane.add(menuPane, BorderLayout.NORTH);
this.resetToolkitByPlus(null);
}
/**
* @param ad
* @return
*/
protected JPanel initNorthEastPane(final ToolBarMenuDock ad){
//hugh: private修改为protected方便oem的时候修改右上的组件构成
//顶部日志+登陆按钮
final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
GeneralContext.addPluginReadListener(new PluginReadListener() {
@Override
public void success() {
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor == null) {
processor = new DefaultTitlePlace();
}
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane());
}
});
return northEastPane;
}
public DesignerFrame(ToolBarMenuDock ad) { public DesignerFrame(ToolBarMenuDock ad) {
setName(DESIGNER_FRAME_NAME); setName(DESIGNER_FRAME_NAME);
this.ad = ad; this.ad = ad;
this.initTitleIcon(); this.initTitleIcon();
this.setTitle();// james:因为有默认的了 this.setTitle();// james:因为有默认的了
// set this to context. // set this to context.
DesignerContext.setDesignerFrame(this); DesignerContext.setDesignerFrame(this);
// the content pane // the content pane
basePane.setLayout(new BorderLayout()); basePane.setLayout(new BorderLayout());
menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH);
menuPane.add(initNorthEastPane(ad), BorderLayout.EAST);
toolbarPane = new JPanel() { toolbarPane = new JPanel() {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); Dimension dim = super.getPreferredSize();
@ -211,7 +235,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
centerPane.add(centerTemplateCardPane = new DesktopCardPane(), BorderLayout.CENTER); centerPane.add(centerTemplateCardPane = new DesktopCardPane(), BorderLayout.CENTER);
centerPane.add(toolbarPane, BorderLayout.NORTH); centerPane.add(toolbarPane, BorderLayout.NORTH);
basePane.add(menuPane, BorderLayout.NORTH);
basePane.add(centerPane, BorderLayout.CENTER); basePane.add(centerPane, BorderLayout.CENTER);
laoyoutWestPane(); laoyoutWestPane();
basePane.add(EastRegionContainerPane.getInstance(), BorderLayout.EAST); basePane.add(EastRegionContainerPane.getInstance(), BorderLayout.EAST);
@ -222,7 +246,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
// 调整Window大小 // 调整Window大小
modWindowBounds(); modWindowBounds();
this.resetToolkitByPlus(null);
// p:检查所有按钮的可见性和是否可以编辑性. // p:检查所有按钮的可见性和是否可以编辑性.
checkToolbarMenuEnable(); checkToolbarMenuEnable();
@ -243,6 +267,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.setExtendedState(JFrame.MAXIMIZED_BOTH); this.setExtendedState(JFrame.MAXIMIZED_BOTH);
this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_MOVE, new FileDropTargetListener(), true)); this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_MOVE, new FileDropTargetListener(), true));
closeMode = UIConstants.CLOSE_OF_AUTHORITY; closeMode = UIConstants.CLOSE_OF_AUTHORITY;
initMenuPane();
} }
public void initTitleIcon() { public void initTitleIcon() {
@ -257,22 +282,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
private JPanel initNorthEastPane(final ToolBarMenuDock ad){
//顶部日志+登陆按钮
final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
GeneralContext.addPluginReadListener(new PluginReadListener() {
@Override
public void success() {
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor == null) {
processor = new DefaultTitlePlace();
}
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane());
}
});
return northEastPane;
}
private void addWindowListeners(ArrayList<WindowListener> listeners){ private void addWindowListeners(ArrayList<WindowListener> listeners){
for(WindowListener listener : listeners){ for(WindowListener listener : listeners){
this.addWindowListener(listener); this.addWindowListener(listener);

13
designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java

@ -0,0 +1,13 @@
package com.fr.design.mainframe;
/**
* Coder: zack
* Date: 2016/11/3
* Time: 10:43
*/
public interface HelpDialogHandler {
/**
* 销毁
*/
void destroyHelpDialog();
}

44
designer_base/src/com/fr/design/mainframe/HelpDialogManager.java

@ -0,0 +1,44 @@
package com.fr.design.mainframe;
/**
* 帮助信息的面板由于需要滚动条所以采用了很挫的dialog做dialog很多情况下不能主动关闭这边控制一下
* Coder: zack
* Date: 2016/11/2
* Time: 16:34
*/
public class HelpDialogManager {
private static HelpDialogManager THIS;
private HelpDialogHandler handler;
private HelpDialogManager() {
}
public HelpDialogHandler getPane() {
return handler;
}
public void setPane(HelpDialogHandler dialog) {
if (dialog == this.handler) {
return;
}
//只允许一个dialog存在
if (this.handler != null) {
handler.destroyHelpDialog();
}
this.handler = dialog;
}
public static HelpDialogManager getInstance() {
if (THIS == null) {
THIS = new HelpDialogManager();
}
return THIS;
}
public void destroyDialog() {
if (handler != null) {
handler.destroyHelpDialog();
}
}
}

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

@ -121,7 +121,7 @@ public abstract class ToolBarMenuDock {
///////////////////////////////menu below///////////////////////////////////////////////// ///////////////////////////////menu below/////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
private MenuDef[] menus(final ToolBarMenuDockPlus plus) { public MenuDef[] menus(final ToolBarMenuDockPlus plus) {
java.util.List<MenuDef> menuList = new java.util.ArrayList<MenuDef>(); java.util.List<MenuDef> menuList = new java.util.ArrayList<MenuDef>();
// 添加文件菜单 // 添加文件菜单
menuList.add(createFileMenuDef(plus)); menuList.add(createFileMenuDef(plus));
@ -143,17 +143,17 @@ public abstract class ToolBarMenuDock {
return menuList.toArray(new MenuDef[menuList.size()]); return menuList.toArray(new MenuDef[menuList.size()]);
} }
private void insertTemplateExtendMenu(ToolBarMenuDockPlus plus, MenuDef[] menuDefs) { public void insertTemplateExtendMenu(ToolBarMenuDockPlus plus, MenuDef[] menuDefs) {
// 给菜单加插件入口 // 给菜单加插件入口
for (MenuDef m : menuDefs) { for (MenuDef m : menuDefs) {
switch (m.getAnchor()) { switch (m.getAnchor()) {
case MenuHandler.TEMPLATE: case MenuHandler.TEMPLATE :
insertMenu(m, MenuHandler.TEMPLATE, new TemplateTargetAction(plus)); insertMenu(m, MenuHandler.TEMPLATE, new TemplateTargetAction(plus));
break; break;
case MenuHandler.INSERT: case MenuHandler.INSERT :
insertMenu(m, MenuHandler.INSERT); insertMenu(m, MenuHandler.INSERT);
break; break;
case MenuHandler.CELL: case MenuHandler.CELL :
insertMenu(m, MenuHandler.CELL); insertMenu(m, MenuHandler.CELL);
break; break;
default: default:
@ -172,7 +172,7 @@ public abstract class ToolBarMenuDock {
return plus.menus4Target(); return plus.menus4Target();
} }
private MenuDef createFileMenuDef(ToolBarMenuDockPlus plus) { public MenuDef createFileMenuDef(ToolBarMenuDockPlus plus) {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_File"), 'F'); MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_File"), 'F');
ShortCut[] scs = new ShortCut[0]; ShortCut[] scs = new ShortCut[0];
@ -200,7 +200,7 @@ public abstract class ToolBarMenuDock {
addSwitchExistEnvAction(menuDef); addSwitchExistEnvAction(menuDef);
menuDef.addShortCut(new ExitDesignerAction()); menuDef.addShortCut( new ExitDesignerAction());
insertMenu(menuDef, MenuHandler.FILE); insertMenu(menuDef, MenuHandler.FILE);
return menuDef; return menuDef;
@ -222,7 +222,7 @@ public abstract class ToolBarMenuDock {
menuDef.addShortCut(new SwitchExistEnv()); menuDef.addShortCut(new SwitchExistEnv());
} }
protected ShortCut openTemplateAction() { protected ShortCut openTemplateAction(){
return new OpenTemplateAction(); return new OpenTemplateAction();
} }
@ -237,8 +237,9 @@ public abstract class ToolBarMenuDock {
* 创建论坛登录面板, chart那边不需要 * 创建论坛登录面板, chart那边不需要
* *
* @return 面板组件 * @return 面板组件
*
*/ */
public Component createBBSLoginPane() { public Component createBBSLoginPane(){
return new UILabel(); return new UILabel();
} }
@ -264,10 +265,9 @@ public abstract class ToolBarMenuDock {
); );
if (!BaseUtils.isAuthorityEditing()) { if (!BaseUtils.isAuthorityEditing()) {
if (shouldShowPlugin() && !(FRContext.getCurrentEnv() instanceof RemoteEnv)) { if (shouldShowPlugin()) {
menuDef.addShortCut( menuDef.addShortCut(
new PluginManagerAction(), new PluginManagerAction()
new ReuseManagerAction()
); );
} }
menuDef.addShortCut( menuDef.addShortCut(
@ -286,12 +286,11 @@ public abstract class ToolBarMenuDock {
} }
protected boolean shouldShowPlugin() { protected boolean shouldShowPlugin() {
return FRContext.isChineseEnv() || ComparatorUtils.equals(GeneralContext.getLocale(), Locale.TAIWAN); return !(FRContext.getCurrentEnv() instanceof RemoteEnv) && FRContext.isChineseEnv();
} }
/** /**
* 创建帮助子菜单 * 创建帮助子菜单
*
* @return 帮组菜单的子菜单 * @return 帮组菜单的子菜单
*/ */
public ShortCut[] createHelpShortCuts() { public ShortCut[] createHelpShortCuts() {
@ -300,7 +299,7 @@ public abstract class ToolBarMenuDock {
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(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
@ -314,7 +313,6 @@ public abstract class ToolBarMenuDock {
/** /**
* 创建社区子菜单 * 创建社区子菜单
*
* @return 社区菜单的子菜单 * @return 社区菜单的子菜单
*/ */
public ShortCut[] createCommunityShortCuts() { public ShortCut[] createCommunityShortCuts() {
@ -329,7 +327,6 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new SignAction()); shortCuts.add(new SignAction());
return shortCuts.toArray(new ShortCut[shortCuts.size()]); return shortCuts.toArray(new ShortCut[shortCuts.size()]);
} }
public MenuDef createHelpMenuDef() { public 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();
@ -339,7 +336,6 @@ public abstract class ToolBarMenuDock {
insertMenu(menuDef, MenuHandler.HELP); insertMenu(menuDef, MenuHandler.HELP);
return menuDef; return menuDef;
} }
public MenuDef createCommunityMenuDef() { public MenuDef createCommunityMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_COMMUNITY"), 'C'); MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_COMMUNITY"), 'C');
ShortCut[] otherCommunityShortCuts = createCommunityShortCuts(); ShortCut[] otherCommunityShortCuts = createCommunityShortCuts();
@ -349,7 +345,6 @@ public abstract class ToolBarMenuDock {
insertMenu(menuDef, MenuHandler.BBS); insertMenu(menuDef, MenuHandler.BBS);
return menuDef; return menuDef;
} }
/** /**
* 生成工具栏 * 生成工具栏
* *
@ -474,8 +469,7 @@ public abstract class ToolBarMenuDock {
public int getMenuState() { public int getMenuState() {
return DesignState.WORK_SHEET; return DesignState.WORK_SHEET;
} }
public int getToolBarHeight(){
public int getToolBarHeight() {
return PANLE_HEIGNT; return PANLE_HEIGNT;
} }
@ -484,13 +478,13 @@ public abstract class ToolBarMenuDock {
* *
* @return 子菜单 * @return 子菜单
*/ */
public ShortCut[] shortcut4ExportMenu() { public ShortCut[] shortcut4ExportMenu(){
return new ShortCut[0]; return new ShortCut[0];
} }
}; };
public NewTemplatePane getNewTemplatePane() { public NewTemplatePane getNewTemplatePane(){
return new NewTemplatePane() { return new NewTemplatePane() {
@Override @Override
public Icon getNew() { public Icon getNew() {
@ -525,11 +519,11 @@ public abstract class ToolBarMenuDock {
for (MenuHandler handler : target) { for (MenuHandler handler : target) {
int insertPosition = handler.insertPosition(menuDef.getShortCutCount()); int insertPosition = handler.insertPosition(menuDef.getShortCutCount());
if (insertPosition == MenuHandler.HIDE) { if (insertPosition == MenuHandler.HIDE) {
return; return;
} }
ShortCut shortCut = action.methodAction(handler); ShortCut shortCut = action.methodAction(handler);
if (shortCut == null) { if (shortCut == null){
continue; continue;
} }
@ -542,10 +536,10 @@ public abstract class ToolBarMenuDock {
menuDef.insertShortCut(insertPosition, shortCut); menuDef.insertShortCut(insertPosition, shortCut);
if (handler.insertSeparatorBefore()) { if (handler.insertSeparatorBefore()) {
menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT);
insertPosition++; insertPosition ++;
} }
if (handler.insertSeparatorAfter()) { if (handler.insertSeparatorAfter()) {
insertPosition++; insertPosition ++;
menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT);
} }
} }
@ -554,35 +548,36 @@ public abstract class ToolBarMenuDock {
/** /**
* 设计器退出时, 做的一些操作. * 设计器退出时, 做的一些操作.
*
*/ */
public void shutDown() { public void shutDown(){
} }
private interface ShortCutMethodAction { private interface ShortCutMethodAction{
public ShortCut methodAction(MenuHandler handler); public ShortCut methodAction(MenuHandler handler);
} }
private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction { private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction{
public ShortCut methodAction(MenuHandler handler) { public ShortCut methodAction(MenuHandler handler){
return handler.shortcut(); return handler.shortcut();
} }
} }
//不需要编辑对象的菜单, 比如文件, 服务器, 关于 //不需要编辑对象的菜单, 比如文件, 服务器, 关于
private class NoTargetAction extends AbstractShortCutMethodAction { private class NoTargetAction extends AbstractShortCutMethodAction{
} }
//模板为对象的菜单, 比如模板, 后续如果单元格也要, 直接加个CellTargetAction即可. //模板为对象的菜单, 比如模板, 后续如果单元格也要, 直接加个CellTargetAction即可.
//在methodAction中做handler.shortcut(cell), 不需要修改handler中原有接口, 加个shortcut(cell). //在methodAction中做handler.shortcut(cell), 不需要修改handler中原有接口, 加个shortcut(cell).
private class TemplateTargetAction extends AbstractShortCutMethodAction { private class TemplateTargetAction extends AbstractShortCutMethodAction{
private ToolBarMenuDockPlus plus; private ToolBarMenuDockPlus plus;
public TemplateTargetAction(ToolBarMenuDockPlus plus) { public TemplateTargetAction(ToolBarMenuDockPlus plus){
this.plus = plus; this.plus = plus;
} }

2
designer_base/src/com/fr/start/BaseDesigner.java

@ -149,7 +149,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
} }
protected DesignerFrame createDesignerFrame() { protected DesignerFrame createDesignerFrame() {
return new DesignerFrame(this); return new DesignerFrame(this);
} }
protected int getStartPort() { protected int getStartPort() {

2
designer_chart/build.dev.gradle

@ -4,7 +4,7 @@ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
//jdk版本 //jdk版本
sourceCompatibility=1.8 sourceCompatibility=1.7
//jar包的版本 //jar包的版本
version='8.0' version='8.0'

66
designer_chart/build.master.gradle

@ -0,0 +1,66 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
//jdk版本
sourceCompatibility=1.7
//jar包的版本
version='8.0'
def srcDir="."
//jar包进行重命名
jar{
baseName='fr-designer-chart'
}
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
}
}
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
testCompile 'junit:junit:4.12'
}
//.java classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

198
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -21,10 +21,7 @@ import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.file.XMLFileManager; import com.fr.file.XMLFileManager;
import com.fr.form.ui.ChartEditor; import com.fr.form.ui.ChartEditor;
import com.fr.general.FRLogger; import com.fr.general.*;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.plugin.PluginCollector; import com.fr.plugin.PluginCollector;
import com.fr.plugin.PluginLicenseManager; import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.PluginMessage; import com.fr.plugin.PluginMessage;
@ -52,12 +49,12 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
private static ChartTypeInterfaceManager classManager = null; private static ChartTypeInterfaceManager classManager = null;
private static LinkedHashMap<String, LinkedHashMap<String, IndependentChartUIProvider>> chartTypeInterfaces = new LinkedHashMap<String, LinkedHashMap<String, IndependentChartUIProvider>>(); private static LinkedHashMap<String, LinkedHashMap<String, IndependentChartUIProvider>> chartTypeInterfaces = new LinkedHashMap<String, LinkedHashMap<String, IndependentChartUIProvider>>();
private static final String DEFAULT_CHART_ID = "DefaultChart";
public synchronized static ChartTypeInterfaceManager getInstance() { public synchronized static ChartTypeInterfaceManager getInstance() {
if (classManager == null) { if (classManager == null) {
classManager = new ChartTypeInterfaceManager(); classManager = new ChartTypeInterfaceManager();
chartTypeInterfaces.clear(); chartTypeInterfaces.clear();
classManager.readDefault();
} }
return classManager; return classManager;
} }
@ -74,9 +71,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
GeneralContext.addPluginReadListener(new PluginReadListener() { GeneralContext.addPluginReadListener(new PluginReadListener() {
@Override @Override
public void success() { public void success() {
if (chartTypeInterfaces.size() == 0) {
ChartTypeInterfaceManager.getInstance().readDefault();
}
//重新注册designModuleFactory //重新注册designModuleFactory
DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption());
} }
@ -85,8 +79,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
public static WidgetOption[] initWidgetOption(){ public static WidgetOption[] initWidgetOption(){
ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); final ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames();
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; final ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
//异步加载 //异步加载
new Thread(new Runnable() { new Thread(new Runnable() {
@ -96,7 +90,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
} }
}).start(); }).start();
return child; return child;
} }
@ -132,6 +125,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
} }
private static void readDefault() { private static void readDefault() {
if (chartTypeInterfaces.containsKey(ChartTypeManager.CHART_PRIORITY)){
return;
}
LinkedHashMap<String, IndependentChartUIProvider> chartUIList = new LinkedHashMap<String, IndependentChartUIProvider>(); LinkedHashMap<String, IndependentChartUIProvider> chartUIList = new LinkedHashMap<String, IndependentChartUIProvider>();
chartUIList.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); chartUIList.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface());
chartUIList.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); chartUIList.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface());
@ -151,7 +147,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
chartUIList.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); chartUIList.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface());
chartUIList.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); chartUIList.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface());
chartTypeInterfaces.put(DEFAULT_CHART_ID, chartUIList); chartTypeInterfaces.put(ChartTypeManager.CHART_PRIORITY, chartUIList);
} }
public String getIconPath(String plotID) { public String getIconPath(String plotID) {
@ -159,8 +155,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey(); String priority = (String) entry.getKey();
String imagePath = getIconPath(chartID, plotID); String imagePath = getIconPath(priority, plotID);
if (!StringUtils.isEmpty(imagePath)) { if (!StringUtils.isEmpty(imagePath)) {
return imagePath; return imagePath;
} }
@ -169,23 +165,23 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
private String getIconPath(String chartID, String plotID) { private String getIconPath(String priority, String plotID) {
if (chartTypeInterfaces.get(chartID) != null && chartTypeInterfaces.get(chartID).get(plotID) != null) { if (chartTypeInterfaces.get(priority) != null && chartTypeInterfaces.get(priority).get(plotID) != null) {
return chartTypeInterfaces.get(chartID).get(plotID).getIconPath(); return chartTypeInterfaces.get(priority).get(plotID).getIconPath();
}else { }else {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
} }
public static void addChartTypeInterface(IndependentChartUIProvider provider, String chartID, String plotID) { public static void addChartTypeInterface(IndependentChartUIProvider provider, String priority, String plotID) {
if (chartTypeInterfaces != null){ if (chartTypeInterfaces != null){
if (!chartTypeInterfaces.containsKey(chartID)){ if (!chartTypeInterfaces.containsKey(priority)){
//新建一个具体图表列表 //新建一个具体图表列表
LinkedHashMap<String, IndependentChartUIProvider> chartUIList = new LinkedHashMap<String, IndependentChartUIProvider>(); LinkedHashMap<String, IndependentChartUIProvider> chartUIList = new LinkedHashMap<String, IndependentChartUIProvider>();
chartUIList.put(plotID, provider); chartUIList.put(plotID, provider);
chartTypeInterfaces.put(chartID, chartUIList); chartTypeInterfaces.put(priority, chartUIList);
}else { }else {
LinkedHashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(chartID); LinkedHashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
if (!chartUIList.containsKey(plotID)) { if (!chartUIList.containsKey(plotID)) {
chartUIList.put(plotID, provider); chartUIList.put(plotID, provider);
} }
@ -199,7 +195,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
* @param className 类名 * @param className 类名
* @param plotID 标志ID * @param plotID 标志ID
*/ */
public void addChartInterface(String className, String chartID, String plotID, PluginSimplify simplify) { public void addChartInterface(String className, String priority, String plotID, PluginSimplify simplify) {
if (StringUtils.isNotBlank(className)) { if (StringUtils.isNotBlank(className)) {
try { try {
Class<?> clazz = Class.forName(className); Class<?> clazz = Class.forName(className);
@ -211,7 +207,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName()) || !containsChart(plotID)) { if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName()) || !containsChart(plotID)) {
PluginMessage.remindUpdate(className); PluginMessage.remindUpdate(className);
} else { } else {
ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, chartID, plotID); ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, priority, plotID);
} }
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
FRLogger.getLogger().error("class not found:" + e.getMessage()); FRLogger.getLogger().error("class not found:" + e.getMessage());
@ -235,8 +231,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey(); String priority = (String) entry.getKey();
Iterator chartUIIterator = chartTypeInterfaces.get(chartID).entrySet().iterator(); Iterator chartUIIterator = chartTypeInterfaces.get(priority).entrySet().iterator();
while (chartUIIterator.hasNext()) { while (chartUIIterator.hasNext()) {
Map.Entry chartUIEntry = (Map.Entry) chartUIIterator.next(); Map.Entry chartUIEntry = (Map.Entry) chartUIIterator.next();
IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue();
@ -245,13 +241,13 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
} }
} }
public String[] getTitle4PopupWindow(String chartID){ public String[] getTitle4PopupWindow(String priority){
if (chartID.isEmpty()){ if (priority.isEmpty()){
return getTitle4PopupWindow(); return getTitle4PopupWindow();
} }
String[] names = new String[getChartSize(chartID)]; String[] names = new String[getChartSize(priority)];
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID)){ if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)){
HashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(chartID); HashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
Iterator iterator = chartUIList.entrySet().iterator(); Iterator iterator = chartUIList.entrySet().iterator();
int i = 0; int i = 0;
while (iterator.hasNext()){ while (iterator.hasNext()){
@ -266,13 +262,13 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
/** /**
* 获取指定图表的标题 * 获取指定图表的标题
* @param chartID * @param priority
* @return * @return
*/ */
public String getTitle4PopupWindow(String chartID, String plotID){ public String getTitle4PopupWindow(String priority, String plotID){
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID) && chartTypeInterfaces.get(chartID).containsKey(plotID)){ if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)){
HashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(chartID); HashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
IndependentChartUIProvider provider = chartTypeInterfaces.get(chartID).get(plotID); IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID);
return provider.getPlotTypePane().title4PopupWindow(); return provider.getPlotTypePane().title4PopupWindow();
} }
@ -280,59 +276,67 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
} }
private String[] getTitle4PopupWindow(){ private String[] getTitle4PopupWindow(){
List<Integer> priorityList = new ArrayList<Integer>();
int size = 0; int size = 0;
if (chartTypeInterfaces != null){ if (chartTypeInterfaces != null){
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){ while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey(); String priority = (String) entry.getKey();
size += getChartSize(chartID); priorityList.add(Integer.valueOf(priority));
size += getChartSize(priority);
} }
String[] names = new String[size]; String[] names = new String[size];
priorityList = ChartTypeManager.orderInPriority(priorityList);
int index = 0; int index = 0;
Iterator i = chartTypeInterfaces.entrySet().iterator(); for (int i = 0; i < priorityList.size(); i++){
while (i.hasNext()){ String priority = String.valueOf(priorityList.get(i));
Map.Entry entry = (Map.Entry) i.next(); Iterator chartUI = chartTypeInterfaces.get(priority).entrySet().iterator();
String chartID = (String) entry.getKey(); index = fetchNames(chartUI, names, index);
Iterator chartUI = chartTypeInterfaces.get(chartID).entrySet().iterator();
while (chartUI.hasNext()){
Map.Entry chartUIEntry = (Map.Entry) chartUI.next();
IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue();
names[index++] = provider.getPlotTypePane().title4PopupWindow();
}
} }
return names; return names;
} }
return new String[0]; return new String[0];
} }
private int fetchNames(Iterator chartUI, String[] names, int index) {
while (chartUI.hasNext()) {
Map.Entry chartUIEntry = (Map.Entry) chartUI.next();
IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue();
names[index++] = provider.getPlotTypePane().title4PopupWindow();
}
return index;
}
public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){ while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey(); String priority = (String) entry.getKey();
if (plotInChart(plotID, chartID)) { if (plotInChart(plotID, priority)) {
return getChartDataPane(chartID, plotID, listener); return getChartDataPane(priority, plotID, listener);
} }
} }
return getChartDataPane(DEFAULT_CHART_ID, plotID, listener); return getChartDataPane(ChartTypeManager.CHART_PRIORITY, plotID, listener);
} }
private ChartDataPane getChartDataPane(String chartID, String plotID, AttributeChangeListener listener) { private ChartDataPane getChartDataPane(String priority, String plotID, AttributeChangeListener listener) {
return chartTypeInterfaces.get(chartID).get(plotID).getChartDataPane(listener); return chartTypeInterfaces.get(priority).get(plotID).getChartDataPane(listener);
} }
/** /**
* 获取对应ID的图表数量 * 获取对应ID的图表数量
* @param chartID * @param key
* @return * @return
*/ */
private int getChartSize(String chartID){ private int getChartSize(String key){
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID)){ if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(key)){
return chartTypeInterfaces.get(chartID).size(); return chartTypeInterfaces.get(key).size();
} }
return 0; return 0;
} }
@ -341,32 +345,32 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){ while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey(); String priority = (String) entry.getKey();
if (plotInChart(plotID, chartID)) { if (plotInChart(plotID, priority)) {
return getAttrPaneArray(chartID, plotID, listener); return getAttrPaneArray(priority, plotID, listener);
} }
} }
return getAttrPaneArray(DEFAULT_CHART_ID, plotID, listener); return getAttrPaneArray(ChartTypeManager.CHART_PRIORITY, plotID, listener);
} }
private AbstractChartAttrPane[] getAttrPaneArray(String chartID, String plotID, AttributeChangeListener listener) { private AbstractChartAttrPane[] getAttrPaneArray(String priority, String plotID, AttributeChangeListener listener) {
return chartTypeInterfaces.get(chartID).get(plotID).getAttrPaneArray(listener); return chartTypeInterfaces.get(priority).get(plotID).getAttrPaneArray(listener);
} }
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){ while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey(); String priority = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), chartID)) { if (plotInChart(plot.getPlotID(), priority)) {
return getTableDataSourcePane(chartID, plot, parent); return getTableDataSourcePane(priority, plot, parent);
} }
} }
return getTableDataSourcePane(DEFAULT_CHART_ID, plot, parent); return getTableDataSourcePane(ChartTypeManager.CHART_PRIORITY, plot, parent);
} }
private AbstractTableDataContentPane getTableDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { private AbstractTableDataContentPane getTableDataSourcePane(String priority, Plot plot, ChartDataPane parent) {
return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getTableDataSourcePane(plot, parent); return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getTableDataSourcePane(plot, parent);
} }
@ -374,23 +378,23 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){ while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey(); String priority = (String) entry.getKey();
String plotID = plot.getPlotID(); String plotID = plot.getPlotID();
if (plotInChart(plotID, chartID)) { if (plotInChart(plotID, priority)) {
return getReportDataSourcePane(chartID, plot, parent); return getReportDataSourcePane(priority, plot, parent);
} }
} }
return getReportDataSourcePane(DEFAULT_CHART_ID, plot, parent); return getReportDataSourcePane(ChartTypeManager.CHART_PRIORITY, plot, parent);
} }
private boolean plotInChart(String plotID, String chartID) { private boolean plotInChart(String plotID, String priority) {
return chartTypeInterfaces != null return chartTypeInterfaces != null
&& chartTypeInterfaces.containsKey(chartID) && chartTypeInterfaces.containsKey(priority)
&& chartTypeInterfaces.get(chartID).containsKey(plotID); && chartTypeInterfaces.get(priority).containsKey(plotID);
} }
private AbstractReportDataContentPane getReportDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { private AbstractReportDataContentPane getReportDataSourcePane(String priority, Plot plot, ChartDataPane parent) {
return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getReportDataSourcePane(plot, parent); return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getReportDataSourcePane(plot, parent);
} }
@ -398,16 +402,16 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){ while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey(); String priority = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), chartID)) { if (plotInChart(plot.getPlotID(), priority)) {
return getPlotConditionPane(chartID, plot); return getPlotConditionPane(priority, plot);
} }
} }
return getPlotConditionPane(DEFAULT_CHART_ID, plot); return getPlotConditionPane(ChartTypeManager.CHART_PRIORITY, plot);
} }
private ConditionAttributesPane getPlotConditionPane(String chartID, Plot plot) { private ConditionAttributesPane getPlotConditionPane(String priority, Plot plot) {
return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getPlotConditionPane(plot); return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getPlotConditionPane(plot);
} }
@ -415,16 +419,16 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){ while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey(); String priority = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), chartID)) { if (plotInChart(plot.getPlotID(), priority)) {
return getPlotSeriesPane(chartID, parent, plot); return getPlotSeriesPane(priority, parent, plot);
} }
} }
return getPlotSeriesPane(DEFAULT_CHART_ID, parent, plot); return getPlotSeriesPane(ChartTypeManager.CHART_PRIORITY, parent, plot);
} }
private BasicBeanPane<Plot> getPlotSeriesPane(String chartID, ChartStylePane parent, Plot plot) { private BasicBeanPane<Plot> getPlotSeriesPane(String priority, ChartStylePane parent, Plot plot) {
return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getPlotSeriesPane(parent, plot); return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getPlotSeriesPane(parent, plot);
} }
/** /**
@ -437,19 +441,19 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){ while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey(); String priority = (String) entry.getKey();
if (chartTypeInterfaces.get(chartID).containsKey(plotID)){ if (chartTypeInterfaces.get(priority).containsKey(plotID)){
return isUseDefaultPane(chartID, plotID); return isUseDefaultPane(priority, plotID);
} }
} }
return true; return true;
} }
private boolean isUseDefaultPane(String chartID, String plotID){ private boolean isUseDefaultPane(String priority, String plotID){
if (chartTypeInterfaces.containsKey(chartID) && chartTypeInterfaces.get(chartID).containsKey(plotID)) { if (chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) {
return chartTypeInterfaces.get(chartID).get(plotID).isUseDefaultPane(); return chartTypeInterfaces.get(priority).get(plotID).isUseDefaultPane();
} }
return true; return true;
@ -467,7 +471,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
extraChartDesignInterfaceList.add(tagName); extraChartDesignInterfaceList.add(tagName);
} }
if (IndependentChartUIProvider.XML_TAG.equals(tagName)) { if (IndependentChartUIProvider.XML_TAG.equals(tagName)) {
addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("chartID", DEFAULT_CHART_ID),reader.getAttrAsString("plotID", ""), simplify); addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("priority", ChartTypeManager.CHART_PRIORITY),reader.getAttrAsString("plotID", ""), simplify);
} }
} }
} }

16
designer_chart/src/com/fr/design/chart/gui/ChartComponent.java

@ -5,6 +5,7 @@ import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartGlyph; import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.chart.base.ChartConstants; import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
@ -31,7 +32,7 @@ import java.util.List;
* 类说明: 事件说明: 工具栏编辑--> 是刷新ChartComponent 然后响应整个设计块的改变事件 * 类说明: 事件说明: 工具栏编辑--> 是刷新ChartComponent 然后响应整个设计块的改变事件
右键编辑 ---> 刷新ChartCompment 刷新对应的工具栏(加入事件) 然后响应整个设计块的改变事件 右键编辑 ---> 刷新ChartCompment 刷新对应的工具栏(加入事件) 然后响应整个设计块的改变事件
*/ */
public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener { public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener, CallbackEvent{
private static final long serialVersionUID = 744164838619052097L; private static final long serialVersionUID = 744164838619052097L;
private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>(); private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
private ChartCollection chartCollection4Design; private ChartCollection chartCollection4Design;
@ -181,6 +182,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
// 反锯齿 // 反锯齿
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//画图
drawChartGlyph(g2d); drawChartGlyph(g2d);
ActiveGlyph ag = this.getActiveGlyph(); ActiveGlyph ag = this.getActiveGlyph();
@ -222,9 +224,9 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
/** /**
* 鼠标点击 * 鼠标点击
* @param event 鼠标事件 * @param event 鼠标事件
* 不设置鼠标点击跳转事件
*/ */
public void mouseClicked(MouseEvent event) { public void mouseClicked(MouseEvent event) {
} }
/** /**
@ -302,7 +304,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
return chartGlyph == null || chartWidth != this.getBounds().width || chartHeight != this.getBounds().height; return chartGlyph == null || chartWidth != this.getBounds().width || chartHeight != this.getBounds().height;
} }
private void drawChartGlyph(Graphics2D g2d) { public void drawChartGlyph(Graphics2D g2d) {
if (chartGlyph != null) { if (chartGlyph != null) {
if (chartGlyph.isRoundBorder()) { if (chartGlyph.isRoundBorder()) {
chartGlyph.setBounds(new RoundRectangle2D.Double(0, 0, chartWidth, chartHeight, 10, 10)); chartGlyph.setBounds(new RoundRectangle2D.Double(0, 0, chartWidth, chartHeight, 10, 10));
@ -312,8 +314,14 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
//不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单 //不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单
//其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边 //其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution()); //处理画图事件
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution(), this);
g2d.drawImage(chartImage, 0, 0, null); g2d.drawImage(chartImage, 0, 0, null);
} }
} }
@Override
public void callback() {
this.repaint();
}
} }

86
designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java

@ -1,37 +1,36 @@
package com.fr.design.chart.series.PlotSeries; package com.fr.design.chart.series.PlotSeries;
import java.awt.BorderLayout; import com.fr.base.FRContext;
import java.awt.Dimension; import com.fr.base.TableData;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.MapSvgAttr; import com.fr.chart.base.MapSvgAttr;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.data.TableDataSource;
import com.fr.data.core.DataCoreUtils;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.FilterComboBox; import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.data.DataModel;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import org.apache.batik.swing.svg.SVGFileFilter; import org.apache.batik.swing.svg.SVGFileFilter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/** /**
* 自定义地图界面. * 自定义地图界面.
* *
@ -131,22 +130,51 @@ refreshAreaNameBox();
String colName = Utils.objectToString(areaString.getSelectedItem()); String colName = Utils.objectToString(areaString.getSelectedItem());
TableDataWrapper tableDataWrappe = tableDataNameBox.getTableDataWrapper(); TableDataWrapper tableDataWrappe = tableDataNameBox.getTableDataWrapper();
TableDataSource source = DesignTableDataManager.getEditingTableDataSource();
if (tableDataWrappe == null || source == null) {
return;
}
String[] values = DataCoreUtils.getColValuesInData(source, tableDataWrappe.getTableDataName(), colName); imageShowPane.refreshFromDataList(getColValuesInData(tableDataWrappe, colName));
ArrayList list = new ArrayList();
for(int i = 0; i < values.length; i++) {
list.add(values[i]);
}
imageShowPane.refreshFromDataList(list);
} }
} }
}; };
public static List<String> getColValuesInData(TableDataWrapper tableDataWrappe, String colName) {
List<String> colValues = new ArrayList<>();
EmbeddedTableData embeddedTableData = null;
try {
embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataWrappe.getTableData(), TableData.RESULT_ALL, false);
} catch (Exception ee) {
FRContext.getLogger().error(ee.getMessage(), ee);
}
if(embeddedTableData == null){
return colValues;
}
int columnIndex = getColumnIndex(embeddedTableData, colName);
if(columnIndex == DataModel.COLUMN_NAME_NOT_FOUND){
return colValues;
}
for (int rowIndex = 0, rowCount = embeddedTableData.getRowCount(); rowIndex < rowCount; rowIndex++) {
String colValueName = GeneralUtils.objectToString(embeddedTableData.getValueAt(rowIndex, columnIndex));
if (!colValues.contains(colValueName)) {
colValues.add(colValueName);
}
}
return colValues;
}
private static int getColumnIndex(EmbeddedTableData tableData, String colName) {
for (int columnIndex = 0, columnCount = tableData.getColumnCount(); columnIndex < columnCount; columnIndex++) {
if (ComparatorUtils.tableDataColumnNameEquals(tableData.getColumnName(columnIndex), colName)) {
return columnIndex;
}
}
return DataModel.COLUMN_NAME_NOT_FOUND;
}
/** /**
* 选中方式: 区域或者点 * 选中方式: 区域或者点
*/ */

54
designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java

@ -1,42 +1,32 @@
package com.fr.design.chart.series.PlotSeries; package com.fr.design.chart.series.PlotSeries;
import java.awt.BorderLayout; import com.fr.base.Utils;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.swing.AbstractCellEditor;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import com.fr.chart.base.MapSvgAttr; import com.fr.chart.base.MapSvgAttr;
import com.fr.chart.base.MapSvgXMLHelper; import com.fr.chart.base.MapSvgXMLHelper;
import com.fr.base.Utils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.data.TableDataSource;
import com.fr.data.core.DataCoreUtils;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.TextEditor;
import com.fr.design.gui.icombobox.FilterComboBox; import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.UIArrayTableModel; import com.fr.design.gui.itableeditorpane.UIArrayTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.xcombox.ComboBoxUseEditor; import com.fr.design.gui.xcombox.ComboBoxUseEditor;
import com.fr.design.editor.editor.Editor; import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane;
import com.fr.design.editor.editor.TextEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/** /**
* 地图, 定义区域名. * 地图, 定义区域名.
* *
@ -89,7 +79,7 @@ public class MapDefiAreaNamePane extends BasicBeanPane<String> implements Abstrc
tableDataBox.setPreferredSize(new Dimension(200, 20)); tableDataBox.setPreferredSize(new Dimension(200, 20));
northPane.add(tableDataBox); northPane.add(tableDataBox);
columnBox = new FilterComboBox(); columnBox = new FilterComboBox<>();
columnBox.setPreferredSize(new Dimension(40, 20)); columnBox.setPreferredSize(new Dimension(40, 20));
columnBox.addItemListener(columnChange); columnBox.addItemListener(columnChange);
@ -113,12 +103,10 @@ public class MapDefiAreaNamePane extends BasicBeanPane<String> implements Abstrc
String columnName = Utils.objectToString(columnBox.getSelectedItem()); String columnName = Utils.objectToString(columnBox.getSelectedItem());
TableDataWrapper tableDataWrappe = tableDataBox.getTableDataWrapper(); TableDataWrapper tableDataWrappe = tableDataBox.getTableDataWrapper();
TableDataSource source = DesignTableDataManager.getEditingTableDataSource();
if (tableDataWrappe == null || source == null) {
return;
}
initNames = DataCoreUtils.getColValuesInData(source, tableDataWrappe.getTableDataName(), columnName); List<String> list = MapCustomPane.getColValuesInData(tableDataWrappe, columnName);
initNames = list.toArray(initNames);
if (tableEditorModel != null) { if (tableEditorModel != null) {
tableEditorModel.stopCellEditing();// 只是用来刷新列表的combox tableEditorModel.stopCellEditing();// 只是用来刷新列表的combox

10
designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -129,7 +129,9 @@ public class ChartTypePane extends AbstractChartAttrPane{
} }
public void updateBean(Chart chart) { public void updateBean(Chart chart) {
int lastSelectIndex = editPane.getSelectedChartIndex(chart);
Plot oldPlot = chart.getPlot();
String lastPlotID = oldPlot == null ? StringUtils.EMPTY : oldPlot.getPlotID();
try{ try{
Chart newDefaultChart = (Chart)((AbstractChartTypePane)getSelectedPane()).getDefaultChart().clone(); Chart newDefaultChart = (Chart)((AbstractChartTypePane)getSelectedPane()).getDefaultChart().clone();
@ -159,7 +161,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && lastSelectIndex != jcb.getSelectedIndex())){ if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){
editPane.reLayout(chart); editPane.reLayout(chart);
} }
} }
@ -188,7 +190,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void reactor(ChartCollection collection){ public void reactor(ChartCollection collection){
//重构需要重构下拉框选项和cardNames //重构需要重构下拉框选项和cardNames
Chart chart = collection.getSelectedChart(); Chart chart = collection.getSelectedChart();
String chartID = chart.getChartID(); String chartID = chart.getPriority();
if (collection.getState() == SwitchState.DEFAULT){ if (collection.getState() == SwitchState.DEFAULT){
chartID = StringUtils.EMPTY; chartID = StringUtils.EMPTY;
} }
@ -197,7 +199,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
//重构下拉框选项 //重构下拉框选项
reactorComboBox(); reactorComboBox();
//重新选择选中的下拉项 //重新选择选中的下拉项
chartID = chart.getChartID(); chartID = chart.getPriority();
String plotID = chart.getPlot().getPlotID(); String plotID = chart.getPlot().getPlotID();
Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID); Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID);
jcb.setSelectedItem(item); jcb.setSelectedItem(item);

2
designer_form/src/com/fr/design/designer/beans/models/AddingModel.java

@ -124,7 +124,7 @@ public class AddingModel {
Rectangle rect = ComponentUtils.getRelativeBounds(container); Rectangle rect = ComponentUtils.getRelativeBounds(container);
if(!ComparatorUtils.equals(container.getOuterLayout(), container.getBackupParent())){ if(!ComparatorUtils.equals(container.getOuterLayout(), container.getBackupParent())){
return added = container.getLayoutAdapter().addBean(creator,x,y); return added = container.getLayoutAdapter().addBean(creator, x + designer.getArea().getHorizontalValue(), y + designer.getArea().getVerticalValue());
} }
return added = container.getLayoutAdapter().addBean(creator, return added = container.getLayoutAdapter().addBean(creator,
x + designer.getArea().getHorizontalValue() - rect.x, x + designer.getArea().getHorizontalValue() - rect.x,

7
designer_form/src/com/fr/design/designer/creator/XChartEditor.java

@ -2,26 +2,21 @@ package com.fr.design.designer.creator;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import javax.swing.*; import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.*;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.events.DesignerEditor;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.BaseChartEditor; import com.fr.form.ui.BaseChartEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
@ -237,7 +232,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
editor.setLayout(null); editor.setLayout(null);
editor.setOpaque(false); editor.setOpaque(false);
coverPanel = new CoverReportPane(); coverPanel = new CoverPane();
coverPanel.setPreferredSize(this.getPreferredSize()); coverPanel.setPreferredSize(this.getPreferredSize());
coverPanel.setBounds(this.getBounds()); coverPanel.setBounds(this.getBounds());

13
designer_form/src/com/fr/design/designer/creator/XElementCase.java

@ -9,10 +9,7 @@ import com.fr.design.fun.FormElementCaseEditorProvider;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider; import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.*;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.BooleanEditor; import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
@ -201,6 +198,13 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
editor.repaint(); editor.repaint();
} }
/**
* 销毁帮助提示框
*/
public void destroyHelpDialog(){
coverPanel.destroyHelpDialog();
}
public JComponent getCoverPane(){ public JComponent getCoverPane(){
return coverPanel; return coverPanel;
} }
@ -280,6 +284,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
if (this.isHelpBtnOnFocus()) { if (this.isHelpBtnOnFocus()) {
coverPanel.setMsgDisplay(e); coverPanel.setMsgDisplay(e);
}else { }else {
coverPanel.destroyHelpDialog();
switchTab(e,editingMouseListener); switchTab(e,editingMouseListener);
} }
} }

3
designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java

@ -116,6 +116,9 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
moveComponents2FitLayout(xfl); moveComponents2FitLayout(xfl);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreator(xfl); formDesigner.getSelectionModel().setSelectedCreator(xfl);
xfl.convert();
LayoutUtils.layoutContainer(xfl);
xfl.adjustCreatorsWhileSlide(xfl.getContainerPercent() - 1.0);
for (int i = 0; i < components.length; i++) { for (int i = 0; i < components.length; i++) {
Component comp = xfl.getComponent(i); Component comp = xfl.getComponent(i);

4
designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java

@ -7,8 +7,8 @@ import com.fr.form.ui.container.WBodyLayoutType;
*/ */
public class FRLayoutTypeItems implements ItemProvider{ public class FRLayoutTypeItems implements ItemProvider{
public static final Item[] ITEMS = new Item[] { public static final Item[] ITEMS = new Item[] {
new Item(WBodyLayoutType.FIT.description(), WBodyLayoutType.FIT.getTypeValue()), new Item(WBodyLayoutType.FIT.description(), WBodyLayoutType.FIT.getTypeValue())/*,
new Item(WBodyLayoutType.ABSOLUTE.description(), WBodyLayoutType.ABSOLUTE.getTypeValue())}; new Item(WBodyLayoutType.ABSOLUTE.description(), WBodyLayoutType.ABSOLUTE.getTypeValue())*/};
public Item[] getItems() { public Item[] getItems() {
return ITEMS; return ITEMS;

11
designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java

@ -114,8 +114,6 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
if (!BaseUtils.isAuthorityEditing()) { if (!BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().replaceUpPane( EastRegionContainerPane.getInstance().replaceUpPane(
WidgetPropertyPane.getInstance(this)); WidgetPropertyPane.getInstance(this));
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this));
refreshParameter();
} else { } else {
showAuthorityEditPane(); showAuthorityEditPane();
} }
@ -232,7 +230,14 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
} }
ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean(
p.getParameterArray() == null ? new Parameter[0] : p.getParameterArray()); p.getParameterArray() == null ? new Parameter[0] : p.getParameterArray());
ParameterPropertyPane.getInstance().repaintContainer();
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this));
if (p.getParameterArray().length == 0) {
EastRegionContainerPane.getInstance().setParameterHeight(30);
} else {
//参数面板独立后只能这边触发调整高度,根据参数个数调整换行,计算高度
EastRegionContainerPane.getInstance().setParameterHeight((p.getParameterArray().length + 5) / 6 * 30 + 80);
}
} }
/** /**

2
designer_form/src/com/fr/design/gui/core/FormWidgetOption.java

@ -1 +1 @@
package com.fr.design.gui.core; import javax.swing.Icon; import com.fr.base.BaseUtils; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WVerticalBoxLayout; import com.fr.general.Inter; /** * Author : Shockway * Date: 13-6-17 * Time: 上午10:40 */ public class FormWidgetOption extends WidgetOption { /** * 返回名字 * @return 名字 */ @Override public String optionName() { return null; } /** * 返回图标 * @return 图标 */ @Override public Icon optionIcon() { return null; } /** * 组件类 * @return 类 */ @Override public Class<? extends Widget> widgetClass() { return null; } /** * 返回组件 * @return 控件 */ @Override public Widget createWidget() { return null; } /* * 表单容器 */ public static WidgetOption[] getFormContainerInstance() { return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER, CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER }; } /** * 表单工具栏上的布局 * @return 控件 */ public static WidgetOption[] getFormLayoutInstance() { return new WidgetOption[] {CARDLAYOUTCONTAINER, ABSOLUTELAYOUTCONTAINER}; } public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Absolute"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute_new.png"), WAbsoluteLayout.class); public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"), WBorderLayout.class); public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Tab"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"), WCardLayout.class); public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"), WHorizontalBoxLayout.class); public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WVerticalBoxLayout.class); public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WFitLayout.class); public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"), WParameterLayout.class); public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"), ElementCaseEditor.class); } package com.fr.design.gui.core; import javax.swing.Icon; import com.fr.base.BaseUtils; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WVerticalBoxLayout; import com.fr.general.Inter; /** * Author : Shockway * Date: 13-6-17 * Time: 上午10:40 */ public class FormWidgetOption extends WidgetOption { /** * 返回名字 * @return 名字 */ @Override public String optionName() { return null; } /** * 返回图标 * @return 图标 */ @Override public Icon optionIcon() { return null; } /** * 组件类 * @return 类 */ @Override public Class<? extends Widget> widgetClass() { return null; } /** * 返回组件 * @return 控件 */ @Override public Widget createWidget() { return null; } /* * 表单容器 */ public static WidgetOption[] getFormContainerInstance() { return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER, CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER }; } /** * 表单工具栏上的布局 * @return 控件 */ public static WidgetOption[] getFormLayoutInstance() { return new WidgetOption[] {CARDLAYOUTCONTAINER/*, ABSOLUTELAYOUTCONTAINER*/}; } public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Absolute"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute_new.png"), WAbsoluteLayout.class); public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"), WBorderLayout.class); public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Tab"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"), WCardLayout.class); public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"), WHorizontalBoxLayout.class); public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WVerticalBoxLayout.class); public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WFitLayout.class); public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"), WParameterLayout.class); public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"), ElementCaseEditor.class); }

97
designer_form/src/com/fr/design/mainframe/CoverPane.java

@ -0,0 +1,97 @@
package com.fr.design.mainframe;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created with IntelliJ IDEA.
* User: zx
* Date: 14-7-24
* Time: 上午9:09
*/
public class CoverPane extends JPanel {
private UIButton editButton;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F);
public CoverPane() {
setLayout(getCoverLayout());
setBackground(null);
setOpaque(false);
editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)) {
@Override
public Dimension getPreferredSize() {
return new Dimension(60, 24);
}
};
editButton.setBorderPainted(false);
editButton.setExtraPainted(false);
editButton.setBackground(new Color(176, 196, 222));
add(editButton);
}
public AlphaComposite getComposite() {
return composite;
}
public void setComposite(AlphaComposite composite) {
this.composite = composite;
}
public UIButton getEditButton() {
return editButton;
}
public void setEditButton(UIButton editButton) {
this.editButton = editButton;
}
protected LayoutManager getCoverLayout() {
return new LayoutManager() {
@Override
public void removeLayoutComponent(Component comp) {
}
@Override
public Dimension preferredLayoutSize(Container parent) {
return parent.getPreferredSize();
}
@Override
public Dimension minimumLayoutSize(Container parent) {
return null;
}
@Override
public void layoutContainer(Container parent) {
int width = parent.getParent().getWidth();
int height = parent.getParent().getHeight();
int preferWidth = editButton.getPreferredSize().width;
int preferHeight = editButton.getPreferredSize().height;
editButton.setBounds((width - preferWidth) / 2, (height - preferHeight) / 2, preferWidth, preferHeight);
}
@Override
public void addLayoutComponent(String name, Component comp) {
}
};
}
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite();
g2d.setComposite(composite);
g2d.setColor(Color.white);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setComposite(oldComposite);
super.paint(g);
}
}

52
designer_form/src/com/fr/design/mainframe/CoverReportPane.java

@ -8,7 +8,6 @@ import com.fr.design.icon.IconPathConstants;
import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareConstants;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -16,15 +15,13 @@ import java.awt.*;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
/** /**
* Created with IntelliJ IDEA. * 报表块的封面如果后面所有的组件都有帮助信息的话就抽接口吧
* User: zx * Coder: zack
* Date: 14-7-24 * Date: 2016/11/2
* Time: 上午9:09 * Time: 11:32
*/ */
public class CoverReportPane extends JPanel { public class CoverReportPane extends CoverPane implements HelpDialogHandler{
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
private UIButton editButton;
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH);
private JComponent controlButton = new JComponent() { private JComponent controlButton = new JComponent() {
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
g.setColor(UIConstants.NORMAL_BACKGROUND); g.setColor(UIConstants.NORMAL_BACKGROUND);
@ -39,28 +36,13 @@ public class CoverReportPane extends JPanel {
private ElementCaseHelpDialog helpDialog = null; private ElementCaseHelpDialog helpDialog = null;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F);
public CoverReportPane() { public CoverReportPane() {
this(StringUtils.EMPTY); this(StringUtils.EMPTY);
} }
public CoverReportPane(String helpMsg) { public CoverReportPane(String helpMsg) {
super();
this.helpMsg = helpMsg; this.helpMsg = helpMsg;
setLayout(getCoverLayout());
setBackground(null);
setOpaque(false);
editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)) {
@Override
public Dimension getPreferredSize() {
return new Dimension(60, 24);
}
};
editButton.setBorderPainted(false);
editButton.setExtraPainted(false);
editButton.setBackground(new Color(176, 196, 222));
add(editButton);
add(controlButton); add(controlButton);
if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) { if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) {
WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() { WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() {
@ -98,6 +80,7 @@ public class CoverReportPane extends JPanel {
int rY = 165 + e.getY();//165是设计器最上面几个面板的高度 int rY = 165 + e.getY();//165是设计器最上面几个面板的高度
helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY); helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY);
helpDialog.showWindow(); helpDialog.showWindow();
HelpDialogManager.getInstance().setPane(this);
} else { } else {
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
controlButton.repaint(); controlButton.repaint();
@ -125,6 +108,7 @@ public class CoverReportPane extends JPanel {
@Override @Override
public void layoutContainer(Container parent) { public void layoutContainer(Container parent) {
UIButton editButton = getEditButton();
int width = parent.getParent().getWidth(); int width = parent.getParent().getWidth();
int height = parent.getParent().getHeight(); int height = parent.getParent().getHeight();
int preferWidth = editButton.getPreferredSize().width; int preferWidth = editButton.getPreferredSize().width;
@ -139,17 +123,6 @@ public class CoverReportPane extends JPanel {
}; };
} }
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite();
g2d.setComposite(composite);
g2d.setColor(Color.white);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setComposite(oldComposite);
super.paint(g);
}
public void destroyHelpDialog() { public void destroyHelpDialog() {
if (helpDialog != null) { if (helpDialog != null) {
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
@ -159,4 +132,11 @@ public class CoverReportPane extends JPanel {
} }
} }
@Override
public void setVisible(boolean aFlag) {
super.setVisible(aFlag);
if (aFlag) {
HelpDialogManager.getInstance().setPane(this);
}
}
} }

17
designer_form/src/com/fr/design/mainframe/EditingMouseListener.java

@ -256,7 +256,7 @@ public class EditingMouseListener extends MouseInputAdapter {
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
XCreator component = designer.getComponentAt(e); XCreator component = designer.getComponentAt(e);
setCoverPaneNotDisplay(); setCoverPaneNotDisplay(e, false);
if(processTopLayoutMouseMove(component, e)){ if(processTopLayoutMouseMove(component, e)){
return; return;
@ -320,8 +320,17 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.repaint(); designer.repaint();
} }
private void setCoverPaneNotDisplay(){ private void setCoverPaneNotDisplay(MouseEvent e, boolean isLinkedHelpDialog) {
if (xElementCase != null){ if (xElementCase != null) {
int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue();
int y = getParentPositionY(xElementCase, 0) - designer.getArea().getVerticalValue();
Rectangle rect = new Rectangle(x, y, xElementCase.getWidth(), xElementCase.getHeight());
if (rect.contains(e.getPoint())) {
return;
}
if(isLinkedHelpDialog){
xElementCase.destroyHelpDialog();
}
xElementCase.displayCoverPane(false); xElementCase.displayCoverPane(false);
} }
if (xChartEditor != null){ if (xChartEditor != null){
@ -525,7 +534,7 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getDefaultCursor()); designer.setCursor(Cursor.getDefaultCursor());
} }
setCoverPaneNotDisplay(); setCoverPaneNotDisplay(e, true);
cancelPromptWidgetForbidEnter(); cancelPromptWidgetForbidEnter();
} }

2
designer_form/src/com/fr/design/mainframe/FormArea.java

@ -341,8 +341,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
if (layout.getParent() != null) { if (layout.getParent() != null) {
int paraHeight = designer.getParaHeight(); int paraHeight = designer.getParaHeight();
if (needCalculateParaHeight && paraHeight > 0) { if (needCalculateParaHeight && paraHeight > 0) {
// 调整参数界面的大小
paraHeight += (int) (paraHeight*percent) ;
designer.setParaHeight(paraHeight); designer.setParaHeight(paraHeight);
XWBorderLayout parent = (XWBorderLayout) layout.getParent(); XWBorderLayout parent = (XWBorderLayout) layout.getParent();
parent.toData().setNorthSize(paraHeight); parent.toData().setNorthSize(paraHeight);

15
designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java

@ -1,40 +1,27 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout; import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.actions.community.NeedAction;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.mainframe.widget.UITreeComboBox; import com.fr.design.mainframe.widget.UITreeComboBox;
import com.fr.design.parameter.HierarchyTreePane; import com.fr.design.parameter.HierarchyTreePane;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.design.designer.treeview.ComponentTreeModel;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import javax.swing.JComponent;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import com.fr.design.gui.itextfield.UITextField;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.tree.TreePath;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;

62
designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -1,47 +1,35 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.filechooser.FileNameExtensionFilter;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.PluginWebBridge; import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.ShopDialog; import com.fr.design.extra.ShopDialog;
import com.fr.design.extra.WebManagerPaneFactory; import com.fr.design.extra.WebManagerPaneFactory;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIPreviewButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.itoolbar.UILargeToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareConstants;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.ElCaseBindInfo;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import java.io.IOException;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
* User: zx * User: zx
@ -60,6 +48,7 @@ public class FormWidgetDetailPane extends FormDockView{
private UIButton deleteButton; private UIButton deleteButton;
private static final int OFFSET_X = 140; private static final int OFFSET_X = 140;
private static final int OFFSET_Y = 26; private static final int OFFSET_Y = 26;
private SwingWorker sw;
public static FormWidgetDetailPane getInstance() { public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) { if (HOLDER.singleton == null) {
@ -105,7 +94,19 @@ public class FormWidgetDetailPane extends FormDockView{
reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
reuWidgetPanel.setBorder(null); reuWidgetPanel.setBorder(null);
if (elCaseBindInfoList == null) { if (elCaseBindInfoList == null) {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); elCaseBindInfoList = new ElCaseBindInfo[0];
if (sw != null) {
sw.cancel(true);
}
sw = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
refreshDownPanel(false);
return null;
}
};
sw.execute();
} }
initReuWidgetPanel(); initReuWidgetPanel();
createRefreshButton(); createRefreshButton();
@ -178,8 +179,19 @@ public class FormWidgetDetailPane extends FormDockView{
refreshButton.addActionListener(new ActionListener() { refreshButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
refreshShareMoudule(); if (sw != null) {
refreshDownPanel(false); sw.cancel(true);
}
sw = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
ShareLoader.getLoader().refreshModule();
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
refreshDownPanel(false);
return null;
}
};
sw.execute();
} }
}); });

2
sonar-project.properties

@ -3,7 +3,7 @@ sonar.projectKey=finereport.design
# this is the name displayed in the SonarQube UI # this is the name displayed in the SonarQube UI
sonar.projectName=finereport.design sonar.projectName=finereport.design
sonar.projectVersion=1.0 sonar.projectVersion=1.0
sonar.branch=master sonar.branch=dev
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set. # Since SonarQube 4.2, this property is optional if sonar.modules is set.

Loading…
Cancel
Save