Browse Source

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

* commit 'f8ffda50923974e7f62daa1d76acf78a075f9f4c':
  rt
  rt
  rt
  rt
  rt
  rt
  rt
  修改一下控件
master
superman 8 years ago
parent
commit
156c0b3933
  1. 41
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  2. 40
      designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java
  3. 15
      designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java

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

@ -95,26 +95,19 @@ public class FormWidgetDetailPane extends FormDockView{
clearDockingView();
return;
}
JPanel esp = FRGUIPaneFactory.createBorderLayout_S_Pane();
esp.setBorder(null);
reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
reuWidgetPanel.setBorder(null);
if (elCaseBindInfoList == null) {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
}
initReuWidgetPanel();
esp.add(reuWidgetPanel, BorderLayout.CENTER);
createDownloadButton();
JPanel widgetPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
widgetPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 3, 3));
widgetPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"),
SwingConstants.HORIZONTAL), BorderLayout.WEST);
widgetPane.add(downloadButton, BorderLayout.EAST);
esp.add(widgetPane,BorderLayout.NORTH);
initMenuPanel();
tabbedPane = new UITabbedPane();
tabbedPane.setOpaque(true);
tabbedPane.setBorder(null);
tabbedPane.setTabPlacement(SwingConstants.BOTTOM);
tabbedPane.addTab(Inter.getLocText("FR-Engine_Report"), esp);
tabbedPane.addTab(Inter.getLocText("FR-Engine_Report"), reuWidgetPanel);
tabbedPane.addTab(Inter.getLocText("FR-Designer-Form-ToolBar_Chart"), new JPanel());
add(tabbedPane, BorderLayout.CENTER);
@ -124,16 +117,25 @@ public class FormWidgetDetailPane extends FormDockView{
* 初始化组件共享和复用面板
*/
private void initReuWidgetPanel() {
int rowCount = (elCaseBindInfoList.length + 1)/2;
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList));
downPanel.setPreferredSize(new Dimension(236, rowCount * 82));
reuWidgetPanel = new JPanel();
reuWidgetPanel.add(downPanel);
}
/**
* 初始化菜单栏面板
*/
private void initMenuPanel() {
JPanel menutPane = new JPanel();
menutPane.setLayout(FRGUIPaneFactory.createBorderLayout());
menutPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 3, 3));
menutPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"),
SwingConstants.HORIZONTAL), BorderLayout.WEST);
menutPane.add(downloadButton, BorderLayout.EAST);
comboBox = new UIComboBox(getFormCategories());
comboBox.setPreferredSize(new Dimension(236, 30));
comboBox.setPreferredSize(new Dimension(240, 30));
initComboBoxSelectedListener();
reuWidgetPanel.add(comboBox, BorderLayout.NORTH);
reuWidgetPanel.add(downPanel, BorderLayout.CENTER);
reuWidgetPanel.setBorder(new LineBorder(Color.gray));
menutPane.add(comboBox, BorderLayout.SOUTH);
reuWidgetPanel.add(menutPane,BorderLayout.NORTH);
}
private void initComboBoxSelectedListener() {
@ -144,7 +146,7 @@ public class FormWidgetDetailPane extends FormDockView{
if (filterIndex == 0) {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
} else {
String filterName = (String) e.getItem();
String filterName = comboBox.getSelectedItem().toString();
elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName);
}
refreshDownPanel();
@ -193,7 +195,6 @@ public class FormWidgetDetailPane extends FormDockView{
public void refreshDownPanel() {
reuWidgetPanel.remove(downPanel);
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList));
//todo:这个地方有问题
reuWidgetPanel.add(downPanel);
repaintContainer();

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

@ -4,7 +4,6 @@ import com.fr.base.BaseUtils;
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.layout.FRGUIPaneFactory;
import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo;
import com.fr.form.ui.Widget;
@ -20,7 +19,6 @@ import java.awt.dnd.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.Serializable;
@ -36,42 +34,20 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
public ShareWidgetButton(ElCaseBindInfo bindInfo) {
this.bindInfo = bindInfo;
initUI();
this.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
this.addMouseListener(this);
this.addMouseMotionListener(this);
new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE);
}
private void initUI() {
this.setBackground(Color.WHITE);
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
setPreferredSize(new Dimension(108, 72));
setLayout(FRGUIPaneFactory.createBorderLayout());
ImagePanel imagePanel = new ImagePanel((BufferedImage) bindInfo.getCover());
imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.add(imagePanel, BorderLayout.NORTH);
UILabel label = new UILabel(bindInfo.getName(), SwingConstants.HORIZONTAL);
label.setOpaque(true);
label.setBackground(new Color(184, 220, 242));
this.add(label, BorderLayout.SOUTH);
}
private class ImagePanel extends JPanel {
private BufferedImage image;
public ImagePanel(BufferedImage image) {
this.image = image;
this.setPreferredSize(new Dimension(108, 52));
}
@Override
public void paintComponent(Graphics g) {
g.drawImage(image, 0, 0, null);
}
JPanel 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);
labelPane.setBackground(new Color(184, 220, 242));
labelPane.add(label, BorderLayout.CENTER);
reportPane.add(labelPane, BorderLayout.SOUTH);
add(reportPane);
}
public ElCaseBindInfo getBindInfo() {

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

@ -1,13 +1,10 @@
package com.fr.design.mainframe;
import com.fr.form.ui.ElCaseBindInfo;
import com.fr.form.ui.ElCaseBindInfo;
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.util.List;
/**
@ -16,16 +13,14 @@ import java.util.List;
public class ShareWidgetPane extends JPanel {
public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList) {
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));// 设置面板的边框 ,距离上、左、下、右 的距离
int rowCount = (elCaseBindInfoList.length + 1)/2;
this.setLayout(new GridLayout(rowCount, 2, 10, 10));
this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离
int rowCount = (elCaseBindInfoList.length + 1) / 2;
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) {
ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo);
this.add(widgetButton);
}
if (elCaseBindInfoList.length == 1) {
this.add(new JPanel());
}
this.setPreferredSize(new Dimension(240, rowCount * 80));
}

Loading…
Cancel
Save