Browse Source

Merging in latest from upstream (BA/design:refs/heads/dev)

* commit '199bd0b3310dde7887bd9a988255ec476b8be14a': (31 commits)
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  标签右对齐
  rt
  REPORT-414 同步到dev上演示
  rt
  rt
  rt
  rt
  rt
  ...
master
lee 8 years ago
parent
commit
d9bf7d3f99
  1. 2
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  2. 2
      designer_base/src/com/fr/design/constants/KeyWords.java
  3. 52
      designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java
  4. 19
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  5. 4
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java
  6. 8
      designer_form/build.dev.gradle
  7. 89
      designer_form/build.dev.gradle.bak
  8. BIN
      designer_form/src/com/fr/design/form/images/delete icon.png
  9. BIN
      designer_form/src/com/fr/design/form/images/download icon.png
  10. BIN
      designer_form/src/com/fr/design/form/images/install icon.png
  11. BIN
      designer_form/src/com/fr/design/form/images/marked.png
  12. BIN
      designer_form/src/com/fr/design/form/images/refresh.png
  13. BIN
      designer_form/src/com/fr/design/form/images/unmarked.png
  14. 2
      designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
  15. 9
      designer_form/src/com/fr/design/mainframe/FormDesigner.java
  16. 8
      designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java
  17. 125
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  18. 6
      designer_form/src/com/fr/design/mainframe/JForm.java
  19. 99
      designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java
  20. 5
      designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java
  21. 7
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

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

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.page.ReportSettingsProvider; import com.fr.page.ReportSettingsProvider;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -58,6 +59,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
if (editingTemplate != null && !editingTemplate.isUpMode()) { if (editingTemplate != null && !editingTemplate.isUpMode()) {
EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance()); EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceUpPane(QuickEditorRegion.getInstance()); EastRegionContainerPane.getInstance().replaceUpPane(QuickEditorRegion.getInstance());
EastRegionContainerPane.getInstance().removeParameterPane();
} }
} }
}); });

2
designer_base/src/com/fr/design/constants/KeyWords.java

