xiaoxia 8 years ago
parent
commit
6371256efa
  1. 1
      build.dev.gradle
  2. 22
      designer/src/com/fr/design/mainframe/SheetNameTabPane.java
  3. 4
      designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java
  4. 4
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  5. 14
      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. 7
      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. 187
      designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java
  16. 12
      designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java
  17. 65
      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. 20
      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. 2
      designer_form/src/com/fr/design/gui/core/FormWidgetOption.java
  35. 97
      designer_form/src/com/fr/design/mainframe/CoverPane.java
  36. 54
      designer_form/src/com/fr/design/mainframe/CoverReportPane.java
  37. 17
      designer_form/src/com/fr/design/mainframe/EditingMouseListener.java
  38. 2
      designer_form/src/com/fr/design/mainframe/FormArea.java
  39. 15
      designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java
  40. 62
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  41. 2
      sonar-project.properties

1
build.dev.gradle

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

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

@ -273,7 +273,17 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
leftButton.setEnabled(buttonEnabled);
rightButton.setEnabled(buttonEnabled);
}
/**
* 抽出来方便OEM
* @return
*/
public Icon getAddWorkSheet(){
return ADD_WORK_SHEET;
}
public Icon getWorkSheetIcon(){
return WORK_SHEET_ICON;
}
@Override
/**
* 画Tab
@ -290,7 +300,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
double textHeight = this.getSize().getHeight() - 1;
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();// 最大宽度
paintBackgroundAndLine(g2d, textHeight, maxWidth, charWidth, textAscent);
checkButton(showCount < widthArray.length);
@ -321,7 +331,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName();
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);
if (i == selectedIndex) {
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){
ADD_WORK_SHEET.paintIcon(this, g2d, iconLocation, 3);
ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation + ADD_WORK_SHEET.getIconWidth() + ICON_SEP_DISTANCE, 3);
getAddWorkSheet().paintIcon(this, g2d, iconLocation, 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();
int width = widthArray[i];
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();// 最大宽度
if (i < widthArray.length - 1 && textX + widthArray[i + 1] + 1 > maxWidth) {
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_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 int TIME_OUT = 10000;
@ -284,12 +283,13 @@ public class BBSLoginDialog extends UIDialog {
FRLogger.getLogger().error(e.getMessage());
}
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.login") + "&username=" + username + "&password=" + password;
String loginSuccessFlag = SiteCenter.getInstance().acquireUrlByKind("bbs");
HttpClient client = new HttpClient(url);
client.setTimeout(TIME_OUT);
if (client.getResponseCodeNoException() == HttpURLConnection.HTTP_OK) {
try {
String res = client.getResponseText(EncodeConstants.ENCODING_GBK);
if (res.contains(LOGIN_SUCCESS_FLAG)) {
if (res.contains(loginSuccessFlag)) {
return true;
}
} catch (Exception e) {

4
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);
UserLoginContext.addLoginContextListener(new LoginContextListener() {
@ -310,4 +310,4 @@ public class UserInfoLabel extends UILabel{
}
}
};
}
}

14
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.ConfigManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.core.WidgetOption;
@ -22,10 +23,12 @@ import com.fr.stable.Constants;
import com.fr.web.attr.ReportWebAttr;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class WriteToolBarPane extends AbstractEditToolBarPane {
@ -103,12 +106,12 @@ public class WriteToolBarPane extends AbstractEditToolBarPane {
toolBarManager.setToolBarLocation(Location.createTopEmbedLocation());
this.toolBarManagers = new ToolBarManager[]{toolBarManager};
}
private ActionListener editBtnListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
final DragToolBarPane dragToolbarPane = new DragToolBarPane();
dragToolbarPane.setDefaultToolBar(ToolBarManager.createDefaultWriteToolBar(), ReportWebWidgetConstants.getWriteToolBarInstance());
dragToolbarPane.setDefaultToolBar(ToolBarManager.createDefaultWriteToolBar(), getToolBarInstance());
dragToolbarPane.populateBean(WriteToolBarPane.this.toolBarManagers);
BasicDialog toobarDialog = dragToolbarPane.showWindow(SwingUtilities.getWindowAncestor(WriteToolBarPane.this));
toobarDialog.addDialogActionListener(new DialogActionAdapter() {
@ -130,7 +133,12 @@ public class WriteToolBarPane extends AbstractEditToolBarPane {
@Override
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

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

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

2
designer_base/build.dev.gradle

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

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

@ -20,6 +20,7 @@ import com.fr.stable.xml.*;
import javax.swing.*;
import javax.swing.SwingWorker.StateValue;
import java.awt.*;
import java.io.*;
import java.util.*;
@ -28,6 +29,7 @@ import java.util.Map.Entry;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.SimpleFormatter;
/**
@ -226,7 +228,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
StableUtils.makesureFileExist(new java.io.File(fileName));
}
Handler handler = new FileHandler(fileName, true);
handler.setFormatter(new SimpleFormatter());
handler.setFormatter(new FRLogFormatter());
FRContext.getLogger().addLogHandler(handler);
} catch (SecurityException e) {
FRContext.getLogger().error(e.getMessage(), e);
@ -235,7 +238,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
}
private File getDesignerEnvFile() {
File envFile = getEnvFile();
// james:FineReportEnv.xml文件没有必要做兼容,里面保存的主要是界面布局以及设计器激活的信息

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 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 {
PluginDependence dependence = plugin.getDependence();
if (dependence == null){
if (dependence == null) {
return;
}
@ -138,14 +139,14 @@ public class PluginHelper {
String currentID = dependence.getCurrentPluginID();
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);
if (!dependenceUnit.checkFileEnv()){
if (!dependenceUnit.checkFileEnv()) {
needInstallDependence.add(dependenceUnit);
}
}
if (needInstallDependence.isEmpty()){
if (needInstallDependence.isEmpty()) {
return;
}
@ -155,14 +156,16 @@ public class PluginHelper {
/**
* 构造一个下载UI
*
* @param currentID
* @param list
* @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);
ui.installOnline();
}
/**
* 从选中的压缩文件中安装插件
*

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

@ -31,30 +31,30 @@ public class PluginsReaderFromStore {
* @return 插件信息
*/
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 {
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 {
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);
}
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()]);
}
@ -65,35 +65,33 @@ public class PluginsReaderFromStore {
* @return 插件信息
*/
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 {
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(SiteCenter.getInstance().acquireUrlByKind("plugin.update"), para);
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 {
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);
}
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()]);
}

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

