diff --git a/designer/src/com/fr/design/actions/edit/HyperlinkAction.java b/designer/src/com/fr/design/actions/edit/HyperlinkAction.java deleted file mode 100644 index 6c6c4379b6..0000000000 --- a/designer/src/com/fr/design/actions/edit/HyperlinkAction.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. - */ -package com.fr.design.actions.edit; - -import java.awt.Color; - -import javax.swing.SwingUtilities; - -import com.fr.base.BaseUtils; -import com.fr.base.Style; -import com.fr.design.actions.ElementCaseAction; -import com.fr.design.actions.utils.ReportActionUtils; -import com.fr.design.actions.utils.ReportActionUtils.IterAction; -import com.fr.design.gui.frpane.HyperlinkGroupPane; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl; -import com.fr.design.menu.KeySetUtils; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.general.FRFont; -import com.fr.grid.selection.CellSelection; -import com.fr.grid.selection.FloatSelection; -import com.fr.grid.selection.Selection; -import com.fr.js.NameJavaScriptGroup; -import com.fr.report.cell.CellElement; -import com.fr.report.cell.FloatElement; -import com.fr.report.elementcase.TemplateElementCase; -import com.fr.stable.Constants; - -/** - * HyperlinkAction. - */ -public class HyperlinkAction extends ElementCaseAction { - private boolean b; - - public HyperlinkAction(ElementCasePane t) { - super(t); - this.setMenuKeySet(KeySetUtils.HYPER_LINK); - this.setName(getMenuKeySet().getMenuKeySetName() + "..."); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/hyperLink.png")); - } - - /** - * 计算Action, - * @return 返回是否需要记录undo - */ - public boolean executeActionReturnUndoRecordNeeded() { - b = true; - ElementCasePane reportPane = this.getEditingComponent(); - if (reportPane == null) { - return false; - } - - final TemplateElementCase report = reportPane.getEditingElementCase(); - NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report); - final HyperlinkGroupPane pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance()); - pane.populate(nameHyperlinks); - - final Selection sel = reportPane.getSelection(); - BasicDialog dialog = pane.showWindow(SwingUtilities.getWindowAncestor(reportPane)); - dialog.addDialogActionListener(new DialogActionAdapter() { - public void doOk() { - super.doOk(); - final NameJavaScriptGroup updateNameHyperlinks = pane.updateJSGroup(); - if (sel instanceof FloatSelection) { - FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName()); - selectedFloatElement.setNameHyperlinkGroup(updateNameHyperlinks); - } else { - ReportActionUtils.actionIterateWithCellSelection((CellSelection)sel, report, new IterAction() { - public void dealWith(CellElement editCellElement) { - Style elementStyle = editCellElement.getStyle(); - FRFont frFont = elementStyle.getFRFont(); - if (updateNameHyperlinks.size() > 0) { - frFont = frFont.applyForeground(Color.blue); - frFont = frFont.applyUnderline(Constants.LINE_THIN); - } else { - frFont = frFont.applyForeground(Color.black); - frFont = frFont.applyUnderline(Constants.LINE_NONE); - } - editCellElement.setStyle(elementStyle.deriveFRFont(frFont)); - editCellElement.setNameHyperlinkGroup(updateNameHyperlinks); - } - }); - } - } - public void doCancel() { - b = false; - } - }); - dialog.setVisible(true); - - return b; - } - - private NameJavaScriptGroup getNameJSGroup(ElementCasePane reportPane, final TemplateElementCase report) { - NameJavaScriptGroup nameHyperlinks = null; - final Selection sel = reportPane.getSelection(); - if (sel instanceof FloatSelection) { - FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName()); - nameHyperlinks = selectedFloatElement.getNameHyperlinkGroup(); - } else { - CellElement editCellElement = report.getCellElement(((CellSelection)sel).getColumn(), ((CellSelection)sel).getRow()); - if (editCellElement != null) { - nameHyperlinks = editCellElement.getNameHyperlinkGroup(); - } - } - - return nameHyperlinks; - } - -} \ 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 d2ccd6b18b..dd28242cd1 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -7,7 +7,6 @@ import com.fr.design.actions.cell.*; import com.fr.design.actions.columnrow.InsertColumnAction; import com.fr.design.actions.columnrow.InsertRowAction; import com.fr.design.actions.core.ActionFactory; -import com.fr.design.actions.edit.HyperlinkAction; import com.fr.design.actions.edit.merge.MergeCellAction; import com.fr.design.actions.edit.merge.UnmergeCellAction; import com.fr.design.actions.utils.DeprecatedActionManager; @@ -169,7 +168,6 @@ public class ElementCasePaneDelegate extends ElementCasePane { // 单元格形态 menuDef.addShortCut(DeprecatedActionManager.getPresentMenu(this)); - menuDef.addShortCut(new HyperlinkAction(this)); menuDef.addShortCut(SeparatorDef.DEFAULT); menuDef.addShortCut(new MergeCellAction(this)); menuDef.addShortCut(new UnmergeCellAction(this)); diff --git a/designer/src/com/fr/grid/selection/CellSelection.java b/designer/src/com/fr/grid/selection/CellSelection.java index 458d9fd293..6a7adbd9d8 100644 --- a/designer/src/com/fr/grid/selection/CellSelection.java +++ b/designer/src/com/fr/grid/selection/CellSelection.java @@ -8,7 +8,6 @@ import com.fr.design.actions.cell.GlobalStyleMenuDef.GlobalStyleSelection; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.edit.CopyAction; import com.fr.design.actions.edit.CutAction; -import com.fr.design.actions.edit.HyperlinkAction; import com.fr.design.actions.edit.PasteAction; import com.fr.design.actions.utils.DeprecatedActionManager; import com.fr.design.cell.clipboard.CellElementsClip; @@ -461,7 +460,6 @@ public class CellSelection extends Selection { popup.add(DeprecatedActionManager.getPresentMenu(ePane).createJMenu()); popup.add(new ConditionAttributesAction(ePane).createMenuItem()); popup.add(new CellAttributeAction().createMenuItem()); - popup.add(new HyperlinkAction(ePane).createMenuItem()); // cut, copy and paste popup.addSeparator(); popup.add(new CutAction(ePane).createMenuItem()); diff --git a/designer/src/com/fr/grid/selection/FloatSelection.java b/designer/src/com/fr/grid/selection/FloatSelection.java index 5f0be878cf..adc6b01f1d 100644 --- a/designer/src/com/fr/grid/selection/FloatSelection.java +++ b/designer/src/com/fr/grid/selection/FloatSelection.java @@ -13,7 +13,6 @@ import com.fr.design.actions.edit.CopyAction; import com.fr.design.actions.edit.CutAction; import com.fr.design.actions.edit.DeleteAction; import com.fr.design.actions.edit.EditFloatElementNameAction; -import com.fr.design.actions.edit.HyperlinkAction; import com.fr.design.actions.edit.PasteAction; import com.fr.design.actions.utils.DeprecatedActionManager; import com.fr.design.cell.clipboard.CellElementsClip; @@ -126,7 +125,6 @@ public class FloatSelection extends Selection { } popup.add(DeprecatedActionManager.getCellMenu(ePane).createJMenu()); popup.add(new FloatStyleAction(ePane).createMenuItem()); - popup.add(new HyperlinkAction(ePane).createMenuItem()); // cut, copy and paste popup.addSeparator(); diff --git a/designer/src/com/fr/poly/creator/ECBlockPane.java b/designer/src/com/fr/poly/creator/ECBlockPane.java index a1e04d8915..fbc5e1f8a1 100644 --- a/designer/src/com/fr/poly/creator/ECBlockPane.java +++ b/designer/src/com/fr/poly/creator/ECBlockPane.java @@ -10,7 +10,6 @@ import com.fr.page.ReportSettingsProvider; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.cell.*; import com.fr.design.actions.core.ActionFactory; -import com.fr.design.actions.edit.HyperlinkAction; import com.fr.design.actions.edit.merge.MergeCellAction; import com.fr.design.actions.edit.merge.UnmergeCellAction; import com.fr.design.actions.columnrow.InsertColumnAction; @@ -148,7 +147,6 @@ public class ECBlockPane extends PolyElementCasePane { // 单元格形态 menuDef.addShortCut(DeprecatedActionManager.getPresentMenu(this)); - menuDef.addShortCut(new HyperlinkAction(this)); menuDef.addShortCut(SeparatorDef.DEFAULT); menuDef.addShortCut(new MergeCellAction(this)); menuDef.addShortCut(new UnmergeCellAction(this)); diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java index c47f8b195d..42d7e97bd2 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -252,12 +252,13 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH // 点击"编辑"按钮,弹出面板 protected class PopupEditDialog extends JDialog { private JComponent editPane; - private static final int WIDTH = 470; - private static final int HEIGHT = 550; + private static final int WIDTH = 490; + private static final int HEIGHT = 570; PopupEditDialog(JComponent pane) { super(DesignerContext.getDesignerFrame()); setUndecorated(true); + pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.editPane = pane; this.getContentPane().add(editPane, BorderLayout.CENTER); setSize(WIDTH, HEIGHT); diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 2027c4483b..72be5fb33c 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -301,7 +301,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } public void addParameterPane(JComponent paraPane) { -// propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(paraPane); + propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane); } public void setParameterHeight(int height) { @@ -340,7 +340,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } public void removeParameterPane() { - + propertyItemMap.get(KEY_WIDGET_SETTINGS).removeHeaderPane(); } /** @@ -396,6 +396,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private String title; // 用于显示 private JComponent propertyPanel; private JComponent contentPane; + private JComponent headerPane; // 在contentPane 上方,可以用于显示参数面板 + private Container contentArea; // 包含 headerPane 和 contentPane private FixedPopupPane popupPane; // 左侧固定弹出框 private PopupToolPane popupToolPane; // 弹出工具条 private PopupDialog popupDialog; // 弹出框 @@ -404,6 +406,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private boolean isEnabled = true; // 是否可用 private Set visibleModes; private Set enableModes; + private static final int MAX_PARA_HEIGHT = 240; public PropertyItem(String name, String title, String btnUrl, PropertyMode[] visibleModes, PropertyMode[] enableModes) { this.name = name; @@ -454,9 +457,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyPanel.setBackground(Color.pink); contentPane = generateContentPane(); popupToolPane = new PopupToolPane(this, PopupToolPane.DOWN_BUTTON); + headerPane = new JPanel(); + contentArea = new JPanel(new BorderLayout()); + contentArea.add(headerPane, BorderLayout.NORTH); + contentArea.add(contentPane, BorderLayout.CENTER); propertyPanel.setLayout(new BorderLayout()); propertyPanel.add(popupToolPane, BorderLayout.NORTH); - propertyPanel.add(contentPane, BorderLayout.CENTER); + propertyPanel.add(contentArea, BorderLayout.CENTER); } public boolean isPoppedOut() { @@ -477,8 +484,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } public void replaceContentPane(JComponent pane) { - propertyPanel.remove(this.contentPane); - propertyPanel.add(this.contentPane = pane); + contentArea.remove(this.contentPane); + contentArea.add(this.contentPane = pane); if (popupDialog != null && isPoppedOut) { popupDialog.replaceContentPane(this); } @@ -493,6 +500,25 @@ public class EastRegionContainerPane extends UIEastResizableContainer { return contentPane; } + public void replaceHeaderPane(JComponent pane) { + contentArea.remove(headerPane); + int height = Math.min(pane.getPreferredSize().height, MAX_PARA_HEIGHT); + pane.setPreferredSize(new Dimension(pane.getPreferredSize().width, height)); + headerPane = pane; + contentArea.add(headerPane, BorderLayout.NORTH); + + refreshContainer(); + } + + public void removeHeaderPane() { + contentArea.remove(headerPane); + refreshContainer(); + } + + public JComponent getHeaderPane() { + return headerPane; + } + public void onResize() { if (isRightPaneVisible()) { hideCurrentPopupPane();