Browse Source

REPORT-4267 单元格预定义控件不可用

master
yaoh.wu 7 years ago
parent
commit
033940a959
  1. 19
      designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  2. 13
      designer/src/com/fr/design/widget/WidgetPane.java

19
designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -2,18 +2,14 @@ package com.fr.design.mainframe;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.present.CellWriteAttrPane;
import com.fr.design.widget.WidgetPane; import com.fr.design.widget.WidgetPane;
import com.fr.form.ui.NoneWidget; import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.privilege.finegrain.WidgetPrivilegeControl; import com.fr.privilege.finegrain.WidgetPrivilegeControl;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
@ -34,7 +30,7 @@ public class CellWidgetPropertyPane extends BasicPane {
private WidgetPane cellEditorDefPane; private WidgetPane cellEditorDefPane;
private ElementCasePane ePane; private ElementCasePane ePane;
public static CellWidgetPropertyPane getInstance(){ public static CellWidgetPropertyPane getInstance() {
if (singleton == null) { if (singleton == null) {
singleton = new CellWidgetPropertyPane(); singleton = new CellWidgetPropertyPane();
} }
@ -43,11 +39,9 @@ public class CellWidgetPropertyPane extends BasicPane {
public CellWidgetPropertyPane() { public CellWidgetPropertyPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
// this.addAttributeChangeListener(listener);
// cellEditorDefPane = new WidgetPane(elementCasePane);
} }
public void clear (){ public void clear() {
singleton = null; singleton = null;
} }
@ -86,7 +80,7 @@ public class CellWidgetPropertyPane extends BasicPane {
} }
public void reInit(ElementCasePane ePane){ public void reInit(ElementCasePane ePane) {
this.ePane = ePane; this.ePane = ePane;
cellEditorDefPane = new WidgetPane(ePane); cellEditorDefPane = new WidgetPane(ePane);
this.removeAll(); this.removeAll();
@ -144,14 +138,15 @@ public class CellWidgetPropertyPane extends BasicPane {
return newWidget; return newWidget;
} }
@Override
/** /**
*检测是否有效 * 检测是否有效
*
* @throws Exception e
*/ */
@Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
this.cellEditorDefPane.checkValid(); this.cellEditorDefPane.checkValid();
} }
} }

13
designer/src/com/fr/design/widget/WidgetPane.java

@ -65,7 +65,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
this.addAttributeChangeListener(listener); this.addAttributeChangeListener(listener);
} }
public JPanel initNorthPane(){ public JPanel initNorthPane() {
UILabel emptyLabel = new UILabel(); UILabel emptyLabel = new UILabel();
emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
@ -80,7 +80,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
return jPanel; return jPanel;
} }
protected CellWidgetCardPane initWidgetCardPane(ElementCasePane pane){ protected CellWidgetCardPane initWidgetCardPane(ElementCasePane pane) {
return new CellWidgetCardPane(pane); return new CellWidgetCardPane(pane);
} }
@ -129,16 +129,16 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
editorTypeComboBox.setSelectedIndex(-1); editorTypeComboBox.setSelectedIndex(-1);
return; return;
} }
// 预定义组件
if (widget instanceof NameWidget) { if (widget instanceof NameWidget) {
String name = ((NameWidget) widget).getName(); String name = ((NameWidget) widget).getName();
shouldFireSelectedEvent = false; shouldFireSelectedEvent = false;
editorTypeComboBox.setSelectedItem(new Item(name, name)); editorTypeComboBox.setSelectedItem(new Item(name, name));
shouldFireSelectedEvent = true; shouldFireSelectedEvent = true;
cellEditorCardPane.populate(widget); cellEditorCardPane.populate(widget);
return;
} }
// 内置组件
else {
Class clazz = widget.getClass(); Class clazz = widget.getClass();
if (ArrayUtils.contains(ButtonConstants.CLASSES4BUTTON, clazz)) { if (ArrayUtils.contains(ButtonConstants.CLASSES4BUTTON, clazz)) {
clazz = Button.class; clazz = Button.class;
@ -148,11 +148,10 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
shouldFireSelectedEvent = false; shouldFireSelectedEvent = false;
editorTypeComboBox.setSelectedItemByWidgetClass(clazz); editorTypeComboBox.setSelectedItemByWidgetClass(clazz);
shouldFireSelectedEvent = true; shouldFireSelectedEvent = true;
}
removeAttributeChangeListener(); removeAttributeChangeListener();
initAllListeners(); initAllListeners();
this.addAttributeChangeListener(listener); this.addAttributeChangeListener(listener);
} }
public Widget update() { public Widget update() {

Loading…
Cancel
Save