@ -1,5 +1,6 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
@ -26,8 +27,14 @@ public class GetPluginCategoriesExecutor implements Executor {
@Override
public void run(Process<String> process) {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.category"));
result = httpClient.getResponseText();
String url = SiteCenter.getInstance().acquireUrlByKind("plugin.category");
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;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.SiteCenter;
@ -38,21 +39,27 @@ public class GetPluginFromStoreExecutor implements Executor {
@Override
public void run(Process<String> process) {
StringBuilder url = new StringBuilder(SiteCenter.getInstance().acquireUrlByKind("plugin.plist"));
if (StringUtils.isNotBlank(category)) {
url.append("&cid=").append(category.split("-")[1]);
}
if (StringUtils.isNotBlank(seller)) {
url.append("&seller=").append(seller.split("-")[1]);
}
if (StringUtils.isNotBlank(fee)) {
url.append("&fee=").append(fee.split("-")[1]);
}
try {
HttpClient httpClient = new HttpClient(url.toString());
result = httpClient.getResponseText();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("plugin.plist");
if (StringUtils.isNotBlank(plistUrl)) {
StringBuilder url = new StringBuilder();
url.append(plistUrl);
if (StringUtils.isNotBlank(category)) {
url.append("&cid=").append(category.split("-")[1]);
}
if (StringUtils.isNotBlank(seller)) {
url.append("&seller=").append(seller.split("-")[1]);
}
if (StringUtils.isNotBlank(fee)) {
url.append("&fee=").append(fee.split("-")[1]);
}
try {
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() {
return totalSize == -1 ? "NAN" : totalSize / Math.pow(10, 6) + "";
private String showFileLength(){
double len = totalSize / Math.pow(10, 6);
String lenStr = String.format("%.2f", len);
return totalSize == -1 ? "NAN" : lenStr;
}
}

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

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

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

@ -115,7 +115,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth());
private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight());
private WindowAdapter windowAdapter = new WindowAdapter() {
public void windowOpened(WindowEvent e) {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite();
@ -166,26 +166,50 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
protected DesktopCardPane getCenterTemplateCardPane() {
return centerTemplateCardPane;
}
/**
* 初始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);
}
/**
* Constructor.
* @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) {
setName(DESIGNER_FRAME_NAME);
this.ad = ad;
this.initTitleIcon();
this.setTitle();// james:因为有默认的了
// set this to context.
DesignerContext.setDesignerFrame(this);
// the content pane
basePane.setLayout(new BorderLayout());
menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH);
menuPane.add(initNorthEastPane(ad), BorderLayout.EAST);
toolbarPane = new JPanel() {
public Dimension 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(toolbarPane, BorderLayout.NORTH);
basePane.add(menuPane, BorderLayout.NORTH);
basePane.add(centerPane, BorderLayout.CENTER);
laoyoutWestPane();
basePane.add(EastRegionContainerPane.getInstance(), BorderLayout.EAST);
@ -222,7 +246,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
// 调整Window大小
modWindowBounds();
this.resetToolkitByPlus(null);
// p:检查所有按钮的可见性和是否可以编辑性.
checkToolbarMenuEnable();
@ -243,6 +267,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_MOVE, new FileDropTargetListener(), true));
closeMode = UIConstants.CLOSE_OF_AUTHORITY;
initMenuPane();
}
public void initTitleIcon() {
@ -256,22 +281,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png"));
}
}
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){
for(WindowListener listener : listeners){

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

2
designer_chart/build.dev.gradle

@ -4,7 +4,7 @@ tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
//jdk版本
sourceCompatibility=1.8
sourceCompatibility=1.7
//jar包的版本
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.file.XMLFileManager;
import com.fr.form.ui.ChartEditor;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.*;
import com.fr.plugin.PluginCollector;
import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.PluginMessage;
@ -52,12 +49,12 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
private static ChartTypeInterfaceManager classManager = null;
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() {
if (classManager == null) {
classManager = new ChartTypeInterfaceManager();
chartTypeInterfaces.clear();
classManager.readDefault();
}
return classManager;
}
@ -74,9 +71,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
GeneralContext.addPluginReadListener(new PluginReadListener() {
@Override
public void success() {
if (chartTypeInterfaces.size() == 0) {
ChartTypeInterfaceManager.getInstance().readDefault();
}
//重新注册designModuleFactory
DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption());
}
@ -85,8 +79,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
public static WidgetOption[] initWidgetOption(){
ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames();
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
final ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames();
final ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
//异步加载
new Thread(new Runnable() {
@ -96,7 +90,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
}
}).start();
return child;
}
@ -132,6 +125,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
}
private static void readDefault() {
if (chartTypeInterfaces.containsKey(ChartTypeManager.CHART_PRIORITY)){
return;
}
LinkedHashMap<String, IndependentChartUIProvider> chartUIList = new LinkedHashMap<String, IndependentChartUIProvider>();
chartUIList.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface());
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.FUNNEL_CHART, new FunnelIndependentChartInterface());
chartTypeInterfaces.put(DEFAULT_CHART_ID, chartUIList);
chartTypeInterfaces.put(ChartTypeManager.CHART_PRIORITY, chartUIList);
}
public String getIconPath(String plotID) {
@ -159,8 +155,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey();
String imagePath = getIconPath(chartID, plotID);
String priority = (String) entry.getKey();
String imagePath = getIconPath(priority, plotID);
if (!StringUtils.isEmpty(imagePath)) {
return imagePath;
}
@ -169,23 +165,23 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
return StringUtils.EMPTY;
}
private String getIconPath(String chartID, String plotID) {
if (chartTypeInterfaces.get(chartID) != null && chartTypeInterfaces.get(chartID).get(plotID) != null) {
return chartTypeInterfaces.get(chartID).get(plotID).getIconPath();
private String getIconPath(String priority, String plotID) {
if (chartTypeInterfaces.get(priority) != null && chartTypeInterfaces.get(priority).get(plotID) != null) {
return chartTypeInterfaces.get(priority).get(plotID).getIconPath();
}else {
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.containsKey(chartID)){
if (!chartTypeInterfaces.containsKey(priority)){
//新建一个具体图表列表
LinkedHashMap<String, IndependentChartUIProvider> chartUIList = new LinkedHashMap<String, IndependentChartUIProvider>();
chartUIList.put(plotID, provider);
chartTypeInterfaces.put(chartID, chartUIList);
chartTypeInterfaces.put(priority, chartUIList);
}else {
LinkedHashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(chartID);
LinkedHashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
if (!chartUIList.containsKey(plotID)) {
chartUIList.put(plotID, provider);
}
@ -199,7 +195,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
* @param className 类名
* @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)) {
try {
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)) {
PluginMessage.remindUpdate(className);
} else {
ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, chartID, plotID);
ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, priority, plotID);
}
} catch (ClassNotFoundException e) {
FRLogger.getLogger().error("class not found:" + e.getMessage());
@ -235,8 +231,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey();
Iterator chartUIIterator = chartTypeInterfaces.get(chartID).entrySet().iterator();
String priority = (String) entry.getKey();
Iterator chartUIIterator = chartTypeInterfaces.get(priority).entrySet().iterator();
while (chartUIIterator.hasNext()) {
Map.Entry chartUIEntry = (Map.Entry) chartUIIterator.next();
IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue();
@ -245,13 +241,13 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
}
}
public String[] getTitle4PopupWindow(String chartID){
if (chartID.isEmpty()){
public String[] getTitle4PopupWindow(String priority){
if (priority.isEmpty()){
return getTitle4PopupWindow();
}
String[] names = new String[getChartSize(chartID)];
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID)){
HashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(chartID);
String[] names = new String[getChartSize(priority)];
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)){
HashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
Iterator iterator = chartUIList.entrySet().iterator();
int i = 0;
while (iterator.hasNext()){
@ -266,13 +262,13 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
/**
* 获取指定图表的标题
* @param chartID
* @param priority
* @return
*/
public String getTitle4PopupWindow(String chartID, String plotID){
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID) && chartTypeInterfaces.get(chartID).containsKey(plotID)){
HashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(chartID);
IndependentChartUIProvider provider = chartTypeInterfaces.get(chartID).get(plotID);
public String getTitle4PopupWindow(String priority, String plotID){
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)){
HashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID);
return provider.getPlotTypePane().title4PopupWindow();
}
@ -280,59 +276,67 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
}
private String[] getTitle4PopupWindow(){
List<Integer> priorityList = new ArrayList<Integer>();
int size = 0;
if (chartTypeInterfaces != null){
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey();
size += getChartSize(chartID);
String priority = (String) entry.getKey();
priorityList.add(Integer.valueOf(priority));
size += getChartSize(priority);
}
String[] names = new String[size];
priorityList = ChartTypeManager.orderInPriority(priorityList);
int index = 0;
Iterator i = chartTypeInterfaces.entrySet().iterator();
while (i.hasNext()){
Map.Entry entry = (Map.Entry) i.next();
String chartID = (String) entry.getKey();
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();
}
for (int i = 0; i < priorityList.size(); i++){
String priority = String.valueOf(priorityList.get(i));
Iterator chartUI = chartTypeInterfaces.get(priority).entrySet().iterator();
index = fetchNames(chartUI, names, index);
}
return names;
}
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) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey();
if (plotInChart(plotID, chartID)) {
return getChartDataPane(chartID, plotID, listener);
String priority = (String) entry.getKey();
if (plotInChart(plotID, priority)) {
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) {
return chartTypeInterfaces.get(chartID).get(plotID).getChartDataPane(listener);
private ChartDataPane getChartDataPane(String priority, String plotID, AttributeChangeListener listener) {
return chartTypeInterfaces.get(priority).get(plotID).getChartDataPane(listener);
}
/**
* 获取对应ID的图表数量
* @param chartID
* @param key
* @return
*/
private int getChartSize(String chartID){
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID)){
return chartTypeInterfaces.get(chartID).size();
private int getChartSize(String key){
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(key)){
return chartTypeInterfaces.get(key).size();
}
return 0;
}
@ -341,32 +345,32 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey();
if (plotInChart(plotID, chartID)) {
return getAttrPaneArray(chartID, plotID, listener);
String priority = (String) entry.getKey();
if (plotInChart(plotID, priority)) {
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) {
return chartTypeInterfaces.get(chartID).get(plotID).getAttrPaneArray(listener);
private AbstractChartAttrPane[] getAttrPaneArray(String priority, String plotID, AttributeChangeListener listener) {
return chartTypeInterfaces.get(priority).get(plotID).getAttrPaneArray(listener);
}
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), chartID)) {
return getTableDataSourcePane(chartID, plot, parent);
String priority = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), priority)) {
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) {
return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getTableDataSourcePane(plot, parent);
private AbstractTableDataContentPane getTableDataSourcePane(String priority, Plot plot, ChartDataPane 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();
while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey();
String priority = (String) entry.getKey();
String plotID = plot.getPlotID();
if (plotInChart(plotID, chartID)) {
return getReportDataSourcePane(chartID, plot, parent);
if (plotInChart(plotID, priority)) {
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
&& chartTypeInterfaces.containsKey(chartID)
&& chartTypeInterfaces.get(chartID).containsKey(plotID);
&& chartTypeInterfaces.containsKey(priority)
&& chartTypeInterfaces.get(priority).containsKey(plotID);
}
private AbstractReportDataContentPane getReportDataSourcePane(String chartID, Plot plot, ChartDataPane parent) {
return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getReportDataSourcePane(plot, parent);
private AbstractReportDataContentPane getReportDataSourcePane(String priority, Plot plot, ChartDataPane 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();
while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), chartID)) {
return getPlotConditionPane(chartID, plot);
String priority = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), priority)) {
return getPlotConditionPane(priority, plot);
}
}
return getPlotConditionPane(DEFAULT_CHART_ID, plot);
return getPlotConditionPane(ChartTypeManager.CHART_PRIORITY, plot);
}
private ConditionAttributesPane getPlotConditionPane(String chartID, Plot plot) {
return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getPlotConditionPane(plot);
private ConditionAttributesPane getPlotConditionPane(String priority, Plot 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();
while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), chartID)) {
return getPlotSeriesPane(chartID, parent, plot);
String priority = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), priority)) {
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) {
return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getPlotSeriesPane(parent, plot);
private BasicBeanPane<Plot> getPlotSeriesPane(String priority, ChartStylePane parent, Plot 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();
while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next();
String chartID = (String) entry.getKey();
if (chartTypeInterfaces.get(chartID).containsKey(plotID)){
return isUseDefaultPane(chartID, plotID);
String priority = (String) entry.getKey();
if (chartTypeInterfaces.get(priority).containsKey(plotID)){
return isUseDefaultPane(priority, plotID);
}
}
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)) {
return chartTypeInterfaces.get(chartID).get(plotID).isUseDefaultPane();
if (chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) {
return chartTypeInterfaces.get(priority).get(plotID).isUseDefaultPane();
}
return true;
@ -467,7 +471,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
extraChartDesignInterfaceList.add(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);
}
}
}