@ -117,6 +117,8 @@ public class KeyWords {
"verifyReport()", "verifyReport()",
"writeReportIgnoreVerify(true)", "writeReportIgnoreVerify(true)",
"writeReport(index)", "writeReport(index)",
"loadSheetByIndex(index)",
"loadSheetByName(sheetName)",
// curLGP // curLGP
"currentTDCell", "currentTDCell",

52
designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java

@ -3,6 +3,7 @@ package com.fr.design.gui.icontainer;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -21,6 +22,8 @@ public class UIResizableContainer extends JPanel {
private JComponent upPane; private JComponent upPane;
private JComponent downPane; private JComponent downPane;
//放参数面板
private JComponent parameterPane = new JPanel();
private HorizotalToolPane horizontToolPane; private HorizotalToolPane horizontToolPane;
private VerticalToolPane verticalToolPane; private VerticalToolPane verticalToolPane;
@ -37,6 +40,7 @@ public class UIResizableContainer extends JPanel {
private boolean isLeftRightDragEnabled = true; private boolean isLeftRightDragEnabled = true;
private boolean isDownPaneVisible = true ; private boolean isDownPaneVisible = true ;
private int paraHeight;
public UIResizableContainer(int direction) { public UIResizableContainer(int direction) {
this(new JPanel(), new JPanel(), direction); this(new JPanel(), new JPanel(), direction);
@ -85,7 +89,9 @@ public class UIResizableContainer extends JPanel {
add(horizontToolPane); add(horizontToolPane);
add(downPane); add(downPane);
add(verticalToolPane); add(verticalToolPane);
add(parameterPane);
} }
public UIResizableContainer(JComponent upPane, int direction) { public UIResizableContainer(JComponent upPane, int direction) {
setBackground(UIConstants.NORMAL_BACKGROUND); setBackground(UIConstants.NORMAL_BACKGROUND);
@ -96,6 +102,7 @@ public class UIResizableContainer extends JPanel {
setLayout(containerLayout); setLayout(containerLayout);
add(upPane); add(upPane);
add(horizontToolPane); add(horizontToolPane);
add(parameterPane);
} }
@ -119,6 +126,26 @@ public class UIResizableContainer extends JPanel {
} }
} }
/**
* 获取参数面板高度
*/
public int getParameterPaneHeight() {
return paraHeight;
}
/**
* 设置参数面板高度
*
* @param height
*/
public void setParameterHeight(int height) {
paraHeight = height;
refreshContainer();
}
/** /**
* 得到上下子面板的高度 * 得到上下子面板的高度
* *
@ -183,7 +210,7 @@ public class UIResizableContainer extends JPanel {
if(isDownPaneVisible){ if(isDownPaneVisible){
upPane.setBounds(0, 0, containerWidth - toolPaneHeight, toolPaneY); upPane.setBounds(0, 0, containerWidth - toolPaneHeight, toolPaneY);
horizontToolPane.setBounds(0, toolPaneY, containerWidth - toolPaneHeight, toolPaneHeight); horizontToolPane.setBounds(0, toolPaneY, containerWidth - toolPaneHeight, toolPaneHeight);
downPane.setBounds(0, toolPaneY + toolPaneHeight, containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight); downPane.setBounds(0, toolPaneY + toolPaneHeight, containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight-30);
verticalToolPane.setBounds(containerWidth - toolPaneHeight, 0, toolPaneHeight, getHeight()); verticalToolPane.setBounds(containerWidth - toolPaneHeight, 0, toolPaneHeight, getHeight());
}else{ }else{
upPane.setBounds(0, 0, containerWidth - toolPaneHeight, getHeight()); upPane.setBounds(0, 0, containerWidth - toolPaneHeight, getHeight());
@ -194,12 +221,14 @@ public class UIResizableContainer extends JPanel {
if (toolPaneY > getHeight() - toolPaneHeight) { if (toolPaneY > getHeight() - toolPaneHeight) {
toolPaneY = getHeight() - toolPaneHeight; toolPaneY = getHeight() - toolPaneHeight;
} }
upPane.setBounds(toolPaneHeight, 0, containerWidth - toolPaneHeight, toolPaneY); parameterPane.setBounds(20, 0, 230, getParameterPaneHeight());
horizontToolPane.setBounds(toolPaneHeight, toolPaneY, containerWidth - toolPaneHeight, toolPaneHeight); upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneY);
downPane.setBounds(toolPaneHeight, toolPaneY + toolPaneHeight, containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight); horizontToolPane.setBounds(toolPaneHeight, toolPaneY + getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneHeight);
downPane.setBounds(toolPaneHeight, toolPaneY + toolPaneHeight + getParameterPaneHeight(), containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight - getParameterPaneHeight());
verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight());
} else { } else {
upPane.setBounds(toolPaneHeight, 0, containerWidth - toolPaneHeight, getHeight()); parameterPane.setBounds(20, 0, 230, getParameterPaneHeight());
upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, getHeight() - getParameterPaneHeight());
verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight());
} }
} }
@ -244,6 +273,17 @@ public class UIResizableContainer extends JPanel {
refreshContainer(); refreshContainer();
} }
public void addParameterPane(JComponent pane) {
add(this.parameterPane = pane);
refreshContainer();
}
public void removeParameterPane() {
remove(this.parameterPane);
setParameterHeight(0);
refreshContainer();
}
/** /**
* 得到上子面板 * 得到上子面板
* *
@ -483,7 +523,7 @@ public class UIResizableContainer extends JPanel {
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane(); JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout()); content.setLayout(new BorderLayout());
UIResizableContainer bb = new UIResizableContainer(Constants.LEFT); UIResizableContainer bb = new UIResizableContainer(Constants.RIGHT);
JPanel cc = new JPanel(); JPanel cc = new JPanel();
cc.setBackground(Color.blue); cc.setBackground(Color.blue);
content.add(bb, BorderLayout.EAST); content.add(bb, BorderLayout.EAST);

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

@ -87,6 +87,20 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames();
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
//异步加载
new Thread(new Runnable() {
@Override
public void run() {
getWidgetOption(typeName, child);
}
}).start();
return child;
}
private static void getWidgetOption(ChartInternationalNameContentBean[] typeName, ChartWidgetOption[] child){
for (int i = 0; i < typeName.length; i++) { for (int i = 0; i < typeName.length; i++) {
String plotID = typeName[i].getPlotID(); String plotID = typeName[i].getPlotID();
Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID);
@ -94,14 +108,15 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
continue; continue;
} }
//初始化图表模型图片 //加载初始化图表模型图片
initChartsDemoImage(rowChart); initChartsDemoImage(rowChart);
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID);
Icon icon = IOUtils.readIcon(iconPath); Icon icon = IOUtils.readIcon(iconPath);
child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]);
} }
return child;
DesignModuleFactory.registerExtraWidgetOptions(child);
} }
private static void initChartsDemoImage(Chart[] rowChart) { private static void initChartsDemoImage(Chart[] rowChart) {

4
designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java

@ -46,8 +46,8 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
double[] rowSize = { p, p, p}; double[] rowSize = { p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(getCateNameString()), getSingCatePane()}, new Component[]{new UILabel(getCateNameString(), SwingConstants.RIGHT), getSingCatePane()},
new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()}, new Component[]{new UILabel(getNValueString(), SwingConstants.RIGHT), singValuePane = new TinyFormulaPane()},
new Component[]{null, null} new Component[]{null, null}
}; };

8
designer_form/build.dev.gradle

@ -30,11 +30,17 @@ FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//jar包
FileTree f=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
f.each{File file->
println "----${file.path}"
}
// //
dependencies{ dependencies{
compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar') compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }

89
designer_form/build.dev.gradle.bak

@ -0,0 +1,89 @@
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)
//jar包
FileTree f=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
f.each{File file->
println "----${f.path}"
}
//
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

BIN
designer_form/src/com/fr/design/form/images/delete icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

BIN
designer_form/src/com/fr/design/form/images/download icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

BIN
designer_form/src/com/fr/design/form/images/install icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

BIN
designer_form/src/com/fr/design/form/images/marked.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
designer_form/src/com/fr/design/form/images/refresh.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

BIN
designer_form/src/com/fr/design/form/images/unmarked.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

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

@ -114,6 +114,8 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
if (!BaseUtils.isAuthorityEditing()) { if (!BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().replaceUpPane( EastRegionContainerPane.getInstance().replaceUpPane(
WidgetPropertyPane.getInstance(this)); WidgetPropertyPane.getInstance(this));
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this));
refreshParameter();
} else { } else {
showAuthorityEditPane(); showAuthorityEditPane();
} }

9
designer_form/src/com/fr/design/mainframe/FormDesigner.java

@ -198,6 +198,13 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean(
getParameterArray() == null ? new Parameter[0] : getParameterArray()); getParameterArray() == null ? new Parameter[0] : getParameterArray());
ParameterPropertyPane.getInstance().repaintContainer(); ParameterPropertyPane.getInstance().repaintContainer();
if (getParameterArray().length == 0) {
EastRegionContainerPane.getInstance().setParameterHeight(30);
} else {
//参数面板独立后只能这边触发调整高度,根据参数个数调整换行,计算高度
EastRegionContainerPane.getInstance().setParameterHeight((getParameterArray().length + 5) / 6 * 30 + 80);
}
} }
private void removeSame(Parameter[] parameters, List<String> namelist){ private void removeSame(Parameter[] parameters, List<String> namelist){
@ -463,6 +470,8 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
paraComponent = null; paraComponent = null;
formLayoutContainer.setSize(rootComponent.getWidth(), rootComponent.getHeight()); formLayoutContainer.setSize(rootComponent.getWidth(), rootComponent.getHeight());
EastRegionContainerPane.getInstance().replaceDownPane(this.getEastDownPane()); EastRegionContainerPane.getInstance().replaceDownPane(this.getEastDownPane());
//atat
//EastRegionContainerPane.getInstance().addTitlePane(ParameterPropertyPane.getInstance(FormDesigner.this));
//删除后重绘下 //删除后重绘下
invalidateLayout(); invalidateLayout();
} }

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

@ -49,7 +49,6 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
private ComponentTree componentTree; private ComponentTree componentTree;
private UITreeComboBox treeComboBox; private UITreeComboBox treeComboBox;
private JPanel widgetPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
// richer:搜寻树节点的的文本框 // richer:搜寻树节点的的文本框
// private UITextField searchTextField; // private UITextField searchTextField;
// private SearchResultPane searchResult; // private SearchResultPane searchResult;
@ -116,16 +115,15 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
if(childCount == NODE_LENGTH){ if(childCount == NODE_LENGTH){
adjustPosition(treeModel, formDesigner); adjustPosition(treeModel, formDesigner);
} }
widgetPane.setBorder(BorderFactory.createEmptyBorder(3, 2, 3, 0)); JPanel widgetPane = new JPanel();
widgetPane.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
widgetPane.setLayout(FRGUIPaneFactory.createBorderLayout());
add(widgetPane, BorderLayout.NORTH); add(widgetPane, BorderLayout.NORTH);
if(treeComboBox == null) {
widgetPane.add(new UILabel(Inter.getLocText("FR-Designer-Selected_Widget") + " ", widgetPane.add(new UILabel(Inter.getLocText("FR-Designer-Selected_Widget") + " ",
SwingConstants.HORIZONTAL), BorderLayout.WEST); SwingConstants.HORIZONTAL), BorderLayout.WEST);
treeComboBox = new UITreeComboBox(componentTree); treeComboBox = new UITreeComboBox(componentTree);
widgetPane.add(treeComboBox, BorderLayout.CENTER); widgetPane.add(treeComboBox, BorderLayout.CENTER);
add(widgetPane, BorderLayout.CENTER); add(widgetPane, BorderLayout.CENTER);
}
// UIScrollPane scrollPane = new UIScrollPane(componentTree); // UIScrollPane scrollPane = new UIScrollPane(componentTree);

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

@ -5,11 +5,14 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.List; import java.util.List;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import javax.swing.filechooser.FileNameExtensionFilter;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.actions.file.WebPreviewUtils;
@ -31,10 +34,12 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.gui.itoolbar.UILargeToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareConstants;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.ElCaseBindInfo;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
/** /**
@ -51,6 +56,8 @@ public class FormWidgetDetailPane extends FormDockView{
private UIComboBox comboBox; private UIComboBox comboBox;
private ElCaseBindInfo[] elCaseBindInfoList; private ElCaseBindInfo[] elCaseBindInfoList;
private UIButton downloadButton; private UIButton downloadButton;
private UIButton refreshButton;
private UIButton deleteButton;
private static final int OFFSET_X = 140; private static final int OFFSET_X = 140;
private static final int OFFSET_Y = 26; private static final int OFFSET_Y = 26;
@ -101,6 +108,7 @@ public class FormWidgetDetailPane extends FormDockView{
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
} }
initReuWidgetPanel(); initReuWidgetPanel();
createRefreshButton();
createDownloadButton(); createDownloadButton();
initMenuPanel(); initMenuPanel();
tabbedPane = new UITabbedPane(); tabbedPane = new UITabbedPane();
@ -117,7 +125,7 @@ public class FormWidgetDetailPane extends FormDockView{
* 初始化组件共享和复用面板 * 初始化组件共享和复用面板
*/ */
private void initReuWidgetPanel() { private void initReuWidgetPanel() {
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false));
reuWidgetPanel.add(downPanel); reuWidgetPanel.add(downPanel);
} }
@ -127,15 +135,22 @@ public class FormWidgetDetailPane extends FormDockView{
private void initMenuPanel() { private void initMenuPanel() {
JPanel menutPane = new JPanel(); JPanel menutPane = new JPanel();
menutPane.setLayout(FRGUIPaneFactory.createBorderLayout()); menutPane.setLayout(FRGUIPaneFactory.createBorderLayout());
menutPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 3, 3)); menutPane.setBorder(BorderFactory.createEmptyBorder(3, 8, 3, 3));
menutPane.setPreferredSize(new Dimension(240, 48));
menutPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), menutPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"),
SwingConstants.HORIZONTAL), BorderLayout.WEST); SwingConstants.HORIZONTAL), BorderLayout.WEST);
menutPane.add(downloadButton, BorderLayout.EAST); JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
buttonPanel.add(refreshButton, BorderLayout.WEST);
buttonPanel.add(downloadButton, BorderLayout.EAST);
menutPane.add(buttonPanel, BorderLayout.EAST);
menutPane.add(new JPanel(), BorderLayout.CENTER);
comboBox = new UIComboBox(getFormCategories()); comboBox = new UIComboBox(getFormCategories());
comboBox.setPreferredSize(new Dimension(240, 30)); comboBox.setPreferredSize(new Dimension(240, 30));
initComboBoxSelectedListener(); initComboBoxSelectedListener();
menutPane.add(comboBox, BorderLayout.SOUTH); menutPane.add(comboBox, BorderLayout.SOUTH);
reuWidgetPanel.add(menutPane, BorderLayout.NORTH); reuWidgetPanel.add(menutPane, BorderLayout.NORTH);
} }
private void initComboBoxSelectedListener() { private void initComboBoxSelectedListener() {
@ -149,12 +164,27 @@ public class FormWidgetDetailPane extends FormDockView{
String filterName = comboBox.getSelectedItem().toString(); String filterName = comboBox.getSelectedItem().toString();
elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName);
} }
refreshDownPanel(); refreshDownPanel(false);
} }
}); });
} }
private void createRefreshButton() {
refreshButton = new UIButton();
refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"));
refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Refresh"));
refreshButton.set4ToolbarButton();
refreshButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
refreshShareMoudule();
refreshDownPanel(false);
}
});
}
/** /**
* 创建下载模板的按钮 * 创建下载模板的按钮
*/ */
@ -162,12 +192,19 @@ public class FormWidgetDetailPane extends FormDockView{
downloadButton = new UIButton(); downloadButton = new UIButton();
downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/showmenu.png")); downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/showmenu.png"));
downloadButton.set4ToolbarButton(); downloadButton.set4ToolbarButton();
downloadButton.setToolTipText(Inter.getLocText("FR-Designer_Download_Template"));
downloadButton.addActionListener(new ActionListener() { downloadButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
UIPopupMenu menu = new UIPopupMenu(); UIPopupMenu menu = new UIPopupMenu();
UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download icon.png"));
UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Install_Template"), BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"));
UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Delete_Template"), BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png"));
menu.add(downloadItem); menu.add(downloadItem);
menu.add(installItem);
menu.add(deleteItem);
downloadItem.addActionListener(new ActionListener() { downloadItem.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -177,12 +214,84 @@ public class FormWidgetDetailPane extends FormDockView{
dlg.setVisible(true); dlg.setVisible(true);
} }
}); });
GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, tabbedPane.getY() + OFFSET_Y);
installItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu"));
int returnValue = fileChooser.showDialog(new JLabel(), Inter.getLocText("FR-Designer_Select"));
if (returnValue == JFileChooser.APPROVE_OPTION) {
final File chosenFile = fileChooser.getSelectedFile();
installFromDiskZipFile(chosenFile);
}
}
});
deleteItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
deleteFromDiskZipFile();
}
});
GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, OFFSET_Y);
} }
}); });
} }
private void deleteFromDiskZipFile() {
deleteButton = new UIButton(Inter.getLocText("FR-Designer-CommitTab_Remove"));
deleteButton.setOpaque(true);
deleteButton.setBackground(Color.red);
deleteButton.setPreferredSize(new Dimension(240, 40));
reuWidgetPanel.add(deleteButton, BorderLayout.SOUTH);
deleteButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(ShareLoader.getLoader().removeModulesFromList()) {
refreshShareMoudule();
reuWidgetPanel.remove(deleteButton);
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful"));
refreshDownPanel(false);
} else {
reuWidgetPanel.remove(deleteButton);
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed"));
refreshDownPanel(false);
}
}
});
refreshDownPanel(true);
}
private void installFromDiskZipFile(File chosenFile) {
try {
ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile);
refreshShareMoudule();
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
refreshDownPanel(false);
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK"));
} catch (IOException e) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error"));
e.printStackTrace();
}
}
private void refreshShareMoudule() {
try {
ShareLoader.getLoader().refreshModule();
} catch (Exception e) {
e.printStackTrace();
}
}
/** /**
* 获取报表块组件分类 * 获取报表块组件分类
*/ */
@ -192,9 +301,9 @@ public class FormWidgetDetailPane extends FormDockView{
public void refreshDownPanel() { public void refreshDownPanel(boolean isEdit) {
reuWidgetPanel.remove(downPanel); reuWidgetPanel.remove(downPanel);
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit));
reuWidgetPanel.add(downPanel); reuWidgetPanel.add(downPanel);
repaintContainer(); repaintContainer();

6
designer_form/src/com/fr/design/mainframe/JForm.java

@ -28,6 +28,7 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.file.FILE; import com.fr.file.FILE;
@ -247,6 +248,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
ComparatorUtils.equals(editingComponent.getClass(), NoSupportAuthorityEdit.class) ? editingComponent : createAuthorityEditPane()); ComparatorUtils.equals(editingComponent.getClass(), NoSupportAuthorityEdit.class) ? editingComponent : createAuthorityEditPane());
} else { } else {
EastRegionContainerPane.getInstance().replaceUpPane(editingComponent); EastRegionContainerPane.getInstance().replaceUpPane(editingComponent);
} }
} }
@ -615,8 +617,9 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
} }
} }
EastRegionContainerPane.getInstance().replaceUpPane(WidgetPropertyPane.getInstance(formDesign));
EastRegionContainerPane.getInstance().replaceUpPane(WidgetPropertyPane.getInstance(formDesign));
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(formDesign));
if (EastRegionContainerPane.getInstance().getDownPane() == null) { if (EastRegionContainerPane.getInstance().getDownPane() == null) {
new Thread() { new Thread() {
public void run() { public void run() {
@ -636,6 +639,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
pane.setLayout(new BorderLayout()); pane.setLayout(new BorderLayout());
pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER); pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceDownPane(pane); EastRegionContainerPane.getInstance().replaceDownPane(pane);
} }
} }

99
designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java

@ -1,16 +1,21 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.*;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.icon.IconPathConstants;
import com.fr.form.share.ShareConstants;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.ElCaseBindInfo;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.Icon;
import java.awt.*; import java.awt.*;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
@ -30,17 +35,56 @@ import java.io.Serializable;
public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable { public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable {
private ElCaseBindInfo bindInfo; private ElCaseBindInfo bindInfo;
private MouseEvent lastPressEvent; private MouseEvent lastPressEvent;
private JPanel reportPane;
private boolean isEdit;
private boolean isMarked;
private Icon markedMode = IOUtils.readIcon("/com/fr/design/form/images/marked.png");
private Icon unMarkedMode = IOUtils.readIcon("/com/fr/design/form/images/unmarked.png");
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F);
private JComponent markedButton = new JComponent() {
protected void paintComponent(Graphics g) {
markedMode.paintIcon(this, g, 0, 0);
}
};
private JComponent unMarkedButton = new JComponent() {
protected void paintComponent(Graphics g) {
unMarkedMode.paintIcon(this, g, 0, 0);
}
};
public ShareWidgetButton(ElCaseBindInfo bindInfo) { public ShareWidgetButton(ElCaseBindInfo bindInfo) {
this.bindInfo = bindInfo; this.bindInfo = bindInfo;
this.setPreferredSize(new Dimension(108, 68));
initUI(); initUI();
this.setLayout(getCoverLayout());
this.addMouseListener(this); this.addMouseListener(this);
this.addMouseMotionListener(this); this.addMouseMotionListener(this);
new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE); new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE);
} }
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite();
g2d.setComposite(composite);
g2d.setColor(Color.white);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setComposite(oldComposite);
super.paint(g);
}
public void setElementCaseEdit(boolean isEdit) {
this.isEdit = isEdit;
if (isEdit) {
this.add(unMarkedButton, 0);
repaint();
}
}
private void initUI() { private void initUI() {
JPanel reportPane = new JPanel(new BorderLayout());
reportPane = new JPanel(new BorderLayout());
reportPane.add(new UILabel(new ImageIcon(bindInfo.getCover())), BorderLayout.CENTER); reportPane.add(new UILabel(new ImageIcon(bindInfo.getCover())), BorderLayout.CENTER);
JPanel labelPane = new JPanel(new BorderLayout()); JPanel labelPane = new JPanel(new BorderLayout());
UILabel label = new UILabel(bindInfo.getName(), UILabel.CENTER); UILabel label = new UILabel(bindInfo.getName(), UILabel.CENTER);
@ -50,6 +94,41 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
add(reportPane); add(reportPane);
} }
protected LayoutManager getCoverLayout() {
return new LayoutManager() {
@Override
public void removeLayoutComponent(Component comp) {
}
@Override
public Dimension preferredLayoutSize(Container parent) {
return parent.getPreferredSize();
}
@Override
public Dimension minimumLayoutSize(Container parent) {
return null;
}
@Override
public void layoutContainer(Container parent) {
int width = parent.getWidth();
int height = parent.getHeight();
markedButton.setBounds((width - 25), 0, 25, 25);
unMarkedButton.setBounds((width - 25), 0, 25, 25);
reportPane.setBounds(0, 0, width, height);
}
@Override
public void addLayoutComponent(String name, Component comp) {
}
};
}
public ElCaseBindInfo getBindInfo() { public ElCaseBindInfo getBindInfo() {
return bindInfo; return bindInfo;
} }
@ -58,9 +137,25 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
this.bindInfo = bindInfo; this.bindInfo = bindInfo;
} }
public String getFileName() {
return bindInfo.getName() +"." + bindInfo.getId() + ShareConstants.SUFFIX_MODULE;
}
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (isEdit) {
if (isMarked) {
remove(markedButton);
ShareLoader.getLoader().removeModuleForList(getFileName());
isMarked = false;
} else {
add(markedButton,0);
ShareLoader.getLoader().addModuleToList(getFileName());
isMarked = true;
}
}
repaint();
} }
@Override @Override

