xiaoxia 8 years ago
parent
commit
26b940e0e2
  1. 2
      designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java
  2. 149
      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() { private FormHierarchyTreePane() {
setLayout(new BorderLayout(0, 6)); setLayout(new BorderLayout(0, 0));
} }
@Override @Override

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

@ -1,28 +1,22 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.CardLayout; import java.awt.event.ItemEvent;
import java.awt.Color; import java.awt.event.ItemListener;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.gui.frpane.UITabbedPane; 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.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.parameter.ParameterPropertyPane; import com.fr.form.share.ShareLoader;
import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.form.ui.ElCaseBindInfo;
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.general.Inter; import com.fr.general.Inter;
/** /**
@ -32,16 +26,11 @@ import com.fr.general.Inter;
* Time: 下午8:18 * Time: 下午8:18
*/ */
public class FormWidgetDetailPane extends FormDockView{ public class FormWidgetDetailPane extends FormDockView{
public static final String PARA = "para";
public static final String BODY = "body";
private UITabbedPane tabbedPane; private UITabbedPane tabbedPane;
private ParameterPropertyPane parameterPropertyPane; private JScrollPane downPanel;
private MobileWidgetTable mobileWidgetTable; private JPanel reuWidgetPanel;
private MobileBodyWidgetTable mobileBodyWidgetTable; private ArrayList<ElCaseBindInfo> elCaseBindInfoList;
private UIScrollPane downPanel;
private JPanel centerPane;
private CardLayout cardLayout;
public static FormWidgetDetailPane getInstance() { public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) { if (HOLDER.singleton == null) {
@ -84,100 +73,76 @@ public class FormWidgetDetailPane extends FormDockView{
clearDockingView(); clearDockingView();
return; return;
} }
parameterPropertyPane = ParameterPropertyPane.getInstance(designer);
parameterPropertyPane.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
JPanel esp = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel esp = FRGUIPaneFactory.createBorderLayout_S_Pane();
esp.setBorder(null); esp.setBorder(null);
mobileWidgetTable = new MobileWidgetTable(designer); if (elCaseBindInfoList == null) {
mobileBodyWidgetTable = new MobileBodyWidgetTable(designer); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
designer.addDesignerEditListener(new mobileWidgetDesignerAdapter()); }
centerPane = FRGUIPaneFactory.createCardLayout_S_Pane(); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList));
cardLayout = (CardLayout) centerPane.getLayout(); downPanel.setPreferredSize(new Dimension(240, 400));
centerPane.add(mobileWidgetTable,PARA); reuWidgetPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane();
centerPane.add(mobileBodyWidgetTable,BODY); UIComboBox comboBox = new UIComboBox(getCategories());
if(hasSelectParaPane(designer)){ comboBox.setPreferredSize(new Dimension(240, 30));
cardLayout.show(centerPane,PARA); comboBox.addItemListener(new ItemListener() {
@Override
} else { public void itemStateChanged(ItemEvent e) {
cardLayout.show(centerPane,BODY); String filterName = (String) e.getItem();
} elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName);
downPanel = new UIScrollPane(centerPane); refreshUI();
downPanel.setBorder(new LineBorder(Color.gray)); reuWidgetPanel.repaint();
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)); reuWidgetPanel.add(comboBox, BorderLayout.NORTH);
esp.add(upLabel,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 = 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-Widget_Mobile_Tree"), parameterPropertyPane); tabbedPane.addTab(Inter.getLocText("FR-Engine_Report"), esp);
tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Terminal"), esp); tabbedPane.addTab(Inter.getLocText("FR-Designer-Form-ToolBar_Chart"), new JPanel());
add(tabbedPane, BorderLayout.CENTER); add(tabbedPane, BorderLayout.CENTER);
} }
public void setSelectedIndex(int index){ public String[] getCategories() {
tabbedPane.setSelectedIndex(index); return new String[]{Inter.getLocText("FR-Designer_AllCategories"), "" };
} }
/** public void refreshUI() {
* 选中的组件是否在参数面板里 reuWidgetPanel.remove(downPanel);
* @param designer 设计器 downPanel = new JScrollPane(new ShareWidgetPane(elCaseBindInfoList), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
* @return 是则返回true reuWidgetPanel.add(downPanel);
*/
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 setSelectedIndex(int index){
tabbedPane.setSelectedIndex(index);
} }
/** /**
* 清除数据 * 清除数据
*/ */
public void clearDockingView() { public void clearDockingView() {
parameterPropertyPane = null;
mobileWidgetTable = null;
JScrollPane psp = new JScrollPane(); JScrollPane psp = new JScrollPane();
psp.setBorder(null); psp.setBorder(null);
this.add(psp, BorderLayout.CENTER); 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