20
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.BaseChartCollection;
import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Chart;
@ -31,7 +32,7 @@ import java.util.List;
* 类说明: 事件说明: 工具栏编辑--> 是刷新ChartComponent 然后响应整个设计块的改变事件
右键编辑 ---> 刷新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 final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
private ChartCollection chartCollection4Design;
@ -181,8 +182,9 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
// 反锯齿
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//画图
drawChartGlyph(g2d);
ActiveGlyph ag = this.getActiveGlyph();
if (ag != null) {
ag.paint4ActiveGlyph(g2d, chartGlyph);
@ -222,9 +224,9 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
/**
* 鼠标点击
* @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;
}
private void drawChartGlyph(Graphics2D g2d) {
public void drawChartGlyph(Graphics2D g2d) {
if (chartGlyph != null) {
if (chartGlyph.isRoundBorder()) {
chartGlyph.setBounds(new RoundRectangle2D.Double(0, 0, chartWidth, chartHeight, 10, 10));
@ -312,8 +314,14 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
//不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单
//其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution());
//处理画图事件
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution(), this);
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;
import java.awt.BorderLayout;
import java.awt.Dimension;
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.FRContext;
import com.fr.base.TableData;
import com.fr.base.Utils;
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.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.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.DesignerContext;
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.data.DataModel;
import com.fr.stable.StringUtils;
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());
TableDataWrapper tableDataWrappe = tableDataNameBox.getTableDataWrapper();
TableDataSource source = DesignTableDataManager.getEditingTableDataSource();
if (tableDataWrappe == null || source == null) {
return;
}
String[] values = DataCoreUtils.getColValuesInData(source, tableDataWrappe.getTableDataName(), colName);
ArrayList list = new ArrayList();
for(int i = 0; i < values.length; i++) {
list.add(values[i]);
}
imageShowPane.refreshFromDataList(list);
imageShowPane.refreshFromDataList(getColValuesInData(tableDataWrappe, colName));
}
}
};
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;
import java.awt.BorderLayout;
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.base.Utils;
import com.fr.chart.base.MapSvgAttr;
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.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.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.UIArrayTableModel;
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.editor.editor.Editor;
import com.fr.design.editor.editor.TextEditor;
import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane;
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));
northPane.add(tableDataBox);
columnBox = new FilterComboBox();
columnBox = new FilterComboBox<>();
columnBox.setPreferredSize(new Dimension(40, 20));
columnBox.addItemListener(columnChange);
@ -113,12 +103,10 @@ public class MapDefiAreaNamePane extends BasicBeanPane<String> implements Abstrc
String columnName = Utils.objectToString(columnBox.getSelectedItem());
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) {
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) {
int lastSelectIndex = editPane.getSelectedChartIndex(chart);
Plot oldPlot = chart.getPlot();
String lastPlotID = oldPlot == null ? StringUtils.EMPTY : oldPlot.getPlotID();
try{
Chart newDefaultChart = (Chart)((AbstractChartTypePane)getSelectedPane()).getDefaultChart().clone();
@ -159,7 +161,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
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);
}
}
@ -188,7 +190,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void reactor(ChartCollection collection){
//重构需要重构下拉框选项和cardNames
Chart chart = collection.getSelectedChart();
String chartID = chart.getChartID();
String chartID = chart.getPriority();
if (collection.getState() == SwitchState.DEFAULT){
chartID = StringUtils.EMPTY;
}
@ -197,7 +199,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
//重构下拉框选项
reactorComboBox();
//重新选择选中的下拉项
chartID = chart.getChartID();
chartID = chart.getPriority();
String plotID = chart.getPlot().getPlotID();
Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID);
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);
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,
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.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.beans.IntrospectionException;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.design.module.DesignModuleFactory;
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.Widget;
import com.fr.design.form.util.XCreatorConstants;
@ -237,7 +232,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
editor.setLayout(null);
editor.setOpaque(false);
coverPanel = new CoverReportPane();
coverPanel = new CoverPane();
coverPanel.setPreferredSize(this.getPreferredSize());
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.impl.AbstractFormElementCaseEditorProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.CoverReportPane;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
@ -201,6 +198,13 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
editor.repaint();
}
/**
* 销毁帮助提示框
*/
public void destroyHelpDialog(){
coverPanel.destroyHelpDialog();
}
public JComponent getCoverPane(){
return coverPanel;
}
@ -280,6 +284,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
if (this.isHelpBtnOnFocus()) {
coverPanel.setMsgDisplay(e);
}else {
coverPanel.destroyHelpDialog();
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);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreator(xfl);
xfl.convert();
LayoutUtils.layoutContainer(xfl);
xfl.adjustCreatorsWhileSlide(xfl.getContainerPercent() - 1.0);
for (int i = 0; i < components.length; 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 static final Item[] ITEMS = new Item[] {
new Item(WBodyLayoutType.FIT.description(), WBodyLayoutType.FIT.getTypeValue()),
new Item(WBodyLayoutType.ABSOLUTE.description(), WBodyLayoutType.ABSOLUTE.getTypeValue())};
new Item(WBodyLayoutType.FIT.description(), WBodyLayoutType.FIT.getTypeValue())/*,
new Item(WBodyLayoutType.ABSOLUTE.description(), WBodyLayoutType.ABSOLUTE.getTypeValue())*/};
public Item[] getItems() {
return ITEMS;

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);
}
}

