diff --git a/designer/src/com/fr/design/actions/cell/CellWidgetAttrAction.java b/designer/src/com/fr/design/actions/cell/CellWidgetAttrAction.java index f5307b2aca..2a231a21f6 100644 --- a/designer/src/com/fr/design/actions/cell/CellWidgetAttrAction.java +++ b/designer/src/com/fr/design/actions/cell/CellWidgetAttrAction.java @@ -1,24 +1,18 @@ package com.fr.design.actions.cell; import com.fr.base.BaseUtils; -import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.actions.UpdateAction; +import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.menu.KeySetUtils; -import com.fr.design.present.CellWriteAttrPane; -import com.fr.design.dialog.BasicPane; -import com.fr.form.ui.Widget; -import com.fr.general.FRLogger; -import com.fr.grid.selection.CellSelection; -import com.fr.grid.selection.Selection; -import com.fr.privilege.finegrain.WidgetPrivilegeControl; -import com.fr.report.cell.TemplateCellElement; + +import java.awt.event.ActionEvent; /** * Cell Widget Attribute. */ -public class CellWidgetAttrAction extends AbstractCellElementAction { +public class CellWidgetAttrAction extends UpdateAction { - public CellWidgetAttrAction(ElementCasePane t) { - super(t); + public CellWidgetAttrAction() { this.setMenuKeySet(KeySetUtils.CELL_WIDGET_ATTR); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); @@ -26,47 +20,7 @@ public class CellWidgetAttrAction extends AbstractCellElementAction { } @Override - protected BasicPane populateBasicPane(TemplateCellElement cellElement) { - CellWriteAttrPane pane = new CellWriteAttrPane(this.getEditingComponent()); - //got simple cell element from column and row. - pane.populate(cellElement); - - return pane; - } - - @Override - protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { - CellWriteAttrPane pane = (CellWriteAttrPane) bp; - if (cellElement.getWidget() == null) { - pane.update(cellElement); - return; - } - try { - Widget oldWidget = (Widget) cellElement.getWidget().clone(); - pane.update(cellElement); - //这边需要重新设置权限细粒度的hashset是因为Update是直接生成一个新的来update的,所以以前里面的hashset都没有了 - Widget newWidget = cellElement.getWidget(); - if (newWidget.getClass() == oldWidget.getClass()) { - newWidget.setWidgetPrivilegeControl((WidgetPrivilegeControl) oldWidget.getWidgetPrivilegeControl().clone()); - } - } catch (Exception e) { - FRLogger.getLogger().error(e.getMessage()); - } - } - - @Override - protected boolean isNeedShinkToFit() { - return true; - } - - @Override - public void update() { - ElementCasePane ePane = this.getEditingComponent(); - Selection sel = ePane.getSelection(); - if (sel instanceof CellSelection) { - this.setEnabled(true); - } else { - this.setEnabled(false); - } + public void actionPerformed(ActionEvent e) { + EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); } } \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java index cf63c4448e..283425f6bc 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -169,7 +169,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { MenuDef menuDef = new MenuDef(KeySetUtils.CELL.getMenuKeySetName(), KeySetUtils.CELL.getMnemonic()); menuDef.addShortCut(new CellExpandAttrAction()); - menuDef.addShortCut(new CellWidgetAttrAction(this)); + menuDef.addShortCut(new CellWidgetAttrAction()); menuDef.addShortCut(new GlobalStyleMenuDef(this)); // 单元格形态 diff --git a/designer/src/com/fr/grid/GridMouseAdapter.java b/designer/src/com/fr/grid/GridMouseAdapter.java index fc88714adc..90b302d8d1 100644 --- a/designer/src/com/fr/grid/GridMouseAdapter.java +++ b/designer/src/com/fr/grid/GridMouseAdapter.java @@ -6,6 +6,7 @@ import com.fr.base.ScreenResolution; import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.JSliderPane; import com.fr.design.present.CellWriteAttrPane; @@ -204,7 +205,6 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous */ private void showWidetWindow(TemplateCellElement cellElement, TemplateElementCase report) { -// int resolution = ScreenResolution.getScreenResolution(); DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); double fixed_pos_x = this.oldEvtX - columnWidthList.getRangeValue(grid.getHorizontalValue(), cellElement.getColumn()).toPixD(resolution); @@ -212,7 +212,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous double cell_width = columnWidthList.getRangeValue(cellElement.getColumn(), cellElement.getColumn() + cellElement.getColumnSpan()).toPixD(resolution); double cell_height = rowHeightList.getRangeValue(cellElement.getRow(), cellElement.getRow() + cellElement.getRowSpan()).toPixD(resolution); if (fitSizeToShow(cell_width, cell_height, fixed_pos_x, fixed_pos_y)) { - CellWriteAttrPane.showWidgetWindow(grid.getElementCasePane()); + EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); } } diff --git a/designer/src/com/fr/grid/selection/CellSelection.java b/designer/src/com/fr/grid/selection/CellSelection.java index d3778d72a0..634dab7041 100644 --- a/designer/src/com/fr/grid/selection/CellSelection.java +++ b/designer/src/com/fr/grid/selection/CellSelection.java @@ -456,7 +456,7 @@ public class CellSelection extends Selection { } JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (jTemplate.isJWorkBook()){ //表单中报表块编辑屏蔽掉 控件设置 - popup.add(new CellWidgetAttrAction(ePane).createMenuItem()); + popup.add(new CellWidgetAttrAction().createMenuItem()); } popup.add(new CellExpandAttrAction().createMenuItem()); popup.add(DeprecatedActionManager.getPresentMenu(ePane).createJMenu()); diff --git a/designer/src/com/fr/poly/creator/ECBlockPane.java b/designer/src/com/fr/poly/creator/ECBlockPane.java index 61ad308b9c..78f9b31995 100644 --- a/designer/src/com/fr/poly/creator/ECBlockPane.java +++ b/designer/src/com/fr/poly/creator/ECBlockPane.java @@ -142,7 +142,7 @@ public class ECBlockPane extends PolyElementCasePane { MenuDef menuDef = new MenuDef(KeySetUtils.CELL.getMenuKeySetName(), KeySetUtils.CELL.getMnemonic()); menuDef.addShortCut(new CellExpandAttrAction()); - menuDef.addShortCut(new CellWidgetAttrAction(this)); + menuDef.addShortCut(new CellWidgetAttrAction()); menuDef.addShortCut(new GlobalStyleMenuDef(this)); // 单元格形态 diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index ab2dff8b2b..3aec09d459 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -39,17 +39,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private static final int POPUP_MIN_HEIGHT = 145; private static final int POPUP_MAX_HEIGHT = 480; private static final int POPUP_DEFAULT_HEIGHT = 360; - private static final String KEY_CELL_ELEMENT = "cellElement"; - private static final String KEY_CELL_ATTR = "cellAttr"; - private static final String KEY_FLOAT_ELEMENT = "floatElement"; - private static final String KEY_WIDGET_SETTINGS = "widgetSettings"; - 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 KEY_AUTHORITY_EDITION = "authorityEdition"; - private static final String KEY_CONFIGURED_ROLES = "editedRoles"; - private static final String DEFAULT_PANE = "defaultPane"; - private static final String DEFAULT_AUTHORITY_PANE = "defaultAuthorityPane"; + public static final String KEY_CELL_ELEMENT = "cellElement"; + public static final String KEY_CELL_ATTR = "cellAttr"; + public static final String KEY_FLOAT_ELEMENT = "floatElement"; + public static final String KEY_WIDGET_SETTINGS = "widgetSettings"; + public static final String KEY_CONDITION_ATTR = "conditionAttr"; + public static final String KEY_HYPERLINK = "hyperlink"; + public static final String KEY_WIDGET_LIB = "widgetLib"; + public static final String KEY_AUTHORITY_EDITION = "authorityEdition"; + public static final String KEY_CONFIGURED_ROLES = "editedRoles"; + public static final String DEFAULT_PANE = "defaultPane"; + public static final String DEFAULT_AUTHORITY_PANE = "defaultAuthorityPane"; private JPanel defaultPane; // "无可用配置项"面板 private JPanel defaultAuthorityPane; // "该元素不支持权限编辑" @@ -359,6 +359,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap.get(KEY_WIDGET_SETTINGS).removeHeaderPane(); } + public void switchTabTo(String tabName) { + PropertyItem propertyItem = propertyItemMap.get(tabName); + if (propertyItem == null) { + return; + } + if (propertyItem.isVisible() && propertyItem.isEnabled() && !propertyItem.isPoppedOut()) { + propertyCard.show(rightPane, tabName); + propertyItem.setTabButtonSelected(); + } + } + /** * 刷新右面板 */