xiaoxia 8 years ago
parent
commit
c9c351c551
  1. 26
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  2. 7
      designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java

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

@ -3,7 +3,8 @@ package com.fr.design.mainframe;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.border.LineBorder;
@ -15,6 +16,7 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.share.ShareConstants;
import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo;
import com.fr.general.Inter;
@ -30,7 +32,7 @@ public class FormWidgetDetailPane extends FormDockView{
private UITabbedPane tabbedPane;
private JScrollPane downPanel;
private JPanel reuWidgetPanel;
private ArrayList<ElCaseBindInfo> elCaseBindInfoList;
private List<ElCaseBindInfo> elCaseBindInfoList;
public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) {
@ -80,16 +82,22 @@ public class FormWidgetDetailPane extends FormDockView{
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
}
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList));
downPanel.setPreferredSize(new Dimension(235, 480));
downPanel.setPreferredSize(new Dimension(236, 480));
reuWidgetPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane();
UIComboBox comboBox = new UIComboBox(getCategories());
comboBox.setPreferredSize(new Dimension(240, 30));
final UIComboBox comboBox = new UIComboBox(getCategories());
comboBox.setPreferredSize(new Dimension(236, 30));
comboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
String filterName = (String) e.getItem();
elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName);
int filterIndex = comboBox.getSelectedIndex();
if (filterIndex == 0) {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
} else {
String filterName = (String) e.getItem();
elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName);
}
refreshDownPanel();
}
});
reuWidgetPanel.add(comboBox, BorderLayout.NORTH);
@ -116,13 +124,13 @@ public class FormWidgetDetailPane extends FormDockView{
}
public String[] getCategories() {
return new String[]{Inter.getLocText("FR-Designer_AllCategories"), "" };
return ShareConstants.WIDGET_CATEGORIES;
}
public void refreshDownPanel() {
reuWidgetPanel.remove(downPanel);
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList));
downPanel.setPreferredSize(new Dimension(235, 480));
//todo:这个地方有问题
reuWidgetPanel.add(downPanel);
repaintContainer();

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

@ -6,14 +6,16 @@ import com.fr.form.ui.ElCaseBindInfo;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.*;
import java.util.List;
/**
* Created by xiaxiang on 2016/10/10.
*/
public class ShareWidgetPane extends JPanel {
public ShareWidgetPane(ArrayList<ElCaseBindInfo> elCaseBindInfoList) {
public ShareWidgetPane(List<ElCaseBindInfo> elCaseBindInfoList) {
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));// 设置面板的边框 ,距离上、左、下、右 的距离
int rowCount = (elCaseBindInfoList.size() + 1)/2;
this.setLayout(new GridLayout(rowCount, 2, 10, 10));
@ -26,4 +28,5 @@ public class ShareWidgetPane extends JPanel {
}
}
}

Loading…
Cancel
Save