54
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.general.FRScreen;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -16,15 +15,13 @@ import java.awt.*;
import java.awt.event.MouseEvent;
/**
* Created with IntelliJ IDEA.
* User: zx
* Date: 14-7-24
* Time: 上午9:09
* 报表块的封面如果后面所有的组件都有帮助信息的话就抽接口吧
* Coder: zack
* Date: 2016/11/2
* Time: 11:32
*/
public class CoverReportPane extends JPanel {
private UIButton editButton;
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH);
public class CoverReportPane extends CoverPane implements HelpDialogHandler{
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
private JComponent controlButton = new JComponent() {
protected void paintComponent(Graphics g) {
g.setColor(UIConstants.NORMAL_BACKGROUND);
@ -39,28 +36,13 @@ public class CoverReportPane extends JPanel {
private ElementCaseHelpDialog helpDialog = null;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F);
public CoverReportPane() {
this(StringUtils.EMPTY);
}
public CoverReportPane(String helpMsg) {
super();
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);
if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) {
WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() {
@ -98,6 +80,7 @@ public class CoverReportPane extends JPanel {
int rY = 165 + e.getY();//165是设计器最上面几个面板的高度
helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY);
helpDialog.showWindow();
HelpDialogManager.getInstance().setPane(this);
} else {
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
controlButton.repaint();
@ -125,6 +108,7 @@ public class CoverReportPane extends JPanel {
@Override
public void layoutContainer(Container parent) {
UIButton editButton = getEditButton();
int width = parent.getParent().getWidth();
int height = parent.getParent().getHeight();
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() {
if (helpDialog != null) {
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) {
XCreator component = designer.getComponentAt(e);
setCoverPaneNotDisplay();
setCoverPaneNotDisplay(e, false);
if(processTopLayoutMouseMove(component, e)){
return;
@ -320,8 +320,17 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.repaint();
}
private void setCoverPaneNotDisplay(){
if (xElementCase != null){
private void setCoverPaneNotDisplay(MouseEvent e, boolean isLinkedHelpDialog) {
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);
}
if (xChartEditor != null){
@ -525,7 +534,7 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getDefaultCursor());
}
setCoverPaneNotDisplay();
setCoverPaneNotDisplay(e, true);
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) {
int paraHeight = designer.getParaHeight();
if (needCalculateParaHeight && paraHeight > 0) {
// 调整参数界面的大小
paraHeight += (int) (paraHeight*percent) ;
designer.setParaHeight(paraHeight);
XWBorderLayout parent = (XWBorderLayout) layout.getParent();
parent.toData().setNorthSize(paraHeight);

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

@ -1,40 +1,27 @@
package com.fr.design.mainframe;
import java.awt.*;
import java.awt.event.ActionEvent;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import com.fr.design.designer.creator.XLayoutContainer;
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.parameter.HierarchyTreePane;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWParameterLayout;
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 javax.swing.JPanel;
import javax.swing.JScrollPane;
import com.fr.design.gui.itextfield.UITextField;
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.general.Inter;
import com.fr.stable.StringUtils;
import com.fr.design.actions.UpdateAction;
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;
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.design.actions.file.WebPreviewUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.ShopDialog;
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.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIPreviewButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.itoolbar.UILargeToolbar;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.share.ShareConstants;
import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo;
import com.fr.general.IOUtils;
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.
* User: zx
@ -60,6 +48,7 @@ public class FormWidgetDetailPane extends FormDockView{
private UIButton deleteButton;
private static final int OFFSET_X = 140;
private static final int OFFSET_Y = 26;
private SwingWorker sw;
public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) {
@ -105,7 +94,19 @@ public class FormWidgetDetailPane extends FormDockView{
reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
reuWidgetPanel.setBorder(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();
createRefreshButton();
@ -178,8 +179,19 @@ public class FormWidgetDetailPane extends FormDockView{
refreshButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
refreshShareMoudule();
refreshDownPanel(false);
if (sw != null) {
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
sonar.projectName=finereport.design
sonar.projectVersion=1.0
sonar.branch=master
sonar.branch=dev
# 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.

Loading…
Cancel
Save