Fangjie Hu 8 years ago
parent
commit
16099fd0b7
  1. 12
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java
  2. 41
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  3. 40
      designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java
  4. 15
      designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java

12
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(CATENAME), getSingCatePane()}, new Component[]{new UILabel(getCateNameString()), getSingCatePane()},
new Component[]{new UILabel(NVALUE), singValuePane = new TinyFormulaPane()}, new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()},
new Component[]{null, null} new Component[]{null, null}
}; };
@ -67,6 +67,14 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
this.add(pane, BorderLayout.CENTER); this.add(pane, BorderLayout.CENTER);
} }
protected String getCateNameString() {
return CATENAME;
}
protected String getNValueString() {
return NVALUE;
}
public void populateBean(ChartCollection collection) { public void populateBean(ChartCollection collection) {
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition();
if(definition instanceof MeterReportDefinition) { if(definition instanceof MeterReportDefinition) {

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

@ -95,26 +95,19 @@ public class FormWidgetDetailPane extends FormDockView{
clearDockingView(); clearDockingView();
return; return;
} }
reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel esp = FRGUIPaneFactory.createBorderLayout_S_Pane(); reuWidgetPanel.setBorder(null);
esp.setBorder(null);
if (elCaseBindInfoList == null) { if (elCaseBindInfoList == null) {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
} }
initReuWidgetPanel(); initReuWidgetPanel();
esp.add(reuWidgetPanel, BorderLayout.CENTER);
createDownloadButton(); createDownloadButton();
JPanel widgetPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); initMenuPanel();
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);
tabbedPane = new UITabbedPane(); tabbedPane = new UITabbedPane();
tabbedPane.setOpaque(true); tabbedPane.setOpaque(true);
tabbedPane.setBorder(null); tabbedPane.setBorder(null);
tabbedPane.setTabPlacement(SwingConstants.BOTTOM); 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()); tabbedPane.addTab(Inter.getLocText("FR-Designer-Form-ToolBar_Chart"), new JPanel());
add(tabbedPane, BorderLayout.CENTER); add(tabbedPane, BorderLayout.CENTER);
@ -124,16 +117,25 @@ public class FormWidgetDetailPane extends FormDockView{
* 初始化组件共享和复用面板 * 初始化组件共享和复用面板
*/ */
private void initReuWidgetPanel() { private void initReuWidgetPanel() {
int rowCount = (elCaseBindInfoList.length + 1)/2;
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList));
downPanel.setPreferredSize(new Dimension(236, rowCount * 82)); reuWidgetPanel.add(downPanel);
reuWidgetPanel = new JPanel(); }
/**
* 初始化菜单栏面板
*/
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 = new UIComboBox(getFormCategories());
comboBox.setPreferredSize(new Dimension(236, 30)); comboBox.setPreferredSize(new Dimension(240, 30));
initComboBoxSelectedListener(); initComboBoxSelectedListener();
reuWidgetPanel.add(comboBox, BorderLayout.NORTH); menutPane.add(comboBox, BorderLayout.SOUTH);
reuWidgetPanel.add(downPanel, BorderLayout.CENTER); reuWidgetPanel.add(menutPane,BorderLayout.NORTH);
reuWidgetPanel.setBorder(new LineBorder(Color.gray));
} }
private void initComboBoxSelectedListener() { private void initComboBoxSelectedListener() {
@ -144,7 +146,7 @@ public class FormWidgetDetailPane extends FormDockView{
if (filterIndex == 0) { if (filterIndex == 0) {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
} else { } else {
String filterName = (String) e.getItem(); String filterName = comboBox.getSelectedItem().toString();
elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName);
} }
refreshDownPanel(); refreshDownPanel();
@ -193,7 +195,6 @@ public class FormWidgetDetailPane extends FormDockView{
public void refreshDownPanel() { public void refreshDownPanel() {
reuWidgetPanel.remove(downPanel); reuWidgetPanel.remove(downPanel);
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList));
//todo:这个地方有问题
reuWidgetPanel.add(downPanel); reuWidgetPanel.add(downPanel);
repaintContainer(); 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.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.layout.FRGUIPaneFactory;
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;
@ -20,7 +19,6 @@ import java.awt.dnd.*;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
@ -36,42 +34,20 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
public ShareWidgetButton(ElCaseBindInfo bindInfo) { public ShareWidgetButton(ElCaseBindInfo bindInfo) {
this.bindInfo = bindInfo; this.bindInfo = bindInfo;
initUI(); initUI();
this.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
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);
} }
private void initUI() { private void initUI() {
this.setBackground(Color.WHITE); JPanel reportPane = new JPanel(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); reportPane.add(new UILabel(new ImageIcon(bindInfo.getCover())), BorderLayout.CENTER);
setPreferredSize(new Dimension(108, 72)); JPanel labelPane = new JPanel(new BorderLayout());
setLayout(FRGUIPaneFactory.createBorderLayout()); UILabel label = new UILabel(bindInfo.getName(), UILabel.CENTER);
ImagePanel imagePanel = new ImagePanel((BufferedImage) bindInfo.getCover()); labelPane.setBackground(new Color(184, 220, 242));
imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); labelPane.add(label, BorderLayout.CENTER);
reportPane.add(labelPane, BorderLayout.SOUTH);
this.add(imagePanel, BorderLayout.NORTH); add(reportPane);
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);
}
} }
public ElCaseBindInfo getBindInfo() { public ElCaseBindInfo getBindInfo() {

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

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

Loading…
Cancel
Save