diff --git a/build.dev.gradle b/build.dev.gradle
new file mode 100644
index 0000000000..507d77e9f5
--- /dev/null
+++ b/build.dev.gradle
@@ -0,0 +1,85 @@
+apply plugin: "java"
+tasks.withType(JavaCompile){
+ options.encoding = "UTF-8"
+}
+def basicDir="../../"
+def libDir="${basicDir}/finereport-lib-stable"
+//获取什么分支名
+FileTree files =fileTree(dir:"./",include:"build.*.gradle")
+def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\"))
+def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1)
+
+task appletJar<<{
+
+ ant{
+ mkdir(dir:"${libDir}/tmp-${branchName}")
+ mkdir(dir:"build/classes/")
+ copy(todir:"build/classes/"){
+ fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main")
+
+ fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main")
+
+ fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main")
+
+ fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main")
+
+ fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main")
+
+ }
+ unjar(src:"${libDir}/3rd.jar",dest:"${libDir}/tmp-${branchName}")
+ unjar(src:"${libDir}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}")
+ jar(jarfile:"build/libs/fr-applet-8.0.jar"){
+ fileset(dir:"build/classes"){
+ exclude(name:"*.*")
+ exclude(name:"bin/*.*")
+ exclude(name:"classes/**")
+ exclude(name:"com/fr/schedule/**")
+ exclude(name:"com/fr/cell/**")
+ exclude(name:"com/fr/dialog/**")
+ exclude(name:"com/fr/view/**")
+ exclude(name:"com/fr/web/**")
+ exclude(name:"com/fr/fs/**")
+ exclude(name:"com/fr/design/**")
+ exclude(name:"com/fr/start/**")
+ exclude(name:"com/fr/process/**")
+ }
+ fileset(dir:"${libDir}/tmp-${branchName}"){
+ include(name:"javax/mail/**")
+ include(name:"javax/servlet/**")
+ include(name:"org/freehep/**")
+ include(name:"com/fr/third/JAI/**")
+ include(name:"com/fr/third/antlr/**")
+ include(name:"com/fr/third/javax/**")
+ include(name:"com/sun/xml/**")
+ include(name:"javax/xml/**")
+
+ }
+ fileset(dir:"build/classes"){
+ include(name:"com/fr/web/*.class")
+ include(name:"com/fr/web/attr/*.class")
+ }
+ }
+ delete(dir:"${libDir}/tmp-${branchName}")
+ def jdk6home= "D:/FineReport/develop/java/jdk1.6u35"
+ def keystore="frapplet.store"
+ def keycert="fr.cert"
+ def keypassword="123456"
+ def keyalias="fr"
+
+ exec(executable:"${jdk6home}/bin/keytool"){
+ arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}")
+ }
+ exec(executable:"${jdk6home}/bin/keytool"){
+ arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}")
+ }
+
+ exec(executable:"${jdk6home}/bin/jarsigner"){
+ arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}")
+ }
+ delete(file:"${keystore}")
+ delete(file:"${keycert}")
+ delete(dir:"build/classes")
+
+ }
+
+}
\ No newline at end of file
diff --git a/designer/src/com/fr/design/actions/ElementCaseAction.java b/designer/src/com/fr/design/actions/ElementCaseAction.java
index be9ff9f9a8..bfc0c8b4e5 100644
--- a/designer/src/com/fr/design/actions/ElementCaseAction.java
+++ b/designer/src/com/fr/design/actions/ElementCaseAction.java
@@ -10,24 +10,10 @@ import com.fr.grid.selection.Selection;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
-public abstract class ElementCaseAction extends TemplateComponentAction {
+public abstract class ElementCaseAction extends SelectionListenerAction {
protected ElementCaseAction(ElementCasePane t) {
super(t);
- t.addSelectionChangeListener(new SelectionListener() {
-
- @Override
- public void selectionChanged(SelectionEvent e) {
- update();
- if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) {
- Selection selection = getEditingComponent().getSelection();
- if (selection instanceof CellSelection) {
- CellSelection cellselection = (CellSelection) selection;
- //样式处理
- getEditingComponent().setCellNeedTOFormat(cellselection);
- }
- }
- }
- });
+ t.addSelectionChangeListener(createSelectionListener());
}
}
\ No newline at end of file
diff --git a/designer/src/com/fr/design/actions/SelectionListenerAction.java b/designer/src/com/fr/design/actions/SelectionListenerAction.java
new file mode 100644
index 0000000000..48cd2d4f9a
--- /dev/null
+++ b/designer/src/com/fr/design/actions/SelectionListenerAction.java
@@ -0,0 +1,36 @@
+package com.fr.design.actions;
+
+import com.fr.design.mainframe.DesignerContext;
+import com.fr.design.mainframe.ElementCasePane;
+import com.fr.design.selection.SelectionEvent;
+import com.fr.design.selection.SelectionListener;
+import com.fr.grid.selection.CellSelection;
+import com.fr.grid.selection.Selection;
+
+/**
+ * Created by daniel on 2016/10/10.
+ */
+public abstract class SelectionListenerAction extends TemplateComponentAction {
+
+ protected SelectionListenerAction(ElementCasePane elementCasePane) {
+ super(elementCasePane);
+ }
+
+ protected SelectionListener createSelectionListener () {
+ return new SelectionListener() {
+
+ @Override
+ public void selectionChanged(SelectionEvent e) {
+ update();
+ if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) {
+ Selection selection = getEditingComponent().getSelection();
+ if (selection instanceof CellSelection) {
+ CellSelection cellselection = (CellSelection) selection;
+ //样式处理
+ getEditingComponent().setCellNeedTOFormat(cellselection);
+ }
+ }
+ }
+ };
+ }
+}
diff --git a/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java b/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java
index b33d269966..27adef643a 100644
--- a/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java
+++ b/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java
@@ -8,19 +8,27 @@ import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.base.NameStyle;
import com.fr.design.actions.ElementCaseAction;
+import com.fr.design.actions.SelectionListenerAction;
+import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.mainframe.CellElementPropertyPane;
+import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef;
+import com.fr.design.selection.SelectionEvent;
+import com.fr.design.selection.SelectionListener;
import com.fr.design.style.StylePane;
import com.fr.general.Inter;
import com.fr.base.ConfigManagerProvider;
+import com.fr.grid.selection.CellSelection;
+import com.fr.grid.selection.Selection;
import com.fr.stable.StringUtils;
import com.fr.stable.pinyin.PinyinHelper;
-import java.awt.event.ActionEvent;
+import java.awt.*;
+import java.awt.event.*;
import java.util.Iterator;
public class GlobalStyleMenuDef extends MenuDef {
@@ -35,6 +43,36 @@ public class GlobalStyleMenuDef extends MenuDef {
this.setIconPath("/com/fr/design/images/m_web/style.png");
}
+ protected ContainerListener getContainerListener() {
+ return containerListener;
+ }
+
+ private ContainerListener containerListener = new ContainerListener() {
+ @Override
+ public void componentAdded(ContainerEvent e) {
+
+ }
+
+ @Override
+ public void componentRemoved(ContainerEvent e) {
+ Component c = e.getChild();
+ c.dispatchEvent(new MenuDeleteEvent(c));
+ }
+ };
+
+ private class MenuDeleteEvent extends UpdateAction.ComponentRemoveEvent {
+
+ public MenuDeleteEvent(Component source) {
+ super(source);
+ }
+
+ @Override
+ public void release(SelectionListener listener) {
+ ePane.removeSelectionChangeListener(listener);
+ }
+ }
+
+
/**
* 更新菜单项
*/
@@ -46,8 +84,7 @@ public class GlobalStyleMenuDef extends MenuDef {
while (iterator.hasNext()) {
String name = (String) iterator.next();
NameStyle nameStyle = NameStyle.getInstance(name);
-
- UpdateAction.UseMenuItem useMenuItem = new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem();
+ UpdateAction.UseMenuItem useMenuItem =new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem();
useMenuItem.setNameStyle(nameStyle);
createdMenu.add(useMenuItem);
}
@@ -113,7 +150,9 @@ public class GlobalStyleMenuDef extends MenuDef {
}
- public static class GlobalStyleSelection extends ElementCaseAction {
+
+
+ public static class GlobalStyleSelection extends SelectionListenerAction {
private NameStyle nameStyle;
@@ -149,5 +188,14 @@ public class GlobalStyleMenuDef extends MenuDef {
stylePane.updateGlobalStyle(getEditingComponent());
return true;
}
+
+ public UseMenuItem createUseMenuItem() {
+ UseMenuItem useMenuItem = super.createUseMenuItem();
+ SelectionListener listener = createSelectionListener();
+ getEditingComponent().addSelectionChangeListener(listener);
+ useMenuItem.setSelectionListener(listener);
+ return useMenuItem;
+ }
+
}
}
\ No newline at end of file
diff --git a/designer/src/com/fr/design/actions/file/export/AbstractExcelExportAction.java b/designer/src/com/fr/design/actions/file/export/AbstractExcelExportAction.java
index 63aaf064c2..ae1a08ce22 100644
--- a/designer/src/com/fr/design/actions/file/export/AbstractExcelExportAction.java
+++ b/designer/src/com/fr/design/actions/file/export/AbstractExcelExportAction.java
@@ -36,7 +36,7 @@ public abstract class AbstractExcelExportAction extends AbstractExportAction {
if (hasLayerReport(tpl)) {
return "zip";
} else {
- return ExcelUtils.checkPOIJarExist() ? "xlsx" : "xls";
+ return ExcelUtils.checkThirdJarSupportPOI() ? "xlsx" : "xls";
}
}
}
\ No newline at end of file
diff --git a/designer/src/com/fr/design/actions/file/export/AbstractExportAction.java b/designer/src/com/fr/design/actions/file/export/AbstractExportAction.java
index a4a55ac304..0c6f0c8ed0 100644
--- a/designer/src/com/fr/design/actions/file/export/AbstractExportAction.java
+++ b/designer/src/com/fr/design/actions/file/export/AbstractExportAction.java
@@ -5,6 +5,7 @@ package com.fr.design.actions.file.export;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
+import com.fr.io.exporter.pdfstream.PDFStreamExporter;
import com.fr.page.PageSetProvider;
import com.fr.design.actions.JWorkBookAction;
import com.fr.design.gui.iprogressbar.FRProgressBar;
@@ -139,7 +140,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
if (exporter instanceof AppExporter) {
AppExporter appExporter = (AppExporter) exporter;
if (exporter instanceof ExcelExporter || exporter instanceof CSVExporter
- || exporter instanceof PDFExporter || exporter instanceof WordExporter) {
+ || exporter instanceof PDFExporter || exporter instanceof PDFStreamExporter || exporter instanceof WordExporter) {
ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果
appExporter.export(fileOutputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)
diff --git a/designer/src/com/fr/design/actions/file/export/PDFExportAction.java b/designer/src/com/fr/design/actions/file/export/PDFExportAction.java
index 68fdd783f8..64cf5dabf5 100644
--- a/designer/src/com/fr/design/actions/file/export/PDFExportAction.java
+++ b/designer/src/com/fr/design/actions/file/export/PDFExportAction.java
@@ -10,6 +10,7 @@ import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.Inter;
import com.fr.io.exporter.Exporter;
import com.fr.io.exporter.PDFExporter;
+import com.fr.io.exporter.pdfstream.PDFStreamExporter;
/**
* Export pdf
@@ -28,7 +29,7 @@ public class PDFExportAction extends AbstractExportAction {
@Override
protected Exporter getExporter() {
- return new PDFExporter();
+ return new PDFStreamExporter();
}
@Override
diff --git a/designer/src/com/fr/design/mainframe/bbs/LoginDialog.java b/designer/src/com/fr/design/mainframe/bbs/LoginDialog.java
index b5fe200ea1..e3013e4877 100644
--- a/designer/src/com/fr/design/mainframe/bbs/LoginDialog.java
+++ b/designer/src/com/fr/design/mainframe/bbs/LoginDialog.java
@@ -15,7 +15,7 @@ import java.awt.*;
* Created by zhaohehe on 16/7/26.
*/
public class LoginDialog extends UIDialog {
- private static final Dimension DEFAULT_SHOP = new Dimension(404, 204);
+ private static final Dimension DEFAULT_SHOP = new Dimension(401, 201);
public LoginDialog(Frame frame, BasicPane pane) {
super(frame);
diff --git a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
index 1c3f83aa0a..460f758df6 100644
--- a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
+++ b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
@@ -87,6 +87,7 @@ public class UserInfoLabel extends UILabel{
LoginCheckContext.addLoginCheckListener(new LoginCheckListener() {
@Override
public void loginChecked() {
+ /*
if (bbsLoginDialog == null) {
bbsLoginDialog = new BBSLoginDialog(DesignerContext.getDesignerFrame(), UserInfoLabel.this);
}
@@ -94,6 +95,7 @@ public class UserInfoLabel extends UILabel{
bbsLoginDialog.showTipForDownloadPluginWithoutLogin();
bbsLoginDialog.setModal(true);
bbsLoginDialog.showWindow();
+ */
}
});
@@ -282,7 +284,8 @@ public class UserInfoLabel extends UILabel{
public void mousePressed(MouseEvent e) {
if(StringUtils.isNotEmpty(userName)){
try {
- Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default")));
+ String loginUrl = SiteCenter.getInstance().acquireUrlByKind("bbs.default");
+ Desktop.getDesktop().browse(new URI(loginUrl));
} catch (Exception exp) {
FRContext.getLogger().info(exp.getMessage());
}
diff --git a/designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java b/designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java
index b8a168baa0..df18f1f88d 100644
--- a/designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java
+++ b/designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java
@@ -77,12 +77,11 @@ public class UserInfoPane extends BasicPane{
@Override
public void run() {
String username = DesignerEnvManager.getEnvManager().getBBSName();
- String password = DesignerEnvManager.getEnvManager().getBBSPassword();
- String loginResult = LoginWebBridge.getHelper().login(username, password);
- if (loginResult.equals(LOGININ)) {
- markSignIn(username);
- }else {
+ String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName();
+ if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)){
markUnSignIn();
+ } else {
+ markSignIn(username);
}
}
});
diff --git a/designer/src/com/fr/design/present/CellWriteAttrPane.java b/designer/src/com/fr/design/present/CellWriteAttrPane.java
index 5f4d6a8eac..4158dbd6c6 100644
--- a/designer/src/com/fr/design/present/CellWriteAttrPane.java
+++ b/designer/src/com/fr/design/present/CellWriteAttrPane.java
@@ -1,15 +1,13 @@
package com.fr.design.present;
import com.fr.base.FRContext;
-import com.fr.base.Style;
+import com.fr.design.dialog.BasicDialog;
+import com.fr.design.dialog.BasicPane;
+import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.widget.WidgetPane;
-import com.fr.design.dialog.BasicDialog;
-import com.fr.design.dialog.BasicPane;
-import com.fr.design.dialog.DialogActionAdapter;
-import com.fr.form.ui.DateEditor;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
import com.fr.general.FRLogger;
@@ -22,8 +20,6 @@ import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
import java.awt.*;
-import java.text.Format;
-import java.text.SimpleDateFormat;
public class CellWriteAttrPane extends BasicPane {
@@ -78,22 +74,6 @@ public class CellWriteAttrPane extends BasicPane {
Widget cellWidget = cellElement.getWidget();
- if (cellWidget != null && cellWidget instanceof DateEditor) {
- // p:日期的格式需要设置到单元格子里面.
- DateEditor dateCellEditorDef = (DateEditor) cellWidget;
-
- // p:需要把下拉的编辑器,日期格式,都放到CellElement的Style里面
- // 这个地方很方便用户,是alex提出的.
- // p:日期的格式需要设置到单元格子里面.
- Style style = cellElement.getStyle();
- if (style != null) {
- Format format = style.getFormat();
- if (format != null && format instanceof SimpleDateFormat) {
- SimpleDateFormat simpleDateFormat = (SimpleDateFormat) format;
- dateCellEditorDef.setFormatText(simpleDateFormat.toPattern());
- }
- }
- }
// 这里进行克隆的原因是为了保留原始的Widget以便和新的Widget做比较来判断是否发生了改变
if (cellWidget != null) {
try {
@@ -111,19 +91,6 @@ public class CellWriteAttrPane extends BasicPane {
}
Widget cellWidget = this.cellEditorDefPane.update();
- // p:需要把下拉的编辑器,日期格式,都放到CellElement的Style里面
- if (cellWidget instanceof DateEditor) {
- // p:日期的格式需要设置到单元格子里面.
- DateEditor dateCellEditorDef = (DateEditor) cellWidget;
- String formatText = dateCellEditorDef.getFormatText();
- if (formatText != null) {
- Style style = cellElement.getStyle();
- if (style != null) {
- cellElement.setStyle(style.deriveFormat(new SimpleDateFormat(formatText)));
- }
- }
- }
-
// p:最后把这个cellEditorDef设置到CellGUIAttr.
if (cellWidget instanceof NoneWidget) {
cellElement.setWidget(null);
diff --git a/designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java b/designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java
index fd24573fe3..2624318aed 100644
--- a/designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java
+++ b/designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java
@@ -10,9 +10,10 @@ import javax.swing.event.ChangeListener;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
-import com.fr.design.extra.PluginManagerPane;
-import com.fr.design.extra.PluginShopDialog;
+import com.fr.design.extra.ShopManagerPane;
+import com.fr.design.extra.ShopDialog;
import com.fr.design.extra.PluginWebBridge;
+import com.fr.design.extra.WebManagerPaneFactory;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel;
@@ -29,583 +30,572 @@ import com.fr.stable.bridge.StableFactory;
*/
public class RepeatAndFreezeSettingPane extends BasicPane {
- //边框高度
- private static final int LABEL_HEIGHT = 45;
-
- // 重复标题行
- private RepeatRowPane repeatTitleRowPane;
- // 重复标题列
- private RepeatColPane repeatTitleColPane;
- // 重复结尾行
- private RepeatRowPane repeatFinisRowPane;
- // 重复结尾列
- private RepeatColPane repeatFinisColPane;
- // 分页冻结行
- private FreezePagePane freezePageRowPane;
- // 分页冻结列
- private FreezePagePane freezePageColPane;
- // 填报冻结行
- private FreezeWriteRowPane freezeWriteRowPane;
- // 填报冻结列
- private FreezeWriteColPane freezeWriteColPane;
- // 重复标题
- private UICheckBox useRepeatTitleRCheckBox;
- private UICheckBox useRepeatTitleCCheckBox;
- // 重复结尾
- private UICheckBox useRepeatFinisRCheckBox;
- private UICheckBox useRepeatFinisCCheckBox;
-
- // 分页冻结
- private UICheckBox usePageFrozenCCheckBox;
- private UICheckBox usePageFrozenRCheckBox;
- // 填报冻结
- private UICheckBox useWriteFrozenCCheckBox;
- private UICheckBox useWriteFrozenRCheckBox;
-
- /**
- * 重复标题行
- */
- private JPanel initRowStartPane(){
- JPanel soverlapRowStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
- useRepeatTitleRCheckBox = new UICheckBox();
- soverlapRowStartPane.add(useRepeatTitleRCheckBox);
- soverlapRowStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Title_Start_Row", "From"})));
- repeatTitleRowPane = new RepeatRowPane();
- soverlapRowStartPane.add(repeatTitleRowPane);
-
- return soverlapRowStartPane;
- }
-
- /**
- * 重复标题列
- */
- private JPanel initColStartPane(){
- // 重复打印标题的起始列
- JPanel soverlapColStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
- useRepeatTitleCCheckBox = new UICheckBox();
- soverlapColStartPane.add(useRepeatTitleCCheckBox);
- soverlapColStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Title_Start_Column", "From"})));
- // 重复打印标题的结束列
- repeatTitleColPane = new RepeatColPane();
- soverlapColStartPane.add(repeatTitleColPane);
-
- return soverlapColStartPane;
- }
-
- /**
- * 重复结尾行
- */
- private JPanel initFootRowStarPane(){
- // 重复打印结尾的起始行
- JPanel foverlapRowStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
- useRepeatFinisRCheckBox = new UICheckBox();
- foverlapRowStartPane.add(useRepeatFinisRCheckBox);
- foverlapRowStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Finis_Start_Row", "From"})));
- repeatFinisRowPane = new RepeatRowPane();
- foverlapRowStartPane.add(repeatFinisRowPane);
-
- return foverlapRowStartPane;
- }
-
- /**
- * 重复结尾列
- */
- private JPanel initFootColStartPane(){
- // 重复打印结尾的起始列
- JPanel foverlapColStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
- useRepeatFinisCCheckBox = new UICheckBox();
- foverlapColStartPane.add(useRepeatFinisCCheckBox);
- foverlapColStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Finis_Start_Column", "From"})));
- repeatFinisColPane = new RepeatColPane();
- foverlapColStartPane.add(repeatFinisColPane);
-
- return foverlapColStartPane;
- }
-
- /**
- * 获取分页冻结的标题(表单中不需要写分页二字)
- *
- * @return 分页冻结的标题
- *
- *
- * @date 2014-11-14-下午1:32:08
- *
- */
- protected String getPageFrozenTitle(){
- return Inter.getLocText("FR-Engine_Page-Frozen");
- }
-
- /**
- * 分页冻结Pane
- */
- private JPanel initPageFrozenPane(){
- JPanel pagePanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
- // 分页冻结
- UILabel pageLabel = new UILabel(getPageFrozenTitle());
- JPanel pageLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
- pageLabelPanel.add(pageLabel);
- pagePanel.add(pageLabelPanel, BorderLayout.NORTH);
- JPanel pagecon = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1);
- pagecon.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
- pagePanel.add(pagecon, BorderLayout.CENTER);
- UILabel warningx = new UILabel("(" + Inter.getLocText("FR-Engine_Please_Set_Repeat_First") + ")");
- warningx.setForeground(Color.red);
- pageLabelPanel.add(warningx);
-
- JPanel pageRowGridPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
- pageRowGridPane.add(this.usePageFrozenRCheckBox = new UICheckBox());
- pagecon.add(pageRowGridPane);
- // 显示行冻结信息的panel
- freezePageRowPane = new FreezePagePane(true);
- pageRowGridPane.add(freezePageRowPane);
- addPageFrozenCol(pagecon);
-
- return pagePanel;
- }
-
- /**
- * 分页冻结列
- */
- private void addPageFrozenCol(JPanel pagecon){
- // 显示列冻结信息的panel
- freezePageColPane = new FreezePagePane(false);
- JPanel pageColGridPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
- pageColGridPane.add(this.usePageFrozenCCheckBox = new UICheckBox());
- pagecon.add(pageColGridPane);
- pageColGridPane.add(freezePageColPane);
- }
-
- /**
- * 填报冻结Pane
- */
- private JPanel initWriteFrozenPane(){
- JPanel writePanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
- // 填报冻结
- UILabel writeLabel = new UILabel(Inter.getLocText(new String[]{"Face_Write", "Frozen"}) + ":");
- JPanel writeLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
- writeLabelPanel.add(writeLabel);
- writePanel.add(writeLabelPanel, BorderLayout.NORTH);
- JPanel writecon = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1);
- writecon.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
- writePanel.add(writecon, BorderLayout.CENTER);
-
- // 行冻结
- JPanel writeRowPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
- writeRowPane.add(this.useWriteFrozenRCheckBox = new UICheckBox());
- // 列冻结
- JPanel writeColPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
- writeColPane.add(this.useWriteFrozenCCheckBox = new UICheckBox());
- writecon.add(writeRowPane);
- freezeWriteRowPane = new FreezeWriteRowPane();
- writeRowPane.add(freezeWriteRowPane);
- writecon.add(writeColPane);
- freezeWriteColPane = new FreezeWriteColPane();
- writeColPane.add(freezeWriteColPane);
-
- return writePanel;
- }
-
- public RepeatAndFreezeSettingPane() {
- this.setLayout(FRGUIPaneFactory.createBorderLayout());
- JPanel outrepeatPanel = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Engine_Repeat"));
- JPanel cenrepeatPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
- outrepeatPanel.add(cenrepeatPanel);
- JPanel outfreezePanel = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Engine_Frozen"));
- this.add(outrepeatPanel, BorderLayout.NORTH);
- this.add(outfreezePanel, BorderLayout.CENTER);
- JPanel repeatPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1);
- repeatPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
- JPanel freezePanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
-
- //自适应插件
- JPanel infoPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Attention"));
-
- BoxCenterAligmentPane actionLabel = getURLActionLabel(Inter.getLocText("FR-Designer_Form-Fit-Tip"));
- infoPane.add(actionLabel, BorderLayout.SOUTH);
-
- outfreezePanel.add(freezePanel);
- this.add(infoPane, BorderLayout.SOUTH);
- // 重复打印部分
- // 重复打印标题的起始行
- JPanel labelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
- labelPanel.add(new UILabel(Inter.getLocText("FR-Engine_Select_the_repeated_row_and_column") + ":"));
- UILabel warning = new UILabel("(" + Inter.getLocText("FR-Engine_FreezeWarning1") + ")");
- warning.setForeground(Color.red);
- labelPanel.add(warning);
- cenrepeatPanel.add(labelPanel, BorderLayout.NORTH);
- cenrepeatPanel.add(repeatPanel, BorderLayout.CENTER);
-
- repeatPanel.add(initRowStartPane());
- addColStart(repeatPanel);
- repeatPanel.add(initFootRowStarPane());
- addFootColStart(repeatPanel);
-
- freezePanel.add(initPageFrozenPane(), BorderLayout.NORTH);
- addWriteFrozen(freezePanel);
-
- initPageRwoListener();
- initPageColListener();
- initWriteListener();
- }
-
- protected void initWriteListener(){
- // 填报重复冻结行
- useWriteFrozenCCheckBox.addChangeListener(useWriteFrozenCListener);
- // 填报重复冻结列
- useWriteFrozenRCheckBox.addChangeListener(useWriteFrozenRListener);
- }
-
- private void initPageRwoListener(){
- repeatTitleRowPane.addListener(freezePageRowListener);
- // 分页重复冻结行
- usePageFrozenRCheckBox.addChangeListener(usePageFrozenRListener);
- //重复标题行
- useRepeatTitleRCheckBox.addChangeListener(useRepeatTitleRListener);
- //重复结尾行
- useRepeatFinisRCheckBox.addChangeListener(useRepeatFinisRListener);
- }
-
- protected void initPageColListener(){
- repeatTitleColPane.addListener(freezePageColListener);
- // 分页重复冻结列
- usePageFrozenCCheckBox.addChangeListener(usePageFrozenCListener);
- //重复标题列
- useRepeatTitleCCheckBox.addChangeListener(useRepeatTitleCListener);
- //重复结尾列
- useRepeatFinisCCheckBox.addChangeListener(useRepeatFinisCListener);
- }
-
- protected void addWriteFrozen(JPanel freezePanel) {
- freezePanel.add(initWriteFrozenPane(), BorderLayout.CENTER);
- }
-
- protected void addFootColStart(JPanel repeatPanel){
- repeatPanel.add(initFootColStartPane());
- }
-
- protected void addColStart(JPanel repeatPanel){
- repeatPanel.add(initColStartPane());
- }
-
- ChangeListener useRepeatFinisCListener = new ChangeListener() {
-
- @Override
- public void stateChanged(ChangeEvent e) {
- repeatFinisColPane.setEnabled(useRepeatFinisCCheckBox.isSelected());
-
- }
- };
-
- ChangeListener useRepeatFinisRListener = new ChangeListener() {
-
- @Override
- public void stateChanged(ChangeEvent e) {
- repeatFinisRowPane.setEnabled(useRepeatFinisRCheckBox.isSelected());
-
- }
- };
-
- ChangeListener useRepeatTitleCListener = new ChangeListener() {
-
- @Override
- public void stateChanged(ChangeEvent e) {
- boolean flag = useRepeatTitleCCheckBox.isSelected();
- repeatTitleColPane.setEnabled(flag);
- if (!flag) {
- usePageFrozenCCheckBox.setSelected(false);
- usePageFrozenCCheckBox.setEnabled(false);
- } else {
- usePageFrozenCCheckBox.setEnabled(true);
- }
- }
- };
-
- ChangeListener useRepeatTitleRListener = new ChangeListener() {
-
- @Override
- public void stateChanged(ChangeEvent e) {
- boolean flag = useRepeatTitleRCheckBox.isSelected();
- repeatTitleRowPane.setEnabled(flag);
- if (!flag) {
- usePageFrozenRCheckBox.setSelected(false);
- usePageFrozenRCheckBox.setEnabled(false);
- } else {
- usePageFrozenRCheckBox.setEnabled(true);
- }
- }
- };
-
- ChangeListener useWriteFrozenRListener = new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- boolean flag = useWriteFrozenRCheckBox.isSelected();
- freezeWriteRowPane.setEnabled(flag);
-
- }
- };
-
- ChangeListener useWriteFrozenCListener = new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- boolean flag = useWriteFrozenCCheckBox.isSelected();
- freezeWriteColPane.setEnabled(flag);
-
- }
- };
-
- ChangeListener usePageFrozenCListener = new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- freezePageColPane.setEnabled(usePageFrozenCCheckBox.isSelected());
- }
- };
-
- ChangeListener usePageFrozenRListener = new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- freezePageRowPane.setEnabled(usePageFrozenRCheckBox.isSelected());
- }
- };
-
- // 分页重复冻结行数据联动
- ChangeListener freezePageRowListener = new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- FT ft = repeatTitleRowPane.updateBean();
- int to = ft.getTo();
- freezePageRowPane.populateBean(new FT(to > -1 ? 0 : -1, to));
- }
- };
-
- // 分页重复冻结列数据联动
- ChangeListener freezePageColListener = new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- FT ft = repeatTitleColPane.updateBean();
- int to = ft.getTo();
- freezePageColPane.populateBean(new FT(to > -1 ? 0 : -1, to));
- }
- };
-
- /**
- * 窗口标题
- *
- *
- * @date 2014-11-14-下午2:30:58
- *
- */
- protected String title4PopupWindow() {
- return Inter.getLocText("FR-Engine_Repeat-Freeze");
- }
-
- public void populate(ReportPageAttrProvider attribute) {
-
- if (attribute == null) {
- attribute = (ReportPageAttrProvider) StableFactory.createXmlObject(ReportPageAttrProvider.XML_TAG);
- }
- FT defaultFT = new FT(0, 0);
- populatColPane(attribute, defaultFT);
- populateRowPane(attribute, defaultFT);
- }
-
- protected void populateRowPane(ReportPageAttrProvider attribute, FT defaultFT){
- FT ft = new FT(new Integer(attribute.getRepeatHeaderRowFrom()), new Integer(attribute.getRepeatHeaderRowTo()));
- if (isDefalut(ft)) {
- this.repeatTitleRowPane.populateBean(defaultFT);
- this.repeatTitleRowPane.setEnabled(false);
- usePageFrozenRCheckBox.setEnabled(false);
- } else {
- this.repeatTitleRowPane.populateBean(ft);
- useRepeatTitleRCheckBox.setSelected(true);
- }
-
- ft = new FT(new Integer(attribute.getRepeatFooterRowFrom()), new Integer(attribute.getRepeatFooterRowTo()));
- if (isDefalut(ft)) {
- this.repeatFinisRowPane.populateBean(defaultFT);
- this.repeatFinisRowPane.setEnabled(false);
- useRepeatFinisRCheckBox.setSelected(false);
- } else {
- this.repeatFinisRowPane.populateBean(ft);
- useRepeatFinisRCheckBox.setSelected(true);
- }
-
- this.usePageFrozenRCheckBox.setSelected(attribute.isUsePageFrozenRow());
- this.freezePageRowPane.setEnabled(attribute.isUsePageFrozenRow());
- }
-
- protected void populatColPane(ReportPageAttrProvider attribute, FT defaultFT){
- FT ft = new FT(new Integer(attribute.getRepeatHeaderColumnFrom()), new Integer(attribute.getRepeatHeaderColumnTo()));
- if (isDefalut(ft)) {
- this.repeatTitleColPane.populateBean(defaultFT);
- this.repeatTitleColPane.setEnabled(false);
- usePageFrozenCCheckBox.setEnabled(false);
- } else {
- this.repeatTitleColPane.populateBean(ft);
- useRepeatTitleCCheckBox.setSelected(true);
- }
-
- ft = new FT(new Integer(attribute.getRepeatFooterColumnFrom()), new Integer(attribute.getRepeatFooterColumnTo()));
- if (isDefalut(ft)) {
- this.repeatFinisColPane.populateBean(defaultFT);
- this.repeatFinisColPane.setEnabled(false);
- useRepeatFinisCCheckBox.setSelected(false);
- } else {
- this.repeatFinisColPane.populateBean(ft);
- useRepeatFinisCCheckBox.setSelected(true);
- }
-
- this.usePageFrozenCCheckBox.setSelected(attribute.isUsePageFrozenColumn());
- this.freezePageColPane.setEnabled(attribute.isUsePageFrozenColumn());
- }
-
- private boolean isDefalut(FT ob) {
- return ob.getFrom() == -1 && ob.getTo() == -1;
- }
+ //边框高度
+ private static final int LABEL_HEIGHT = 45;
+
+ // 重复标题行
+ private RepeatRowPane repeatTitleRowPane;
+ // 重复标题列
+ private RepeatColPane repeatTitleColPane;
+ // 重复结尾行
+ private RepeatRowPane repeatFinisRowPane;
+ // 重复结尾列
+ private RepeatColPane repeatFinisColPane;
+ // 分页冻结行
+ private FreezePagePane freezePageRowPane;
+ // 分页冻结列
+ private FreezePagePane freezePageColPane;
+ // 填报冻结行
+ private FreezeWriteRowPane freezeWriteRowPane;
+ // 填报冻结列
+ private FreezeWriteColPane freezeWriteColPane;
+ // 重复标题
+ private UICheckBox useRepeatTitleRCheckBox;
+ private UICheckBox useRepeatTitleCCheckBox;
+ // 重复结尾
+ private UICheckBox useRepeatFinisRCheckBox;
+ private UICheckBox useRepeatFinisCCheckBox;
+
+ // 分页冻结
+ private UICheckBox usePageFrozenCCheckBox;
+ private UICheckBox usePageFrozenRCheckBox;
+ // 填报冻结
+ private UICheckBox useWriteFrozenCCheckBox;
+ private UICheckBox useWriteFrozenRCheckBox;
/**
- * 初始化填报冻结pane
- *
- * @param writeFrozenColumnRow 填报冻结格子
- *
- *
- * @date 2014-11-14-下午2:30:15
- *
- */
- public void populateWriteFrozenColumnRow(ColumnRow writeFrozenColumnRow) {
- if (writeFrozenColumnRow != null) {
- int col = writeFrozenColumnRow.getColumn();
- int row = writeFrozenColumnRow.getRow();
- if (col > 0) {
- freezeWriteColPane.populateBean(new FT(1, col - 1));
- }
- if (row > 0) {
- freezeWriteRowPane.populateBean(new FT(1, row - 1));
- }
-
- useWriteFrozenCCheckBox.setSelected(col > 0);
- useWriteFrozenRCheckBox.setSelected(row > 0);
- freezeWriteColPane.setEnabled(col > 0);
- freezeWriteRowPane.setEnabled(row > 0);
- } else {
- useWriteFrozenCCheckBox.setSelected(false);
- useWriteFrozenRCheckBox.setSelected(false);
- freezeWriteRowPane.setEnabled(false);
- freezeWriteColPane.setEnabled(false);
- }
- }
-
- public ReportPageAttrProvider update() {
- ReportPageAttrProvider attribute = (ReportPageAttrProvider) StableFactory.createXmlObject(ReportPageAttrProvider.XML_TAG);
-
- updateRowPane(attribute);
- updateColPane(attribute);
-
- return attribute;
- }
-
- protected void updateRowPane(ReportPageAttrProvider attribute){
- // 重复标题行
- int titleFrom = valid(useRepeatTitleRCheckBox, this.repeatTitleRowPane.updateBean().getFrom());
- int titleTo = valid(useRepeatTitleRCheckBox, this.repeatTitleRowPane.updateBean().getTo());
- attribute.setRepeatHeaderRowFrom(titleFrom);
- attribute.setRepeatHeaderRowTo(titleTo);
-
- int finishFrom = valid(useRepeatFinisRCheckBox, this.repeatFinisRowPane.updateBean().getFrom());
- int finishTo = valid(useRepeatFinisRCheckBox, this.repeatFinisRowPane.updateBean().getTo());
- attribute.setRepeatFooterRowFrom(finishFrom);
- attribute.setRepeatFooterRowTo(finishTo);
-
- attribute.setUsePageFrozenRow(this.usePageFrozenRCheckBox.isSelected());
- }
-
- private int valid(UICheckBox checkBox, int num){
- return checkBox.isSelected() ? num : -1;
- }
-
- protected void updateColPane(ReportPageAttrProvider attribute){
- int titleFrom = valid(useRepeatTitleCCheckBox, this.repeatTitleColPane.updateBean().getFrom());
- int titleTo = valid(useRepeatTitleCCheckBox, this.repeatTitleColPane.updateBean().getTo());
- attribute.setRepeatHeaderColumnFrom(titleFrom);
- attribute.setRepeatHeaderColumnTo(titleTo);
-
- int finishFrom = valid(useRepeatFinisCCheckBox, this.repeatFinisColPane.updateBean().getFrom());
- int finishTo = valid(useRepeatFinisCCheckBox, this.repeatFinisColPane.updateBean().getTo());
- attribute.setRepeatFooterColumnFrom(finishFrom);
- attribute.setRepeatFooterColumnTo(finishTo);
-
- attribute.setUsePageFrozenColumn(this.usePageFrozenCCheckBox.isSelected());
- }
-
+ * 重复标题行
+ */
+ private JPanel initRowStartPane() {
+ JPanel soverlapRowStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
+ useRepeatTitleRCheckBox = new UICheckBox();
+ soverlapRowStartPane.add(useRepeatTitleRCheckBox);
+ soverlapRowStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Title_Start_Row", "From"})));
+ repeatTitleRowPane = new RepeatRowPane();
+ soverlapRowStartPane.add(repeatTitleRowPane);
+
+ return soverlapRowStartPane;
+ }
+
+ /**
+ * 重复标题列
+ */
+ private JPanel initColStartPane() {
+ // 重复打印标题的起始列
+ JPanel soverlapColStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
+ useRepeatTitleCCheckBox = new UICheckBox();
+ soverlapColStartPane.add(useRepeatTitleCCheckBox);
+ soverlapColStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Title_Start_Column", "From"})));
+ // 重复打印标题的结束列
+ repeatTitleColPane = new RepeatColPane();
+ soverlapColStartPane.add(repeatTitleColPane);
+
+ return soverlapColStartPane;
+ }
+
+ /**
+ * 重复结尾行
+ */
+ private JPanel initFootRowStarPane() {
+ // 重复打印结尾的起始行
+ JPanel foverlapRowStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
+ useRepeatFinisRCheckBox = new UICheckBox();
+ foverlapRowStartPane.add(useRepeatFinisRCheckBox);
+ foverlapRowStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Finis_Start_Row", "From"})));
+ repeatFinisRowPane = new RepeatRowPane();
+ foverlapRowStartPane.add(repeatFinisRowPane);
+
+ return foverlapRowStartPane;
+ }
+
/**
- * 更新WriteFrozenColumnRow
- *
- * @return 行列
- *
- *
- * @date 2014-11-14-下午2:29:45
- *
- */
- public ColumnRow updateWriteFrozenColumnRow() {
- if (useWriteFrozenCCheckBox.isSelected() || useWriteFrozenRCheckBox.isSelected()) {
- int col = useWriteFrozenCCheckBox.isSelected() ? freezeWriteColPane.updateBean().getTo() + 1 : 0;
- int row = useWriteFrozenRCheckBox.isSelected() ? freezeWriteRowPane.updateBean().getTo() + 1 : 0;
+ * 重复结尾列
+ */
+ private JPanel initFootColStartPane() {
+ // 重复打印结尾的起始列
+ JPanel foverlapColStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
+ useRepeatFinisCCheckBox = new UICheckBox();
+ foverlapColStartPane.add(useRepeatFinisCCheckBox);
+ foverlapColStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Finis_Start_Column", "From"})));
+ repeatFinisColPane = new RepeatColPane();
+ foverlapColStartPane.add(repeatFinisColPane);
+
+ return foverlapColStartPane;
+ }
+
+ /**
+ * 获取分页冻结的标题(表单中不需要写分页二字)
+ *
+ * @return 分页冻结的标题
+ * @date 2014-11-14-下午1:32:08
+ */
+ protected String getPageFrozenTitle() {
+ return Inter.getLocText("FR-Engine_Page-Frozen");
+ }
+
+ /**
+ * 分页冻结Pane
+ */
+ private JPanel initPageFrozenPane() {
+ JPanel pagePanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
+ // 分页冻结
+ UILabel pageLabel = new UILabel(getPageFrozenTitle());
+ JPanel pageLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
+ pageLabelPanel.add(pageLabel);
+ pagePanel.add(pageLabelPanel, BorderLayout.NORTH);
+ JPanel pagecon = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1);
+ pagecon.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
+ pagePanel.add(pagecon, BorderLayout.CENTER);
+ UILabel warningx = new UILabel("(" + Inter.getLocText("FR-Engine_Please_Set_Repeat_First") + ")");
+ warningx.setForeground(Color.red);
+ pageLabelPanel.add(warningx);
+
+ JPanel pageRowGridPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
+ pageRowGridPane.add(this.usePageFrozenRCheckBox = new UICheckBox());
+ pagecon.add(pageRowGridPane);
+ // 显示行冻结信息的panel
+ freezePageRowPane = new FreezePagePane(true);
+ pageRowGridPane.add(freezePageRowPane);
+ addPageFrozenCol(pagecon);
+
+ return pagePanel;
+ }
+
+ /**
+ * 分页冻结列
+ */
+ private void addPageFrozenCol(JPanel pagecon) {
+ // 显示列冻结信息的panel
+ freezePageColPane = new FreezePagePane(false);
+ JPanel pageColGridPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
+ pageColGridPane.add(this.usePageFrozenCCheckBox = new UICheckBox());
+ pagecon.add(pageColGridPane);
+ pageColGridPane.add(freezePageColPane);
+ }
+
+ /**
+ * 填报冻结Pane
+ */
+ private JPanel initWriteFrozenPane() {
+ JPanel writePanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
+ // 填报冻结
+ UILabel writeLabel = new UILabel(Inter.getLocText(new String[]{"Face_Write", "Frozen"}) + ":");
+ JPanel writeLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
+ writeLabelPanel.add(writeLabel);
+ writePanel.add(writeLabelPanel, BorderLayout.NORTH);
+ JPanel writecon = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1);
+ writecon.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
+ writePanel.add(writecon, BorderLayout.CENTER);
+
+ // 行冻结
+ JPanel writeRowPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
+ writeRowPane.add(this.useWriteFrozenRCheckBox = new UICheckBox());
+ // 列冻结
+ JPanel writeColPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
+ writeColPane.add(this.useWriteFrozenCCheckBox = new UICheckBox());
+ writecon.add(writeRowPane);
+ freezeWriteRowPane = new FreezeWriteRowPane();
+ writeRowPane.add(freezeWriteRowPane);
+ writecon.add(writeColPane);
+ freezeWriteColPane = new FreezeWriteColPane();
+ writeColPane.add(freezeWriteColPane);
+
+ return writePanel;
+ }
+
+ public RepeatAndFreezeSettingPane() {
+ this.setLayout(FRGUIPaneFactory.createBorderLayout());
+ JPanel outrepeatPanel = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Engine_Repeat"));
+ JPanel cenrepeatPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
+ outrepeatPanel.add(cenrepeatPanel);
+ JPanel outfreezePanel = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Engine_Frozen"));
+ this.add(outrepeatPanel, BorderLayout.NORTH);
+ this.add(outfreezePanel, BorderLayout.CENTER);
+ JPanel repeatPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1);
+ repeatPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
+ JPanel freezePanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
+
+ //自适应插件
+ JPanel infoPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Attention"));
+
+ BoxCenterAligmentPane actionLabel = getURLActionLabel(Inter.getLocText("FR-Designer_Form-Fit-Tip"));
+ infoPane.add(actionLabel, BorderLayout.SOUTH);
+
+ outfreezePanel.add(freezePanel);
+ this.add(infoPane, BorderLayout.SOUTH);
+ // 重复打印部分
+ // 重复打印标题的起始行
+ JPanel labelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
+ labelPanel.add(new UILabel(Inter.getLocText("FR-Engine_Select_the_repeated_row_and_column") + ":"));
+ UILabel warning = new UILabel("(" + Inter.getLocText("FR-Engine_FreezeWarning1") + ")");
+ warning.setForeground(Color.red);
+ labelPanel.add(warning);
+ cenrepeatPanel.add(labelPanel, BorderLayout.NORTH);
+ cenrepeatPanel.add(repeatPanel, BorderLayout.CENTER);
+
+ repeatPanel.add(initRowStartPane());
+ addColStart(repeatPanel);
+ repeatPanel.add(initFootRowStarPane());
+ addFootColStart(repeatPanel);
+
+ freezePanel.add(initPageFrozenPane(), BorderLayout.NORTH);
+ addWriteFrozen(freezePanel);
+
+ initPageRwoListener();
+ initPageColListener();
+ initWriteListener();
+ }
+
+ protected void initWriteListener() {
+ // 填报重复冻结行
+ useWriteFrozenCCheckBox.addChangeListener(useWriteFrozenCListener);
+ // 填报重复冻结列
+ useWriteFrozenRCheckBox.addChangeListener(useWriteFrozenRListener);
+ }
+
+ private void initPageRwoListener() {
+ repeatTitleRowPane.addListener(freezePageRowListener);
+ // 分页重复冻结行
+ usePageFrozenRCheckBox.addChangeListener(usePageFrozenRListener);
+ //重复标题行
+ useRepeatTitleRCheckBox.addChangeListener(useRepeatTitleRListener);
+ //重复结尾行
+ useRepeatFinisRCheckBox.addChangeListener(useRepeatFinisRListener);
+ }
+
+ protected void initPageColListener() {
+ repeatTitleColPane.addListener(freezePageColListener);
+ // 分页重复冻结列
+ usePageFrozenCCheckBox.addChangeListener(usePageFrozenCListener);
+ //重复标题列
+ useRepeatTitleCCheckBox.addChangeListener(useRepeatTitleCListener);
+ //重复结尾列
+ useRepeatFinisCCheckBox.addChangeListener(useRepeatFinisCListener);
+ }
+
+ protected void addWriteFrozen(JPanel freezePanel) {
+ freezePanel.add(initWriteFrozenPane(), BorderLayout.CENTER);
+ }
+
+ protected void addFootColStart(JPanel repeatPanel) {
+ repeatPanel.add(initFootColStartPane());
+ }
+
+ protected void addColStart(JPanel repeatPanel) {
+ repeatPanel.add(initColStartPane());
+ }
+
+ ChangeListener useRepeatFinisCListener = new ChangeListener() {
+
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ repeatFinisColPane.setEnabled(useRepeatFinisCCheckBox.isSelected());
+
+ }
+ };
+
+ ChangeListener useRepeatFinisRListener = new ChangeListener() {
+
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ repeatFinisRowPane.setEnabled(useRepeatFinisRCheckBox.isSelected());
+
+ }
+ };
+
+ ChangeListener useRepeatTitleCListener = new ChangeListener() {
+
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ boolean flag = useRepeatTitleCCheckBox.isSelected();
+ repeatTitleColPane.setEnabled(flag);
+ if (!flag) {
+ usePageFrozenCCheckBox.setSelected(false);
+ usePageFrozenCCheckBox.setEnabled(false);
+ } else {
+ usePageFrozenCCheckBox.setEnabled(true);
+ }
+ }
+ };
+
+ ChangeListener useRepeatTitleRListener = new ChangeListener() {
+
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ boolean flag = useRepeatTitleRCheckBox.isSelected();
+ repeatTitleRowPane.setEnabled(flag);
+ if (!flag) {
+ usePageFrozenRCheckBox.setSelected(false);
+ usePageFrozenRCheckBox.setEnabled(false);
+ } else {
+ usePageFrozenRCheckBox.setEnabled(true);
+ }
+ }
+ };
+
+ ChangeListener useWriteFrozenRListener = new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ boolean flag = useWriteFrozenRCheckBox.isSelected();
+ freezeWriteRowPane.setEnabled(flag);
+
+ }
+ };
+
+ ChangeListener useWriteFrozenCListener = new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ boolean flag = useWriteFrozenCCheckBox.isSelected();
+ freezeWriteColPane.setEnabled(flag);
+
+ }
+ };
+
+ ChangeListener usePageFrozenCListener = new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ freezePageColPane.setEnabled(usePageFrozenCCheckBox.isSelected());
+ }
+ };
+
+ ChangeListener usePageFrozenRListener = new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ freezePageRowPane.setEnabled(usePageFrozenRCheckBox.isSelected());
+ }
+ };
+
+ // 分页重复冻结行数据联动
+ ChangeListener freezePageRowListener = new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ FT ft = repeatTitleRowPane.updateBean();
+ int to = ft.getTo();
+ freezePageRowPane.populateBean(new FT(to > -1 ? 0 : -1, to));
+ }
+ };
+
+ // 分页重复冻结列数据联动
+ ChangeListener freezePageColListener = new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ FT ft = repeatTitleColPane.updateBean();
+ int to = ft.getTo();
+ freezePageColPane.populateBean(new FT(to > -1 ? 0 : -1, to));
+ }
+ };
+
+ /**
+ * 窗口标题
+ *
+ * @date 2014-11-14-下午2:30:58
+ */
+ protected String title4PopupWindow() {
+ return Inter.getLocText("FR-Engine_Repeat-Freeze");
+ }
+
+ public void populate(ReportPageAttrProvider attribute) {
+
+ if (attribute == null) {
+ attribute = (ReportPageAttrProvider) StableFactory.createXmlObject(ReportPageAttrProvider.XML_TAG);
+ }
+ FT defaultFT = new FT(0, 0);
+ populatColPane(attribute, defaultFT);
+ populateRowPane(attribute, defaultFT);
+ }
+
+ protected void populateRowPane(ReportPageAttrProvider attribute, FT defaultFT) {
+ FT ft = new FT(new Integer(attribute.getRepeatHeaderRowFrom()), new Integer(attribute.getRepeatHeaderRowTo()));
+ if (isDefalut(ft)) {
+ this.repeatTitleRowPane.populateBean(defaultFT);
+ this.repeatTitleRowPane.setEnabled(false);
+ usePageFrozenRCheckBox.setEnabled(false);
+ } else {
+ this.repeatTitleRowPane.populateBean(ft);
+ useRepeatTitleRCheckBox.setSelected(true);
+ }
+
+ ft = new FT(new Integer(attribute.getRepeatFooterRowFrom()), new Integer(attribute.getRepeatFooterRowTo()));
+ if (isDefalut(ft)) {
+ this.repeatFinisRowPane.populateBean(defaultFT);
+ this.repeatFinisRowPane.setEnabled(false);
+ useRepeatFinisRCheckBox.setSelected(false);
+ } else {
+ this.repeatFinisRowPane.populateBean(ft);
+ useRepeatFinisRCheckBox.setSelected(true);
+ }
+
+ this.usePageFrozenRCheckBox.setSelected(attribute.isUsePageFrozenRow());
+ this.freezePageRowPane.setEnabled(attribute.isUsePageFrozenRow());
+ }
+
+ protected void populatColPane(ReportPageAttrProvider attribute, FT defaultFT) {
+ FT ft = new FT(new Integer(attribute.getRepeatHeaderColumnFrom()), new Integer(attribute.getRepeatHeaderColumnTo()));
+ if (isDefalut(ft)) {
+ this.repeatTitleColPane.populateBean(defaultFT);
+ this.repeatTitleColPane.setEnabled(false);
+ usePageFrozenCCheckBox.setEnabled(false);
+ } else {
+ this.repeatTitleColPane.populateBean(ft);
+ useRepeatTitleCCheckBox.setSelected(true);
+ }
+
+ ft = new FT(new Integer(attribute.getRepeatFooterColumnFrom()), new Integer(attribute.getRepeatFooterColumnTo()));
+ if (isDefalut(ft)) {
+ this.repeatFinisColPane.populateBean(defaultFT);
+ this.repeatFinisColPane.setEnabled(false);
+ useRepeatFinisCCheckBox.setSelected(false);
+ } else {
+ this.repeatFinisColPane.populateBean(ft);
+ useRepeatFinisCCheckBox.setSelected(true);
+ }
+
+ this.usePageFrozenCCheckBox.setSelected(attribute.isUsePageFrozenColumn());
+ this.freezePageColPane.setEnabled(attribute.isUsePageFrozenColumn());
+ }
+
+ private boolean isDefalut(FT ob) {
+ return ob.getFrom() == -1 && ob.getTo() == -1;
+ }
+
+ /**
+ * 初始化填报冻结pane
+ *
+ * @param writeFrozenColumnRow 填报冻结格子
+ * @date 2014-11-14-下午2:30:15
+ */
+ public void populateWriteFrozenColumnRow(ColumnRow writeFrozenColumnRow) {
+ if (writeFrozenColumnRow != null) {
+ int col = writeFrozenColumnRow.getColumn();
+ int row = writeFrozenColumnRow.getRow();
+ if (col > 0) {
+ freezeWriteColPane.populateBean(new FT(1, col - 1));
+ }
+ if (row > 0) {
+ freezeWriteRowPane.populateBean(new FT(1, row - 1));
+ }
+
+ useWriteFrozenCCheckBox.setSelected(col > 0);
+ useWriteFrozenRCheckBox.setSelected(row > 0);
+ freezeWriteColPane.setEnabled(col > 0);
+ freezeWriteRowPane.setEnabled(row > 0);
+ } else {
+ useWriteFrozenCCheckBox.setSelected(false);
+ useWriteFrozenRCheckBox.setSelected(false);
+ freezeWriteRowPane.setEnabled(false);
+ freezeWriteColPane.setEnabled(false);
+ }
+ }
+
+ public ReportPageAttrProvider update() {
+ ReportPageAttrProvider attribute = (ReportPageAttrProvider) StableFactory.createXmlObject(ReportPageAttrProvider.XML_TAG);
+
+ updateRowPane(attribute);
+ updateColPane(attribute);
+
+ return attribute;
+ }
+
+ protected void updateRowPane(ReportPageAttrProvider attribute) {
+ // 重复标题行
+ int titleFrom = valid(useRepeatTitleRCheckBox, this.repeatTitleRowPane.updateBean().getFrom());
+ int titleTo = valid(useRepeatTitleRCheckBox, this.repeatTitleRowPane.updateBean().getTo());
+ attribute.setRepeatHeaderRowFrom(titleFrom);
+ attribute.setRepeatHeaderRowTo(titleTo);
+
+ int finishFrom = valid(useRepeatFinisRCheckBox, this.repeatFinisRowPane.updateBean().getFrom());
+ int finishTo = valid(useRepeatFinisRCheckBox, this.repeatFinisRowPane.updateBean().getTo());
+ attribute.setRepeatFooterRowFrom(finishFrom);
+ attribute.setRepeatFooterRowTo(finishTo);
+
+ attribute.setUsePageFrozenRow(this.usePageFrozenRCheckBox.isSelected());
+ }
+
+ private int valid(UICheckBox checkBox, int num) {
+ return checkBox.isSelected() ? num : -1;
+ }
+
+ protected void updateColPane(ReportPageAttrProvider attribute) {
+ int titleFrom = valid(useRepeatTitleCCheckBox, this.repeatTitleColPane.updateBean().getFrom());
+ int titleTo = valid(useRepeatTitleCCheckBox, this.repeatTitleColPane.updateBean().getTo());
+ attribute.setRepeatHeaderColumnFrom(titleFrom);
+ attribute.setRepeatHeaderColumnTo(titleTo);
+
+ int finishFrom = valid(useRepeatFinisCCheckBox, this.repeatFinisColPane.updateBean().getFrom());
+ int finishTo = valid(useRepeatFinisCCheckBox, this.repeatFinisColPane.updateBean().getTo());
+ attribute.setRepeatFooterColumnFrom(finishFrom);
+ attribute.setRepeatFooterColumnTo(finishTo);
+
+ attribute.setUsePageFrozenColumn(this.usePageFrozenCCheckBox.isSelected());
+ }
+
+ /**
+ * 更新WriteFrozenColumnRow
+ *
+ * @return 行列
+ * @date 2014-11-14-下午2:29:45
+ */
+ public ColumnRow updateWriteFrozenColumnRow() {
+ if (useWriteFrozenCCheckBox.isSelected() || useWriteFrozenRCheckBox.isSelected()) {
+ int col = useWriteFrozenCCheckBox.isSelected() ? freezeWriteColPane.updateBean().getTo() + 1 : 0;
+ int row = useWriteFrozenRCheckBox.isSelected() ? freezeWriteRowPane.updateBean().getTo() + 1 : 0;
return ColumnRow.valueOf(col, row);
}
- return null;
- }
-
- private BoxCenterAligmentPane getURLActionLabel(final String text) {
- ActionLabel actionLabel = new ActionLabel(text);
-
- actionLabel.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- try {
- //Desktop.getDesktop().browse(new URI(url));
- final PluginManagerPane managerPane = new PluginManagerPane();
- UIDialog dlg = new PluginShopDialog(DesignerContext.getDesignerFrame(),managerPane);
- PluginWebBridge.getHelper().setDialogHandle(dlg);
- dlg.setVisible(true);
- RepeatAndFreezeSettingPane.this.getTopLevelAncestor().setVisible(false);
- } catch (Exception exp) {
-
- }
- }
- });
-
- return new BoxCenterAligmentPane(actionLabel);
- }
-
- class BoxCenterAligmentPane extends JPanel {
-
- private UILabel textLabel;
-
- public BoxCenterAligmentPane(String text) {
- this(new UILabel(text));
- }
-
- public BoxCenterAligmentPane(UILabel label) {
- this.setLayout(FRGUIPaneFactory.createBorderLayout());
-
- JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
- this.add(centerPane, BorderLayout.CENTER);
- UILabel label1 = new UILabel(Inter.getLocText("FR-Designer_Form-Frozen-Tip"));
- label1.setForeground(new Color(255, 0, 0));
- UILabel label2 = new UILabel(Inter.getLocText("FR-Designer_Form-Forzen-Speed"));
- label2.setForeground(new Color(255, 0, 0));
- this.textLabel = label;
- centerPane.add(label1);
- centerPane.add(textLabel);
- centerPane.add(label2);
- }
-
- public void setFont(Font font) {
- super.setFont(font);
-
- if (textLabel != null) {
- textLabel.setFont(font);
- }
- }
- }
+ return null;
+ }
+
+ private BoxCenterAligmentPane getURLActionLabel(final String text) {
+ ActionLabel actionLabel = new ActionLabel(text);
+
+ actionLabel.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ try {
+ //Desktop.getDesktop().browse(new URI(url));
+ BasicPane managerPane = new WebManagerPaneFactory().createPluginPane();
+ UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);
+ PluginWebBridge.getHelper().setDialogHandle(dlg);
+ dlg.setVisible(true);
+ RepeatAndFreezeSettingPane.this.getTopLevelAncestor().setVisible(false);
+ } catch (Exception exp) {
+
+ }
+ }
+ });
+
+ return new BoxCenterAligmentPane(actionLabel);
+ }
+
+ class BoxCenterAligmentPane extends JPanel {
+
+ private UILabel textLabel;
+
+ public BoxCenterAligmentPane(String text) {
+ this(new UILabel(text));
+ }
+
+ public BoxCenterAligmentPane(UILabel label) {
+ this.setLayout(FRGUIPaneFactory.createBorderLayout());
+
+ JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
+ this.add(centerPane, BorderLayout.CENTER);
+ UILabel label1 = new UILabel(Inter.getLocText("FR-Designer_Form-Frozen-Tip"));
+ label1.setForeground(new Color(255, 0, 0));
+ UILabel label2 = new UILabel(Inter.getLocText("FR-Designer_Form-Forzen-Speed"));
+ label2.setForeground(new Color(255, 0, 0));
+ this.textLabel = label;
+ centerPane.add(label1);
+ centerPane.add(textLabel);
+ centerPane.add(label2);
+ }
+
+ public void setFont(Font font) {
+ super.setFont(font);
+
+ if (textLabel != null) {
+ textLabel.setFont(font);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java
index b536c927e4..367b04ae9e 100644
--- a/designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java
+++ b/designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java
@@ -22,7 +22,6 @@ import com.fr.form.ui.IframeEditor;
import com.fr.general.Inter;
import com.fr.stable.ParameterProvider;
import com.fr.design.widget.DataModify;
-import com.fr.third.org.apache.poi.hssf.record.formula.functions.Abs;
public class IframeEditorDefinePane extends AbstractDataModify {
private UITextField srcTextField;
diff --git a/designer_base/build.dev.gradle b/designer_base/build.dev.gradle
new file mode 100644
index 0000000000..7b3bea2ba9
--- /dev/null
+++ b/designer_base/build.dev.gradle
@@ -0,0 +1,70 @@
+
+apply plugin: 'java'
+tasks.withType(JavaCompile){
+ options.encoding = 'UTF-8'
+}
+//指定构建的jdk版本
+sourceCompatibility=1.8
+//指定生成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
+
+
+
diff --git a/designer_base/src/com/fr/design/actions/UpdateAction.java b/designer_base/src/com/fr/design/actions/UpdateAction.java
index 72cd74c537..93a553f9ca 100644
--- a/designer_base/src/com/fr/design/actions/UpdateAction.java
+++ b/designer_base/src/com/fr/design/actions/UpdateAction.java
@@ -12,10 +12,13 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UICheckBoxMenuItem;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.menu.ShortCut;
+import com.fr.design.selection.SelectionListener;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ContainerEvent;
import java.beans.PropertyChangeListener;
import java.util.HashMap;
import java.util.Iterator;
@@ -321,12 +324,24 @@ public abstract class UpdateAction extends ShortCut implements Action {
toolBar.add(this.createToolBarComponent());
}
+ public abstract static class ComponentRemoveEvent extends ComponentEvent {
+
+ private static int EVENT_DELETE= 3001;
+
+ public ComponentRemoveEvent(Component source) {
+ super(source, EVENT_DELETE);
+ }
+
+ public abstract void release(SelectionListener listener);
+ }
+
/**
* 全局style的菜单
*/
public static class UseMenuItem extends UIMenuItem {
private NameStyle nameStyle;
+ private SelectionListener listener;
public UseMenuItem(Action action) {
super(action);
@@ -337,6 +352,18 @@ public abstract class UpdateAction extends ShortCut implements Action {
super(text, icon);
}
+ protected void processEvent(AWTEvent e) {
+ if (e instanceof ComponentRemoveEvent) {
+ ((ComponentRemoveEvent) e).release(listener);
+ return;
+ }
+ super.processEvent(e);
+ }
+
+ public void setSelectionListener(SelectionListener listener) {
+ this.listener = listener;
+ }
+
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
diff --git a/designer_base/src/com/fr/design/actions/server/PluginManagerAction.java b/designer_base/src/com/fr/design/actions/server/PluginManagerAction.java
index d88fdf9929..fee4678202 100644
--- a/designer_base/src/com/fr/design/actions/server/PluginManagerAction.java
+++ b/designer_base/src/com/fr/design/actions/server/PluginManagerAction.java
@@ -2,10 +2,11 @@ package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
+import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
-import com.fr.design.extra.PluginManagerPane;
import com.fr.design.extra.PluginWebBridge;
-import com.fr.design.extra.PluginShopDialog;
+import com.fr.design.extra.ShopDialog;
+import com.fr.design.extra.WebManagerPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
@@ -29,8 +30,8 @@ public class PluginManagerAction extends UpdateAction {
@Override
public void actionPerformed(ActionEvent e) {
- final PluginManagerPane managerPane = new PluginManagerPane();
- UIDialog dlg = new PluginShopDialog(DesignerContext.getDesignerFrame(),managerPane);
+ BasicPane managerPane = new WebManagerPaneFactory().createPluginPane();
+ UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);
PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true);
}
diff --git a/designer_base/src/com/fr/design/actions/server/ReuseManagerAction.java b/designer_base/src/com/fr/design/actions/server/ReuseManagerAction.java
new file mode 100644
index 0000000000..3bd21a0d91
--- /dev/null
+++ b/designer_base/src/com/fr/design/actions/server/ReuseManagerAction.java
@@ -0,0 +1,53 @@
+package com.fr.design.actions.server;
+
+import com.fr.base.BaseUtils;
+import com.fr.design.actions.UpdateAction;
+import com.fr.design.dialog.BasicPane;
+import com.fr.design.dialog.UIDialog;
+import com.fr.design.extra.ShopDialog;
+import com.fr.design.extra.PluginWebBridge;
+import com.fr.design.extra.WebManagerPaneFactory;
+import com.fr.design.mainframe.DesignerContext;
+import com.fr.design.menu.MenuKeySet;
+import com.fr.general.Inter;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+
+/**
+ * Created by vito on 2016/9/27.
+ */
+public class ReuseManagerAction extends UpdateAction {
+
+ public ReuseManagerAction() {
+ this.setMenuKeySet(REUSE_MANAGER);
+ this.setName(getMenuKeySet().getMenuKeySetName());
+ this.setMnemonic(getMenuKeySet().getMnemonic());
+ this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/server/plugin.png"));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ BasicPane managerPane = new WebManagerPaneFactory().createReusePane();
+ UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);
+ PluginWebBridge.getHelper().setDialogHandle(dlg);
+ dlg.setVisible(true);
+ }
+
+ public static final MenuKeySet REUSE_MANAGER = new MenuKeySet() {
+ @Override
+ public char getMnemonic() {
+ return 'R';
+ }
+
+ @Override
+ public String getMenuName() {
+ return Inter.getLocText("FR-Designer-Reuse_Manager");
+ }
+
+ @Override
+ public KeyStroke getKeyStroke() {
+ return null;
+ }
+ };
+}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer_base/src/com/fr/design/data/datapane/connect/JDBCDefPane.java
index 5e6cd1292a..07c5b91006 100644
--- a/designer_base/src/com/fr/design/data/datapane/connect/JDBCDefPane.java
+++ b/designer_base/src/com/fr/design/data/datapane/connect/JDBCDefPane.java
@@ -43,7 +43,8 @@ public class JDBCDefPane extends JPanel {
new DriverURLName("org.hsqldb.jdbcDriver", "jdbc:hsqldb:file:[PATH_TO_DB_FILES]"), new DriverURLName("com.inet.tds.TdsDriver", "jdbc:inetdae7:localhost:1433/"),
new DriverURLName("COM.cloudscape.JDBCDriver", "jdbc:cloudscape:/cloudscape/"),
new DriverURLName("com.internetcds.jdbc.tds.Driver", "jdbc:freetds:sqlserver://localhost/")});
-// jdbcMap.put("Hadoop Hive",new DriverURLName[]{new DriverURLName("org.apache.hadoop.hive.jdbc.HiveDriver","jdbc:hive://localhost:10000/default")});
+ jdbcMap.put("Inceptor",new DriverURLName[]{new DriverURLName("org.apache.hive.jdbc.HiveDriver","jdbc:inceptor2://localhost:10000/default"),
+ new DriverURLName("org.apache.hadoop.hive.jdbc.HiveDriver","jdbc:inceptor://localhost:10000/default")});
jdbcMap.put("Oracle", new DriverURLName[]{new DriverURLName("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@localhost:1521:databaseName")});
jdbcMap.put("DB2", new DriverURLName[]{new DriverURLName("com.ibm.db2.jcc.DB2Driver", "jdbc:db2://localhost:50000/")});
jdbcMap.put("SQL Server", new DriverURLName[]{new DriverURLName("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://localhost:1433;" + "databaseName=")});
@@ -63,7 +64,7 @@ public class JDBCDefPane extends JPanel {
private UITextField userNameTextField;
private JPasswordField passwordTextField;
// 请不要改动dbtype,只应该最后添加
- private final String[] dbtype = {"", "Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre","SQLite", "Others"};
+ private final String[] dbtype = {"", "Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre","SQLite","Inceptor", "Others"};
// carl:DBCP的一些属性
private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor();
diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
index fd127375d2..7a40959ed2 100644
--- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
+++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
@@ -1,16 +1,23 @@
package com.fr.design.data.tabledata.tabledatapane;
+import com.fr.base.Parameter;
import com.fr.data.impl.ClassTableData;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.JavaEditorPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.gui.itableeditorpane.ParameterTableModel;
+import com.fr.design.gui.itableeditorpane.UITableEditAction;
+import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
+import com.fr.general.IOUtils;
import com.fr.general.Inter;
+import com.fr.script.Calculator;
+import com.fr.stable.ParameterProvider;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
@@ -21,6 +28,7 @@ import java.io.File;
public class ClassTableDataPane extends AbstractTableDataPane {
private UITextField classNameTextField;
+ private UITableEditorPane editorPane;
public ClassTableDataPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@@ -89,13 +97,62 @@ public class ClassTableDataPane extends AbstractTableDataPane {
};
JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.add(northPane, BorderLayout.NORTH);
- // TODO alex_ENV
-// northPane.add(flowTableLayoutHelper.createLabelFlowPane(
-// " ", new UILabel(Inter.getLocText("Example") + ":" +
-// BaseCoreUtils.pathJoin(new String[] {FRContext.getCurrentEnv().getPath(), "classes"}))));
+ this.add(initSouthPanel(), BorderLayout.SOUTH);
+ }
+ private JPanel initSouthPanel() {
+ JPanel jpanel = new JPanel();
+ jpanel.setPreferredSize(new Dimension(-1, 150));
+ jpanel.setLayout(new BorderLayout());
+
+ editorPane = new UITableEditorPane(new ParameterTableModel() {
+ @Override
+ public UITableEditAction[] createAction() {
+ return new UITableEditAction[]{
+ new AddParaAction(),
+ new RemoveParaAction()
+ };
+ }
+ }, " " + Inter.getLocText("FR-Designer_TableData-Default-Para"));
+
+ jpanel.add(editorPane, BorderLayout.CENTER);
+ return jpanel;
}
-
+
+ public class AddParaAction extends UITableEditAction {
+ public AddParaAction() {
+ this.setName(Inter.getLocText("FR-Designer_Add"));
+ this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ java.util.List oldParas = editorPane.update();
+ oldParas.add(new Parameter());
+ editorPane.populate(oldParas.toArray(new ParameterProvider[oldParas.size()]));
+ }
+
+ @Override
+ public void checkEnabled() {
+ }
+ }
+ private class RemoveParaAction extends UITableEditAction {
+ public RemoveParaAction() {
+ this.setName(Inter.getLocText("FR-Designer_Remove"));
+ this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/control/remove.png"));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ ParameterProvider selectedPara = editorPane.getTableModel().getSelectedValue();
+ java.util.List oldParas = editorPane.update();
+ oldParas.remove(selectedPara);
+ editorPane.populate(oldParas.toArray(new ParameterProvider[oldParas.size()]));
+ }
+
+ @Override
+ public void checkEnabled() {
+ }
+ }
+
@Override
protected String title4PopupWindow() {
return Inter.getLocText("DS-Class_TableData");
@@ -103,12 +160,17 @@ public class ClassTableDataPane extends AbstractTableDataPane {
@Override
public void populateBean(ClassTableData ob) {
+ this.editorPane.populate(ob.getParameters(Calculator.createCalculator()));
this.classNameTextField.setText(ob.getClassName());
}
@Override
public ClassTableData updateBean() {
- return new ClassTableData(this.classNameTextField.getText());
+ ClassTableData tableData = new ClassTableData(this.classNameTextField.getText());
+ java.util.List paras = this.editorPane.update();
+ tableData.setParameters(paras.toArray(new ParameterProvider[paras.size()]));
+
+ return tableData;
}
diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
index 8fbb7af568..3ba059d221 100644
--- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
+++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
@@ -99,12 +99,6 @@ public class MultiTDTableDataPane extends AbstractTableDataPane MAX_LENTH_OF_DATASET) {
- tmp = tmp.substring(0, tmp.length() - SUB_LENGTH);
- tmp = tmp + "...";
- uiLabel = new UILabel(tmp);
- }
if (!ComparatorUtils.equals(tableDataWrappe.getTableDataName(), multiName)) {
centerPanel.add(new BarPanel(tmp, tableDataWrappe.getIcon()));
}
@@ -285,12 +279,18 @@ public class MultiTDTableDataPane extends AbstractTableDataPane MAX_LENTH_OF_DATASET) {
+ tmp = tmp.substring(0, tmp.length() - SUB_LENGTH);
+ tmp = tmp + "...";
+ tabledataName = new UILabel(tmp);
+ }
UILabel iconLabel = new UILabel(icon);
chekbox.addActionListener(tableDataCheckboxListener);
iconLabel.addMouseListener(chooseTableDataListener);
diff --git a/designer_base/src/com/fr/design/extra/LoginWebBridge.java b/designer_base/src/com/fr/design/extra/LoginWebBridge.java
index 482dde4903..b604ae8d8b 100644
--- a/designer_base/src/com/fr/design/extra/LoginWebBridge.java
+++ b/designer_base/src/com/fr/design/extra/LoginWebBridge.java
@@ -210,7 +210,7 @@ public class LoginWebBridge {
*/
public void forgetHref() {
try {
- Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default")));
+ Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.reset")));
}catch (Exception e) {
FRContext.getLogger().info(e.getMessage());
}
@@ -267,7 +267,6 @@ public class LoginWebBridge {
if (uiDialog != null) {
uiDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
uiDialog.setVisible(false);
- uiDialog.dispose();
}
}
@@ -336,4 +335,4 @@ public class LoginWebBridge {
}
return UNKNOWN_ERROR;
}
-}
\ No newline at end of file
+}
diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java
index 4446ffae82..12c3e85c41 100644
--- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java
+++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java
@@ -42,6 +42,7 @@ public class PluginWebBridge {
private String ACTION = "action";
private String KEYWORD = "keyword";
private Map config;
+ private WebEngine webEngine;
private UILabel uiLabel;
@@ -79,8 +80,6 @@ public class PluginWebBridge {
return helper;
}
- private WebEngine webEngine;
-
private PluginWebBridge() {
}
@@ -380,7 +379,8 @@ public class PluginWebBridge {
*/
public void getPriviteMessage() {
try {
- Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default")));
+ String loginUrl = SiteCenter.getInstance().acquireUrlByKind("bbs.default");
+ Desktop.getDesktop().browse(new URI(loginUrl));
}catch (Exception exp) {
FRContext.getLogger().info(exp.getMessage());
}
@@ -509,7 +509,7 @@ public class PluginWebBridge {
*/
public void forgetHref() {
try {
- Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default")));
+ Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.reset")));
}catch (Exception e) {
FRContext.getLogger().info(e.getMessage());
}
diff --git a/designer_base/src/com/fr/design/extra/PluginWebPane.java b/designer_base/src/com/fr/design/extra/PluginWebPane.java
index 0f2bd07608..ce32babc79 100644
--- a/designer_base/src/com/fr/design/extra/PluginWebPane.java
+++ b/designer_base/src/com/fr/design/extra/PluginWebPane.java
@@ -19,7 +19,7 @@ public class PluginWebPane extends JFXPanel {
private WebEngine webEngine;
- public PluginWebPane(final String installHome) {
+ public PluginWebPane(final String mainJs) {
Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override
@@ -29,7 +29,7 @@ public class PluginWebPane extends JFXPanel {
PluginWebPane.this.setScene(scene);
WebView webView = new WebView();
webEngine = webView.getEngine();
- webEngine.load("file:///" + installHome + "/scripts/store/web/index.html");
+ webEngine.load("file:///" + mainJs);
webEngine.setOnAlert(new EventHandler>() {
@Override
public void handle(WebEvent event) {
diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java
index a2826cd0dd..d0bcc27e12 100644
--- a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java
+++ b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java
@@ -117,7 +117,7 @@ public class QQLoginWebBridge {
//账号没有QQ授权
closeQQWindow();
try {
- Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default")));
+ Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("QQ_binding")));
}catch (Exception exp) {
}
}
@@ -127,24 +127,5 @@ public class QQLoginWebBridge {
if (url.indexOf("qqLogin.html") > 0) {
return;
}
- if (Desktop.isDesktopSupported()) {
- try {
- //创建一个URI实例,注意不是URL
- URI uri = URI.create(url);
- //获取当前系统桌面扩展
- Desktop desktop = Desktop.getDesktop();
- //判断系统桌面是否支持要执行的功能
- if (desktop.isSupported(Desktop.Action.BROWSE)) {
- //获取系统默认浏览器打开链接
- desktop.browse(uri);
- }
- } catch (NullPointerException e) {
- //此为uri为空时抛出异常
- FRLogger.getLogger().error(e.getMessage());
- } catch (IOException e) {
- //此为无法获取系统默认浏览器
- FRLogger.getLogger().error(e.getMessage());
- }
- }
}
}
diff --git a/designer_base/src/com/fr/design/extra/ReuseWebBridge.java b/designer_base/src/com/fr/design/extra/ReuseWebBridge.java
new file mode 100644
index 0000000000..413f862759
--- /dev/null
+++ b/designer_base/src/com/fr/design/extra/ReuseWebBridge.java
@@ -0,0 +1,36 @@
+package com.fr.design.extra;
+
+import javafx.scene.web.WebEngine;
+
+/**
+ * Created by vito on 2016/9/28.
+ */
+public class ReuseWebBridge {
+ public static ReuseWebBridge helper;
+ private WebEngine webEngine;
+
+ public static ReuseWebBridge getHelper() {
+ if (helper != null) {
+ return helper;
+ }
+ synchronized (ReuseWebBridge.class) {
+ if (helper == null) {
+ helper = new ReuseWebBridge();
+ }
+ return helper;
+ }
+ }
+
+ public static ReuseWebBridge getHelper(WebEngine webEngine) {
+ getHelper();
+ helper.setEngine(webEngine);
+ return helper;
+ }
+
+ private ReuseWebBridge() {
+ }
+
+ public void setEngine(WebEngine webEngine) {
+ this.webEngine = webEngine;
+ }
+}
diff --git a/designer_base/src/com/fr/design/extra/ReuseWebPane.java b/designer_base/src/com/fr/design/extra/ReuseWebPane.java
new file mode 100644
index 0000000000..b48957e0f8
--- /dev/null
+++ b/designer_base/src/com/fr/design/extra/ReuseWebPane.java
@@ -0,0 +1,54 @@
+package com.fr.design.extra;
+
+import javafx.application.Platform;
+import javafx.embed.swing.JFXPanel;
+import javafx.event.EventHandler;
+import javafx.scene.Scene;
+import javafx.scene.layout.BorderPane;
+import javafx.scene.web.WebEngine;
+import javafx.scene.web.WebEvent;
+import javafx.scene.web.WebView;
+import netscape.javascript.JSObject;
+
+import javax.swing.*;
+
+/**
+ * Created by vito on 2016/9/28.
+ */
+public class ReuseWebPane extends JFXPanel {
+ private WebEngine webEngine;
+
+ public ReuseWebPane(final String mainJs) {
+ Platform.setImplicitExit(false);
+ Platform.runLater(new Runnable() {
+ @Override
+ public void run() {
+ BorderPane root = new BorderPane();
+ Scene scene = new Scene(root);
+ ReuseWebPane.this.setScene(scene);
+ WebView webView = new WebView();
+ webEngine = webView.getEngine();
+ webEngine.load("file:///" + mainJs);
+ webEngine.setOnAlert(new EventHandler>() {
+ @Override
+ public void handle(WebEvent event) {
+ showAlert(event.getData());
+ }
+ });
+ JSObject obj = (JSObject) webEngine.executeScript("window");
+ obj.setMember("ReuseHelper", ReuseWebBridge.getHelper(webEngine));
+ webView.setContextMenuEnabled(false);//屏蔽右键
+ root.setCenter(webView);
+ }
+ });
+ }
+
+ private void showAlert(final String message) {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ JOptionPane.showMessageDialog(ReuseWebPane.this, message);
+ }
+ });
+ }
+}
diff --git a/designer_base/src/com/fr/design/extra/PluginShopDialog.java b/designer_base/src/com/fr/design/extra/ShopDialog.java
similarity index 70%
rename from designer_base/src/com/fr/design/extra/PluginShopDialog.java
rename to designer_base/src/com/fr/design/extra/ShopDialog.java
index f2e1e93ec8..e2fb97b627 100644
--- a/designer_base/src/com/fr/design/extra/PluginShopDialog.java
+++ b/designer_base/src/com/fr/design/extra/ShopDialog.java
@@ -3,8 +3,7 @@ package com.fr.design.extra;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
-import com.fr.general.Inter;
-import javafx.embed.swing.JFXPanel;
+import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
@@ -12,19 +11,20 @@ import java.awt.*;
/**
* Created by vito on 16/4/18.
*/
-public class PluginShopDialog extends UIDialog {
+public class ShopDialog extends UIDialog {
private static final Dimension DEFAULT_SHOP = new Dimension(900, 700);
- public PluginShopDialog(Frame frame, BasicPane pane) {
+ public ShopDialog(Frame frame, BasicPane pane) {
super(frame);
- setUndecorated(true);
+ if (StableUtils.getMajorJavaVersion() == 8) {
+ setUndecorated(true);
+ }
JPanel panel = (JPanel) getContentPane();
panel.setLayout(new BorderLayout());
add(pane, BorderLayout.CENTER);
setSize(DEFAULT_SHOP);
GUICoreUtils.centerWindow(this);
setResizable(false);
- setTitle(Inter.getLocText("FR-Designer-Plugin_Manager"));
}
@Override
diff --git a/designer_base/src/com/fr/design/extra/PluginManagerPane.java b/designer_base/src/com/fr/design/extra/ShopManagerPane.java
similarity index 65%
rename from designer_base/src/com/fr/design/extra/PluginManagerPane.java
rename to designer_base/src/com/fr/design/extra/ShopManagerPane.java
index 1c9f7aafa4..12900c720b 100644
--- a/designer_base/src/com/fr/design/extra/PluginManagerPane.java
+++ b/designer_base/src/com/fr/design/extra/ShopManagerPane.java
@@ -4,7 +4,6 @@ import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicPane;
-import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
@@ -12,12 +11,12 @@ import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.plugin.PluginVerifyException;
import com.fr.stable.StableUtils;
+import javafx.embed.swing.JFXPanel;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.net.HttpURLConnection;
-import java.net.URL;
import java.util.concurrent.ExecutionException;
/**
@@ -31,82 +30,55 @@ import java.util.concurrent.ExecutionException;
* 因为如果直接嵌入WebView,和设计器的交互就需要预先设定好,这样灵活性会差很多,而如果使用JavaScript引擎,
* 就可以直接在JavaScript中和WebView组件做交互,而同时JavaScript中可以调用任何的设计器API.
*/
-public class PluginManagerPane extends BasicPane {
+public class ShopManagerPane extends BasicPane {
private static final String LATEST = "latest";
+ private ShopPaneConfig shopPaneConfig;
- public PluginManagerPane() {
+ public ShopManagerPane(ShopPaneConfig shopPaneConfig) {
+ this.shopPaneConfig = shopPaneConfig;
setLayout(new BorderLayout());
- if (StableUtils.getMajorJavaVersion() == 8) {
- String installHome;
- if (StableUtils.isDebug()) {
- URL url = ClassLoader.getSystemResource("");
- installHome = url.getPath();
- addPane(installHome);
- } else {
- installHome = StableUtils.getInstallHome();
- File file = new File(StableUtils.pathJoin(installHome, "scripts"));
- if (!file.exists()) {
- int rv = JOptionPane.showConfirmDialog(
- this,
- Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"),
- Inter.getLocText("FR-Designer-Plugin_Warning"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.INFORMATION_MESSAGE
- );
- if (rv == JOptionPane.OK_OPTION) {
- downloadShopScripts();
- }
- } else {
- addPane(installHome);
- updateShopScripts();
+ if (StableUtils.isDebug()) {
+ addPane();
+ } else {
+ File file = new File(shopPaneConfig.getMainJS());
+ if (!file.exists()) {
+ int rv = JOptionPane.showConfirmDialog(
+ this,
+ Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"),
+ Inter.getLocText("FR-Designer-Plugin_Warning"),
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.INFORMATION_MESSAGE
+ );
+ if (rv == JOptionPane.OK_OPTION) {
+ downloadShopScripts();
}
+ } else {
+ addPane();
+ updateShopScripts();
}
- } else {
- initTraditionalStore();
}
}
- /**
- * 以关键词打开设计器商店
- *
- * @param keyword 关键词
- */
- public PluginManagerPane(String keyword) {
- this();
- PluginWebBridge.getHelper().openWithSearch(keyword);
- }
-
- private void addPane(String installHome) {
- PluginWebPane webPane = new PluginWebPane(new File(installHome).getAbsolutePath());
+ private void addPane() {
+ JFXPanel webPane = shopPaneConfig.getWebPane();
add(webPane, BorderLayout.CENTER);
}
-
- private void initTraditionalStore() {
- UITabbedPane tabbedPane = new UITabbedPane();
- add(tabbedPane, BorderLayout.CENTER);
- PluginInstalledPane installedPane = new PluginInstalledPane();
- tabbedPane.addTab(installedPane.tabTitle(), installedPane);
- tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_Update"), new PluginUpdatePane(tabbedPane));
- tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_All_Plugins"), new PluginFromStorePane(tabbedPane));
- }
-
private void downloadShopScripts() {
new SwingWorker() {
@Override
protected Boolean doInBackground() throws Exception {
- String id = "shop_scripts";
String username = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
try {
- PluginHelper.downloadPluginFile(id, username, password, new Process() {
+ PluginHelper.downloadPluginFile(shopPaneConfig.getScriptsId(), username, password, new Process() {
@Override
public void process(Double integer) {
}
});
} catch (PluginVerifyException e) {
- JOptionPane.showMessageDialog(PluginManagerPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(ShopManagerPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
return false;
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
@@ -122,7 +94,7 @@ public class PluginManagerPane extends BasicPane {
if (get()) {
IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome());
int rv = JOptionPane.showOptionDialog(
- PluginManagerPane.this,
+ ShopManagerPane.this,
Inter.getLocText("FR-Designer-Plugin_Shop_Installed"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_OPTION,
@@ -151,7 +123,7 @@ public class PluginManagerPane extends BasicPane {
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
if (!ComparatorUtils.equals(httpClient.getResponseText(), LATEST)) {
int rv = JOptionPane.showConfirmDialog(
- PluginManagerPane.this,
+ ShopManagerPane.this,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
diff --git a/designer_base/src/com/fr/design/extra/ShopPaneConfig.java b/designer_base/src/com/fr/design/extra/ShopPaneConfig.java
new file mode 100644
index 0000000000..87bc719ee1
--- /dev/null
+++ b/designer_base/src/com/fr/design/extra/ShopPaneConfig.java
@@ -0,0 +1,24 @@
+package com.fr.design.extra;
+
+import javafx.embed.swing.JFXPanel;
+
+/**
+ * Created by vito on 2016/9/28.
+ */
+public abstract class ShopPaneConfig {
+ private String mainJS;
+ private String scriptsId;
+ private JFXPanel webPane;
+
+ public ShopPaneConfig() {
+ this.mainJS = getMainJS();
+ this.scriptsId = getScriptsId();
+ this.webPane = getWebPane();
+ }
+
+ abstract String getMainJS();
+
+ abstract String getScriptsId();
+
+ abstract JFXPanel getWebPane();
+}
diff --git a/designer_base/src/com/fr/design/extra/WebManagerPaneFactory.java b/designer_base/src/com/fr/design/extra/WebManagerPaneFactory.java
new file mode 100644
index 0000000000..75a79deddd
--- /dev/null
+++ b/designer_base/src/com/fr/design/extra/WebManagerPaneFactory.java
@@ -0,0 +1,99 @@
+package com.fr.design.extra;
+
+import com.fr.design.dialog.BasicPane;
+import com.fr.design.gui.frpane.UITabbedPane;
+import com.fr.general.Inter;
+import com.fr.stable.StableUtils;
+import javafx.embed.swing.JFXPanel;
+
+import java.awt.*;
+import java.io.File;
+import java.net.URL;
+
+/**
+ * Created by vito on 2016/9/28.
+ */
+public class WebManagerPaneFactory {
+ private String installHome;
+
+ public WebManagerPaneFactory() {
+ if (StableUtils.isDebug()) {
+ URL url = ClassLoader.getSystemResource("");
+ this.installHome = url.getPath();
+ } else {
+ this.installHome = StableUtils.getInstallHome();
+ }
+ }
+
+ public BasicPane createPluginPane() {
+ if (StableUtils.getMajorJavaVersion() == 8) {
+ return new ShopManagerPane(new ShopPaneConfig() {
+ @Override
+ String getMainJS() {
+ String relativePath = "/scripts/store/web/index.html";
+ return StableUtils.pathJoin(new File(installHome).getAbsolutePath(), relativePath);
+ }
+
+ @Override
+ String getScriptsId() {
+ return "shop_scripts";
+ }
+
+ @Override
+ JFXPanel getWebPane() {
+ return new PluginWebPane(getMainJS());
+ }
+
+ });
+ } else {
+ BasicPane traditionalStorePane = new BasicPane() {
+ @Override
+ protected String title4PopupWindow() {
+ return Inter.getLocText("FR-Designer-Plugin_Manager");
+ }
+ };
+ traditionalStorePane.setLayout(new BorderLayout());
+ traditionalStorePane.add(initTraditionalStore(), BorderLayout.CENTER);
+ return traditionalStorePane;
+ }
+ }
+
+ public BasicPane createReusePane() {
+ return new ShopManagerPane(new ShopPaneConfig() {
+ @Override
+ String getMainJS() {
+ String relativePath = "/scripts/store/reuse/index.html";
+ return StableUtils.pathJoin(new File(installHome).getAbsolutePath(), relativePath);
+ }
+
+ @Override
+ String getScriptsId() {
+ return "reuse_scripts";
+ }
+
+ @Override
+ JFXPanel getWebPane() {
+ return new ReuseWebPane(getMainJS());
+ }
+ });
+ }
+
+ /**
+ * 以关键词打开设计器商店
+ *
+ * @param keyword 关键词
+ */
+ public BasicPane createPluginPane(String keyword) {
+ PluginWebBridge.getHelper().openWithSearch(keyword);
+ return createPluginPane();
+ }
+
+ private Component initTraditionalStore() {
+ UITabbedPane tabbedPane = new UITabbedPane();
+ PluginInstalledPane installedPane = new PluginInstalledPane();
+ tabbedPane.addTab(installedPane.tabTitle(), installedPane);
+ tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_Update"), new PluginUpdatePane(tabbedPane));
+ tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_All_Plugins"), new PluginFromStorePane(tabbedPane));
+ return tabbedPane;
+ }
+}
diff --git a/designer_base/src/com/fr/design/fun/DesignerFrameUpButtonProvider.java b/designer_base/src/com/fr/design/fun/DesignerFrameUpButtonProvider.java
new file mode 100644
index 0000000000..b6a86ae81c
--- /dev/null
+++ b/designer_base/src/com/fr/design/fun/DesignerFrameUpButtonProvider.java
@@ -0,0 +1,24 @@
+package com.fr.design.fun;
+
+import com.fr.design.gui.ibutton.UIButton;
+import com.fr.stable.fun.mark.Mutable;
+
+/**
+ * 设计器面板最上方的按钮接口(保存,赋值,撤销同级)
+ * Coder: zack
+ * Date: 2016/9/22
+ * Time: 15:40
+ */
+public interface DesignerFrameUpButtonProvider extends Mutable {
+
+ int CURRENT_LEVEL = 1;
+
+ String XML_TAG = "DesignerFrameUpButtonProvider";
+
+ /**
+ * 根据当前的设计状态返回最上层工具按钮
+ * @param menuState 现在设计器的设计状态
+ * @return 按钮
+ */
+ UIButton[] getUpButtons(int menuState);
+}
diff --git a/designer_base/src/com/fr/design/fun/MenuHandler.java b/designer_base/src/com/fr/design/fun/MenuHandler.java
index 9573b11ddf..a6aaa4e8b1 100644
--- a/designer_base/src/com/fr/design/fun/MenuHandler.java
+++ b/designer_base/src/com/fr/design/fun/MenuHandler.java
@@ -18,6 +18,7 @@ public interface MenuHandler extends Mutable {
int LAST = -1;
+ int HIDE =-2;
String HELP = "help";
String SERVER = "server";
diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java b/designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java
new file mode 100644
index 0000000000..bd1f70829b
--- /dev/null
+++ b/designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java
@@ -0,0 +1,23 @@
+package com.fr.design.fun.impl;
+
+import com.fr.design.fun.DesignerFrameUpButtonProvider;
+import com.fr.design.gui.ibutton.UIButton;
+import com.fr.stable.fun.mark.API;
+
+/**
+ * Coder: zack
+ * Date: 2016/9/22
+ * Time: 15:50
+ */
+@API(level = DesignerFrameUpButtonProvider.CURRENT_LEVEL)
+public abstract class AbstractDsinFrameUpButtonProvider implements DesignerFrameUpButtonProvider {
+ @Override
+ public UIButton[] getUpButtons(int menuState) {
+ return new UIButton[0];
+ }
+
+ @Override
+ public String mark4Provider() {
+ return getClass().getName();
+ }
+}
diff --git a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java
index 1039cfac6c..8bf384b313 100644
--- a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java
+++ b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java
@@ -1,44 +1,52 @@
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_Layer-Build"),
- Inter.getLocText("FR-Designer_Auto-Build") };
+ private String[] buildWay = new String[]{Inter.getLocText("FR-Designer_DataTable-Build"),
+ Inter.getLocText("FR-Designer_Auto-Build"), Inter.getLocText("FR-Designer_Layer-Build")};
public TreeSettingPane(boolean isEditor) {
this.initComponents(isEditor);
- }
+ }
private void initComponents(boolean isEditor) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@@ -58,18 +66,34 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
controlPane = new JTreeControlPane(new NameableCreator[] { treeNode },
new TreeDataCardPane(), isEditor);
autoBuildPane = new JTreeAutoBuildPane();
- this.add(buildWayPanel, BorderLayout.NORTH);
- cardChanged(0);
- }
-
+ layerDataControlPane = new LayerDataControlPane();
+ this.add(buildWayPanel, BorderLayout.NORTH);
+ cardChanged(0);
+ }
+
private void cardChanged(int index) {
+
this.remove(controlPane);
this.remove(autoBuildPane);
- this.add(index == 0 ? controlPane : autoBuildPane, BorderLayout.CENTER);
- validate();
- repaint();
- revalidate();
- }
+ 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();
+ }
@Override
protected String title4PopupWindow() {
@@ -101,10 +125,19 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
buildBox.setSelectedIndex(1);
TableDataDictionary dictionary = treeEditor.getDictionary();
autoBuildPane.populate(dictionary);
- } else {
- buildBox.setSelectedIndex(0);
- }
- }
+ } else if (treeEditor.isLayerBuild()) {
+ buildBox.setSelectedIndex(0);
+ java.util.List layerConfigList = treeEditor.getLayerConfigs();
+ LayerConfig[] layerConfigs = new LayerConfig[layerConfigList.size()];
+ int i = 0;
+ for (LayerConfig layerConfig : layerConfigList) {
+ layerConfigs[i++] = layerConfig;
+ }
+ this.layerDataControlPane.populate(new NameObject("tree", layerConfigs));
+ } else {
+ buildBox.setSelectedIndex(2);
+ }
+ }
/**
* 视图树的update
@@ -123,43 +156,46 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
te.setAutoBuild(true);
te.setDictionary(dictionary);
te.setNodeOrDict(dictionary);
- } else {
+ } else if (buildBox.getSelectedIndex() == 2) {
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() == 0) {
- NameObject no = controlPane.update();
- if (no != null) {
- return no.getObject();
+
+ if (buildBox.getSelectedIndex() == 2) {
+ NameObject no = controlPane.update();
+ if (no != null) {
+ return no.getObject();
}
- } else {
- return autoBuildPane.update();
- }
- return null;
- }
+ } else if (buildBox.getSelectedIndex() == 0) {
+ return layerDataControlPane.update();
+ } else {
+ return autoBuildPane.update();
+ }
+ return null;
+ }
/**
* 下拉树的update
@@ -172,7 +208,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
tcb.setAutoBuild(true);
tcb.setDictionary(dictionary);
tcb.setNodeOrDict(dictionary);
- } else {
+ } else if (buildBox.getSelectedIndex() == 2) {
tcb.setAutoBuild(false);
NameObject no = this.controlPane.update();
if (no != null) {
@@ -204,12 +240,15 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
*/
public void populate(Object nodeOrDict) {
if(nodeOrDict instanceof TreeNodeAttr[] || nodeOrDict instanceof TreeNodeWrapper) {
- buildBox.setSelectedIndex(0);
- NameObject no = new NameObject("name", nodeOrDict);
- controlPane.populate(no);
- } else if(nodeOrDict instanceof TableDataDictionary) {
+ buildBox.setSelectedIndex(2);
+ 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);
+ }
+ }
}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java b/designer_base/src/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java
new file mode 100644
index 0000000000..c67dd08d9e
--- /dev/null
+++ b/designer_base/src/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java
@@ -0,0 +1,102 @@
+package com.fr.design.gui.frpane.tree.layer.config;
+
+import com.fr.base.TableData;
+import com.fr.data.impl.TableDataDictionary;
+import com.fr.design.beans.BasicBeanPane;
+import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
+import com.fr.design.present.dict.TableDataDictPane;
+import com.fr.form.ui.tree.LayerConfig;
+import com.fr.form.ui.tree.LayerDependence;
+
+import java.awt.*;
+import java.util.*;
+import java.util.List;
+
+/**
+ * Created by juhaoyu on 16/9/13.
+ */
+public class LayerDataConfigPane extends BasicBeanPane {
+
+ /**
+ * 数据集数据字典选择panel
+ */
+ private TableDataDictPane tableDataDictPane;
+
+ /**
+ * 与父级关联的字段选择
+ */
+ private LayerDependenceSettingPane dependenceSettingPane;
+
+
+ /**
+ * 当前用户正在修改的LayerData
+ */
+ private LayerConfig layerConfig;
+
+ public LayerDataConfigPane() {
+ //初始化组件及布局
+ this.tableDataDictPane = new TableDataDictPane();
+ this.dependenceSettingPane = new LayerDependenceSettingPane(tableDataDictPane);
+ this.setLayout(new BorderLayout(2, 2));
+ this.add(tableDataDictPane, BorderLayout.NORTH);
+ this.add(dependenceSettingPane, BorderLayout.CENTER);
+ }
+
+ /**
+ * 1.切换层级时
+ *
+ * @param layerConfig
+ */
+ @Override
+ public void populateBean(LayerConfig layerConfig) {
+
+ if (layerConfig != null) {
+ this.layerConfig = layerConfig;
+ TableDataDictionary ta = layerConfig.getDictionary();
+ this.tableDataDictPane.populateBean(ta);
+ this.dependenceSettingPane.populate(layerConfig.getIndex(), layerConfig.getDependenceList());
+ }
+
+ }
+
+ @Override
+ public LayerConfig updateBean() {
+
+ if (layerConfig == null) {
+ return null;
+
+ }
+ //从下层panel中读取数据
+ TableData tableData = tableDataDictPane.updateBean().getTableData();
+ TableDataWrapper wrapper = tableDataDictPane.tableDataNameComboBox.getSelectedItem();
+ List columnNames;
+ if (wrapper != null) {
+ columnNames = wrapper.calculateColumnNameList();
+ } else {
+ columnNames = new ArrayList();
+ }
+ String viewColStr = tableDataDictPane.updateBean().getValueColumnName();
+ String modelColStr = tableDataDictPane.updateBean().getKeyColumnName();
+ TableDataDictionary dictionary = tableDataDictPane.updateBean();
+ int viewCol = columnNames.indexOf(viewColStr);
+ int modelCol = columnNames.indexOf(modelColStr);
+ //将数据设置到当前正在修改的layerData中
+ this.layerConfig.setDictionary(dictionary);
+ this.layerConfig.setModelColumn(modelCol);
+ this.layerConfig.setViewColumn(viewCol);
+ this.layerConfig.setTableData(tableData);
+ //添加依赖
+ java.util.List dependenceList = dependenceSettingPane.updateLayerDependence();
+ layerConfig.getDependenceList().clear();
+ layerConfig.addAll(dependenceList);
+ return layerConfig;
+ }
+
+ @Override
+ protected String title4PopupWindow() {
+
+ return "Layer Data Config Panel";
+ }
+
+
+}
diff --git a/designer_base/src/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java b/designer_base/src/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java
new file mode 100644
index 0000000000..0ff6164b67
--- /dev/null
+++ b/designer_base/src/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java
@@ -0,0 +1,254 @@
+package com.fr.design.gui.frpane.tree.layer.config;
+
+import com.fr.base.BaseUtils;
+import com.fr.design.actions.UpdateAction;
+import com.fr.design.gui.controlpane.ControlPane;
+import com.fr.design.gui.icontainer.UIScrollPane;
+import com.fr.design.gui.itoolbar.UIToolbar;
+import com.fr.design.layout.FRGUIPaneFactory;
+import com.fr.design.mainframe.DesignerContext;
+import com.fr.design.menu.ToolBarDef;
+import com.fr.form.ui.tree.LayerConfig;
+import com.fr.general.ComparatorUtils;
+import com.fr.general.Inter;
+import com.fr.general.NameObject;
+
+import javax.swing.*;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+
+/**
+ * Created by juhaoyu on 16/9/21.
+ */
+public class LayerDataControlPane extends ControlPane {
+
+ public static final String BEAN_NAME = "Tree Layer Data";
+
+ // 添加一个treeNode
+ private AddTreeNodeAction addTreeNode;
+
+ // 移除一个treeNode
+ private RemoveTreeNodeAction removeTreeNode;
+
+ private LayerDataConfigPane configPane;
+
+ private JTree tree;
+
+ private DefaultTreeModel defaultTreeModel;
+
+ public LayerDataControlPane() {
+
+ this.setLayout(new BorderLayout(2, 2));
+ //创建层编辑panel
+ configPane = new LayerDataConfigPane();
+ //创建树结构及树控件
+ JPanel leftPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
+ DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(Inter.getLocText("FR-Designer_Root"));
+ defaultTreeModel = new DefaultTreeModel(rootNode);
+ tree = new JTree(defaultTreeModel);
+ DefaultMutableTreeNode firstLayer = new DefaultMutableTreeNode(new NameObject(Inter.getLocText("FR-Designer_Gradation") + 1, new LayerConfig(1)));
+ tree.setRootVisible(false);
+ ((DefaultMutableTreeNode) defaultTreeModel.getRoot()).getLastLeaf().add(firstLayer);
+ tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+ leftPane.add(new UIScrollPane(tree), BorderLayout.CENTER);
+
+ tree.setPreferredSize(new Dimension(170, 350));
+ tree.setCellRenderer(renderer);
+
+ tree.addTreeSelectionListener(new TreeSelectionListener() {
+
+ public void valueChanged(TreeSelectionEvent e) {
+
+ configPane.updateBean();
+ refreshCurrentUpdatePane();
+ checkButtonEnabled();
+ }
+ });
+
+
+ // JTreeControlPane控制栏
+ ToolBarDef toolbarDef = new ToolBarDef();
+ toolbarDef.addShortCut(addTreeNode = new AddTreeNodeAction());
+ toolbarDef.addShortCut(removeTreeNode = new RemoveTreeNodeAction());
+ UIToolbar toolBar = ToolBarDef.createJToolBar();
+ toolbarDef.updateToolBar(toolBar);
+ leftPane.add(toolBar, BorderLayout.NORTH);
+
+
+ this.add(leftPane, BorderLayout.WEST);
+ this.add(this.configPane, BorderLayout.CENTER);
+
+ defaultTreeModel.reload();
+ TreePath path = new TreePath(defaultTreeModel.getPathToRoot(rootNode.getLastLeaf()));
+ tree.setSelectionPath(path);
+
+ this.checkButtonEnabled();
+
+ }
+
+ public void refreshCurrentUpdatePane() {
+
+ TreePath selectTreePath = this.tree.getSelectionPath();
+ if (selectTreePath != null) {
+ NameObject object = (NameObject) ((DefaultMutableTreeNode) selectTreePath.getLastPathComponent()).getUserObject();
+ if (object != null && object.getObject() != null) {
+ configPane.populateBean((LayerConfig) object.getObject());
+ }
+ }
+ }
+
+ TreeCellRenderer renderer = new DefaultTreeCellRenderer() {
+
+ @Override
+ public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
+
+ super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
+ if (leaf) {
+ this.setIcon(BaseUtils.readIcon("com/fr/design/images/data/default_widget.png"));
+ } else {
+ this.setIcon(BaseUtils.readIcon("com/fr/design/images/data/arrow_branch.png"));
+ }
+
+ if (value instanceof DefaultMutableTreeNode) {
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
+ Object userObj = node.getUserObject();
+ if (userObj instanceof NameObject) {
+ this.setText(((NameObject) userObj).getName());
+ }
+ }
+ this.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0));
+ return this;
+ }
+ };
+
+ private void checkButtonEnabled() {
+
+ this.addTreeNode.setEnabled(true);
+ this.removeTreeNode.setEnabled(true);
+
+ // richer:当选择了树根节点时,不能被删除、上移和下移
+ DefaultMutableTreeNode root = (DefaultMutableTreeNode) defaultTreeModel.getRoot();
+ TreePath rootPath = new TreePath(defaultTreeModel.getPathToRoot(root));
+ if (ComparatorUtils.equals(rootPath, tree.getSelectionPath())) {
+ this.removeTreeNode.setEnabled(false);
+ }
+ }
+
+ private class AddTreeNodeAction extends UpdateAction {
+
+
+ public AddTreeNodeAction() {
+
+ this.setName(Inter.getLocText("FR-Designer_Add"));
+ this.setMnemonic('A');
+ this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) defaultTreeModel.getRoot();
+
+ DefaultMutableTreeNode innerNode = node;
+ int nodeCount = 0;
+ do {
+ nodeCount++;
+ } while ((innerNode = innerNode.getNextNode()) != null);
+ NameObject nameable = new NameObject(Inter.getLocText("FR-Designer_Gradation") + nodeCount, new LayerConfig(nodeCount));
+
+ node.getLastLeaf().add(new DefaultMutableTreeNode(nameable));
+ defaultTreeModel.reload();
+ TreePath path = new TreePath(defaultTreeModel.getPathToRoot(node.getLastLeaf()));
+ tree.setSelectionPath(path);
+ }
+ }
+
+ private class RemoveTreeNodeAction extends UpdateAction {
+
+ public RemoveTreeNodeAction() {
+
+ this.setName(Inter.getLocText("FR-Designer_Remove"));
+ this.setMnemonic('R');
+ this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/remove.png"));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ // TODO remove tree node
+ int val = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Utils-Are_you_sure_to_remove_the_selected_item") + "?",
+ Inter.getLocText("FR-Designer_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
+ if (val != JOptionPane.OK_OPTION) {
+ return;
+ }
+ TreePath selectionPath = tree.getSelectionPath();
+ DefaultMutableTreeNode tmpNode = (DefaultMutableTreeNode) selectionPath.getLastPathComponent();
+ tmpNode.removeFromParent();
+ defaultTreeModel.reload();
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) defaultTreeModel.getRoot();
+ TreePath path = new TreePath(defaultTreeModel.getPathToRoot(node.getLastLeaf()));
+ tree.setSelectionPath(path);
+ }
+ }
+
+ public void populate(NameObject nameObject) {
+ // 重新添加tree节点的时候需要remove掉原来的所有子节点
+ ((DefaultMutableTreeNode) defaultTreeModel.getRoot()).removeAllChildren();
+ if (BEAN_NAME.equals(nameObject.getName())) {
+ Object obj = nameObject.getObject();
+ LayerConfig[] layerConfigs = null;
+ if (obj instanceof LayerConfig[]) {
+ layerConfigs = ((LayerConfig[]) obj);
+ }
+
+ int count = layerConfigs == null ? 0 : layerConfigs.length;
+ //将树的层次一层一层的加上去
+ DefaultMutableTreeNode node4root = (DefaultMutableTreeNode) defaultTreeModel.getRoot();
+ for (int i = 0; i < count; i++) {
+
+ DefaultMutableTreeNode node4add = new DefaultMutableTreeNode(
+ new NameObject(Inter.getLocText("FR-Designer_Gradation") + (i + 1), layerConfigs[i].clone()));
+ node4root.add(node4add);
+ node4root = node4add;
+ }
+
+ defaultTreeModel.reload();
+ expandAll(tree, true);
+ tree.setSelectionRow(0);
+ }
+ }
+
+ public NameObject update() {
+
+ return new NameObject(BEAN_NAME, updateLayerDatas());
+ }
+
+ private LayerConfig[] updateLayerDatas() {
+
+ //保存最后一个设置的层级
+ configPane.updateBean();
+ DefaultMutableTreeNode root = (DefaultMutableTreeNode) defaultTreeModel.getRoot();
+ java.util.List nodeList = new ArrayList();
+
+ for (; root != null; root = root.getNextNode()) {
+ if (!(root.getUserObject() instanceof NameObject)) {
+ continue;
+ }
+ NameObject no = (NameObject) root.getUserObject();
+ if (no.getObject() instanceof LayerConfig) {
+ nodeList.add((LayerConfig) no.getObject());
+ }
+ }
+
+ return nodeList.toArray(new LayerConfig[nodeList.size()]);
+ }
+
+
+ @Override
+ protected String title4PopupWindow() {
+
+ return "Layer Data Control Pane";
+ }
+
+}
diff --git a/designer_base/src/com/fr/design/gui/frpane/tree/layer/config/LayerDependenceSettingPane.java b/designer_base/src/com/fr/design/gui/frpane/tree/layer/config/LayerDependenceSettingPane.java
new file mode 100644
index 0000000000..0411afd46c
--- /dev/null
+++ b/designer_base/src/com/fr/design/gui/frpane/tree/layer/config/LayerDependenceSettingPane.java
@@ -0,0 +1,459 @@
+package com.fr.design.gui.frpane.tree.layer.config;
+
+import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
+import com.fr.design.gui.ibutton.UIButton;
+import com.fr.design.gui.icombobox.UIComboBox;
+import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.present.dict.TableDataDictPane;
+import com.fr.form.ui.tree.LayerDependence;
+import com.fr.general.Inter;
+
+import javax.swing.*;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+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.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by juhaoyu on 16/9/19.
+ */
+public class LayerDependenceSettingPane extends JPanel implements ItemListener {
+
+ /**
+ * 用户选择数据集的pane,在LayerDataConfigPane中传入
+ */
+ private TableDataDictPane tableDataDictPane;
+
+
+ /**
+ * 添加依赖按钮
+ */
+ private UIButton addButton;
+
+ /**
+ * 删除依赖按钮
+ */
+ private UIButton delButton;
+
+ /**
+ * 依赖关系编辑Table
+ */
+ private JTable dependenceTable;
+
+ /**
+ * Table的数据模型,两个按钮的操作直接对应于model
+ */
+ private LayerDepenceTableModel model;
+
+ /**
+ * 当前该panel所设置的层级
+ */
+ private int currentLayerIndex = 1;
+
+ private FieldRenderer fieldRenderer;
+
+ private LayerIndexEditor layerIndexEditor;
+
+ private FiledEditor fieldEditor;
+
+
+ public LayerDependenceSettingPane(TableDataDictPane tableDictPane) {
+ //关联数据集选择,并添加监听
+ this.tableDataDictPane = tableDictPane;
+ tableDataDictPane.tableDataNameComboBox.addItemListener(this);
+
+ //初始化按钮对象
+ addButton = new UIButton(Inter.getLocText("add"));
+ delButton = new UIButton(Inter.getLocText("Delete"));
+ //初始化Table对象,并添加renderer和editor
+ model = new LayerDepenceTableModel();
+ dependenceTable = new JTable();
+ dependenceTable.setModel(model);
+ //初始化辅助组件
+ fieldEditor = new FiledEditor(tableDataDictPane);
+ fieldRenderer = new FieldRenderer(tableDictPane);
+ layerIndexEditor = new LayerIndexEditor(currentLayerIndex);
+ //添加renderer
+ dependenceTable.getColumnModel().getColumn(0).setCellRenderer(new FirstRenderer());
+ dependenceTable.getColumnModel().getColumn(1).setCellRenderer(fieldRenderer);
+ //添加第一列editor
+ dependenceTable.getColumnModel().getColumn(0).setCellEditor(layerIndexEditor);
+ //添加第二列editor
+ dependenceTable.getColumnModel().getColumn(1).setCellEditor(fieldEditor);
+ //添加add按钮监听
+ addButton.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ //先要停止编辑,然后再添加
+ fieldEditor.stopCellEditing();
+ layerIndexEditor.stopCellEditing();
+ LayerDependenceSettingPane.this.model.addDependence();
+ }
+ });
+ //添加del按钮监听
+ delButton.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ if (0 == dependenceTable.getSelectedRowCount()) {
+ return;
+ }
+ //获取视图索引,并根据视图索引获取model索引,删除model指定行
+ int selectedRow = dependenceTable.getSelectedRow();
+ int selectedRowModelIndex = dependenceTable.convertRowIndexToModel(selectedRow);
+ //先要停止编辑,然后再删除
+ fieldEditor.stopCellEditing();
+ layerIndexEditor.stopCellEditing();
+ model.delDependence(selectedRowModelIndex);
+ }
+ });
+
+
+ //生成布局
+ this.setLayout(new BorderLayout(2, 2));
+ //添加按钮panel
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new FlowLayout(2));
+ buttonPanel.add(addButton);
+ buttonPanel.add(delButton);
+ this.add(buttonPanel, BorderLayout.NORTH);
+ //添加Table的panel
+ JScrollPane tablePanel = new JScrollPane(dependenceTable);
+ this.add(tablePanel, BorderLayout.CENTER);
+
+
+ }
+
+
+ public void populate(int layerIndex, List dependenceList) {
+
+ this.currentLayerIndex = layerIndex;
+ //更新Editor
+ this.layerIndexEditor.layerChanged(layerIndex);
+ this.fieldEditor.layerChanged();
+
+ this.model.clear();
+ this.model.addAll(dependenceList);
+ }
+
+
+ public List updateLayerDependence() {
+ //保存现有编辑
+ this.fieldEditor.stopCellEditing();
+ this.layerIndexEditor.stopCellEditing();
+ return this.model.update();
+ }
+
+ /**
+ * 当tableDataDictPane变化时,调用该方法
+ */
+
+
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+
+ clearDependences();
+
+ }
+
+ /**
+ * 清楚当前设置的依赖关系
+ */
+ private void clearDependences() {
+
+ this.model.clear();
+
+ }
+
+ /**
+ * 第一列renderer
+ */
+ private static final class FirstRenderer extends UILabel implements TableCellRenderer {
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+
+ if (value != null) {
+ //value是用户选择的字段索引值,从1开始的
+ this.setText(String.valueOf(value));
+ } else {
+ this.setText("");
+ }
+ if (hasFocus) {
+ this.setBorder(UIManager.getBorder("Table.focusCelHighlightBorder"));
+ } else {
+ this.setBorder(null);
+ }
+ return this;
+ }
+ }
+
+ /**
+ * 第二列renderer
+ * 由于从model中获取的数据是数据集列的索引值,这里要转换为列的名称
+ */
+ private static final class FieldRenderer extends UILabel implements TableCellRenderer {
+
+ //用于将字段索引转换为字段名;保存改pane,是为了当用户选择其他数据集时,renderer可同步更新
+ private TableDataDictPane tableDataDictPane;
+
+ public FieldRenderer(TableDataDictPane tableDataDictPane) {
+
+ this.tableDataDictPane = tableDataDictPane;
+ }
+
+ /**
+ * 由于数据是从tableDataDictPane中现取的,所以用户选择不同的数据集时,renderer同步更新;
+ * 此时只需要在用户选择数据集时,刷新Table即可,不需要对renderer处理
+ */
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+
+ if (value != null) {
+ List columnNames = getColumnNameList(this.tableDataDictPane);
+ //value是用户选择的字段索引值,从1开始的
+ this.setText(columnNames.get(Integer.valueOf(String.valueOf(value))));
+ } else {
+ this.setText("");
+ }
+ if (hasFocus) {
+ this.setBorder(UIManager.getBorder("Table.focusCelHighlightBorder"));
+ } else {
+ this.setBorder(null);
+ }
+ return this;
+ }
+ }
+
+ /**
+ * 第一列editor
+ * 该editor于layerIndex关联,当用户选择不同的层时,这个editor要同步更新
+ */
+ private static final class LayerIndexEditor extends AbstractCellEditor implements TableCellEditor {
+
+ private int currentLayerIndex;
+
+ private UIComboBox layerChoseCombobox = new UIComboBox();
+
+ public LayerIndexEditor(int currentLayerIndex) {
+
+ this.currentLayerIndex = currentLayerIndex;
+ for (int i = 1; i < currentLayerIndex; i++) {
+ layerChoseCombobox.addItem(i);
+ }
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
+
+ if (value != null) {
+ layerChoseCombobox.setSelectedIndex(Integer.valueOf(String.valueOf(value)) - 1);
+ }
+ return layerChoseCombobox;
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+
+ return layerChoseCombobox.getSelectedItem();
+ }
+
+ public void layerChanged(int newLayerIndex) {
+
+ this.currentLayerIndex = newLayerIndex;
+ layerChoseCombobox.removeAllItems();
+ for (int i = 1; i < currentLayerIndex; i++) {
+ layerChoseCombobox.addItem(i);
+ }
+ }
+ }
+
+ /**
+ * 第二列editor
+ */
+ private static final class FiledEditor extends AbstractCellEditor implements TableCellEditor {
+
+ private UIComboBox layerChoseCombobox = new UIComboBox();
+
+ TableDataDictPane tableDataDictPane;
+
+ public FiledEditor(TableDataDictPane tableDataDictPane) {
+
+ this.tableDataDictPane = tableDataDictPane;
+ List columnNames = getColumnNameList(this.tableDataDictPane);
+ for (String columnName : columnNames) {
+ this.layerChoseCombobox.addItem(columnName);
+ }
+
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
+
+ List columnNames = getColumnNameList(this.tableDataDictPane);
+ layerChoseCombobox.removeAllItems();
+ for (String columnName : columnNames) {
+
+ layerChoseCombobox.addItem(columnName);
+ }
+ if (value != null) {
+ layerChoseCombobox.setSelectedIndex(Integer.valueOf(String.valueOf(value)));
+ }
+ return layerChoseCombobox;
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+ //转化为数据集的列索引(从0开始)
+ return layerChoseCombobox.getSelectedIndex();
+ }
+
+ public void layerChanged() {
+
+ List columnNames = getColumnNameList(this.tableDataDictPane);
+ layerChoseCombobox.removeAllItems();
+ for (String columnName : columnNames) {
+
+ layerChoseCombobox.addItem(columnName);
+ }
+ }
+ }
+
+ private static List getColumnNameList(TableDataDictPane tableDataDictPane) {
+
+ TableDataWrapper wrapper = tableDataDictPane.tableDataNameComboBox.getSelectedItem();
+ if (wrapper == null) {
+ return new ArrayList();
+ } else {
+ return wrapper.calculateColumnNameList();
+ }
+ }
+
+ private static class LayerDepenceTableModel extends AbstractTableModel {
+
+ private List dependences;
+
+ public LayerDepenceTableModel() {
+
+ dependences = new ArrayList();
+ }
+
+ /**
+ * 添加一条数据,该方法会请求Table进行重绘(通过发送时间,告诉JTable数据更新,JTable会自动重绘)
+ */
+ public void addDependence() {
+
+ dependences.add(new LayerDependence());
+ fireTableRowsInserted(dependences.size(), dependences.size());
+ }
+
+ /**
+ * 删除一条数据
+ *
+ * @param rowIndex
+ */
+ public void delDependence(int rowIndex) {
+
+ if (rowIndex < 0 || rowIndex >= dependences.size()) {
+ return;
+ }
+ dependences.remove(rowIndex);
+ fireTableRowsDeleted(rowIndex + 1, rowIndex + 1);
+ }
+
+ public void addAll(List dependenceList) {
+
+ dependences.addAll(dependenceList);
+ fireTableRowsInserted(1, dependenceList.size());
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+
+ return true;
+ }
+
+ @Override
+ public Class> getColumnClass(int column) {
+
+ return Integer.class;
+ }
+
+ @Override
+ public String getColumnName(int column) {
+
+ String name;
+ if (column == 0) {
+ name = Inter.getLocText("FR-Designer_layerIndex");
+ } else {
+ name = Inter.getLocText("FR-Designer_filedChosen");
+ }
+ return name;
+ }
+
+ @Override
+ public int getRowCount() {
+
+ return dependences.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+
+ return 2;
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+
+ LayerDependence dependence = dependences.get(rowIndex);
+ Object obj;
+ if (columnIndex == 0) {
+ obj = dependence.getLayerIndex();
+ } else {
+ obj = dependence.getThisColumnIndex();
+ }
+ return obj;
+ }
+
+ @Override
+ public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
+
+ LayerDependence dependence = dependences.get(rowIndex);
+ if (aValue != null) {
+ if (columnIndex == 0) {
+ dependence.setLayerIndex((Integer) aValue);
+ } else {
+ dependence.setThisColumnIndex((Integer) aValue);
+ }
+ }
+
+ }
+
+ public void clear() {
+
+ int length = dependences.size();
+ dependences.clear();
+ fireTableRowsDeleted(1, length);
+
+ }
+
+
+ public List update() {
+
+ return this.dependences;
+ }
+ }
+
+
+}
+
+
diff --git a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java
index bc54473291..8a2773f58a 100644
--- a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java
+++ b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java
@@ -127,7 +127,7 @@ public abstract class AbstractHyperlinkPane extends BasicBe
public void updateBean(T link) {
updateSubHyperlinkBean(link);
- link.setTargetFrame((String) targetFrameComboBox.getSelectedItem());
+ link.setTargetFrame(HyperlinkTargetFrame.parse(targetFrameComboBox.getSelectedIndex()).getName());
link.setHeight(Utils.objectToNumber(heightTextFiled.getText(), false).intValue());
link.setWidth(Utils.objectToNumber(widthTextFiled.getText(), false).intValue());
}
diff --git a/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java b/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java
new file mode 100644
index 0000000000..80e9f21a0a
--- /dev/null
+++ b/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java
@@ -0,0 +1,48 @@
+package com.fr.design.hyperlink;
+
+/**
+ * Created by ibm on 2016/10/13.
+ */
+public enum HyperlinkTargetFrame {
+ BLANK_FRAME("_blank", 0), DIALOG_FRAME("_dialog", 1), SELF_FRAME("_self", 2);
+
+ private String name;
+ private int index;
+ private static HyperlinkTargetFrame[] arrayOfValues;
+
+ HyperlinkTargetFrame(String name, int index) {
+ this.name = name;
+ this.index = index;
+ }
+
+ public static HyperlinkTargetFrame parse(int index) {
+ if (arrayOfValues == null) {
+ arrayOfValues = HyperlinkTargetFrame.values();
+ }
+ for (HyperlinkTargetFrame hyperlinkTargetFrame : HyperlinkTargetFrame.values()) {
+ if (hyperlinkTargetFrame.getIndex() == index) {
+ return hyperlinkTargetFrame;
+ }
+ }
+ return BLANK_FRAME;
+ }
+
+
+ public int getIndex() {
+ return index;
+ }
+
+ public void setIndex(int index) {
+ this.index = index;
+ }
+
+ public String getName() {
+ return name;
+
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
+
diff --git a/designer_base/src/com/fr/design/images/control/combobox.png b/designer_base/src/com/fr/design/images/control/combobox.png
new file mode 100644
index 0000000000..6e5be84e73
Binary files /dev/null and b/designer_base/src/com/fr/design/images/control/combobox.png differ
diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java
index a1f5f16a4b..329b631552 100644
--- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java
+++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java
@@ -464,9 +464,28 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
//添加分享按钮
addShareButton();
+
+ //添加插件中的按钮
+ addExtraButtons();
return combineUp;
}
+
+ private void addExtraButtons(){
+ JTemplate, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
+ if(jt == null){
+ return;
+ }
+
+
+ UIButton[] extraButtons = jt.createExtraButtons();
+ for (int i = 0; i < extraButtons.length; i++) {
+ combineUp.add(extraButtons[i]);
+ }
+ if (extraButtons.length > 0) {
+ combineUp.addSeparator(new Dimension(2, 16));
+ }
+ }
private void addShareButton(){
JTemplate, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java
index 8478e2500d..58060d91a9 100644
--- a/designer_base/src/com/fr/design/mainframe/JTemplate.java
+++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java
@@ -8,8 +8,8 @@ import com.fr.base.io.IOFile;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
+import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.TableDataSourceAction;
-import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.edit.RedoAction;
import com.fr.design.actions.edit.UndoAction;
import com.fr.design.actions.file.SaveAsTemplateAction;
@@ -19,6 +19,7 @@ import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.TemplateTreePane;
+import com.fr.design.fun.DesignerFrameUpButtonProvider;
import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
@@ -37,9 +38,12 @@ import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.FileNodeFILE;
import com.fr.file.MemFILE;
+import com.fr.form.ui.NoneWidget;
+import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
+import com.fr.stable.ArrayUtils;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
@@ -51,6 +55,7 @@ import java.awt.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Set;
import java.util.regex.Pattern;
/**
@@ -505,6 +510,9 @@ public abstract class JTemplate> ex
public boolean saveShareFile(){
return true;
}
+ public Widget getSelectElementCase(){
+ return new NoneWidget();
+ }
protected FILEChooserPane getFILEChooserPane(boolean isShowLoc){
return new FILEChooserPane(true, isShowLoc);
@@ -957,4 +965,18 @@ public abstract class JTemplate> ex
public boolean acceptToolbarItem(Class clazz) {
return true;
}
+
+ /**
+ * 加载插件中的按钮
+ * @return 按钮组
+ */
+ public UIButton[] createExtraButtons() {
+ Set providers = ExtraDesignClassManager.getInstance().getArray(DesignerFrameUpButtonProvider.XML_TAG);
+ UIButton[] uiButtons = new UIButton[0];
+ for (DesignerFrameUpButtonProvider provider : providers) {
+ uiButtons = ArrayUtils.addAll(uiButtons, provider.getUpButtons(getMenuState()));
+ }
+
+ return uiButtons;
+ }
}
\ No newline at end of file
diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
index b04e1e5b12..2ea102c545 100644
--- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
+++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
@@ -26,6 +26,7 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
+import com.fr.env.RemoteEnv;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
@@ -146,13 +147,13 @@ public abstract class ToolBarMenuDock {
// 给菜单加插件入口
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:
@@ -199,7 +200,7 @@ public abstract class ToolBarMenuDock {
addSwitchExistEnvAction(menuDef);
- menuDef.addShortCut( new ExitDesignerAction());
+ menuDef.addShortCut(new ExitDesignerAction());
insertMenu(menuDef, MenuHandler.FILE);
return menuDef;
@@ -221,7 +222,7 @@ public abstract class ToolBarMenuDock {
menuDef.addShortCut(new SwitchExistEnv());
}
- protected ShortCut openTemplateAction(){
+ protected ShortCut openTemplateAction() {
return new OpenTemplateAction();
}
@@ -231,15 +232,14 @@ public abstract class ToolBarMenuDock {
* @return 菜单
*/
public abstract ShortCut[] createNewFileShortCuts();
-
+
/**
- * 创建论坛登录面板, chart那边不需要
- *
- * @return 面板组件
- *
- */
- public Component createBBSLoginPane(){
- return new UILabel();
+ * 创建论坛登录面板, chart那边不需要
+ *
+ * @return 面板组件
+ */
+ public Component createBBSLoginPane() {
+ return new UILabel();
}
@@ -264,9 +264,10 @@ public abstract class ToolBarMenuDock {
);
if (!BaseUtils.isAuthorityEditing()) {
- if (shouldShowPlugin()){
+ if (shouldShowPlugin() && !(FRContext.getCurrentEnv() instanceof RemoteEnv)) {
menuDef.addShortCut(
- new PluginManagerAction()
+ new PluginManagerAction(),
+ new ReuseManagerAction()
);
}
menuDef.addShortCut(
@@ -290,6 +291,7 @@ public abstract class ToolBarMenuDock {
/**
* 创建帮助子菜单
+ *
* @return 帮组菜单的子菜单
*/
public ShortCut[] createHelpShortCuts() {
@@ -298,11 +300,11 @@ 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);
- // shortCuts.add(new ForumAction());
+ // shortCuts.add(new ForumAction());
}
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new AboutAction());
@@ -312,6 +314,7 @@ public abstract class ToolBarMenuDock {
/**
* 创建社区子菜单
+ *
* @return 社区菜单的子菜单
*/
public ShortCut[] createCommunityShortCuts() {
@@ -346,6 +349,7 @@ public abstract class ToolBarMenuDock {
insertMenu(menuDef, MenuHandler.BBS);
return menuDef;
}
+
/**
* 生成工具栏
*
@@ -470,7 +474,8 @@ public abstract class ToolBarMenuDock {
public int getMenuState() {
return DesignState.WORK_SHEET;
}
- public int getToolBarHeight(){
+
+ public int getToolBarHeight() {
return PANLE_HEIGNT;
}
@@ -479,29 +484,29 @@ public abstract class ToolBarMenuDock {
*
* @return 子菜单
*/
- public ShortCut[] shortcut4ExportMenu(){
+ public ShortCut[] shortcut4ExportMenu() {
return new ShortCut[0];
}
};
- public NewTemplatePane getNewTemplatePane(){
- return new NewTemplatePane() {
- @Override
- public Icon getNew() {
- return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png");
- }
+ public NewTemplatePane getNewTemplatePane() {
+ return new NewTemplatePane() {
+ @Override
+ public Icon getNew() {
+ return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png");
+ }
- @Override
- public Icon getMouseOverNew() {
- return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png");
- }
+ @Override
+ public Icon getMouseOverNew() {
+ return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png");
+ }
- @Override
- public Icon getMousePressNew() {
- return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png");
- }
- };
+ @Override
+ public Icon getMousePressNew() {
+ return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png");
+ }
+ };
}
protected void insertMenu(MenuDef menuDef, String anchor) {
@@ -520,8 +525,11 @@ public abstract class ToolBarMenuDock {
for (MenuHandler handler : target) {
int insertPosition = handler.insertPosition(menuDef.getShortCutCount());
+ if (insertPosition == MenuHandler.HIDE) {
+ return;
+ }
ShortCut shortCut = action.methodAction(handler);
- if (shortCut == null){
+ if (shortCut == null) {
continue;
}
@@ -534,48 +542,47 @@ 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);
}
}
}
}
-
+
/**
- * 设计器退出时, 做的一些操作.
- *
- */
- 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){
- return handler.shortcut();
+ 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;
}
diff --git a/designer_base/src/com/fr/design/menu/MenuDef.java b/designer_base/src/com/fr/design/menu/MenuDef.java
index aeee4dfb4d..bf85652fd2 100644
--- a/designer_base/src/com/fr/design/menu/MenuDef.java
+++ b/designer_base/src/com/fr/design/menu/MenuDef.java
@@ -13,9 +13,7 @@ import javax.swing.*;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import java.awt.*;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
+import java.awt.event.*;
import java.util.ArrayList;
import java.util.List;
@@ -164,11 +162,18 @@ public class MenuDef extends ShortCut {
createdJMenu.setIcon(BaseUtils.readIcon(this.iconPath));
}
createdJMenu.addMenuListener(menuDefListener);
+ ContainerListener listener = getContainerListener();
+ if(listener != null){
+ createdJMenu.getPopupMenu().addContainerListener(listener);
+ }
}
return createdJMenu;
}
+ protected ContainerListener getContainerListener() {
+ return null;
+ }
/**
* 生成 JPopupMenu
* @return 弹出菜单
diff --git a/designer_base/src/com/fr/design/utils/DesignUtils.java b/designer_base/src/com/fr/design/utils/DesignUtils.java
index 4b05b8d683..8ed8aa6175 100644
--- a/designer_base/src/com/fr/design/utils/DesignUtils.java
+++ b/designer_base/src/com/fr/design/utils/DesignUtils.java
@@ -236,9 +236,6 @@ public class DesignUtils {
guiFRFont = getNamedFont("SimSun");
} else if(isDisplayDialog(defaultLocale)) {
guiFRFont = getNamedFont("Dialog");
- } else if(isDisplayJapaneseFont(defaultLocale)){
- //日文设计器默认用MS Mincho字体渲染
- guiFRFont = getNamedFont("MS Mincho");
} else {
guiFRFont = getNamedFont("Tahoma");
}
@@ -270,14 +267,11 @@ public class DesignUtils {
private static boolean isDisplaySimSun(Locale defaultLocale){
return ComparatorUtils.equals(defaultLocale, Locale.SIMPLIFIED_CHINESE);
}
-
- private static boolean isDisplayJapaneseFont(Locale defaultLocale){
- return ComparatorUtils.equals(defaultLocale, Locale.JAPANESE)
- || ComparatorUtils.equals(defaultLocale, Locale.JAPAN);
- }
private static boolean isDisplayDialog(Locale defaultLocale){
- return ComparatorUtils.equals(defaultLocale, Locale.TRADITIONAL_CHINESE)
+ return ComparatorUtils.equals(defaultLocale, Locale.TRADITIONAL_CHINESE)
+ || ComparatorUtils.equals(defaultLocale, Locale.JAPANESE)
+ || ComparatorUtils.equals(defaultLocale, Locale.JAPAN)
|| ComparatorUtils.equals(defaultLocale, Locale.KOREAN)
|| ComparatorUtils.equals(defaultLocale, Locale.KOREA);
}
diff --git a/designer_base/src/com/fr/start/BaseDesigner.java b/designer_base/src/com/fr/start/BaseDesigner.java
index 470affb44f..9e25a76c68 100644
--- a/designer_base/src/com/fr/start/BaseDesigner.java
+++ b/designer_base/src/com/fr/start/BaseDesigner.java
@@ -7,10 +7,11 @@ import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.RestartHelper;
+import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
-import com.fr.design.extra.PluginManagerPane;
-import com.fr.design.extra.PluginShopDialog;
+import com.fr.design.extra.ShopDialog;
import com.fr.design.extra.PluginWebBridge;
+import com.fr.design.extra.WebManagerPaneFactory;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane;
@@ -130,8 +131,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
String text = StableUtils.join(plugins, ",") + Inter.getLocText("FR-Designer_Plugin_Should_Update");
int r = JOptionPane.showConfirmDialog(null, text, Inter.getLocText("FR-Designer_Plugin_Should_Update_Title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
if (r == JOptionPane.OK_OPTION) {
- final PluginManagerPane managerPane = new PluginManagerPane();
- UIDialog dlg = new PluginShopDialog(DesignerContext.getDesignerFrame(),managerPane);
+ BasicPane managerPane = new WebManagerPaneFactory().createPluginPane();
+ UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);
PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true);
}
diff --git a/designer_chart/build.dev.gradle b/designer_chart/build.dev.gradle
new file mode 100644
index 0000000000..f980fa135a
--- /dev/null
+++ b/designer_chart/build.dev.gradle
@@ -0,0 +1,66 @@
+
+apply plugin: 'java'
+tasks.withType(JavaCompile){
+ options.encoding = 'UTF-8'
+}
+//指定构建的jdk版本
+sourceCompatibility=1.8
+//指定生成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
+
diff --git a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
index 186b7eb6c1..d898640feb 100644
--- a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
+++ b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
@@ -224,10 +224,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
* @param event 鼠标事件
*/
public void mouseClicked(MouseEvent event) {
- int click = event.getClickCount();
- if (click >= 1 && activeGlyph != null && this.isSupportEdit()) {
- activeGlyph.goRightPane();
- }
+
}
/**
diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java
index 515527eaf8..3892493b4b 100644
--- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java
+++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java
@@ -36,7 +36,6 @@ import com.fr.design.gui.xcombox.ComboBoxUseEditor;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.TextEditor;
import com.fr.general.Inter;
-import com.fr.third.org.apache.poi.hssf.record.formula.functions.T;
/**
* 地图, 定义区域名.
@@ -90,7 +89,7 @@ public class MapDefiAreaNamePane extends BasicBeanPane 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);
diff --git a/designer_chart/src/com/fr/design/mainframe/actions/ExcelExportAction4Chart.java b/designer_chart/src/com/fr/design/mainframe/actions/ExcelExportAction4Chart.java
index aa703f3112..e1e64395a3 100644
--- a/designer_chart/src/com/fr/design/mainframe/actions/ExcelExportAction4Chart.java
+++ b/designer_chart/src/com/fr/design/mainframe/actions/ExcelExportAction4Chart.java
@@ -58,7 +58,7 @@ public class ExcelExportAction4Chart extends AbstractExportAction4JChart {
@Override
protected String getDefaultExtension() {
- return ExcelUtils.checkPOIJarExist() ? "xlsx" : "xls";
+ return ExcelUtils.checkThirdJarSupportPOI() ? "xlsx" : "xls";
}
@Override
diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/ChartAreaPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/ChartAreaPane.java
index 673ac0194b..d10cb182b9 100644
--- a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/ChartAreaPane.java
+++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/ChartAreaPane.java
@@ -45,13 +45,8 @@ public class ChartAreaPane extends ThirdTabPane implements AutoSelectedPa
if(parent instanceof ChartStylePane) {
plotPane.setParentPane((ChartStylePane)parent);
}
- JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
- if (jTemplate.isJWorkBook() || jTemplate.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) {
- //表单中的图表组件的图表区挪到控件属性表的样式中了
- paneList.add(new NamePane(areaPane.title4PopupWindow(), areaPane));
- }else if(jTemplate.isChartBook()){
- paneList.add(new NamePane(areaPane.title4PopupWindow(), areaPane));
- }
+
+ paneList.add(new NamePane(areaPane.title4PopupWindow(), areaPane));
if(plot.isSupportPlotBackground()) {
paneList.add(new NamePane(plotPane.title4PopupWindow(), plotPane));
diff --git a/designer_chart/src/com/fr/design/mainframe/exporter/ExcelExporter4Chart.java b/designer_chart/src/com/fr/design/mainframe/exporter/ExcelExporter4Chart.java
index 425f5d2ea0..71e02d1735 100644
--- a/designer_chart/src/com/fr/design/mainframe/exporter/ExcelExporter4Chart.java
+++ b/designer_chart/src/com/fr/design/mainframe/exporter/ExcelExporter4Chart.java
@@ -6,14 +6,14 @@ import com.fr.design.mainframe.JChart;
import com.fr.general.FRLogger;
import com.fr.general.IOUtils;
import com.fr.stable.CoreGraphHelper;
-import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.ss.usermodel.ClientAnchor;
-import org.apache.poi.ss.usermodel.Drawing;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
-import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import com.fr.third.v2.org.apache.poi.hssf.usermodel.HSSFClientAnchor;
+import com.fr.third.v2.org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import com.fr.third.v2.org.apache.poi.ss.usermodel.ClientAnchor;
+import com.fr.third.v2.org.apache.poi.ss.usermodel.Drawing;
+import com.fr.third.v2.org.apache.poi.ss.usermodel.Sheet;
+import com.fr.third.v2.org.apache.poi.ss.usermodel.Workbook;
+import com.fr.third.v2.org.apache.poi.xssf.usermodel.XSSFClientAnchor;
+import com.fr.third.v2.org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
@@ -73,7 +73,7 @@ public class ExcelExporter4Chart extends ImageExporter4Chart {
}
private boolean checkExcelExportVersion() {
- return ExcelUtils.checkPOIJarExist();
+ return ExcelUtils.checkThirdJarSupportPOI();
}
// 加载图片.
private int loadPicture(BufferedImage bufferedImage)throws IOException {
diff --git a/designer_form/build.dev.gradle b/designer_form/build.dev.gradle
new file mode 100644
index 0000000000..57ebd74c2c
--- /dev/null
+++ b/designer_form/build.dev.gradle
@@ -0,0 +1,83 @@
+
+apply plugin: 'java'
+tasks.withType(JavaCompile){
+ options.encoding = 'UTF-8'
+}
+//指定构建的jdk版本
+sourceCompatibility=1.8
+//指定生成的jar包版本
+version='8.0'
+
+def srcDir="."
+
+
+//指明生成jar包的名字
+jar{
+ baseName='fr-designer-report'
+}
+//源码所在位置
+sourceSets{
+ main{
+ java{
+ srcDirs=["${srcDir}/src",
+"${srcDir}/../designer/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'
+}
+
+//指明无法编译文件所在路径
+def dataContent ={def dir ->
+ copySpec{
+ from ("${dir}"){
+ exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
+ }
+ }
+}
+
+//将非.java文件复制到classes文件夹下 参与打包
+task copyFile(type:Copy,dependsOn:compileJava){
+ copy{
+ with dataContent.call("${srcDir}/src")
+ with dataContent.call("${srcDir}/../designer/src")
+ 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')
+
+ }
+ fileset (dir:"${srcDir}/../designer/src"){
+ include (name:'**/*.js')
+ include (name:'**/*.css')
+ }
+
+ }
+}
+jar.dependsOn compressJS
+
diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteBodyLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteBodyLayoutAdapter.java
new file mode 100644
index 0000000000..e06bb74634
--- /dev/null
+++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteBodyLayoutAdapter.java
@@ -0,0 +1,30 @@
+package com.fr.design.designer.beans.adapters.layout;
+
+import com.fr.design.beans.GroupModel;
+import com.fr.design.designer.creator.XLayoutContainer;
+import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
+import com.fr.design.designer.creator.XWAbsoluteLayout;
+import com.fr.design.designer.creator.XWFitLayout;
+import com.fr.design.designer.properties.FRAbsoluteBodyLayoutPropertiesGroupModel;
+import com.fr.design.designer.properties.FRAbsoluteLayoutPropertiesGroupModel;
+import com.fr.form.ui.container.WBodyLayoutType;
+
+/**
+ * Created by zhouping on 2016/10/14.
+ */
+public class FRAbsoluteBodyLayoutAdapter extends FRAbsoluteLayoutAdapter {
+ public FRAbsoluteBodyLayoutAdapter(XLayoutContainer container) {
+ super(container);
+ }
+
+ @Override
+ public GroupModel getLayoutProperties() {
+ XWAbsoluteBodyLayout xwAbsoluteBodyLayout = (XWAbsoluteBodyLayout) container;
+ //如果body是绝对布局,那么获取原来自适应body的属性--布局类型
+ WBodyLayoutType layoutType = WBodyLayoutType.FIT;
+ if (container.getParent() != null) {
+ layoutType = ((XWFitLayout)container.getParent()).toData().getBodyLayoutType();
+ }
+ return new FRAbsoluteBodyLayoutPropertiesGroupModel(xwAbsoluteBodyLayout, layoutType);
+ }
+}
diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
index 3c0f1155c6..c49ecf0f38 100644
--- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
+++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
@@ -12,6 +12,7 @@ import com.fr.design.designer.properties.FRAbsoluteLayoutPropertiesGroupModel;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
+import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
diff --git a/designer_form/src/com/fr/design/designer/creator/XCreator.java b/designer_form/src/com/fr/design/designer/creator/XCreator.java
index ab08de3fea..552402398a 100644
--- a/designer_form/src/com/fr/design/designer/creator/XCreator.java
+++ b/designer_form/src/com/fr/design/designer/creator/XCreator.java
@@ -15,6 +15,7 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.stable.StableUtils;
+import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.border.Border;
@@ -27,7 +28,7 @@ import java.util.List;
/**
* @author richer
* @since 6.5.3 com.fr.base.listener.OB的设计组件
- *
+ *
*/
public abstract class XCreator extends JPanel implements XComponent, XCreatorTools {
@@ -44,6 +45,8 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
// XCreator加入到某些XLayoutContainer中时,能调整宽度或者高度
private int[] directions;
private Rectangle backupBound;
+ private String shareId = StringUtils.EMPTY;//如果组件是共享的会有这个属性
+ private boolean isHelpBtnOnFocus = false;//焦点是否在帮助按钮上
public XCreator(Widget ob, Dimension initSize) {
this.data = ob;
@@ -83,7 +86,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
setSize(this.backupSize);
}
}
-
+
/**
* 备份当前大小
*/
@@ -113,76 +116,76 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public XLayoutContainer getTopLayout(){
return null;
}
-
+
/**
* 获取当前XCreator的一个封装父容器
- *
+ *
* @param widgetName 当前组件名
- *
+ *
* @return 封装的父容器
- *
+ *
*
* @date 2014-11-25-下午4:47:23
- *
+ *
*/
protected XLayoutContainer getCreatorWrapper(String widgetName){
return new XWTitleLayout();
}
-
+
/**
* 将当前对象添加到父容器中
- *
+ *
* @param parentPanel 父容器组件
- *
+ *
*
* @date 2014-11-25-下午4:57:55
- *
+ *
*/
- protected void addToWrapper(XLayoutContainer parentPanel, int width, int minHeight){
+ protected void addToWrapper(XLayoutContainer parentPanel, int width, int minHeight){
parentPanel.add(this, WTitleLayout.BODY);
}
-
+
/**
* 设置父容器的名字
- *
+ *
* @param parentPanel 当前父容器
* @param widgetName 当前控件名
- *
+ *
*
* @date 2014-11-27-上午9:47:00
- *
+ *
*/
protected void setWrapperName(XLayoutContainer parentPanel, String widgetName){
parentPanel.toData().setWidgetName(widgetName);
}
-
+
/**
* 初始化当前组件的父容器
* 大体分为三种: Scale缩放型, Title标题型, Border自定义标题栏
- *
+ *
* @param minHeight 最小高度
- *
+ *
* @return 父容器
- *
+ *
*
* @date 2014-11-25-下午5:15:23
- *
+ *
*/
public XLayoutContainer initCreatorWrapper(int minHeight){
XLayoutContainer parentPanel;
String widgetName = this.toData().getWidgetName();
parentPanel = this.getCreatorWrapper(widgetName);
-
+
int width = this.getWidth();
int height = this.getHeight();
-
+
parentPanel.setLocation(this.getX(), this.getY());
parentPanel.setSize(width, height);
setWrapperName(parentPanel, widgetName);
this.setLocation(0, 0);
this.addToWrapper(parentPanel, width, minHeight);
LayoutUtils.layoutRootContainer(parentPanel);
-
+
return parentPanel;
}
@@ -291,7 +294,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public Dimension getMinimumSize() {
return new Dimension(0, 0);
}
-
+
/**
* 是否支持切换到报表界面编辑
* @return 是则返回true
@@ -299,7 +302,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public boolean isReport(){
return false;
}
-
+
/**
* 该组件是否可以拖入参数面板
* @return 是则返回true
@@ -359,7 +362,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public void setBackupBound(Rectangle rec) {
this.backupBound = rec;
}
-
+
/**
* 控件树不显示此组件
* @param path 控件树list
@@ -367,7 +370,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public void notShowInComponentTree(ArrayList path) {
return;
}
-
+
/**
* 重置组件的名称
* @param name 名称
@@ -375,7 +378,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public void resetCreatorName(String name) {
toData().setWidgetName(name);
}
-
+
/**
* 返回编辑的子组件,scale为其内部组件
* @return 组件
@@ -383,7 +386,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public XCreator getEditingChildCreator() {
return this;
}
-
+
/**
* 返回对应属性表的组件,scale和title返回其子组件
* @return 组件
@@ -391,7 +394,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public XCreator getPropertyDescriptorCreator() {
return this;
}
-
+
/**
* 更新子组件的Bound; 没有不处理
* @param minHeight 最小高度
@@ -399,7 +402,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public void updateChildBound(int minHeight) {
return;
}
-
+
/**
* 是否作为控件树的叶子节点
* @return 是则返回true
@@ -407,7 +410,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public boolean isComponentTreeLeaf() {
return true;
}
-
+
/**
* 是否为sclae和title专属容器
* @return 是则返回true
@@ -415,7 +418,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public boolean isDedicateContainer() {
return false;
}
-
+
/**
* 是否接收这种类型
* @param acceptTypes 接收的类型
@@ -432,13 +435,13 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
/**
* 是否组件要缩放(自适应里部分组件需要, 如数字、文本、下拉框、下拉复选框、密码、下拉树、下拉复选树、日期)
- *
+ *
* @return 是则返回true
*/
public boolean shouldScaleCreator() {
return false;
}
-
+
/**
* 是否支持标题样式
* @return 默认false
@@ -446,10 +449,10 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public boolean hasTitleStyle() {
return false;
}
-
+
/**
* 响应点击事件
- *
+ *
* @param editingMouseListener 鼠标点击,位置处理器
* @param e 鼠标点击事件
*/
@@ -468,10 +471,10 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
}
}
}
-
+
/**
* 删除相关组件
- *
+ *
* @param creator 当前组件
* @param designer 表单设计器
*
@@ -479,17 +482,17 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public void deleteRelatedComponent(XCreator creator,FormDesigner designer){
return;
}
-
+
/**
* 选择相关组件
- *
+ *
* @param creator 当前组件
- *
+ *
*/
public void seleteRelatedComponent(XCreator creator){
return;
}
-
+
/**
* 返回组件
* @return
@@ -498,7 +501,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public XCreator getXCreator(){
return this;
}
-
+
/**
* 按百分比调整组件
* @param percent 百分比
@@ -507,7 +510,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public void adjustCompSize(double percent){
return;
}
-
+
/**
* 返回一些需要的子组件
* @return 返回一些需要的子组件
@@ -516,11 +519,11 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public ArrayList> getTargetChildrenList(){
return new ArrayList();
}
-
+
public XLayoutContainer getOuterLayout(){
return this.getBackupParent();
}
-
+
/**
* 重新调整子组件宽度
* @param width 宽度
@@ -553,4 +556,38 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public boolean supportRenameInWidgetTree() {
return true;
}
+
+ /**
+ * 组件是否是共享组件
+ * @return 是否是共享组件
+ */
+ public boolean isShared() {
+ return StringUtils.isNotEmpty(shareId);
+ }
+
+ public void setShareId(String shareId) {
+ this.shareId = shareId;
+ }
+
+ public String getShareId() {
+ return shareId;
+ }
+
+ /**
+ * 焦点是否在帮助按钮上
+ * @return 焦点是否在帮助按钮上
+ */
+ public boolean isHelpBtnOnFocus() {
+ return isHelpBtnOnFocus;
+ }
+
+ public void setHelpBtnOnFocus(boolean helpBtnOnFocus) {
+ isHelpBtnOnFocus = helpBtnOnFocus;
+ }
+
+ /**
+ * 设置共享帮助信息
+ * @param msg 帮助信息
+ */
+ public void setSharedMsg(String msg){}
}
\ No newline at end of file
diff --git a/designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java b/designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java
index 19cfe2d8d1..e0fc683552 100644
--- a/designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java
+++ b/designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java
@@ -77,6 +77,7 @@ public class XCreatorUtils {
xLayoutMap.put(WAbsoluteLayout.class, XWAbsoluteLayout.class);
xLayoutMap.put(WParameterLayout.class, XWParameterLayout.class);
+ xLayoutMap.put(WAbsoluteBodyLayout.class, XWAbsoluteBodyLayout.class);
xLayoutMap.put(WAbsoluteLayout.class, XWAbsoluteLayout.class);
xLayoutMap.put(WHorizontalBoxLayout.class, XWHorizontalBoxLayout.class);
xLayoutMap.put(WBorderLayout.class, XWBorderLayout.class);
diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java
index 474acfbb91..252ec35c78 100644
--- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java
+++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java
@@ -1,5 +1,6 @@
package com.fr.design.designer.creator;
+import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.properties.mobile.ElementCasePropertyUI;
import com.fr.design.form.util.XCreatorConstants;
@@ -20,6 +21,7 @@ import com.fr.form.FormElementCaseProvider;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
+import com.fr.stable.CoreGraphHelper;
import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.stable.fun.FitProvider;
import com.fr.stable.fun.ReportFitAttrProvider;
@@ -35,6 +37,18 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
private UILabel imageLable;
private JPanel coverPanel;
private FormDesigner designer;
+ //缩略图
+ private BufferedImage thumbnailImage;
+ private static BufferedImage DEFAULT_BACKGROUND;
+
+ static{
+ try{
+ DEFAULT_BACKGROUND = BaseUtils.readImageWithCache("com/fr/base/images/report/elementcase.png");
+ }catch (Throwable e) {
+ //IBM jdk 1.5.0_22 并发下读取图片有时会异常(EOFException), 这个图片反正只有设计器用到, 捕获住
+ DEFAULT_BACKGROUND = CoreGraphHelper.createBufferedImage(0, 0);
+ }
+ }
public XElementCase(ElementCaseEditor widget, Dimension initSize) {
super(widget, initSize);
@@ -145,7 +159,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
*/
private UILabel initImageBackground(){
UILabel imageLable = new UILabel();
- BufferedImage image = toData().getECImage();
+ BufferedImage image = getThumbnailImage();
setLabelBackground(image, imageLable);
return imageLable;
@@ -222,10 +236,18 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
}
public void setBackground(BufferedImage image){
- toData().setECImage(image);
+ setThumbnailImage(image);
setEditorIcon(image);
}
+ private void setThumbnailImage(BufferedImage image) {
+ this.thumbnailImage = image;
+ }
+
+ private BufferedImage getThumbnailImage(){
+ return thumbnailImage == null ? DEFAULT_BACKGROUND : thumbnailImage;
+ }
+
private void setEditorIcon(BufferedImage image){
setLabelBackground(image, imageLable);
}
diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
new file mode 100644
index 0000000000..b9fea0a0bf
--- /dev/null
+++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
@@ -0,0 +1,45 @@
+package com.fr.design.designer.creator;
+
+import com.fr.design.designer.beans.LayoutAdapter;
+import com.fr.design.designer.beans.adapters.layout.FRAbsoluteBodyLayoutAdapter;
+import com.fr.form.ui.container.WAbsoluteBodyLayout;
+
+import java.awt.*;
+
+/**
+ * Created by zhouping on 2016/10/14.
+ * 用作body的绝对布局
+ */
+public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
+ public XWAbsoluteBodyLayout(WAbsoluteBodyLayout widget, Dimension initSize) {
+ super(widget, initSize);
+ this.editable = true;
+ }
+
+ /**
+ * 返回对应的widget容器
+ *
+ * @return 返回WAbsoluteLayout
+ */
+ @Override
+ public WAbsoluteBodyLayout toData() {
+ return (WAbsoluteBodyLayout)data;
+ }
+
+ @Override
+ public LayoutAdapter getLayoutAdapter() {
+ return new FRAbsoluteBodyLayoutAdapter(this);
+ }
+
+
+
+ /**
+ * 假如是body的话,始终要能编辑,不会出现蒙层
+ *
+ * @param isEditable 可否编辑
+ */
+ @Override
+ public void setEditable(boolean isEditable) {
+ super.setEditable(true);
+ }
+}
diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
index a1fc32c402..210343f8ed 100644
--- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
+++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
@@ -75,7 +75,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
xConnectorMap.put(connector, new XConnector(connector, this));
}
- initPercent();
+ initPercent(widget);
}
/**
@@ -89,13 +89,14 @@ public class XWAbsoluteLayout extends XLayoutContainer {
}
//根据屏幕大小来确定显示的百分比, 1440*900默认100%, 1366*768缩放90%
- private void initPercent(){
+ private void initPercent(WAbsoluteLayout widget){
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension scrnsize = toolkit.getScreenSize();
double screenValue = FRScreen.getByDimension(scrnsize).getValue();
if(screenValue != FormArea.DEFAULT_SLIDER){
this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER);
}
+ widget.setDesigningResolution(scrnsize);
}
/**
diff --git a/designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java b/designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java
index 4cc770eec8..e58c7f8abd 100644
--- a/designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java
+++ b/designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java
@@ -1,11 +1,10 @@
package com.fr.design.designer.properties;
-import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer;
-
/**
* Created by zhouping on 2016/8/1.
*/
-public class AbsoluteStateRenderer extends EncoderCellRenderer {
+public class AbsoluteStateRenderer extends BodyLayoutAttrRenderer {
+
public AbsoluteStateRenderer() {
super(new AbsoluteStateWrapper());
}
diff --git a/designer_form/src/com/fr/design/designer/properties/BodyLayoutAttrRenderer.java b/designer_form/src/com/fr/design/designer/properties/BodyLayoutAttrRenderer.java
new file mode 100644
index 0000000000..be05e45986
--- /dev/null
+++ b/designer_form/src/com/fr/design/designer/properties/BodyLayoutAttrRenderer.java
@@ -0,0 +1,23 @@
+package com.fr.design.designer.properties;
+
+import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer;
+import com.fr.general.IOUtils;
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+/**
+ * Created by zhouping on 2016/10/14.
+ */
+public class BodyLayoutAttrRenderer extends EncoderCellRenderer {
+ public BodyLayoutAttrRenderer(Encoder encoder) {
+ super(encoder);
+ }
+
+ @Override
+ public void paint(Graphics g) {
+ super.paint(g);
+ BufferedImage image = IOUtils.readImage("com/fr/design/images/control/combobox.png");
+ g.drawImage(image, getWidth() - image.getWidth(), 0, image.getWidth(), image.getHeight(), null, this);
+ }
+}
diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java
new file mode 100644
index 0000000000..1a7ab03d3f
--- /dev/null
+++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java
@@ -0,0 +1,239 @@
+package com.fr.design.designer.properties;
+
+import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
+import com.fr.design.designer.creator.XWFitLayout;
+import com.fr.design.mainframe.FormDesigner;
+import com.fr.design.mainframe.FormSelectionUtils;
+import com.fr.design.mainframe.WidgetPropertyPane;
+import com.fr.design.mainframe.widget.editors.LayoutTypeEditor;
+import com.fr.design.utils.gui.LayoutUtils;
+import com.fr.form.ui.Widget;
+import com.fr.form.ui.container.WBodyLayoutType;
+import com.fr.general.FRScreen;
+import com.fr.general.Inter;
+
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import java.awt.*;
+import java.awt.geom.Arc2D;
+import java.util.Arrays;
+import java.util.Comparator;
+
+/**
+ * Created by zhouping on 2016/10/14.
+ */
+public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPropertiesGroupModel {
+ private LayoutTypeEditor layoutTypeEditor;
+ private LayoutTypeRenderer layoutTypeRenderer;
+ //默认body是0,自适应布局;1,绝对布局.
+ private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE;
+ public FRAbsoluteBodyLayoutPropertiesGroupModel(XWAbsoluteBodyLayout xwAbsoluteBodyLayout) {
+ super(xwAbsoluteBodyLayout);
+ }
+
+ public FRAbsoluteBodyLayoutPropertiesGroupModel(XWAbsoluteBodyLayout xwAbsoluteBodyLayout, WBodyLayoutType layoutType){
+ this(xwAbsoluteBodyLayout);
+ this.layoutTypeEditor = new LayoutTypeEditor();
+ this.layoutTypeRenderer = new LayoutTypeRenderer();
+ this.layoutType = layoutType;
+ }
+
+ /**
+ * 布局管理器自己的属性
+ */
+ @Override
+ public String getGroupName() {
+ return Inter.getLocText("FR-Designer_Attr_Layout");
+ }
+
+ @Override
+ public int getRowCount() {
+ return 2;
+ }
+
+ @Override
+ public TableCellRenderer getRenderer(int row) {
+ return row == 0 ? layoutTypeRenderer : stateRenderer;
+ }
+
+ @Override
+ public TableCellEditor getEditor(int row) {
+ return row == 0 ? layoutTypeEditor : stateEditor;
+ }
+
+ @Override
+ public Object getValue(int row, int column) {
+ if (column == 0) {
+ switch (row) {
+ case 0:
+ return Inter.getLocText("FR-Designer_Attr_Layout_Type");
+ default:
+ return Inter.getLocText("FR-Designer-Widget_Scaling_Mode");
+ }
+ } else {
+ switch (row) {
+ case 0:
+ return layoutType.getTypeValue();
+ default:
+ return layout.getCompState();
+ }
+ }
+ }
+
+ @Override
+ public boolean setValue(Object value, int row, int column) {
+ if (layoutType == WBodyLayoutType.ABSOLUTE){
+ int state = 0;
+ if(value instanceof Integer) {
+ state = (Integer)value;
+ }
+ if (column == 0 || state < 0) {
+ return false;
+ } else {
+ if (row == 0) {
+ if (state == WBodyLayoutType.FIT.getTypeValue()) {
+ XWFitLayout xfl = (XWFitLayout) xwAbsoluteLayout.getBackupParent();
+ Component[] components = xwAbsoluteLayout.getComponents();
+
+ Arrays.sort(components, new ComparatorComponentLocation());
+
+ xfl.getLayoutAdapter().removeBean(xwAbsoluteLayout, xwAbsoluteLayout.getWidth(), xwAbsoluteLayout.getHeight());
+ xfl.remove(xwAbsoluteLayout);
+ xfl.toData().setLayoutType(WBodyLayoutType.FIT);
+
+ for (Component comp : components) {
+ xfl.add(comp);
+ }
+ moveComponents2FitLayout(xfl, components);
+ FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
+ formDesigner.getSelectionModel().setSelectedCreators(
+ FormSelectionUtils.rebuildSelection(xfl, new Widget[]{xfl.toData()}));
+ xfl.convert();
+ LayoutUtils.layoutContainer(xfl);
+ xfl.adjustCreatorsWhileSlide(xfl.getContainerPercent() - 1.0);
+ return true;
+ }
+ }
+ if (row == 1) {
+ layout.setCompState(state);
+ return true;
+ }
+ return false;
+ }
+ }
+ int state = 0;
+ if(value instanceof Integer) {
+ state = (Integer)value;
+ }
+ if (column == 0 || state < 0) {
+ return false;
+ } else {
+ if (row == 0) {
+ layout.setCompState(state);
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * 是否可编辑
+ * @param row 行
+ * @return 否
+ */
+ @Override
+ public boolean isEditable(int row) {
+ return true;
+ }
+
+ //把绝对布局中的元素按规则移动到自适应布局中
+ private void moveComponents2FitLayout(XWFitLayout xwFitLayout, Component[] components) {
+ int eachRowCount = 4;
+ if (components.length <= 1){
+ return;
+ }
+ int layoutWidth = xwFitLayout.getWidth() - xwFitLayout.toData().getMargin().getLeft() - xwFitLayout.toData().getMargin().getRight();
+ int layoutHeight = xwFitLayout.getHeight() - xwFitLayout.toData().getMargin().getTop() - xwFitLayout.toData().getMargin().getBottom();
+ int leftMargin = xwFitLayout.toData().getMargin().getLeft();
+ int topMargin = xwFitLayout.toData().getMargin().getTop();
+ int row = (components.length / eachRowCount) + (components.length % eachRowCount == 0 ? 0 : 1);
+ //最后一行的列数不定
+ int column = components.length % eachRowCount == 0 ? eachRowCount : components.length % eachRowCount;
+ int componentWidth = layoutWidth / eachRowCount;
+ int componentHeight = layoutHeight / row;
+ for(int i = 0;i < row - 1;i++){
+ for(int j = 0;j < eachRowCount;j++){
+ components[eachRowCount * i + j].setBounds(
+ leftMargin + componentWidth * j,
+ topMargin + componentHeight * i,
+ j == eachRowCount - 1 ? layoutWidth - componentWidth * (eachRowCount - 1) : componentWidth,
+ componentHeight
+ );
+ }
+ }
+ //最后一行列数是特殊的,要单独处理
+ int lastRowWidth = layoutWidth / column;
+ int lastRowHeight = layoutHeight - componentHeight * (row - 1);
+ for (int i = 0;i < column;i++) {
+ components[eachRowCount * (row - 1) + i].setBounds(
+ leftMargin + lastRowWidth * i,
+ topMargin + componentHeight * (row - 1),
+ i == column - 1 ? layoutWidth - lastRowWidth * (column - 1) : lastRowWidth,
+ lastRowHeight
+ );
+ }
+ xwFitLayout.updateBoundsWidget();
+ }
+
+ private class ComponentLocationInfo{
+ private Component component;
+ private int horizontalNO;
+ private int verticalNO;
+
+ public ComponentLocationInfo(Component component, int horizontalNO, int verticalNO){
+ this.component = component;
+ this.horizontalNO = horizontalNO;
+ this.verticalNO = verticalNO;
+ }
+
+ public int getHorizontalNO() {
+ return this.horizontalNO;
+ }
+
+ public int getVerticalNO() {
+ return this.verticalNO;
+ }
+
+ public void setHorizontalNO(int horizontalNO){
+ this.horizontalNO = horizontalNO;
+ }
+
+ public void setVerticalNO(int verticalNO){
+ this.verticalNO = verticalNO;
+ }
+ }
+
+ //以组件的位置来确定先后顺序,y小的在前,x小的在前
+ private class ComparatorComponentLocation implements Comparator {
+ @Override
+ public int compare(Object o1, Object o2) {
+ if(((Component)o1).getY() < ((Component)o2).getY()){
+ return -1;
+ }
+ else if (((Component)o1).getY() > ((Component)o2).getY()) {
+ return 1;
+ }
+ else {
+ if (((Component)o1).getX() < ((Component)o2).getX()){
+ return -1;
+ }
+ else if (((Component)o1).getX() > ((Component)o2).getX()) {
+ return 1;
+ }
+ else{
+ return 0;
+ }
+ }
+ }
+ }
+}
diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java
index fc9c0985cd..66540fe068 100644
--- a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java
+++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java
@@ -19,10 +19,10 @@ public class FRAbsoluteLayoutPropertiesGroupModel implements GroupModel {
private PropertyCellEditor editor;
private DefaultTableCellRenderer renderer;
- private AbsoluteLayoutDirectionEditor stateEditor;
- private AbsoluteStateRenderer stateRenderer;
- private WAbsoluteLayout layout;
- private XWAbsoluteLayout xwAbsoluteLayout;
+ protected AbsoluteLayoutDirectionEditor stateEditor;
+ protected AbsoluteStateRenderer stateRenderer;
+ protected WAbsoluteLayout layout;
+ protected XWAbsoluteLayout xwAbsoluteLayout;
public FRAbsoluteLayoutPropertiesGroupModel(XWAbsoluteLayout xwAbsoluteLayout){
this.xwAbsoluteLayout = xwAbsoluteLayout;
diff --git a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java
index 8a2f507936..f6b8ccaf22 100644
--- a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java
+++ b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java
@@ -4,16 +4,26 @@
package com.fr.design.designer.properties;
import com.fr.design.beans.GroupModel;
+import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWFitLayout;
+import com.fr.design.mainframe.FormDesigner;
+import com.fr.design.mainframe.FormSelectionUtils;
+import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.FitLayoutDirectionEditor;
+import com.fr.design.mainframe.widget.editors.LayoutTypeEditor;
import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor;
import com.fr.design.mainframe.widget.editors.PropertyCellEditor;
+import com.fr.form.ui.Widget;
+import com.fr.form.ui.container.WAbsoluteBodyLayout;
+import com.fr.form.ui.container.WAbsoluteLayout;
+import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout;
import com.fr.general.Inter;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
+import java.awt.*;
/**
* 自适应布局自身的属性表
@@ -28,6 +38,8 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
private DefaultTableCellRenderer renderer;
private FitLayoutDirectionEditor stateEditor;
private FitStateRenderer stateRenderer;
+ private LayoutTypeEditor layoutTypeEditor;
+ private LayoutTypeRenderer layoutTypeRenderer;
private WFitLayout layout;
private XWFitLayout xfl;
@@ -38,6 +50,8 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
editor = new PropertyCellEditor(new IntegerPropertyEditor());
stateEditor = new FitLayoutDirectionEditor();
stateRenderer = new FitStateRenderer();
+ layoutTypeEditor = new LayoutTypeEditor();
+ layoutTypeRenderer = new LayoutTypeRenderer();
}
/**
@@ -45,31 +59,35 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
*/
@Override
public String getGroupName() {
- return Inter.getLocText("FR-Designer-Layout_Adaptive_Layout");
+ return Inter.getLocText("FR-Designer_Layout");
}
@Override
public int getRowCount() {
- return 2;
+ return 3;
}
@Override
public TableCellRenderer getRenderer(int row) {
switch (row) {
case 0:
- return renderer;
+ return layoutTypeRenderer;
+ case 1:
+ return stateRenderer;
default:
- return stateRenderer;
+ return renderer;
}
}
@Override
public TableCellEditor getEditor(int row) {
switch (row) {
- case 0:
- return editor;
+ case 0:
+ return layoutTypeEditor;
+ case 1:
+ return stateEditor;
default:
- return stateEditor;
+ return editor;
}
}
@@ -78,16 +96,20 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
if (column == 0) {
switch (row) {
case 0:
- return Inter.getLocText("FR-Designer_Component_Interval");
+ return Inter.getLocText("FR-Designer_Attr_Layout_Type");
+ case 1:
+ return Inter.getLocText("FR-Designer_Component_Scale");
default:
- return Inter.getLocText("FR-Designer_Component_Scale");
+ return Inter.getLocText("FR-Designer_Component_Interval");
}
} else {
switch (row) {
case 0:
- return layout.getCompInterval();
+ return layout.getBodyLayoutType().getTypeValue();
+ case 1:
+ return layout.getCompState();
default:
- return layout.getCompState();
+ return layout.getCompInterval();
}
}
}
@@ -101,13 +123,35 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
if (column == 0 || state < 0) {
return false;
} else {
- if (row ==0 && xfl.canAddInterval(state)) {
+ if (row == 2 && xfl.canAddInterval(state)) {
// 设置完间隔后,要同步处理界面组件,容器刷新后显示出对应效果
setLayoutGap(state);
return true;
}else if (row == 1) {
layout.setCompState(state);
return true;
+ }else if (row == 0) {
+ layout.setLayoutType(WBodyLayoutType.parse(state));
+ if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) {
+ WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body");
+ wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED);
+ Component[] components = xfl.getComponents();
+ xfl.removeAll();
+ XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0,0));
+ xfl.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0);
+ for (Component component : components) {
+ xwAbsoluteBodyLayout.add(component);
+ }
+ FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
+ formDesigner.getSelectionModel().setSelectedCreators(
+ FormSelectionUtils.rebuildSelection(xfl, new Widget[]{wAbsoluteBodyLayout}));
+ }
+ else {
+ FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
+ formDesigner.getSelectionModel().setSelectedCreators(
+ FormSelectionUtils.rebuildSelection(xfl, new Widget[]{xfl.toData()}));
+ }
+ return true;
}
return false;
}
diff --git a/designer_form/src/com/fr/design/designer/properties/FitStateRenderer.java b/designer_form/src/com/fr/design/designer/properties/FitStateRenderer.java
index dfaa1939b6..933c0d17ce 100644
--- a/designer_form/src/com/fr/design/designer/properties/FitStateRenderer.java
+++ b/designer_form/src/com/fr/design/designer/properties/FitStateRenderer.java
@@ -3,13 +3,11 @@
*/
package com.fr.design.designer.properties;
-import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer;
-
/**
* @author jim
* @date 2014-7-31
*/
-public class FitStateRenderer extends EncoderCellRenderer{
+public class FitStateRenderer extends BodyLayoutAttrRenderer{
/**
* @param encoder
diff --git a/designer_form/src/com/fr/design/designer/properties/LayoutTypeRenderer.java b/designer_form/src/com/fr/design/designer/properties/LayoutTypeRenderer.java
new file mode 100644
index 0000000000..4061245d75
--- /dev/null
+++ b/designer_form/src/com/fr/design/designer/properties/LayoutTypeRenderer.java
@@ -0,0 +1,12 @@
+package com.fr.design.designer.properties;
+
+/**
+ * Created by zhouping on 2016/9/18.
+ */
+public class LayoutTypeRenderer extends BodyLayoutAttrRenderer {
+
+ public LayoutTypeRenderer() {
+ super(new LayoutTypeWrapper());
+ }
+
+}
\ No newline at end of file
diff --git a/designer_form/src/com/fr/design/designer/properties/LayoutTypeWrapper.java b/designer_form/src/com/fr/design/designer/properties/LayoutTypeWrapper.java
new file mode 100644
index 0000000000..4630fe784a
--- /dev/null
+++ b/designer_form/src/com/fr/design/designer/properties/LayoutTypeWrapper.java
@@ -0,0 +1,13 @@
+package com.fr.design.designer.properties;
+
+import com.fr.design.designer.properties.items.FRLayoutTypeItems;
+
+/**
+ * Created by zhouping on 2016/9/18.
+ */
+public class LayoutTypeWrapper extends ItemWrapper{
+
+ public LayoutTypeWrapper() {
+ super(new FRLayoutTypeItems());
+ }
+}
\ No newline at end of file
diff --git a/designer_form/src/com/fr/design/designer/properties/items/FRFitConstraintsItems.java b/designer_form/src/com/fr/design/designer/properties/items/FRFitConstraintsItems.java
index 6ae6f22c8c..92e63bf1ad 100644
--- a/designer_form/src/com/fr/design/designer/properties/items/FRFitConstraintsItems.java
+++ b/designer_form/src/com/fr/design/designer/properties/items/FRFitConstraintsItems.java
@@ -13,8 +13,8 @@ import com.fr.general.Inter;
public class FRFitConstraintsItems implements ItemProvider{
public static final Item[] ITEMS = new Item[] {
- new Item(Inter.getLocText("Adaptive_Full_Area"), WFitLayout.STATE_FULL),
- new Item(Inter.getLocText("Adaptive_Original_Scale"), WFitLayout.STATE_ORIGIN)};
+ new Item(Inter.getLocText("FR-Designer_Attr_Bidirectional_Adaptive"), WFitLayout.STATE_FULL),
+ new Item(Inter.getLocText("FR_Designer_Attr_Horizontal_Adaptive"), WFitLayout.STATE_ORIGIN)};
public Item[] getItems() {
return ITEMS;
diff --git a/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java b/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java
new file mode 100644
index 0000000000..a19d975170
--- /dev/null
+++ b/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java
@@ -0,0 +1,16 @@
+package com.fr.design.designer.properties.items;
+
+import com.fr.form.ui.container.WBodyLayoutType;
+
+/**
+ * Created by zhouping on 2016/9/18.
+ */
+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())};
+
+ public Item[] getItems() {
+ return ITEMS;
+ }
+}
diff --git a/designer_form/src/com/fr/design/designer/treeview/ComponentTreeModel.java b/designer_form/src/com/fr/design/designer/treeview/ComponentTreeModel.java
index f189bcada2..c39ea73b51 100644
--- a/designer_form/src/com/fr/design/designer/treeview/ComponentTreeModel.java
+++ b/designer_form/src/com/fr/design/designer/treeview/ComponentTreeModel.java
@@ -10,11 +10,9 @@ import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import com.fr.base.FRContext;
+import com.fr.design.designer.creator.*;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.designer.beans.events.DesignerEvent;
-import com.fr.design.designer.creator.XCreator;
-import com.fr.design.designer.creator.XLayoutContainer;
-import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.form.ui.Widget;
public class ComponentTreeModel implements TreeModel {
@@ -23,6 +21,8 @@ public class ComponentTreeModel implements TreeModel {
private Component root;
private FormDesigner designer;
+ private final int ABSOLUTE_AS_BODY_NOT_FOUND = -1;
+
public ComponentTreeModel(FormDesigner designer, Component root) {
this.designer = designer;
this.root = root;
@@ -38,6 +38,11 @@ public class ComponentTreeModel implements TreeModel {
if (parent != null && parent instanceof XLayoutContainer) {
XLayoutContainer xlayout = (XLayoutContainer) parent;
XCreator creator = xlayout.getXCreator(index);
+ //绝对布局作为body的时候不显示自适应布局父层
+ int absoluteBodyIndex = getAbsoluteBodyIndex(creator);
+ if (absoluteBodyIndex > ABSOLUTE_AS_BODY_NOT_FOUND){
+ return creator.getComponent(absoluteBodyIndex);
+ }
return creator.getXCreator();
}
return null;
@@ -135,4 +140,19 @@ public class ComponentTreeModel implements TreeModel {
FRContext.getLogger().error(e.getMessage(), e);
}
}
+
+ private int getAbsoluteBodyIndex(XCreator xCreator){
+ //绝对布局作为body,父层是自适应布局,找到绝对布局位于父层的index
+ int index = ABSOLUTE_AS_BODY_NOT_FOUND;
+ if (xCreator.acceptType(XWFitLayout.class)){
+ XWFitLayout bodyFitLayout = (XWFitLayout)xCreator;
+ for (int i = 0;i < bodyFitLayout.getXCreatorCount();i++){
+ //类型是绝对布局并且还是body
+ if (bodyFitLayout.getXCreator(i).acceptType(XWAbsoluteBodyLayout.class)){
+ index = i;
+ }
+ }
+ }
+ return index;
+ }
}
\ No newline at end of file
diff --git a/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java b/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java
index fef70c588d..b3fa73a26d 100644
--- a/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java
+++ b/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_AbsoluteLayout"), 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_CardLayout"), 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);
}
\ No newline at end of file
+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);
}
\ No newline at end of file
diff --git a/designer_form/src/com/fr/design/mainframe/ComponentTree.java b/designer_form/src/com/fr/design/mainframe/ComponentTree.java
index fb0586a693..cc242f3695 100644
--- a/designer_form/src/com/fr/design/mainframe/ComponentTree.java
+++ b/designer_form/src/com/fr/design/mainframe/ComponentTree.java
@@ -16,8 +16,7 @@ import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
-import com.fr.design.designer.creator.XCreator;
-import com.fr.design.designer.creator.XLayoutContainer;
+import com.fr.design.designer.creator.*;
import com.fr.design.designer.treeview.ComponentTreeCellRenderer;
import com.fr.design.designer.treeview.ComponentTreeModel;
import com.fr.stable.StringUtils;
@@ -40,7 +39,7 @@ public class ComponentTree extends JTree {
TreePath[] paths = getSelectedTreePath();
addTreeSelectionListener(designer);
setSelectionPaths(paths);
-
+
designer.addDesignerEditListener(new TreeDesignerEditAdapter());
this.addMouseListener(new MouseAdapter() {
@@ -68,15 +67,19 @@ public class ComponentTree extends JTree {
setEditable(true);
}
+ public FormDesigner getDesigner() {
+ return designer;
+ }
+
/**
* 构造函数
- *
+ *
* @param designer 设计界面组件
* @param model 构造JTree的model
*/
public ComponentTree(FormDesigner designer,ComponentTreeModel model) {
- this(designer);
- this.setModel(model);
+ this(designer);
+ this.setModel(model);
}
@@ -96,17 +99,17 @@ public class ComponentTree extends JTree {
return super.isPathEditable(path);
}
- /**
- * 将值转换为文本
- * @param value 值
- * @param selected 是否选中
- * @param expanded 扩展
- * @param leaf 是否叶子
- * @param row 行
- * @param hasFocus 是否焦点
- *
- * @return 返回文本
- */
+ /**
+ * 将值转换为文本
+ * @param value 值
+ * @param selected 是否选中
+ * @param expanded 扩展
+ * @param leaf 是否叶子
+ * @param row 行
+ * @param hasFocus 是否焦点
+ *
+ * @return 返回文本
+ */
@Override
public String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
if (value != null && value instanceof XCreator) {
@@ -115,25 +118,25 @@ public class ComponentTree extends JTree {
return super.convertValueToText(value, selected, expanded, leaf, row, hasFocus);
}
}
-
+
public void setAndScrollSelectionPath(TreePath treepath) {
- setSelectionPath(treepath);
- scrollPathToVisible(treepath);
+ setSelectionPath(treepath);
+ scrollPathToVisible(treepath);
+ }
+
+ private void popupMenu(MouseEvent e) {
+ TreePath path = this.getSelectionPath();
+ if (path == null) {
+ return;
+ }
+ Component component = (Component) path.getLastPathComponent();
+ if (!(component instanceof XCreator)) {
+ return;
+ }
+ ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, (XCreator) component);
+ JPopupMenu menu = adapter.getContextPopupMenu(e);
+ menu.show(this, e.getX(), e.getY());
}
-
- private void popupMenu(MouseEvent e) {
- TreePath path = this.getSelectionPath();
- if (path == null) {
- return;
- }
- Component component = (Component) path.getLastPathComponent();
- if (!(component instanceof XCreator)) {
- return;
- }
- ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, (XCreator) component);
- JPopupMenu menu = adapter.getContextPopupMenu(e);
- menu.show(this, e.getX(), e.getY());
- }
/**
* 刷新
@@ -145,51 +148,51 @@ public class ComponentTree extends JTree {
-
- public TreePath[] getSelectedTreePath() {
- XCreator[] creators = designer.getSelectionModel().getSelection().getSelectedCreators();
- TreePath[] paths = new TreePath[creators.length];
-
- for (int i = 0; i < paths.length; i++) {
- paths[i] = buildTreePath(creators[i]);
- }
- return paths;
- }
-
- private class TreeDesignerEditAdapter implements DesignerEditListener {
-
- @Override
- public void fireCreatorModified(DesignerEvent evt) {
- if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
- TreePath[] paths = getSelectedTreePath();
-
- if (paths.length == 1) {
- setAndScrollSelectionPath(paths[0]);
- } else {
- setSelectionPaths(paths);
- }
- } else if(evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) {
- ComponentTree.this.refreshUI();
- TreePath[] paths = getSelectedTreePath();
-
- if (paths.length == 1) {
- setAndScrollSelectionPath(paths[0]);
- } else {
- setSelectionPaths(paths);
- }
- ComponentTree.this.repaint();
-
- } else {
- ComponentTree.this.refreshUI();
- ComponentTree.this.repaint();
- }
- }
-
- @Override
- public boolean equals(Object o) {
- return o.getClass() == this.getClass();
- }
- }
+
+ public TreePath[] getSelectedTreePath() {
+ XCreator[] creators = designer.getSelectionModel().getSelection().getSelectedCreators();
+ TreePath[] paths = new TreePath[creators.length];
+
+ for (int i = 0; i < paths.length; i++) {
+ paths[i] = buildTreePath(creators[i]);
+ }
+ return paths;
+ }
+
+ private class TreeDesignerEditAdapter implements DesignerEditListener {
+
+ @Override
+ public void fireCreatorModified(DesignerEvent evt) {
+ if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
+ TreePath[] paths = getSelectedTreePath();
+
+ if (paths.length == 1) {
+ setAndScrollSelectionPath(paths[0]);
+ } else {
+ setSelectionPaths(paths);
+ }
+ } else if(evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) {
+ ComponentTree.this.refreshUI();
+ TreePath[] paths = getSelectedTreePath();
+
+ if (paths.length == 1) {
+ setAndScrollSelectionPath(paths[0]);
+ } else {
+ setSelectionPaths(paths);
+ }
+ ComponentTree.this.repaint();
+
+ } else {
+ ComponentTree.this.refreshUI();
+ ComponentTree.this.repaint();
+ }
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return o.getClass() == this.getClass();
+ }
+ }
/**
@@ -211,11 +214,11 @@ public class ComponentTree extends JTree {
paths[i] = buildTreePath(searchList.get(i));
}
if(paths.length > 0) {
- setAndScrollSelectionPath(paths[0]);
+ setAndScrollSelectionPath(paths[0]);
} else {
- setSelectionPath();
+ setSelectionPath();
}
- return paths;
+ return paths;
}
@@ -248,7 +251,7 @@ public class ComponentTree extends JTree {
* 触发
*/
public void fireTreeChanged() {
- designer.refreshDesignerUI();
+ designer.refreshDesignerUI();
}
/**
@@ -267,14 +270,21 @@ public class ComponentTree extends JTree {
ArrayList path = new ArrayList();
Component parent = comp;
- while (parent != null) {
- XCreator creator = (XCreator) parent;
- path.add(0, parent);
- if (creator != comp ) {
- creator.notShowInComponentTree(path);
- }
- parent = parent.getParent();
- }
+ while (parent != null) {
+ XCreator creator = (XCreator) parent;
+ path.add(0, parent);
+ if (creator != comp ) {
+ creator.notShowInComponentTree(path);
+ }
+ //绝对布局作为body的时候不显示自适应布局父层
+ if (((XCreator) parent).acceptType(XWAbsoluteBodyLayout.class)
+ && (parent.getParent() != null)
+ && ((XCreator)parent.getParent()).acceptType(XWFitLayout.class)){
+ parent = parent.getParent().getParent();
+ continue;
+ }
+ parent = parent.getParent();
+ }
Object[] components = path.toArray();
return new TreePath(components);
}
diff --git a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java
index 78af66a84d..cb111bb929 100644
--- a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java
+++ b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java
@@ -94,12 +94,6 @@ public class FormParaWidgetPane extends JPanel{
private void initFormParaComponent() {
this.removeAll();
// 菜单中的布局先注释掉
-
- JPanel reportPane = new JPanel(new FlowLayout());
- reportPane.add(new ToolBarButton(FormWidgetOption.ELEMENTCASE));
- add(createNormalCombinationPane(reportPane,Inter.getLocText("FR-Designer-Form-ToolBar_Report")));
- add(createJSeparator());
-
JPanel paraPane = new JPanel(new FlowLayout());
ToolBarButton paraButton = new paraButton(FormWidgetOption.PARAMETERCONTAINER);
paraPane.add(paraButton);
@@ -111,7 +105,8 @@ public class FormParaWidgetPane extends JPanel{
for(WidgetOption option : loadLayoutOptions()){
layoutPane.add(new ToolBarButton(option));
}
- add(createNormalCombinationPane(layoutPane,Inter.getLocText("FR-Designer_Layout")));
+ layoutPane.add(new ToolBarButton(FormWidgetOption.ELEMENTCASE));
+ add(createNormalCombinationPane(layoutPane,Inter.getLocText("FR-Designer_Layout_Block_Blank")));
jSeparatorLayout = createJSeparator();
add(jSeparatorLayout);
@@ -192,7 +187,7 @@ public class FormParaWidgetPane extends JPanel{
}
labelPane.add(label,BorderLayout.CENTER);
reportPane.add(labelPane,BorderLayout.SOUTH);
- reportPane.setPreferredSize(new Dimension((int)jComponent.getPreferredSize().getWidth(),(int)reportPane.getPreferredSize().getHeight()));
+ reportPane.setPreferredSize(new Dimension((int)reportPane.getPreferredSize().getWidth(),(int)reportPane.getPreferredSize().getHeight()));
return reportPane;
}
diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java
index 848f0da4cf..ef18f07135 100644
--- a/designer_form/src/com/fr/design/mainframe/JForm.java
+++ b/designer_form/src/com/fr/design/mainframe/JForm.java
@@ -10,6 +10,7 @@ import com.fr.design.designer.beans.actions.FormDeleteAction;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XComponent;
+import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.TargetModifiedEvent;
@@ -35,6 +36,7 @@ import com.fr.file.FILE;
import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider;
import com.fr.form.main.Form;
+import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.general.ComparatorUtils;
@@ -756,4 +758,10 @@ public class JForm extends JTemplate
+ * Description: 树形结构而来的DefaultListCellRenderer
+ */
+ class UITreeComboBoxRenderer extends DefaultListCellRenderer {
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus){
+ if(value != null){
+ TreePath path = (TreePath)value;
+ Object node = path.getLastPathComponent();
+ value = node;
+ TreeCellRenderer r = tree.getCellRenderer();
+ JLabel lb = (JLabel)r.getTreeCellRendererComponent(
+ tree, value, isSelected, false, false, index,
+ cellHasFocus);
+ return lb;
+ }
+ return super.getListCellRendererComponent(list, value, index,
+ isSelected, cellHasFocus);
+ }
+ }
+
+
+ private class TreeComboBoxDesignerEditAdapter implements DesignerEditListener {
+
+ @Override
+ public void fireCreatorModified(DesignerEvent evt) {
+ if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED || evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) {
+ TreePath[] paths = tree.getSelectedTreePath();
+
+ if (paths.length == 1) {
+ tree.setAndScrollSelectionPath(paths[0]);
+ } else {
+ tree.setSelectionPaths(paths);
+ }
+ setSelectedItem(paths[0]);
+ MenuSelectionManager.defaultManager().clearSelectedPath();
+ } else {
+ return;
+ }
+
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return o.getClass() == this.getClass();
+ }
+ }
+
+ /**
+ * 测试
+ */
+// public static void main(String args[]){
+// JFrame frame = new JFrame("UITreeComboBox");
+// final UITreeComboBox box = new UITreeComboBox(new ComponentTree(new FormDesigner()));
+// box.setPreferredSize(new Dimension(300, 28));
+// frame.getContentPane().add(box);
+// frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+// frame.pack();
+// frame.setVisible(true);
+// }
+}
+
+/**
+ * Title: UITreeComboBox
+ * Description: TreePopup
+ */
+class TreePopup extends JPopupMenu implements ComboPopup{
+ protected UITreeComboBox comboBox;
+ protected JScrollPane scrollPane;
+
+ protected MouseMotionListener mouseMotionListener;
+ protected MouseListener mouseListener;
+
+
+ public void popupMenu(MouseEvent e) {
+ TreePath path = comboBox.getTree().getSelectionPath();
+ if (path == null) {
+ return;
+ }
+ Component component = (Component) path.getLastPathComponent();
+ if (!(component instanceof XCreator)) {
+ return;
+ }
+ com.fr.design.designer.beans.ComponentAdapter adapter = AdapterBus.getComponentAdapter(comboBox.getTree().getDesigner(), (XCreator) component);
+ JPopupMenu menu = adapter.getContextPopupMenu(e);
+ menu.show(comboBox, e.getX(), e.getY());
+ }
+
+ public TreePopup(JComboBox comboBox){
+ this.comboBox = (UITreeComboBox)comboBox;
+ setBorder(BorderFactory.createLineBorder(Color.black));
+ setLayout(new BorderLayout());
+ setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled());
+ JTree tree = this.comboBox.getTree();
+ if(tree != null){
+ scrollPane = new JScrollPane(tree);
+ scrollPane.setBorder(null);
+ add(scrollPane, BorderLayout.CENTER);
+ }
+ }
+
+ public void show(){
+ updatePopup();
+ show(comboBox, 0, comboBox.getHeight());
+ comboBox.getTree().requestFocus();
+ }
+
+ public void hide(){
+ setVisible(false);
+ comboBox.firePropertyChange("popupVisible", true, false);
+ }
+
+ protected JList list = new JList();
+ public JList getList(){
+ return list;
+ }
+
+ public MouseMotionListener getMouseMotionListener(){
+ if(mouseMotionListener == null){
+ mouseMotionListener = new MouseMotionAdapter(){};
+ }
+ return mouseMotionListener;
+ }
+
+ public KeyListener getKeyListener(){
+ return null;
+ }
+
+ public void uninstallingUI(){}
+
+ /**
+ * Implementation of ComboPopup.getMouseListener().
+ *
+ * @return a MouseListener
or null
+ * @see ComboPopup#getMouseListener
+ */
+ public MouseListener getMouseListener(){
+ if(mouseListener == null){
+ mouseListener = new InvocationMouseHandler();
+ }
+ return mouseListener;
+ }
+
+ protected void togglePopup(){
+ if(isVisible()){
+ hide();
+ } else{
+ show();
+ }
+ }
+ protected void updatePopup(){
+ setPreferredSize(new Dimension(comboBox.getSize().width, 200));
+ Object selectedObj = comboBox.getSelectedItem();
+ if(selectedObj != null){
+ TreePath tp = (TreePath)selectedObj;
+ ((UITreeComboBox)comboBox).getTree().setSelectionPath(tp);
+ }
+ }
+
+ protected class InvocationMouseHandler extends MouseAdapter{
+ public void mousePressed(MouseEvent e){
+ if(!SwingUtilities.isLeftMouseButton(e) || !comboBox.isEnabled()){
+ return;
+ }
+ if(comboBox.isEditable()){
+ Component comp = comboBox.getEditor().getEditorComponent();
+ if((!(comp instanceof JComponent)) ||
+ ((JComponent)comp).isRequestFocusEnabled()){
+ comp.requestFocus();
+ }
+ } else if(comboBox.isRequestFocusEnabled()){
+ comboBox.requestFocus();
+ }
+ togglePopup();
+ }
+
+ public void mouseClicked (MouseEvent e){
+ if (e.isMetaDown()) {
+ popupMenu(e);
+ } else {
+ return;
+ }
+ }
+ }
+
+
+
+}
diff --git a/designer_form/src/com/fr/design/mainframe/widget/editors/LayoutTypeEditor.java b/designer_form/src/com/fr/design/mainframe/widget/editors/LayoutTypeEditor.java
new file mode 100644
index 0000000000..05de57f52c
--- /dev/null
+++ b/designer_form/src/com/fr/design/mainframe/widget/editors/LayoutTypeEditor.java
@@ -0,0 +1,15 @@
+package com.fr.design.mainframe.widget.editors;
+
+import com.fr.design.designer.properties.EnumerationEditor;
+import com.fr.design.designer.properties.items.FRLayoutTypeItems;
+
+/**
+ * Created by zhouping on 2016/9/18.
+ */
+public class LayoutTypeEditor extends EnumerationEditor {
+
+ public LayoutTypeEditor() {
+ super(new FRLayoutTypeItems());
+ }
+
+}
\ No newline at end of file
diff --git a/designer_form/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java b/designer_form/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java
index 10ab5f2729..17f9d0c891 100644
--- a/designer_form/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java
+++ b/designer_form/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java
@@ -7,6 +7,7 @@ import com.fr.design.Exception.ValidationException;
import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder;
import com.fr.general.Inter;
+import com.fr.general.NameObject;
import com.fr.stable.StringUtils;
public class TreeModelWrapper implements Encoder, Decoder {
@@ -21,6 +22,8 @@ public class TreeModelWrapper implements Encoder, Decoder {
} else if (v instanceof TreeNodeWrapper) {
TreeNodeAttr[] treeNodeAttrs = ((TreeNodeWrapper) v).getTreeNodeAttrs();
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{treeNodeAttrs.length + ""});
+ } else if (v instanceof NameObject) {
+ return Inter.getLocText("FR-Designer_DataTable-Build");
} else {
return Inter.getLocText("FR-Designer_Auto-Build");
}