Browse Source

REPORT-3163 合作开发9.0设计器=>属性面板tab项动态变化(部分)

master
plough 8 years ago
parent
commit
3d04d3d754
  1. 2
      designer/src/com/fr/design/mainframe/ElementCasePane.java
  2. 8
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  3. 158
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  4. 1
      designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
  5. 21
      designer_form/src/com/fr/design/mainframe/JForm.java

2
designer/src/com/fr/design/mainframe/ElementCasePane.java

@ -504,7 +504,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
*/
public void setSelection(Selection selection) {
if (!ComparatorUtils.equals(this.selection, selection) ||
!ComparatorUtils.equals(EastRegionContainerPane.getInstance().getDownPane(), CellElementPropertyPane.getInstance())) {
!ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) {
this.selection = selection;
fireSelectionChanged();
}

8
designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.fun.MenuHandler;
import com.fr.design.menu.KeySetUtils;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection;
import com.fr.page.ReportSettingsProvider;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.DesignState;
@ -56,8 +57,15 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
QuickEditorRegion.getInstance().populate(getCurrentEditor());
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editingTemplate != null && !editingTemplate.isUpMode()) {
if (((ElementCasePaneDelegate)e.getSource()).getSelection() instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
// EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceFloatElementPane(QuickEditorRegion.getInstance());
} else {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
}
EastRegionContainerPane.getInstance().removeParameterPane();
}
}

