fr_shine 8 years ago
parent
commit
2098db2594
  1. 2
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  2. 54
      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. 18
      designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java
  12. 127
      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
  17. 2
      designer_form/src/com/fr/design/parameter/ParameterPropertyPane.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.design.fun.MenuHandler;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.general.Inter;
import com.fr.page.ReportSettingsProvider;
import com.fr.design.file.HistoryTemplateListPane;
@ -58,6 +59,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
if (editingTemplate != null && !editingTemplate.isUpMode()) {
EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceUpPane(QuickEditorRegion.getInstance());
EastRegionContainerPane.getInstance().removeParameterPane();
}
}
});

54
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.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.stable.Constants;
import com.fr.design.utils.gui.GUICoreUtils;
@ -21,6 +22,8 @@ public class UIResizableContainer extends JPanel {
private JComponent upPane;
private JComponent downPane;
//放参数面板
private JComponent parameterPane = new JPanel();
private HorizotalToolPane horizontToolPane;
private VerticalToolPane verticalToolPane;
@ -37,6 +40,7 @@ public class UIResizableContainer extends JPanel {
private boolean isLeftRightDragEnabled = true;
private boolean isDownPaneVisible = true ;
private int paraHeight;
public UIResizableContainer(int direction) {
this(new JPanel(), new JPanel(), direction);
@ -85,7 +89,9 @@ public class UIResizableContainer extends JPanel {
add(horizontToolPane);
add(downPane);
add(verticalToolPane);
add(parameterPane);
}
public UIResizableContainer(JComponent upPane, int direction) {
setBackground(UIConstants.NORMAL_BACKGROUND);
@ -96,6 +102,7 @@ public class UIResizableContainer extends JPanel {
setLayout(containerLayout);
add(upPane);
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){
upPane.setBounds(0, 0, containerWidth - toolPaneHeight, toolPaneY);
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());
}else{
upPane.setBounds(0, 0, containerWidth - toolPaneHeight, getHeight());
@ -194,12 +221,14 @@ public class UIResizableContainer extends JPanel {
if (toolPaneY > getHeight() - toolPaneHeight) {
toolPaneY = getHeight() - toolPaneHeight;
}
upPane.setBounds(toolPaneHeight, 0, containerWidth - toolPaneHeight, toolPaneY);
horizontToolPane.setBounds(toolPaneHeight, toolPaneY, containerWidth - toolPaneHeight, toolPaneHeight);
downPane.setBounds(toolPaneHeight, toolPaneY + toolPaneHeight, containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight);
parameterPane.setBounds(20, 0, 230, getParameterPaneHeight());
upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneY);
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());
}else{
upPane.setBounds(toolPaneHeight, 0, containerWidth - toolPaneHeight, getHeight());
} else {
parameterPane.setBounds(20, 0, 230, getParameterPaneHeight());
upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, getHeight() - getParameterPaneHeight());
verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight());
}
}
@ -244,6 +273,17 @@ public class UIResizableContainer extends JPanel {
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);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
UIResizableContainer bb = new UIResizableContainer(Constants.LEFT);
UIResizableContainer bb = new UIResizableContainer(Constants.RIGHT);
JPanel cc = new JPanel();
cc.setBackground(Color.blue);
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()) {
EastRegionContainerPane.getInstance().replaceUpPane(
WidgetPropertyPane.getInstance(this));
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this));
refreshParameter();
} else {
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(
getParameterArray() == null ? new Parameter[0] : getParameterArray());
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){
@ -463,6 +470,8 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
paraComponent = null;
formLayoutContainer.setSize(rootComponent.getWidth(), rootComponent.getHeight());
EastRegionContainerPane.getInstance().replaceDownPane(this.getEastDownPane());
//atat
//EastRegionContainerPane.getInstance().addTitlePane(ParameterPropertyPane.getInstance(FormDesigner.this));
//删除后重绘下
invalidateLayout();
}

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

@ -49,7 +49,6 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
private ComponentTree componentTree;
private UITreeComboBox treeComboBox;
private JPanel widgetPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
// richer:搜寻树节点的的文本框
// private UITextField searchTextField;
// private SearchResultPane searchResult;
@ -116,16 +115,15 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
if(childCount == NODE_LENGTH){
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);
if(treeComboBox == null) {
widgetPane.add(new UILabel(Inter.getLocText("FR-Designer-Selected_Widget") + " ",
SwingConstants.HORIZONTAL), BorderLayout.WEST);
treeComboBox = new UITreeComboBox(componentTree);
widgetPane.add(treeComboBox, BorderLayout.CENTER);
add(widgetPane, BorderLayout.CENTER);
}
widgetPane.add(new UILabel(Inter.getLocText("FR-Designer-Selected_Widget") + " ",
SwingConstants.HORIZONTAL), BorderLayout.WEST);
treeComboBox = new UITreeComboBox(componentTree);
widgetPane.add(treeComboBox, BorderLayout.CENTER);
add(widgetPane, BorderLayout.CENTER);
// UIScrollPane scrollPane = new UIScrollPane(componentTree);

