xiaoxia 8 years ago
parent
commit
26b940e0e2
  1. 2
      designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java
  2. 147
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java

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

@ -68,7 +68,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
}
private FormHierarchyTreePane() {
setLayout(new BorderLayout(0, 6));
setLayout(new BorderLayout(0, 0));
}
@Override

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

@ -1,28 +1,22 @@
package com.fr.design.mainframe;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import javax.swing.*;
import javax.swing.border.LineBorder;
import com.fr.base.BaseUtils;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ibutton.UIButton;
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.design.parameter.ParameterPropertyPane;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo;
import com.fr.general.Inter;
/**
@ -32,16 +26,11 @@ import com.fr.general.Inter;
* Time: 下午8:18
*/
public class FormWidgetDetailPane extends FormDockView{
public static final String PARA = "para";
public static final String BODY = "body";
private UITabbedPane tabbedPane;
private ParameterPropertyPane parameterPropertyPane;
private MobileWidgetTable mobileWidgetTable;
private MobileBodyWidgetTable mobileBodyWidgetTable;
private UIScrollPane downPanel;
private JPanel centerPane;
private CardLayout cardLayout;
private JScrollPane downPanel;
private JPanel reuWidgetPanel;
private ArrayList<ElCaseBindInfo> elCaseBindInfoList;
public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) {
@ -84,100 +73,76 @@ public class FormWidgetDetailPane extends FormDockView{
clearDockingView();
return;
}
parameterPropertyPane = ParameterPropertyPane.getInstance(designer);
parameterPropertyPane.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
JPanel esp = FRGUIPaneFactory.createBorderLayout_S_Pane();
esp.setBorder(null);
mobileWidgetTable = new MobileWidgetTable(designer);
mobileBodyWidgetTable = new MobileBodyWidgetTable(designer);
designer.addDesignerEditListener(new mobileWidgetDesignerAdapter());
centerPane = FRGUIPaneFactory.createCardLayout_S_Pane();
cardLayout = (CardLayout) centerPane.getLayout();
centerPane.add(mobileWidgetTable,PARA);
centerPane.add(mobileBodyWidgetTable,BODY);
if(hasSelectParaPane(designer)){
cardLayout.show(centerPane,PARA);
} else {
cardLayout.show(centerPane,BODY);
if (elCaseBindInfoList == null) {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
}
downPanel = new UIScrollPane(centerPane);
downPanel.setBorder(new LineBorder(Color.gray));
esp.add(downPanel,BorderLayout.CENTER);
UILabel upLabel = new UILabel(Inter.getLocText("FR-Widget_Mobile_Table"),SwingConstants.CENTER);
upLabel.setBorder(BorderFactory.createEmptyBorder(6,0,6,0));
esp.add(upLabel,BorderLayout.NORTH);
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList));
downPanel.setPreferredSize(new Dimension(240, 400));
reuWidgetPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane();
UIComboBox comboBox = new UIComboBox(getCategories());
comboBox.setPreferredSize(new Dimension(240, 30));
comboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
String filterName = (String) e.getItem();
elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName);
refreshUI();
reuWidgetPanel.repaint();
}
});
reuWidgetPanel.add(comboBox, BorderLayout.NORTH);
reuWidgetPanel.add(downPanel, BorderLayout.SOUTH);
reuWidgetPanel.setBorder(new LineBorder(Color.gray));
esp.add(reuWidgetPanel, BorderLayout.CENTER);
UIButton button = new UIButton();
button.setIcon(BaseUtils.readIcon("/com/fr/design/images/control/download.png"));
button.set4ToolbarButton();
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(button, BorderLayout.EAST);
esp.add(widgetPane,BorderLayout.NORTH);
tabbedPane = new UITabbedPane();
tabbedPane.setOpaque(true);
tabbedPane.setBorder(null);
tabbedPane.setTabPlacement(SwingConstants.BOTTOM);
tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Tree"), parameterPropertyPane);
tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Terminal"), esp);
tabbedPane.addTab(Inter.getLocText("FR-Engine_Report"), esp);
tabbedPane.addTab(Inter.getLocText("FR-Designer-Form-ToolBar_Chart"), new JPanel());
add(tabbedPane, BorderLayout.CENTER);
}
public String[] getCategories() {
return new String[]{Inter.getLocText("FR-Designer_AllCategories"), "" };
}
public void refreshUI() {
reuWidgetPanel.remove(downPanel);
downPanel = new JScrollPane(new ShareWidgetPane(elCaseBindInfoList), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
reuWidgetPanel.add(downPanel);
}
public void setSelectedIndex(int index){
tabbedPane.setSelectedIndex(index);
}
/**
* 选中的组件是否在参数面板里
* @param designer 设计器
* @return 是则返回true
*/
public boolean hasSelectParaPane(FormDesigner designer){
XCreator xCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
if(xCreator == null){
xCreator = designer.getRootComponent();
}
XLayoutContainer container = XCreatorUtils.getHotspotContainer(xCreator);
return xCreator.acceptType(XWParameterLayout.class) || container.acceptType(XWParameterLayout.class);
}
/**
* 清除数据
*/
public void clearDockingView() {
parameterPropertyPane = null;
mobileWidgetTable = null;
JScrollPane psp = new JScrollPane();
psp.setBorder(null);
this.add(psp, BorderLayout.CENTER);
}
public class mobileWidgetDesignerAdapter implements DesignerEditListener {
public mobileWidgetDesignerAdapter() {
}
/**
* 响应界面改变事件
* @param evt 事件
*/
public void fireCreatorModified(DesignerEvent evt) {
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_ADDED) {
int value = downPanel.getVerticalScrollBar().getValue();
if(hasSelectParaPane(getEditingFormDesigner())){
cardLayout.show(centerPane,PARA);
mobileWidgetTable.refresh();
} else {
cardLayout.show(centerPane,BODY);
mobileBodyWidgetTable.refresh();
}
//出现滚动条
downPanel.doLayout();
//控件列表选中某组件,触发表单中选中控件,选中事件又触发列表刷新,滚动条回到0
//此处设置滚动条值为刷新前
downPanel.getVerticalScrollBar().setValue(value);
}
}
}
/**
* 定位

Loading…
Cancel
Save