Browse Source

Merge pull request #439 in BA/design from ~XIAOXIA/design:dev to dev

* commit '128d97ddf37786ecbc8924ecaa2fbd5693b756b1': (26 commits)
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  ...
master
superman 8 years ago
parent
commit
199bd0b331
  1. 2
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  2. 52
      designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java
  3. BIN
      designer_form/src/com/fr/design/form/images/delete icon.png
  4. BIN
      designer_form/src/com/fr/design/form/images/download icon.png
  5. BIN
      designer_form/src/com/fr/design/form/images/install icon.png
  6. BIN
      designer_form/src/com/fr/design/form/images/marked.png
  7. BIN
      designer_form/src/com/fr/design/form/images/refresh.png
  8. BIN
      designer_form/src/com/fr/design/form/images/unmarked.png
  9. 2
      designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
  10. 9
      designer_form/src/com/fr/design/mainframe/FormDesigner.java
  11. 8
      designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java
  12. 125
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  13. 6
      designer_form/src/com/fr/design/mainframe/JForm.java
  14. 99
      designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java
  15. 5
      designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java
  16. 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();
} }
} }
}); });

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

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