158
designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -15,9 +15,7 @@ import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.*;
public class EastRegionContainerPane extends UIEastResizableContainer {
private static EastRegionContainerPane THIS;
@ -37,6 +35,25 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private static final String KEY_CONDITION_ATTR = "conditionAttr";
private static final String KEY_HYPERLINK = "hyperlink";
private static final String KEY_WIDGET_LIB = "widgetLib";
private static final String DEFAULT_PANE = "defaultPane"; // "无可用配置项"面板
// public static final String MODE_REPORT = "report"; // 报表模式
// public static final String MODE_REPORT_PARA = "reportPara"; // 报表参数面板
// public static final String MODE_FORM = "form"; // 表单模式
// public static final String MODE_POLY = "poly"; // 聚合报表模式
public enum PropertyMode {
REPORT, // 报表
REPORT_PARA, // 报表参数面板
REPORT_FLOAT, // 报表悬浮元素
FORM, // 表单
FORM_REPORT, // 表单报表块
POLY, // 聚合报表
POLY_REPORT, // 聚合报表-报表块
POLY_CHART // 聚合报表-图表块
}
private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板)
/**
* 得到实例
@ -56,28 +73,46 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
super();
// setVerticalDragEnabled(false);
initPropertyItemList();
initContentPane();
switchMode(PropertyMode.REPORT);
// initContentPane();
// super(leftPane, rightPane);
setContainerWidth(CONTAINER_WIDTH);
}
private void initPropertyItemList() {
propertyItemMap = new LinkedHashMap<>(); // 有序map
// 单元格元素
PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, Inter.getLocText("FR-Designer_Cell_Element"), "/com/fr/design/images/buttonicon/add.png");
PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, Inter.getLocText("FR-Designer_Cell_Element"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 单元格属性
PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, Inter.getLocText("FR-Designer_Cell_Attributes"), "com/fr/design/images/toolbarbtn/close.png");
PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, Inter.getLocText("FR-Designer_Cell_Attributes"),
"com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 悬浮元素
PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, Inter.getLocText("FR-Designer_Float_Element"), "com/fr/design/images/toolbarbtn/close.png");
PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, Inter.getLocText("FR-Designer_Float_Element"),
"com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT});
// 控件设置
PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, Inter.getLocText("FR-Designer-Widget_Settings"), "com/fr/design/images/toolbarbtn/close.png");
PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, Inter.getLocText("FR-Designer-Widget_Settings"),
"com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT});
// 条件属性
PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, Inter.getLocText("FR-Designer_Condition_Attributes"), "com/fr/design/images/toolbarbtn/close.png");
PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, Inter.getLocText("FR-Designer_Condition_Attributes"),
"com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 超级链接
PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, Inter.getLocText("FR-Designer_Hyperlink"), "com/fr/design/images/toolbarbtn/close.png");
PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, Inter.getLocText("FR-Designer_Hyperlink"),
"com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 组件库
PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"), "com/fr/design/images/toolbarbtn/close.png");
PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"),
"com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.FORM},
new PropertyMode[]{PropertyMode.FORM});
// // 图表属性设置
// PropertyItem chartSettings = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"),
// "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.FORM},
// new PropertyMode[]{PropertyMode.FORM});
propertyItemMap.put(KEY_CELL_ELEMENT, cellElement);
propertyItemMap.put(KEY_CELL_ATTR, cellAttr);
propertyItemMap.put(KEY_FLOAT_ELEMENT, floatElement);
@ -108,14 +143,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
rightPane.setBackground(Color.green);
rightPane.setLayout(propertyCard);
for (PropertyItem item : propertyItemMap.values()) {
if (item.isPoppedOut()) {
if (item.isPoppedOut() || !item.isVisible()) {
continue;
}
rightPane.add(item.getName(), item.getPropertyPanel());
}
rightPane.add(getDefaultPane());
rightPane.add(DEFAULT_PANE, getDefaultPane());
replaceRightPane(rightPane);
refreshRightPane();
}
// 左侧按钮面板
@ -123,7 +159,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
leftPane = new JPanel();
leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0));
for (PropertyItem item : propertyItemMap.values()) {
if (item.isPoppedOut()) {
if (item.isPoppedOut() || !item.isVisible()) {
continue;
}
leftPane.add(item.getButton());
@ -134,10 +170,30 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
replaceLeftPane(leftPane);
}
public void switchMode(PropertyMode mode) {
if (currentMode != null && currentMode.equals(mode)) {
return;
}
currentMode = mode;
updateAllPropertyPane();
}
public void updateAllPropertyPane() {
updatePropertyItemMap();
initContentPane();
}
private void updatePropertyItemMap() {
for (PropertyItem item : propertyItemMap.values()) {
item.updateStatus();
}
}
// 弹出面板时,更新框架内容
private void removeItem(PropertyItem propertyItem) {
leftPane.remove(propertyItem.getButton());
rightPane.remove(propertyItem.getPropertyPanel());
refreshRightPane();
refreshContainer();
}
@ -186,6 +242,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
return propertyItemMap.get(KEY_CELL_ATTR).getContentPane();
}
public void replaceFloatElementPane(JComponent pane) {
propertyItemMap.get(KEY_FLOAT_ELEMENT).replaceContentPane(pane);
}
public JComponent getFloatElementPane() {
return propertyItemMap.get(KEY_FLOAT_ELEMENT).getContentPane();
}
public void replaceWidgetSettingsPane(JComponent pane) {
propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceContentPane(pane);
}
@ -203,7 +267,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
public void addParameterPane(JComponent paraPane) {
propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(paraPane);
// propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(paraPane);
}
public void setParameterHeight(int height) {
@ -249,6 +313,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
* 刷新右面板
*/
public void refreshRightPane() {
boolean hasAvailableTab = false;
for (String name : propertyItemMap.keySet()) {
PropertyItem propertyItem = propertyItemMap.get(name);
if (propertyItem.isVisible() && !propertyItem.isPoppedOut() && propertyItem.isEnabled()) {
propertyCard.show(rightPane, name); // 显示第一个可用tab
hasAvailableTab = true;
break;
}
}
if (!hasAvailableTab) {
propertyCard.show(rightPane, DEFAULT_PANE);
}
// if (this.getRightPane() instanceof DockingView) {
// ((DockingView) this.getRightPane()).refreshDockingView();
@ -275,7 +351,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
class PropertyItem {
// private UIButton button;
private UIButton button;
private String name; // 用于 card 切换
private String title; // 用于显示
@ -284,21 +359,54 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private FixedPopupPane popupPane; // 左侧固定弹出框
private PopupToolPane popupToolPane; // 弹出工具条
private PopupDialog popupDialog; // 弹出框
private int x, y; // 弹出框的坐标
private int height; // 弹出框的高度
private boolean isPoppedOut = false; // 是否弹出
private Dimension fixedSize;
private boolean isVisible = true; // 是否可见
private boolean isEnabled = true; // 是否可用
private Set<PropertyMode> visibleModes;
private Set<PropertyMode> enableModes;
public PropertyItem(String name, String title, String btnUrl) {
public PropertyItem(String name, String title, String btnUrl, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this.name = name;
this.title = title;
initButton(btnUrl);
initPropertyPanel();
// this.visibleModes = new ArrayList<PropertyMode>(visibleModes);
initModes(visibleModes, enableModes);
}
private void initModes(PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this.enableModes = new HashSet<>();
this.visibleModes = new HashSet<>();
for (PropertyMode enableMode : enableModes) {
this.enableModes.add(enableMode);
}
for (PropertyMode visibleMode : visibleModes) {
this.visibleModes.add(visibleMode);
}
this.visibleModes.addAll(this.enableModes); // 可用必可见
}
public void updateStatus() {
setEnabled(enableModes.contains(currentMode));
setVisible(visibleModes.contains(currentMode));
}
public boolean isVisible() {
return isVisible;
}
public void setVisible(boolean isVisible) {
this.isVisible = isVisible;
}
public boolean isEnabled() {
return isEnabled;
}
// 选项不可用
public void setEnabled(boolean enabled) {
button.setEnabled(enabled);
public void setEnabled(boolean isEnabled) {
this.isEnabled = isEnabled;
button.setEnabled(isEnabled);
}
private void initPropertyPanel() {
@ -311,10 +419,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyPanel.add(contentPane, BorderLayout.CENTER);
}
public void setIsPoppedOut(boolean isPoppedOut) {
this.isPoppedOut = isPoppedOut;
}
public boolean isPoppedOut() {
return isPoppedOut;
}

1
designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java

@ -109,6 +109,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
*/
public void initBeforeUpEdit() {
WidgetToolBarPane.getInstance(this);
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA);
EastRegionContainerPane.getInstance().replaceWidgetLibPane(
FormWidgetDetailPane.getInstance(this));
if (!BaseUtils.isAuthorityEditing()) {

21
designer_form/src/com/fr/design/mainframe/JForm.java

@ -257,12 +257,12 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
return;
}
editingComponent = comp.createToolPane(this, formDesign);
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
if (BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().replaceUpPane(
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(
ComparatorUtils.equals(editingComponent.getClass(), NoSupportAuthorityEdit.class) ? editingComponent : createAuthorityEditPane());
} else {
EastRegionContainerPane.getInstance().replaceUpPane(editingComponent);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(editingComponent);
}
}
@ -617,17 +617,19 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
if (formDesign.isReportBlockEditing()) {
if (elementCaseDesign != null) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM_REPORT);
EastRegionContainerPane.getInstance().removeParameterPane();
EastRegionContainerPane.getInstance().replaceDownPane(elementCaseDesign.getEastDownPane());
EastRegionContainerPane.getInstance().replaceUpPane(elementCaseDesign.getEastUpPane());
EastRegionContainerPane.getInstance().replaceCellAttrPane(elementCaseDesign.getEastDownPane());
EastRegionContainerPane.getInstance().replaceCellElementPane(elementCaseDesign.getEastUpPane());
return;
}
}
EastRegionContainerPane.getInstance().replaceUpPane(WidgetPropertyPane.getInstance(formDesign));
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(WidgetPropertyPane.getInstance(formDesign));
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(formDesign));
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(formDesign).getPreferredSize().height);
if (EastRegionContainerPane.getInstance().getDownPane() == null) {
if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) {
new Thread() {
public void run() {
try {
@ -638,15 +640,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
JPanel pane = new JPanel();
pane.setLayout(new BorderLayout());
pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceDownPane(pane);
EastRegionContainerPane.getInstance().replaceWidgetLibPane(pane);
}
}.start();
} else {
JPanel pane = new JPanel();
pane.setLayout(new BorderLayout());
pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceDownPane(pane);
EastRegionContainerPane.getInstance().replaceWidgetLibPane(pane);
}
}

Loading…
Cancel
Save