127
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.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.filechooser.FileNameExtensionFilter;
import com.fr.base.BaseUtils;
import com.fr.design.actions.file.WebPreviewUtils;
@ -31,10 +34,12 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.itoolbar.UILargeToolbar;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.share.ShareConstants;
import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
/**
@ -51,6 +56,8 @@ public class FormWidgetDetailPane extends FormDockView{
private UIComboBox comboBox;
private ElCaseBindInfo[] elCaseBindInfoList;
private UIButton downloadButton;
private UIButton refreshButton;
private UIButton deleteButton;
private static final int OFFSET_X = 140;
private static final int OFFSET_Y = 26;
@ -101,6 +108,7 @@ public class FormWidgetDetailPane extends FormDockView{
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
}
initReuWidgetPanel();
createRefreshButton();
createDownloadButton();
initMenuPanel();
tabbedPane = new UITabbedPane();
@ -117,7 +125,7 @@ public class FormWidgetDetailPane extends FormDockView{
* 初始化组件共享和复用面板
*/
private void initReuWidgetPanel() {
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList));
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false));
reuWidgetPanel.add(downPanel);
}
@ -127,15 +135,22 @@ public class FormWidgetDetailPane extends FormDockView{
private void initMenuPanel() {
JPanel menutPane = new JPanel();
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"),
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.setPreferredSize(new Dimension(240, 30));
initComboBoxSelectedListener();
menutPane.add(comboBox, BorderLayout.SOUTH);
reuWidgetPanel.add(menutPane,BorderLayout.NORTH);
reuWidgetPanel.add(menutPane, BorderLayout.NORTH);
}
private void initComboBoxSelectedListener() {
@ -149,10 +164,25 @@ public class FormWidgetDetailPane extends FormDockView{
String filterName = comboBox.getSelectedItem().toString();
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.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/showmenu.png"));
downloadButton.set4ToolbarButton();
downloadButton.setToolTipText(Inter.getLocText("FR-Designer_Download_Template"));
downloadButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
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(installItem);
menu.add(deleteItem);
downloadItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -177,10 +214,82 @@ public class FormWidgetDetailPane extends FormDockView{
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);
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList));
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit));
reuWidgetPanel.add(downPanel);
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.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.utils.gui.LayoutUtils;
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());
} else {
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) {
new Thread() {
public void run() {
@ -636,6 +639,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
pane.setLayout(new BorderLayout());
pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceDownPane(pane);
}
}

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

@ -1,16 +1,21 @@
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.XCreatorUtils;
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.ui.ElCaseBindInfo;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.Icon;
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
@ -30,17 +35,56 @@ import java.io.Serializable;
public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable {
private ElCaseBindInfo bindInfo;
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) {
this.bindInfo = bindInfo;
this.setPreferredSize(new Dimension(108, 68));
initUI();
this.setLayout(getCoverLayout());
this.addMouseListener(this);
this.addMouseMotionListener(this);
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() {
JPanel reportPane = new JPanel(new BorderLayout());
reportPane = new JPanel(new BorderLayout());
reportPane.add(new UILabel(new ImageIcon(bindInfo.getCover())), BorderLayout.CENTER);
JPanel labelPane = new JPanel(new BorderLayout());
UILabel label = new UILabel(bindInfo.getName(), UILabel.CENTER);
@ -50,6 +94,41 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
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() {
return bindInfo;
}
@ -58,9 +137,25 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
this.bindInfo = bindInfo;
}
public String getFileName() {
return bindInfo.getName() +"." + bindInfo.getId() + ShareConstants.SUFFIX_MODULE;
}
@Override
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

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

@ -12,12 +12,13 @@ import java.awt.*;
*/
public class ShareWidgetPane extends JPanel {
public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList) {
public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList, boolean isEdit) {
this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离
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) {
ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo);
widgetButton.setElementCaseEdit(isEdit);
this.add(widgetButton);
}
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 ComponentTree componentTree;
private JPanel wsp;
private ParameterPropertyPane parameterPropertyPane;
private MobileWidgetTable mobileWidgetTable;
private MobileBodyWidgetTable mobileBodyWidgetTable;
private UIScrollPane downPanel;
@ -51,6 +50,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
public static final int NODE_LENGTH = 2;
public boolean isrefresh = true;
public static WidgetPropertyPane getInstance() {
if (HOLDER.singleton == null) {
HOLDER.singleton = new WidgetPropertyPane();
@ -64,7 +64,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
return HOLDER.singleton;
}
private static class HOLDER {
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);
propertyTable.initPropertyGroups(null);
eventTable.refresh();

2
designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java

@ -47,7 +47,7 @@ public class ParameterPropertyPane extends JPanel{
initParameterListener();
this.setLayout(new BorderLayout(0, 6));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.setBorder(BorderFactory.createEmptyBorder(2, 5, 5, 5));
this.add(toolbarPane, BorderLayout.CENTER);
}

Loading…
Cancel
Save