5
designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java

@ -12,12 +12,13 @@ import java.awt.*;
*/ */
public class ShareWidgetPane extends JPanel { public class ShareWidgetPane extends JPanel {
public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList) { public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList, boolean isEdit) {
this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离
int rowCount = (elCaseBindInfoList.length + 1) / 2; int rowCount = (elCaseBindInfoList.length + 1) / 2;
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10));
for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) {
ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo);
widgetButton.setElementCaseEdit(isEdit);
this.add(widgetButton); this.add(widgetButton);
} }
this.setPreferredSize(new Dimension(240, rowCount * 80)); this.setPreferredSize(new Dimension(240, rowCount * 80));

7
designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

@ -40,7 +40,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
private FormDesigner designer; private FormDesigner designer;
private ComponentTree componentTree; private ComponentTree componentTree;
private JPanel wsp; private JPanel wsp;
private ParameterPropertyPane parameterPropertyPane;
private MobileWidgetTable mobileWidgetTable; private MobileWidgetTable mobileWidgetTable;
private MobileBodyWidgetTable mobileBodyWidgetTable; private MobileBodyWidgetTable mobileBodyWidgetTable;
private UIScrollPane downPanel; private UIScrollPane downPanel;
@ -51,6 +50,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
public static final int NODE_LENGTH = 2; public static final int NODE_LENGTH = 2;
public boolean isrefresh = true; public boolean isrefresh = true;
public static WidgetPropertyPane getInstance() { public static WidgetPropertyPane getInstance() {
if (HOLDER.singleton == null) { if (HOLDER.singleton == null) {
HOLDER.singleton = new WidgetPropertyPane(); HOLDER.singleton = new WidgetPropertyPane();
@ -64,7 +64,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
return HOLDER.singleton; return HOLDER.singleton;
} }
private static class HOLDER { private static class HOLDER {
private static WidgetPropertyPane singleton = new WidgetPropertyPane(); private static WidgetPropertyPane singleton = new WidgetPropertyPane();
} }
@ -190,10 +189,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
} }
} }
parameterPropertyPane = ParameterPropertyPane.getInstance(designer);
parameterPropertyPane.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 4));
add(parameterPropertyPane, BorderLayout.NORTH);
add(tabbedPane, BorderLayout.CENTER); add(tabbedPane, BorderLayout.CENTER);
propertyTable.initPropertyGroups(null); propertyTable.initPropertyGroups(null);
eventTable.refresh(); eventTable.refresh();

Loading…
Cancel
Save