Browse Source

9.0设计器报表块移动端属性面板事件监听以及与后台的数据交互的完善

master
fanglei 7 years ago
parent
commit
26a3acf48b
  1. 40
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java
  2. 97
      designer_form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java
  3. 17
      designer_form/src/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java

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

@ -122,6 +122,9 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
extraPane.initPropertyGroups(designer);
}
}
// for (AbstractPropertyTable propertyTable : widgetPropertyTables) {
// propertyTable.initPropertyGroups(designer);
// }
}
/**
@ -220,9 +223,14 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
MobileWidgetDefinePane extraPane = (MobileWidgetDefinePane) widgetAttrProvider.createWidgetAttrPane();
if (extraPane != null) {
mobileExtraPropertyPanes.add(extraPane);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane));
wsp.add(extraPane);
}
// AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable();
// widgetPropertyTables.add(propertyTable);
// designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane));
//
// UIScrollPane uiScrollPane = new UIScrollPane(getExtraBodyTable(propertyTable));
// wsp.add(uiScrollPane);
}
}
}
@ -379,19 +387,25 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
|| 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);
mobileParaWidgetTable.refreshData();
} else {
cardLayout.show(centerPane, BODY);
mobileWidgetTable.refreshData();
//fanglei:下面的注释不要删,只是暂时屏蔽
// int value = downPanel.getVerticalScrollBar().getValue();
// if (hasSelectParaPane(getEditingFormDesigner())) {
// cardLayout.show(centerPane, PARA);
// mobileParaWidgetTable.refreshData();
// } else {
// cardLayout.show(centerPane, BODY);
// mobileWidgetTable.refreshData();
// }
// //出现滚动条
// downPanel.doLayout();
// //控件列表选中某组件,触发表单中选中控件,选中事件又触发列表刷新,滚动条回到0
// //此处设置滚动条值为刷新前
// downPanel.getVerticalScrollBar().setValue(value);
if (mobileExtraPropertyPanes != null) {
for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) {
extraPane.populate(designer);
}
}
//出现滚动条
downPanel.doLayout();
//控件列表选中某组件,触发表单中选中控件,选中事件又触发列表刷新,滚动条回到0
//此处设置滚动条值为刷新前
downPanel.getVerticalScrollBar().setValue(value);
}
}
}

97
designer_form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

@ -4,6 +4,7 @@ import com.fr.base.mobile.MobileFitAttrState;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
@ -11,19 +12,14 @@ import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* 报表块-移动端属性面板
@ -45,13 +41,27 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
private UICheckBox heightRestrictCheckBox; // 手机显示限制高度复选框
private UILabel maxHeightLabel;
private UISpinner maxHeightSpinner; // 最大高度Spinner
private AttributeChangeListener changeListener;
public ElementCaseDefinePane (XCreator xCreator) {
this.xCreator = xCreator;
}
@Override
protected String title4PopupWindow() {
protected void initContentPane() {}
@Override
protected JPanel createContentPane() {
return null;
}
@Override
public String getIconPath() {
return "";
}
@Override
public String title4PopupWindow() {
return "ElementCase";
}
@ -86,39 +96,68 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
UIExpandablePane folderPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Fit"), 280, 20, panelWrapper);
this.add(folderPane, BorderLayout.NORTH);
this.bingListeners2Widgets();
this.setGlobalNames();
this.repaint();
}
public void bingListeners2Widgets() {
this.hComboBox.addActionListener(new ActionListener() {
private void bingListeners2Widgets() {
reInitAllListeners();
this.changeListener = new AttributeChangeListener() {
@Override
public void actionPerformed(ActionEvent e) {
((ElementCaseEditor)xCreator.toData()).setHorziontalAttr(MobileFitAttrState.parse(hComboBox.getSelectedIndex() + 1));
public void attributeChange() {
update();
}
});
};
}
this.vComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
((ElementCaseEditor)xCreator.toData()).setVerticalAttr(MobileFitAttrState.parse(vComboBox.getSelectedIndex() + 1));
}
});
/**
* 后台初始化所有事件.
*/
private void reInitAllListeners() {
initListener(this);
}
this.heightRestrictCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
@Override
public void populate(FormDesigner designer) {
this.designer = designer;
this.addAttributeChangeListener(changeListener);
ElementCaseEditor elementCaseEditor = (ElementCaseEditor)xCreator.toData();
this.hComboBox.setSelectedIndex(elementCaseEditor.getHorziontalAttr().getState() - 1);
this.vComboBox.setSelectedIndex(elementCaseEditor.getVerticalAttr().getState() - 1);
this.heightRestrictCheckBox.setSelected(elementCaseEditor.isHeightRestrict());
this.maxHeightLabel.setVisible(elementCaseEditor.isHeightRestrict());
this.maxHeightSpinner.setVisible(elementCaseEditor.isHeightRestrict());
this.maxHeightSpinner.setValue(elementCaseEditor.getHeightPercent());
}
@Override
public void update() {
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
String globalName = this.getGlobalName();
switch (globalName) {
case "hComboBox":
((ElementCaseEditor)xCreator.toData()).setHorziontalAttr(MobileFitAttrState.parse(hComboBox.getSelectedIndex() + 1));
break;
case "vComboBox":
((ElementCaseEditor)xCreator.toData()).setVerticalAttr(MobileFitAttrState.parse(vComboBox.getSelectedIndex() + 1));
break;
case "heightRestrictCheckBox":
boolean isHeightRestrict = heightRestrictCheckBox.isSelected();
((ElementCaseEditor)xCreator.toData()).setHeightRestrict(isHeightRestrict);
maxHeightSpinner.setVisible(isHeightRestrict);
maxHeightLabel.setVisible(isHeightRestrict);
}
});
this.maxHeightSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
break;
case "maxHeightSpinner":
((ElementCaseEditor)xCreator.toData()).setHeightPercent(maxHeightSpinner.getValue());
}
});
break;
}
}
private void setGlobalNames() {
this.hComboBox.setGlobalName("hComboBox");
this.vComboBox.setGlobalName("vComboBox");
this.heightRestrictCheckBox.setGlobalName("heightRestrictCheckBox");
this.maxHeightSpinner.setGlobalName("maxHeightSpinner");
}
}

17
designer_form/src/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java

@ -1,13 +1,26 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.mainframe.FormDesigner;
/**
* 所有移动端需要拓展的属性面板均继承此类
*
* Created by fanglei on 2017/8/8.
*/
public abstract class MobileWidgetDefinePane extends BasicPane{
public abstract class MobileWidgetDefinePane extends AbstractAttrNoScrollPane{
//初始化panel数据再repaint
public abstract void initPropertyGroups(Object source);
/**
* 从xCreator中提取数据展示在属性面板中
*
* @param designer
*/
public abstract void populate(FormDesigner designer);
/**
* 从属性面板把数据传到后台
*/
public abstract void update();
}

Loading…
Cancel
Save