diff --git a/designer-base/src/com/fr/design/constants/UIConstants.java b/designer-base/src/com/fr/design/constants/UIConstants.java index 1b8debbb5..1959f6fc0 100644 --- a/designer-base/src/com/fr/design/constants/UIConstants.java +++ b/designer-base/src/com/fr/design/constants/UIConstants.java @@ -108,6 +108,7 @@ public interface UIConstants { public static final Color AUTHORITY_SHEET_UNSELECTED = new Color(146, 192, 225); public static final Color ATTRIBUTE_PRESS = new Color(0x419BF9); public static final Color NORMAL_BLUE = new Color(0x419BF9); + public static final Color DISABLED_ICON_COLOR = new Color(170, 170, 171); public static final Color ATTRIBUTE_NORMAL = Color.WHITE; public static final Color ATTRIBUTE_HOVER = new Color(0xF5F5F7); public static final Color UI_TOOLBAR_COLOR = new Color(0xF5F5F7); diff --git a/designer-base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java b/designer-base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java index 8f5fa9804..1366b46b3 100644 --- a/designer-base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java +++ b/designer-base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java @@ -5,6 +5,7 @@ import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; +import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; @@ -40,7 +41,7 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { * 后台初始化所有事件. */ public void initAllListeners() { - initListener(AbstractAttrNoScrollPane.this); + initListener(AbstractAttrNoScrollPane.this); } protected void initContentPane() { @@ -73,14 +74,14 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { } if (tmpComp instanceof GlobalNameObserver) { ((GlobalNameObserver) tmpComp).registerNameListener(new GlobalNameListener() { - public void setGlobalName(String name) { - globalName = name; - } - - public String getGlobalName() { - return globalName; - } - }); + public void setGlobalName(String name) { + globalName = name; + } + + public String getGlobalName() { + return globalName; + } + }); } if (tmpComp instanceof UIObserver) { ((UIObserver) tmpComp).registerChangeListener(new UIObserverListener() { @@ -93,10 +94,10 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { } } - /** - * 是否有改变监听 - * @return 是则返回true - */ + /** + * 是否有改变监听 + * @return 是则返回true + */ public static boolean isHasChangeListener() { return hasChangeListener; } @@ -109,10 +110,10 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { } - /** - * 返回绑定的属性事件. - * @param listener 增加监听 - */ + /** + * 返回绑定的属性事件. + * @param listener 增加监听 + */ public void addAttributeChangeListener(AttributeChangeListener listener) { this.listener = listener; hasChangeListener = true; @@ -132,13 +133,19 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { /** * 返回图标的路径 */ - public abstract String getIconPath(); + public String getIconPath() { + // 默认为空,子类有需要再重写 + return StringUtils.EMPTY; + } - /** - * 界面标题 - * @return 标题 - */ - public abstract String title4PopupWindow(); + /** + * 界面标题 + * @return 标题 + */ + public String title4PopupWindow() { + // 默认为空,子类有需要再重写 + return StringUtils.EMPTY; + } /** * 设置选中的ID, 用于双击展示界面. @@ -151,12 +158,12 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { return globalName; } - /** - * 主要用于图表设计器 - * @return 是 - */ - public boolean isNeedPresentPaneWhenFilterData(){ - return true; - } + /** + * 主要用于图表设计器 + * @return 是 + */ + public boolean isNeedPresentPaneWhenFilterData(){ + return true; + } } \ No newline at end of file diff --git a/designer-base/src/com/fr/design/gui/ibutton/UIRadioButton.java b/designer-base/src/com/fr/design/gui/ibutton/UIRadioButton.java index d8e36296f..0752eef4d 100644 --- a/designer-base/src/com/fr/design/gui/ibutton/UIRadioButton.java +++ b/designer-base/src/com/fr/design/gui/ibutton/UIRadioButton.java @@ -1,6 +1,14 @@ package com.fr.design.gui.ibutton; +import com.fr.design.event.GlobalNameListener; +import com.fr.design.event.GlobalNameObserver; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.stable.StringUtils; + import javax.swing.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; /** * Created by IntelliJ IDEA. @@ -9,38 +17,110 @@ import javax.swing.*; * Date: 13-3-27 * Time: 下午5:04 */ -public class UIRadioButton extends JRadioButton { +public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNameObserver { + private UIObserverListener uiObserverListener; + private GlobalNameListener globalNameListener = null; + private String radioButtonName = StringUtils.EMPTY; public UIRadioButton() { super(); + initListener(); } public UIRadioButton(Icon icon) { super(icon); + initListener(); } public UIRadioButton(Action a) { super(a); + initListener(); } public UIRadioButton(Icon icon, boolean selected) { super(icon, selected); + initListener(); } public UIRadioButton(String text) { super(text); + initListener(); } public UIRadioButton(String text, boolean selected) { super(text, selected); + initListener(); } public UIRadioButton(String text, Icon icon) { super(text, icon); + initListener(); } public UIRadioButton(String text, Icon icon, boolean selected) { super(text, icon, selected); + initListener(); + } + + private void initListener() { + if (shouldResponseChangeListener()) { + this.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (uiObserverListener == null || e.getStateChange() != ItemEvent.SELECTED) { + return; + } + if (globalNameListener != null && shouldResponseNameListener()) { + globalNameListener.setGlobalName(radioButtonName); + } + uiObserverListener.doChange(); + } + }); + } + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(UIObserverListener listener) { + this.uiObserverListener = listener; + } + + + public void setGlobalName(String name) { + radioButtonName = name; + } + + public String getGlobalName() { + return radioButtonName; + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseChangeListener() { + return true; + } + + /** + * 注册观察者监听事件 + * @param listener 观察者监听事件 + */ + public void registerNameListener(GlobalNameListener listener) { + globalNameListener = listener; + } + + /** + * 组件是否需要响应观察者事件 + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseNameListener() { + return true; } } \ No newline at end of file diff --git a/designer-base/src/com/fr/design/gui/icheckbox/UICheckBox.java b/designer-base/src/com/fr/design/gui/icheckbox/UICheckBox.java index 6e2c93f52..9d49bd06e 100644 --- a/designer-base/src/com/fr/design/gui/icheckbox/UICheckBox.java +++ b/designer-base/src/com/fr/design/gui/icheckbox/UICheckBox.java @@ -137,10 +137,12 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser g.setColor(b.getBackground()); g.fillRect(0, 0, size.width, size.height); } + Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if ( model.isSelected()) { - GUIPaintUtils.fillPaint(g2d, iconRect.x, iconRect.y, iconRect.width, iconRect.height,false, Constants.NULL,UIConstants.CHECKBOX_HOVER_SELECTED, 0); + GUIPaintUtils.fillPaint(g2d, iconRect.x, iconRect.y, iconRect.width, iconRect.height,false, Constants.NULL, + model.isEnabled() ? UIConstants.CHECKBOX_HOVER_SELECTED : UIConstants.DISABLED_ICON_COLOR, 0); } else if (model.isRollover() && ! model.isSelected()) { g.setColor(UIConstants.CHECKBOX_HOVER_SELECTED); g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC); diff --git a/designer-base/src/com/fr/design/icon/IconPathConstants.java b/designer-base/src/com/fr/design/icon/IconPathConstants.java index ec5fcded3..c591a8e75 100644 --- a/designer-base/src/com/fr/design/icon/IconPathConstants.java +++ b/designer-base/src/com/fr/design/icon/IconPathConstants.java @@ -1 +1 @@ -package com.fr.design.icon; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 6.5.6 * Date: 12-12-18 * Time: 上午9:42 * 用于保存所有图标路径的类 */ public class IconPathConstants { private IconPathConstants() { } public static final String ADD_POPMENU_ICON_PATH = "/com/fr/design/images/control/addPopup.png"; public static final String DS_ICON_PATH = "/com/fr/design/images/data/datasource.png"; public static final String CLASS_TD_ICON_PATH = "/com/fr/design/images/data/source/classTableData.png"; public static final String EMB_TD_ICON_PATH = "/com/fr/design/images/data/dataTable.png"; public static final String DS_RELATION_TD_ICON_PATH = "/com/fr/design/images/data/multi.png"; public static final String FILE_TD_ICON_PATH = "/com/fr/design/images/data/file.png"; public static final String DS_TREE_TD_ICON_PATH = "/com/fr/design/images/data/tree.png"; public static final String DS_QUERY_ICON_PATH = "/com/fr/design/images/data/database.png"; public static final String PREVIEW_ICON_PATH = "/com/fr/design/images/m_file/preview.png"; public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png"; public static final String TD_EL_SHARE_HELP_ICON_PATH = "/com/fr/design/images/control/help_open.png"; public static final String TD_EL_SHARE_CLOSE_ICON_PATH = "/com/fr/design/images/control/help_close.png"; public static final String TD_REMOVE_ICON_PATH = "/com/fr/design/images/control/tab/remove.png"; public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png"; public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png"; public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png"; public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png"; public static final String FORBID_ICON_PATH = "/com/fr/web/images/form/forbid.png"; } \ No newline at end of file +package com.fr.design.icon; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 6.5.6 * Date: 12-12-18 * Time: 上午9:42 * 用于保存所有图标路径的类 */ public class IconPathConstants { private IconPathConstants() { } public static final String ADD_POPMENU_ICON_PATH = "/com/fr/design/images/control/addPopup.png"; public static final String DS_ICON_PATH = "/com/fr/design/images/data/datasource.png"; public static final String CLASS_TD_ICON_PATH = "/com/fr/design/images/data/source/classTableData.png"; public static final String EMB_TD_ICON_PATH = "/com/fr/design/images/data/dataTable.png"; public static final String DS_RELATION_TD_ICON_PATH = "/com/fr/design/images/data/multi.png"; public static final String FILE_TD_ICON_PATH = "/com/fr/design/images/data/file.png"; public static final String DS_TREE_TD_ICON_PATH = "/com/fr/design/images/data/tree.png"; public static final String DS_QUERY_ICON_PATH = "/com/fr/design/images/data/database.png"; public static final String PREVIEW_ICON_PATH = "/com/fr/design/images/m_file/preview.png"; public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png"; public static final String TD_EL_SHARE_HELP_ICON_PATH = "/com/fr/design/images/control/help_open.png"; public static final String TD_EL_SHARE_CLOSE_ICON_PATH = "/com/fr/design/images/control/help_close.png"; public static final String TD_REMOVE_ICON_PATH = "/com/fr/design/images/control/tab/remove.png"; public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png"; public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png"; public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png"; public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png"; public static final String FORBID_ICON_PATH = "/com/fr/web/images/form/forbid.png"; public static final String EDIT_ICON_PATH = "/com/fr/design/images/control/newEdit.png"; } \ No newline at end of file diff --git a/designer-base/src/com/fr/design/layout/FRGUIPaneFactory.java b/designer-base/src/com/fr/design/layout/FRGUIPaneFactory.java index e21f1c194..db48cf995 100644 --- a/designer-base/src/com/fr/design/layout/FRGUIPaneFactory.java +++ b/designer-base/src/com/fr/design/layout/FRGUIPaneFactory.java @@ -416,6 +416,37 @@ public class FRGUIPaneFactory { return jp; } + /** + * 创建垂直流布局面板 + * + * @param isAlignLeft 是否左对齐 + * @return JPanel对象 + */ + public static JPanel createVerticalFlowLayout_S_Pane(boolean isAlignLeft) { + JPanel jp = new JPanel(); + VerticalFlowLayout layout = new VerticalFlowLayout(); + layout.setAlignLeft(isAlignLeft); + jp.setLayout(layout); + return jp; + } + + /** + * 创建垂直流布局面板 + * + * @param isAlignLeft 是否左对齐 + * @param align the alignment value + * @param hgap the horizontal gap between components + * @param vgap the vertical gap between components + * @return JPanel对象 + */ + public static JPanel createVerticalFlowLayout_Pane(boolean isAlignLeft, int align, int hgap, int vgap) { + JPanel jp = new JPanel(); + VerticalFlowLayout layout = new VerticalFlowLayout(align, hgap, vgap); + layout.setAlignLeft(isAlignLeft); + jp.setLayout(layout); + return jp; + } + /** * 创建边框面板L * diff --git a/designer-base/src/com/fr/design/layout/VerticalFlowLayout.java b/designer-base/src/com/fr/design/layout/VerticalFlowLayout.java index 7e386c9da..5d5131ff4 100644 --- a/designer-base/src/com/fr/design/layout/VerticalFlowLayout.java +++ b/designer-base/src/com/fr/design/layout/VerticalFlowLayout.java @@ -71,6 +71,9 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable { */ int newAlign; // This is the one we actually use + // 当列宽不一致时,是否需要左对齐(默认居中对齐) + boolean isAlignLeft = false; + /** * The flow layout manager allows a seperation of * components with gaps. The horizontal gap will @@ -261,9 +264,9 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable { return dim; } } - + protected boolean dialWithDim4PreferredLayoutSize(Dimension dim, Dimension d, boolean firstVisibleComponent) { - dim.width = Math.max(dim.width, d.width); + dim.width = Math.max(dim.width, d.width); if (firstVisibleComponent) { firstVisibleComponent = false; } else { @@ -271,7 +274,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable { } dim.height += d.height; - + return firstVisibleComponent; } @@ -291,7 +294,7 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable { Dimension dim = new Dimension(0, 0); int nmembers = target.getComponentCount(); boolean firstVisibleComponent = true; - + for (int i = 0; i < nmembers; i++) { Component m = target.getComponent(i); if (m.isVisible()) { @@ -306,14 +309,14 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable { return dim; } } - + protected boolean dialWithDim4MinimumLayoutSize(Dimension dim, Dimension d, int i, boolean firstVisibleComponent) { - dim.width = Math.max(dim.width, d.width); + dim.width = Math.max(dim.width, d.width); if (i > 0) { dim.height += vgap; } dim.height += d.height; - + return firstVisibleComponent; } @@ -345,10 +348,11 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable { for (int i = rowStart; i < rowEnd; i++) { Component m = target.getComponent(i); if (m.isVisible()) { + int newX = x + (width - m.getWidth()) / 2; if (ltr) { - m.setLocation(x + (width - m.getWidth()) / 2, y); + m.setLocation(isAlignLeft ? x : newX, y); } else { - m.setLocation(x + (width - m.getWidth()) / 2, target.getHeight() - y - m.getHeight()); + m.setLocation(isAlignLeft ? x : newX, target.getHeight() - y - m.getHeight()); } y += m.getHeight() + vgap; } @@ -395,17 +399,17 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable { dealWithMC4LayoutContainer(target, insets, x, y, roww, start, maxlen, nmembers, ltr); } } - + protected Dimension getPreferredSize(Container target, Component m) { - return m.getPreferredSize(); + return m.getPreferredSize(); } - + protected void dealWithMC4LayoutContainer(Container target, Insets insets, int x, int y, int roww, int start, int maxlen, int nmembers, boolean ltr) { - moveComponents(target, x, insets.top + vgap, roww, maxlen - y, start, nmembers, ltr); + moveComponents(target, x, insets.top + vgap, roww, maxlen - y, start, nmembers, ltr); } - + protected int[] dealWithDim4LayoutContainer(Container target, Insets insets, Dimension d, int x, int y, int roww, int start, int maxlen, int i, boolean ltr) { - if ((y == 0) || ((y + d.height) <= maxlen)) { + if ((y == 0) || ((y + d.height) <= maxlen)) { if (y > 0) y += vgap; y += d.height; roww = Math.max(roww, d.width); @@ -416,19 +420,26 @@ public class VerticalFlowLayout implements LayoutManager, java.io.Serializable { roww = d.width; start = i; } - return new int[]{x, y, roww, start}; + return new int[]{x, y, roww, start}; } - + protected int getMaxLen4LayoutContainer(Container target, Insets insets) { - return target.getHeight() - (insets.top + insets.bottom + vgap * 2); + return target.getHeight() - (insets.top + insets.bottom + vgap * 2); } - + protected int getX4LayoutContainer(Insets insets) { - return insets.left + hgap; + return insets.left + hgap; } - + protected int getY4LayoutContainer(Insets insets) { - return 0; + return 0; + } + + /** + * 当列宽不一致时,通过此方法设置是否需要左对齐 + */ + public void setAlignLeft(boolean isAlignLeft) { + this.isAlignLeft = true; } diff --git a/designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java index d2bffafc5..ef8729ddc 100644 --- a/designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; @@ -81,7 +82,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { * * @return */ - public static final EastRegionContainerPane getInstance() { + public static EastRegionContainerPane getInstance() { if (THIS == null) { THIS = new EastRegionContainerPane(); THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth()); @@ -230,6 +231,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { updateAllPropertyPane(); } + /** + * 可通过此方法,判断当前的编辑模式 + * */ + public PropertyMode getCurrentMode() { + return currentMode; + } + public void updateAllPropertyPane() { updatePropertyItemMap(); initContentPane(); @@ -357,10 +365,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane); } - public void setParameterHeight(int height) { - // stub - } - public static void main(String[] args){ JFrame jf = new JFrame("test"); // jf = new JFrame("test"); @@ -436,7 +440,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 无可用 tab 时,显示提示文字 if (!hasAvailableTab) { resetPropertyIcons(); - if (!hasEnabledTab && BaseUtils.isAuthorityEditing()) { + if (!hasEnabledTab && DesignerMode.isAuthorityEditing()) { propertyCard.show(rightPane, DEFAULT_AUTHORITY_PANE); } else { propertyCard.show(rightPane, DEFAULT_PANE); diff --git a/designer-base/src/com/fr/design/mainframe/JTemplate.java b/designer-base/src/com/fr/design/mainframe/JTemplate.java index 14ac74539..df970d1b3 100644 --- a/designer-base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/com/fr/design/mainframe/JTemplate.java @@ -557,15 +557,25 @@ public abstract class JTemplate> operation == FILEChooserPane.OK_OPTION; } - private boolean saveAsTemplate(boolean isShowLoc) { + public boolean saveAsTemplate(boolean isShowLoc) { FILE editingFILE = this.getEditingFILE(); if (editingFILE == null) { return false; } + return saveAsTemplate(isShowLoc, editingFILE.getName()); + } + + /** + * 保存 + * @param isShowLoc 是否显示“报表运行环境”外的路径(C盘D盘等) + * @param fileName 保存文件名 + * @return + */ + public boolean saveAsTemplate(boolean isShowLoc, String fileName) { String oldName = this.getFullPathName(); // alex:如果是SaveAs的话需要让用户来选择路径了 FILEChooserPane fileChooser = getFILEChooserPane(isShowLoc); - fileChooser.setFileNameTextField(editingFILE.getName(), this.suffix()); + fileChooser.setFileNameTextField(fileName, this.suffix()); int chooseResult = fileChooser.showSaveDialog(DesignerContext.getDesignerFrame(), this.suffix()); if (isCancelOperation(chooseResult)) { @@ -574,7 +584,7 @@ public abstract class JTemplate> } if (isOkOperation(chooseResult)) { - if (!FRContext.getCurrentEnv().hasFileFolderAllow(fileChooser.getSelectedFILE().getPath())) { + if (!FRContext.getCurrentEnv().hasFileFolderAllow(fileChooser.getSelectedFILE().getPath()) ) { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_No-Privilege") + "!", Inter.getLocText("FR-Designer_Message"), JOptionPane.WARNING_MESSAGE); return false; } diff --git a/designer-base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java b/designer-base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java index de9628e50..405e1fc18 100644 --- a/designer-base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java +++ b/designer-base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java @@ -47,7 +47,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane { public ImageBackgroundQuickPane(boolean hasImageLayout) { this.setLayout(new BorderLayout(0, 4)); - String[] nameArray = {Inter.getLocText("FR-Background_Image_Default"), Inter.getLocText("FR-Background_Image_Titled"), Inter.getLocText("FR-Background_Image_Adjust"), Inter.getLocText("FR-Background_Image_Extend")}; + String[] nameArray = {Inter.getLocText("FR-Background_Image_Default"), Inter.getLocText("FR-Background_Image_Titled"), Inter.getLocText("FR-Background_Image_Extend"), Inter.getLocText("FR-Background_Image_Adjust")}; Byte[] valueArray = {Constants.IMAGE_CENTER, Constants.IMAGE_TILED, Constants.IMAGE_EXTEND, Constants.IMAGE_ADJUST}; imageLayoutPane = new UIButtonGroup(nameArray, valueArray); imageLayoutPane.setSelectedIndex(0); diff --git a/designer-base/src/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/com/fr/design/utils/gui/GUICoreUtils.java index 0aa153544..69c1e63e9 100644 --- a/designer-base/src/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/com/fr/design/utils/gui/GUICoreUtils.java @@ -12,6 +12,7 @@ import com.fr.design.actions.core.ActionFactory; import com.fr.design.border.UITitledBorder; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.EditTextField; @@ -37,6 +38,7 @@ import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.image.BufferedImage; import java.awt.image.ImageObserver; @@ -844,4 +846,49 @@ public abstract class GUICoreUtils{ && oneRect.getWidth() == otherRect.getWidth() && oneRect.getHeight() == otherRect.getHeight(); } + + /** + * 生成提示标签 + * @param tipText 提示文字 + * @return UILabel 标签对象 + */ + public static UILabel createTipLabel(String tipText) { + UILabel tipLabel = new UILabel("" + tipText + ""); + tipLabel.setForeground(Color.gray); + return tipLabel; + } + + /** + * 生成没有边框的 UICheckBox + * @param text 说明文字 + * @return UICheckBox + */ + public static UICheckBox createNoBorderCheckBox(String text) { + UICheckBox checkBox = new UICheckBox(text); + checkBox.setBorder(BorderFactory.createEmptyBorder()); + return checkBox; + } + + /** + * 创建包含选择框和一个动态面板的联动面板。根据选择框的状态,动态面板会动态地显示或隐藏 + * @param checkBox 选择框 + * @param dynamicPane 包含任意内容的动态面板 + * @param hideOnSelected 选中时隐藏动态面板(若为false,则在"去掉勾选"时隐藏动态面板) + * @return 联动面板 + */ + public static JPanel createCheckboxAndDynamicPane(UICheckBox checkBox, final JPanel dynamicPane, final boolean hideOnSelected) { + checkBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + int visibleState = hideOnSelected ? ItemEvent.DESELECTED : ItemEvent.SELECTED; + dynamicPane.setVisible(e.getStateChange() == visibleState); + } + }); + JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panel.add(checkBox, BorderLayout.NORTH); + JPanel dynamicPaneWrapper = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + dynamicPaneWrapper.add(dynamicPane); + panel.add(dynamicPaneWrapper, BorderLayout.CENTER); + return panel; + } } \ No newline at end of file diff --git a/designer-form/src/com/fr/design/designer/creator/XCreator.java b/designer-form/src/com/fr/design/designer/creator/XCreator.java index 31aceeb91..ee416c7b8 100644 --- a/designer-form/src/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/com/fr/design/designer/creator/XCreator.java @@ -3,7 +3,8 @@ */ package com.fr.design.designer.creator; -import com.fr.base.BaseUtils; +import com.fr.base.GraphHelper; +import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.UpdateAction; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; @@ -14,6 +15,7 @@ import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.AuthorityPropertyPane; import com.fr.design.mainframe.BaseJForm; +import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.NoSupportAuthorityEdit; @@ -21,6 +23,7 @@ import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; +import com.fr.stable.Constants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -32,6 +35,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.Graphics; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.beans.IntrospectionException; @@ -55,14 +59,15 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo protected Widget data; protected JComponent editor; + protected CoverReportPane coverPanel; // XCreator加入到某些XLayoutContainer中时,能调整宽度或者高度 private int[] directions; private Rectangle backupBound; private String shareId = StringUtils.EMPTY;//如果组件是共享的会有这个属性 private boolean isHelpBtnOnFocus = false;//焦点是否在帮助按钮上 - private static final int SHORTS_SEPARATOR_POS = 4; // 弹出菜单分割的位置 + private static final int SHORTS_SEPARATOR_POS = 4; // 弹出菜单分割的位置 - public XCreator(Widget ob, Dimension initSize) { + public XCreator(Widget ob, Dimension initSize) { this.data = ob; this.initEditor(); @@ -71,13 +76,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo this.setLayout(FRGUIPaneFactory.createBorderLayout()); add(editor, BorderLayout.CENTER); } - - if (initSize.width == 0) { - initSize.width = this.initEditorSize().width; - } - if (initSize.height == 0) { - initSize.height = this.initEditorSize().height; - } + setInitSize(initSize); this.setPreferredSize(initSize); this.setSize(initSize); this.setMaximumSize(initSize); @@ -101,6 +100,18 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } } + /** + * 初始化组件大小 + */ + public void setInitSize(Dimension initSize) { + if (initSize.width == 0) { + initSize.width = this.initEditorSize().width; + } + if (initSize.height == 0) { + initSize.height = this.initEditorSize().height; + } + } + /** * 备份当前大小 */ @@ -241,8 +252,8 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } protected String getIconName() { - return StringUtils.EMPTY; - } + return StringUtils.EMPTY; + } public String getIconPath() { return "/com/fr/web/images/form/resources/" + getIconName(); @@ -282,8 +293,9 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo *@param formEditor 设计界面组件 *@return 工具界面 */ + @Override public JComponent createToolPane(BaseJForm jform, FormDesigner formEditor) { - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { if (isDedicateContainer()) { // 图表块和报表块由于控件树处不显示,但对应的属性表要显示,此处处理下 XCreator child = ((XLayoutContainer) this).getXCreator(0); @@ -317,21 +329,21 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo return false; } - /** - * 该组件是否可以拖入参数面板 - * @return 是则返回true - */ - public boolean canEnterIntoParaPane(){ - return true; - } + /** + * 该组件是否可以拖入参数面板 + * @return 是则返回true + */ + public boolean canEnterIntoParaPane(){ + return true; + } - /** - * 该组件是否可以拖入表单主体 - * @return 是则返回true - */ - public boolean canEnterIntoAdaptPane(){ - return true; - } + /** + * 该组件是否可以拖入表单主体 + * @return 是则返回true + */ + public boolean canEnterIntoAdaptPane(){ + return true; + } /** * 该组件是否可以拖入绝对布局 @@ -341,27 +353,27 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo return true; } - /** - * 该组件是否可以拖拽(表单中参数面板和自适应布局不可以拖拽) - * @return 是则返回true - */ - public boolean isSupportDrag(){ - return true; - } + /** + * 该组件是否可以拖拽(表单中参数面板和自适应布局不可以拖拽) + * @return 是则返回true + */ + public boolean isSupportDrag(){ + return true; + } - public List getAllXCreatorNameList(XCreator xCreator, List namelist){ - namelist.add(xCreator.toData().getWidgetName()); - return namelist; - } + public List getAllXCreatorNameList(XCreator xCreator, List namelist){ + namelist.add(xCreator.toData().getWidgetName()); + return namelist; + } - /** - * 是否有查询按钮 - * @param xCreator 控件或容器 - * @return 有无查询按钮 - */ - public boolean SearchQueryCreators(XCreator xCreator) { - return false; - } + /** + * 是否有查询按钮 + * @param xCreator 控件或容器 + * @return 有无查询按钮 + */ + public boolean SearchQueryCreators(XCreator xCreator) { + return false; + } /** * @return the backupBound @@ -381,14 +393,25 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo * 控件树不显示此组件 * @param path 控件树list */ - public void notShowInComponentTree(ArrayList path) { + @Override + public void notShowInComponentTree(List path) { return; } + /** + * 获取其在控件树上可见父层 + * @return 组件 + */ + @Override + public Component getParentShow(){ + return this.getParent(); + } + /** * 重置组件的名称 * @param name 名称 */ + @Override public void resetCreatorName(String name) { toData().setWidgetName(name); } @@ -405,6 +428,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo * 返回编辑的子组件,scale为其内部组件 * @return 组件 */ + @Override public XCreator getEditingChildCreator() { return this; } @@ -413,6 +437,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo * 返回对应属性表的组件,scale和title返回其子组件 * @return 组件 */ + @Override public XCreator getPropertyDescriptorCreator() { return this; } @@ -421,6 +446,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo * 更新子组件的Bound; 没有不处理 * @param minHeight 最小高度 */ + @Override public void updateChildBound(int minHeight) { return; } @@ -429,6 +455,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo * 是否作为控件树的叶子节点 * @return 是则返回true */ + @Override public boolean isComponentTreeLeaf() { return true; } @@ -437,23 +464,24 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo * 是否为sclae和title专属容器 * @return 是则返回true */ + @Override public boolean isDedicateContainer() { return false; } /** - * 是否接收这种类型 - * @param acceptTypes 接收的类型 - * @return 接收指定的类型则返回true,否则返回false - */ - public boolean acceptType(Class... acceptTypes) { - for (Class type : acceptTypes) { - if (StableUtils.objectInstanceOf(this, type)) { - return true; - } - } - return false; - } + * 是否接收这种类型 + * @param acceptTypes 接收的类型 + * @return 接收指定的类型则返回true,否则返回false + */ + public boolean acceptType(Class... acceptTypes) { + for (Class type : acceptTypes) { + if (StableUtils.objectInstanceOf(this, type)) { + return true; + } + } + return false; + } /** * 是否组件要缩放(自适应里部分组件需要, 如数字、文本、下拉框、下拉复选框、密码、下拉树、下拉复选树、日期) @@ -580,7 +608,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo /** * 组件是否是共享组件 * @return 是否是共享组件 - */ + */ public boolean isShared() { return StringUtils.isNotEmpty(shareId); } @@ -596,7 +624,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo /** * 焦点是否在帮助按钮上 * @return 焦点是否在帮助按钮上 - */ + */ public boolean isHelpBtnOnFocus() { return isHelpBtnOnFocus; } @@ -608,18 +636,41 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo /** * 设置描述信息 * @param msg 帮助信息 - */ - public void setXDescrption(String msg){} + */ + public void setXDescrption(String msg){ + if (coverPanel != null) { + coverPanel.setHelpMsg(msg); + } + } + + public JComponent getCoverPane(){ + return coverPanel; + } + + /** + * 销毁帮助提示框 + */ + public void destroyHelpDialog(){ + if (coverPanel != null) { + coverPanel.destroyHelpDialog(); + } + } + + /** + * 是否展现覆盖的pane + * @param display 是否 + */ + public void displayCoverPane(boolean display){ + } /** * 根据widget设置Xcreator描述信息 * @param widget - */ + */ public void setXDescrption(Widget widget){ if (widget != null) { setXDescrption(widget.getDescription()); } - } /** @@ -667,39 +718,55 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo * */ public void firePropertyChange(){ - // do nothing + // do nothing + } + + /** + * 有的控件是有编辑状态的,给一个退出编辑的接口 + * + */ + public void stopEditing() { + // do nothing } - /** - * 有的控件是有编辑状态的,给一个退出编辑的接口 - * - */ - public void stopEditing() { - // do nothing - } + /** + * 编辑状态的时候需要重新绘制下边框 + * + */ + public void paintBorder(Graphics g, Rectangle bounds){ + GraphHelper.draw(g, bounds, Constants.LINE_MEDIUM); + } /** * 创建右击弹出菜单 * */ public UIPopupMenu createPopupMenu(FormDesigner formDesigner) { - UpdateAction[] actions = formDesigner.getActions(); + UpdateAction[] actions = formDesigner.getActions(); UIPopupMenu popup = new UIPopupMenu(); - for (int i = 0; i < actions.length; i++) { - if (i == SHORTS_SEPARATOR_POS) { - popup.addSeparator(); - } - popup.add(actions[i].createMenuItem()); - } + for (int i = 0; i < actions.length; i++) { + if (i == SHORTS_SEPARATOR_POS) { + popup.addSeparator(); + } + popup.add(actions[i].createMenuItem()); + } return popup; } - /** - * 是否支持上移一层、下移一层等操作 - * - */ - public boolean isMovable() { - return true; - } + /** + * 是否支持上移一层、下移一层等操作 + * + */ + public boolean isMovable() { + return true; + } + + /** + * 是否支持共享-现只支持报表块、图表、tab块、绝对布局 + * @return + */ + public boolean isSupportShared() { + return false; + } } \ No newline at end of file diff --git a/designer-form/src/com/fr/design/designer/creator/XCreatorTools.java b/designer-form/src/com/fr/design/designer/creator/XCreatorTools.java index 8a23daa78..d0aa039f2 100644 --- a/designer-form/src/com/fr/design/designer/creator/XCreatorTools.java +++ b/designer-form/src/com/fr/design/designer/creator/XCreatorTools.java @@ -1,15 +1,16 @@ /** - * + * */ package com.fr.design.designer.creator; import java.awt.Component; import java.util.ArrayList; +import java.util.List; /** * @author jim * @date 2014-11-7 - * + * */ public interface XCreatorTools { @@ -17,42 +18,48 @@ public interface XCreatorTools { * 控件树不显示此组件 * @param path 控件树list */ - void notShowInComponentTree(ArrayList path); - + void notShowInComponentTree(List path); + /** * 重置组件的名称 * @param name 名称 */ void resetCreatorName(String name); - + /** * 返回编辑的子组件,scale为其内部组件 * @return 组件 */ XCreator getEditingChildCreator(); - + /** * 返回对应属性表的组件,scale和title返回其子组件 * @return 组件 */ XCreator getPropertyDescriptorCreator(); - + /** * 更新子组件的Bound; 没有不处理 * @param minHeight 最小高度 */ void updateChildBound(int minHeight); - + /** * 是否作为控件树的叶子节点 * @return 是则返回true */ boolean isComponentTreeLeaf(); - + /** * 是否为sclae和title专属容器 * @return 是则返回true */ boolean isDedicateContainer(); - + + /** + * 获取其在控件树上可见父层 + * @return 组件 + */ + Component getParentShow(); + } \ No newline at end of file diff --git a/designer-form/src/com/fr/design/designer/creator/XLayoutContainer.java b/designer-form/src/com/fr/design/designer/creator/XLayoutContainer.java index 3b4067aac..4f0476388 100644 --- a/designer-form/src/com/fr/design/designer/creator/XLayoutContainer.java +++ b/designer-form/src/com/fr/design/designer/creator/XLayoutContainer.java @@ -241,6 +241,10 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme } } + public int getShowXCreatorCount() { + return getXCreatorCount(); + } + public int getXCreatorCount() { return getComponentCount(); } diff --git a/designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java index 69277fc6f..b1ac29089 100644 --- a/designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -3,6 +3,9 @@ */ package com.fr.design.designer.creator; +import com.fr.base.GraphHelper; +import com.fr.base.iofileattr.SharableAttrMark; +import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.LayoutAdapter; @@ -11,10 +14,14 @@ import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.form.layout.FRAbsoluteLayout; +import com.fr.design.form.util.XCreatorConstants; import com.fr.design.icon.IconPathConstants; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormArea; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.WidgetHelpDialog; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.form.ui.Connector; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; @@ -23,6 +30,8 @@ import com.fr.form.ui.container.WLayout; import com.fr.general.FRScreen; import com.fr.general.IOUtils; import com.fr.general.Inter; +import com.fr.share.ShareConstants; +import com.fr.stable.Constants; import java.awt.*; import java.awt.event.ContainerEvent; @@ -31,6 +40,7 @@ import java.awt.image.BufferedImage; import java.beans.IntrospectionException; import java.util.ArrayList; import java.util.HashMap; +import javax.swing.Icon; /** * @author richer @@ -38,14 +48,20 @@ import java.util.HashMap; */ public class XWAbsoluteLayout extends XLayoutContainer { - private static final int EDIT_BTN_WIDTH = 60; - private static final int EDIT_BTN_HEIGHT = 24; + private static final int EDIT_BTN_WIDTH = 75; + private static final int EDIT_BTN_HEIGHT = 20; private int minWidth = WLayout.MIN_WIDTH; private int minHeight = WLayout.MIN_HEIGHT; + private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30); + private static final Color INNER_BORDER_COLOR = new Color(65, 155, 249); + private static final int BORDER_WIDTH = 1; + private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); //由于屏幕分辨率不同,界面上的容器大小可能不是默认的100%,此时拖入组件时,保存的大小按照100%时的计算 protected double containerPercent = 1.0; + private boolean isHovering = false; + private HashMap xConnectorMap; public XWAbsoluteLayout() { @@ -437,15 +453,18 @@ public class XWAbsoluteLayout extends XLayoutContainer { Graphics2D g2d = (Graphics2D) g; Composite oldComposite = g2d.getComposite(); //画白色的编辑层 - g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F)); - g2d.setColor(Color.WHITE); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 50 / 100.0F)); + g2d.setColor(XCreatorConstants.COVER_COLOR); g2d.fillRect(x, y, w, h); //画编辑按钮所在框 + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, formDesigner.getCursor().getType() != Cursor.DEFAULT_CURSOR ? 0.9f : 0.7f); + g2d.setColor(XCreatorConstants.EDIT_COLOR); + g2d.setComposite(alphaComposite); + g2d.fillRoundRect((x + w / 2 - EDIT_BTN_WIDTH / 2), (y + h / 2 - EDIT_BTN_HEIGHT / 2), EDIT_BTN_WIDTH, EDIT_BTN_HEIGHT, 4, 4); g2d.setComposite(oldComposite); - g2d.setColor(new Color(176, 196, 222)); - g2d.fillRect((x + w / 2 - EDIT_BTN_WIDTH / 2), (y + h / 2 - EDIT_BTN_HEIGHT / 2), EDIT_BTN_WIDTH, EDIT_BTN_HEIGHT); //画编辑按钮图标 - BufferedImage image = IOUtils.readImage(IconPathConstants.TD_EDIT_ICON_PATH); + BufferedImage image = IOUtils.readImage(IconPathConstants.EDIT_ICON_PATH); g2d.drawImage( image, (x + w / 2 - 23), @@ -455,12 +474,37 @@ public class XWAbsoluteLayout extends XLayoutContainer { null, this ); - g2d.setColor(Color.BLACK); + g2d.setColor(Color.WHITE); //画编辑文字 + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.drawString(Inter.getLocText("FR-Designer_Edit"), x + w / 2 - 2, y + h / 2 + 5); + g.setColor(XCreatorConstants.FORM_BORDER_COLOR); + GraphHelper.draw(g, new Rectangle(BORDER_WIDTH, BORDER_WIDTH, getWidth() - BORDER_WIDTH * 2, getHeight() - BORDER_WIDTH * 2), Constants.LINE_MEDIUM); + paintExtro(g); + } + } + + public void paintExtro(Graphics g) { + if (this.toData().getWidgetAttrMark(SharableAttrMark.XML_TAG) != null) { + int width = getWidth() - ShareConstants.SHARE_EL_CONTROL_BUTTON_HW; + g.setColor(UIConstants.NORMAL_BACKGROUND); + g.fillArc(width, 0, ShareConstants.SHARE_EL_CONTROL_BUTTON_HW, ShareConstants.SHARE_EL_CONTROL_BUTTON_HW, + 0, 360); + controlMode.paintIcon(this, g, width, 0); } } + @Override + public void paintBorder(Graphics g, Rectangle bounds){ + if(editable){ + g.setColor(OUTER_BORDER_COLOR); + GraphHelper.draw(g, new Rectangle(bounds.x - 3, bounds.y - 3, bounds.width + 5, bounds.height + 5), Constants.LINE_LARGE); + g.setColor(INNER_BORDER_COLOR); + GraphHelper.draw(g, new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height), Constants.LINE_MEDIUM); + }else if(!isMouseEnter){ + super.paintBorder(g, bounds); + } + } /** * 响应点击事件 * @@ -468,6 +512,11 @@ public class XWAbsoluteLayout extends XLayoutContainer { * @param e 鼠标点击事件 */ public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) { + //帮助弹窗 + if (this.isHelpBtnOnFocus()) { + new WidgetHelpDialog(DesignerContext.getDesignerFrame(), this.toData().getDescription()).showWindow(e); + return; + } FormDesigner designer = editingMouseListener.getDesigner(); SelectionModel selectionModel = editingMouseListener.getSelectionModel(); boolean isEditing = isEditable() || @@ -523,4 +572,12 @@ public class XWAbsoluteLayout extends XLayoutContainer { public boolean supportInnerOrderChangeActions() { return true; } + + /** + * 是否支持共享-现只支持报表块、图表、tab块、绝对布局 + * @return + */ + public boolean isSupportShared() { + return true; + } } \ No newline at end of file diff --git a/designer-form/src/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/com/fr/design/designer/creator/XWFitLayout.java index 614259bf3..722e86676 100644 --- a/designer-form/src/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer-form/src/com/fr/design/designer/creator/XWFitLayout.java @@ -28,14 +28,17 @@ import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; +import javax.swing.JOptionPane; + + /** * @author jim * @date 2014-6-23 */ public class XWFitLayout extends XLayoutContainer { - + private static final long serialVersionUID = 8112908607102660176L; - + //由于屏幕分辨率不同,界面上的容器大小可能不是默认的100%,此时拖入组件时,保存的大小按照100%时的计算 protected double containerPercent = 1.0; // 布局缩小的时候,考虑最小宽高,若挨着右侧或底侧边框的控件缩小后达到最小宽或高,此时容器大小微调下 @@ -50,7 +53,7 @@ public class XWFitLayout extends XLayoutContainer { public XWFitLayout(){ this(new WFitLayout(), new Dimension()); } - + public XWFitLayout(WFitLayout widget, Dimension initSize) { super(widget, initSize); @@ -58,17 +61,17 @@ public class XWFitLayout extends XLayoutContainer { widget.setResolutionScaling(containerPercent); } - + //根据屏幕大小来确定显示的百分比, 1440*900默认100%, 1366*768缩放90% private void initPercent(){ - Toolkit toolkit = Toolkit.getDefaultToolkit(); - Dimension scrnsize = toolkit.getScreenSize(); - double screenValue = FRScreen.getByDimension(scrnsize).getValue(); - if(screenValue != FormArea.DEFAULT_SLIDER){ - this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); - } - } - + Toolkit toolkit = Toolkit.getDefaultToolkit(); + Dimension scrnsize = toolkit.getScreenSize(); + double screenValue = FRScreen.getByDimension(scrnsize).getValue(); + if(screenValue != FormArea.DEFAULT_SLIDER){ + this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); + } + } + @Override public LayoutAdapter getLayoutAdapter() { return new FRFitLayoutAdapter(this); @@ -79,15 +82,15 @@ public class XWFitLayout extends XLayoutContainer { this.setLayout(new FRFitLayout()); } - @Override + @Override protected String getIconName() { return "layout_absolute.png"; } - - /** - * 返回最右侧控件的微调宽度 - * @return 微调宽度 - */ + + /** + * 返回最右侧控件的微调宽度 + * @return 微调宽度 + */ public int getNeedAddWidth() { return needAddWidth; } @@ -96,10 +99,10 @@ public class XWFitLayout extends XLayoutContainer { this.needAddWidth = needAddWidth; } - /** - * 返回最右侧控件的微调高度 - * @return 微调宽度 - */ + /** + * 返回最右侧控件的微调高度 + * @return 微调宽度 + */ public int getNeedAddHeight() { return needAddHeight; } @@ -107,7 +110,7 @@ public class XWFitLayout extends XLayoutContainer { public void setNeedAddHeight(int needAddHeight) { this.needAddHeight = needAddHeight; } - + /** * 更新组件的backupBound * 拖动滑块改变容器大小,改变的是界面显示大小,更新bound,再次拖入或拉伸边框用到 @@ -119,7 +122,7 @@ public class XWFitLayout extends XLayoutContainer { creator.setBackupBound(comp.getBounds()); } } - + /** * 直接拖动滑条改变整体像素大小时,不用考虑控件的最小高度宽度,内部组件全部一起缩小放大 * 只是界面显示大小改变,不改变对应的BoundsWidget大小 @@ -172,7 +175,7 @@ public class XWFitLayout extends XLayoutContainer { } LayoutUtils.layoutContainer(this); } - + /** * 调整控件的point和size,避免拖动滑块出现空隙 */ @@ -216,20 +219,20 @@ public class XWFitLayout extends XLayoutContainer { * 获取内部组件横坐标的值 * @return int[] 横坐标数组 */ - + public int[] getHors(){ return getHors(false); } - + /** * 获取内部组件纵坐标值 * @return int[] 纵坐标数组 - * + * */ public int[] getVeris(){ return getVeris(false); } - + /** * 获取内部组件横坐标的值 * @param isActualSize 实际大小 @@ -254,12 +257,12 @@ public class XWFitLayout extends XLayoutContainer { Collections.sort(posX); return ArrayUtils.toPrimitive(posX.toArray(new Integer[]{posX.size()})); } - + /** * 获取内部组件纵坐标值 * @param isActualSize 实际大小 * @return int[] 纵坐标数组 - * + * */ public int[] getVeris(boolean isActualSize) { double perc = isActualSize ? containerPercent : 1.0; @@ -280,7 +283,7 @@ public class XWFitLayout extends XLayoutContainer { Collections.sort(posY); return ArrayUtils.toPrimitive(posY.toArray(new Integer[]{posY.size()})); } - + /** * 是否能缩小 * @param percent 百分比 @@ -294,10 +297,10 @@ public class XWFitLayout extends XLayoutContainer { } return canReduceSize; } - + /** * 按照百分比缩放内部组件宽度 - * + * * @param percent 宽度变化的百分比 */ public void adjustCreatorsWidth(double percent) { @@ -311,7 +314,7 @@ public class XWFitLayout extends XLayoutContainer { if (gap >0 && hasCalGap) { moveCompInterval(getAcualInterval()); } - layoutWidthResize(percent); + layoutWidthResize(percent); if (percent < 0 && needAddWidth > 0) { this.setSize(this.getWidth()+needAddWidth, this.getHeight()); modifyEdgemostCreator(true); @@ -321,7 +324,7 @@ public class XWFitLayout extends XLayoutContainer { updateWidgetBackupBounds(); LayoutUtils.layoutContainer(this); } - + // 手动修改宽高时,全部用的实际大小计算,所以最小值不用百分比计算后的 protected void layoutWidthResize(double percent) { int[] hroValues= toData().getHorComps(); @@ -336,11 +339,11 @@ public class XWFitLayout extends XLayoutContainer { //自适应布局里,控件的最小宽度为36 if (nextX-x < MIN_WIDTH-dw) { dw = MIN_WIDTH +x - nextX; - } + } caculateWidth(x, dw); } } - + /** * x位置的组件宽度按dw进行调整 */ @@ -365,7 +368,7 @@ public class XWFitLayout extends XLayoutContainer { calculateCreatorWidth(creator, rec, dw, x); } } - + private void calculateCreatorWidth(XCreator creator, Rectangle rec, int dw, int x) { if (x == 0) { int width = notHasRightCreator(rec) ? this.getWidth() : rec.width+dw; @@ -388,7 +391,7 @@ public class XWFitLayout extends XLayoutContainer { creator.adjustCompWidth((double) creator.getBounds().width / rec.width); toData().setBounds(creator.toData(), creator.getBounds()); } - + /** * 是否在布局最右侧 */ @@ -398,7 +401,7 @@ public class XWFitLayout extends XLayoutContainer { } return false; } - + /** * 是否在布局最下侧 */ @@ -408,7 +411,7 @@ public class XWFitLayout extends XLayoutContainer { } return false; } - + /** * 布局最右侧或下侧有控件在缩小时达到最小宽高,则微调下 */ @@ -424,7 +427,7 @@ public class XWFitLayout extends XLayoutContainer { } } } - + /** * 布局容器高度手动修改时, * 同时调整容器内的组件们,缩小时需要考虑有的组件高度不满足缩小高度 @@ -451,7 +454,7 @@ public class XWFitLayout extends XLayoutContainer { updateWidgetBackupBounds(); LayoutUtils.layoutContainer(this); } - + protected void layoutHeightResize(double percent) { int[] vertiValues= toData().getVertiComps(); int num=vertiValues.length; @@ -464,12 +467,12 @@ public class XWFitLayout extends XLayoutContainer { dh = (int) ((nextY-y)*percent); if (nextY-y < MIN_HEIGHT-dh) { dh = MIN_HEIGHT + y - nextY; - } + } calculateHeight(y, dh); } } - + /** * y位置的组件按dh进行调整 */ @@ -490,11 +493,11 @@ public class XWFitLayout extends XLayoutContainer { creator.setSize(rec.width, rec.height+dh); toData().setBounds(creator.toData(), creator.getBounds()); continue; - } + } calculateCreatorHeight(creator, rec, dh, y); } } - + private void calculateCreatorHeight(XCreator creator, Rectangle rec, int dh, int y) { if (y==0) { int height = notHasBottomCreator(rec) ? this.getHeight() : rec.height+dh; @@ -512,7 +515,7 @@ public class XWFitLayout extends XLayoutContainer { creator.adjustCompHeight((double) creator.getBounds().height / rec.height); toData().setBounds(creator.toData(), creator.getBounds()); } - + private List getCompsAtX(int x) { List comps = new ArrayList(); int size = toData().getWidgetCount(); @@ -529,7 +532,7 @@ public class XWFitLayout extends XLayoutContainer { } return comps; } - + private List getCompsAtY(int y) { List comps = new ArrayList(); for (int i=0,size=this.getComponentCount(); i comps) { //容器高度拉伸时,计算内部组件的最小高度 if (comps.isEmpty()) { - return 0; - } - int minH =this.getWidth(); - for (int i=0, size=comps.size(); icomps.get(i).getHeight() ? comps.get(i).getHeight() : minH; - } - return minH; - } - + return 0; + } + int minH =this.getWidth(); + for (int i=0, size=comps.size(); icomps.get(i).getHeight() ? comps.get(i).getHeight() : minH; + } + return minH; + } + /** * 初始化组件大小 * @return 默认大小 @@ -622,7 +625,7 @@ public class XWFitLayout extends XLayoutContainer { public Dimension initEditorSize() { return new Dimension(0, 0); } - + /** * f返回默认组件name * @return 容器名 @@ -630,16 +633,16 @@ public class XWFitLayout extends XLayoutContainer { public String createDefaultName() { return "fit"; } - + /** * 返回容器对应的wlayout * @return 同上 */ @Override - public WFitLayout toData() { - return (WFitLayout) data; - } - + public WFitLayout toData() { + return (WFitLayout) data; + } + /** * 当前组件zorder位置替换新的控件 * @param widget 控件 @@ -657,118 +660,136 @@ public class XWFitLayout extends XLayoutContainer { } return null; } - + @Override public Dimension getMinimumSize() { return toData().getMinDesignSize(); } - + + /** + * 将WLayout转换为XLayoutContainer + */ + public void convert() { + isRefreshing = true; + WFitLayout layout = this.toData(); + this.removeAll(); + for (int i=0, num=layout.getWidgetCount(); i childrenList = creator.getTargetChildrenList(); - if(!childrenList.isEmpty()){ - for(int i=0; i childrenList = creator.getTargetChildrenList(); + if(!childrenList.isEmpty()){ + for(int i=0; i 0) { for (int i=1, len=hors.length; i directions = new ArrayList(); - // 只要组件边框没有和container贴着的,都可以拉伸 - if (x > margin.getLeft()) { - directions.add(Direction.LEFT); - } - if (x+w < containerWidth - margin.getRight()) { - directions.add(Direction.RIGHT); - } - if (y > margin.getTop()) { - directions.add(Direction.TOP); - } - if (y+h < containerHeight - margin.getBottom()) { - directions.add(Direction.BOTTOM); - } - if (directions.isEmpty()) { - creator.setDirections(null); - }else { - creator.setDirections(ArrayUtils.toPrimitive(directions.toArray(new Integer[directions.size()]))); - } - } - - } - - - /** - * 间隔大于0时,界面处加上间隔 - * 界面的间隔是针对显示,实际保存的大小不受间隔影响 - * ps:改变布局大小或者拖入、删除、拉伸都要重新考虑间隔 - * @param gap 间隔 - */ - public void addCompInterval(int gap) { - if (gap == 0) { - return; - } - int val = gap/2; - for (int i=0, len=this.getComponentCount(); i 0) { - bound.x += val; - bound.width -= val; - } - if (rec.width+rec.x < this.getWidth()) { - bound.width -= val; - } - if (rec.y > 0) { - bound.y += val; - bound.height -= val; - } - if (rec.height+rec.y < this.getHeight()) { - bound.height -= val; - } - comp.setBounds(bound); - } - this.hasCalGap = true; - } - - /** - * 去除原有的间隔 - * @param gap 间隔 - */ - public void moveCompInterval(int gap) { - if (gap == 0) { - return; - } - int val = gap/2; - for (int i=0, len=this.getComponentCount(); i 0) { - bound.x -= val; - bound.width += val; - } - if (rec.width+rec.x < this.getWidth()) { - bound.width += val; - } - if (rec.y > 0) { - bound.y -= val; - bound.height += val; - } - if (rec.height+rec.y < this.getHeight()) { - bound.height += val; - } - comp.setBounds(bound); - } - this.hasCalGap = false; - } - - /** - * 是否可以加入当前间隔 - * @param interval 间隔 - * @return 默认返回true - */ - public boolean canAddInterval(int interval) { - int val = interval/2; - for (int i=0, len=this.getComponentCount(); i 0) { + } + + /** + * 在添加的时候需要把可拉伸的方向确定,所以重写了add方法 + * @param comp 组件 + * @param constraints 属性 + */ + public void add(Component comp, Object constraints) { + if (comp == null) { + return; + } + super.add(comp, constraints); + XCreator creator = (XCreator) comp; + dealDirections(creator, false); + } + + private void add(Component comp, Object constraints, boolean isInit) { + super.add(comp, constraints); + XCreator creator = (XCreator) comp; + dealDirections(creator, isInit); + } + + /** + * 处理自适应布局的directions + * @param xcreator 组件 + */ + public void dealDirections(XCreator xcreator, boolean isInit) { + if (xcreator == null) { + return; + } + // 重新打开模版时,容器还没初始化,大小都还为0 + int containerWidth = isInit ? toData().getContainerWidth() : this.getWidth(); + int containerHeight = isInit ? toData().getContainerHeight() : this.getHeight(); + PaddingMargin margin = isInit ? new PaddingMargin(0,0,0,0) : toData().getMargin(); + // 再次打开时和初始设计时的区别是没计算过内边距和没按屏幕分辨率调整大小 + for (int i=0; i directions = new ArrayList(); + // 只要组件边框没有和container贴着的,都可以拉伸 + if (x > margin.getLeft()) { + directions.add(Direction.LEFT); + } + if (x+w < containerWidth - margin.getRight()) { + directions.add(Direction.RIGHT); + } + if (y > margin.getTop()) { + directions.add(Direction.TOP); + } + if (y+h < containerHeight - margin.getBottom()) { + directions.add(Direction.BOTTOM); + } + if (directions.isEmpty()) { + creator.setDirections(null); + }else { + creator.setDirections(ArrayUtils.toPrimitive(directions.toArray(new Integer[directions.size()]))); + } + } + + } + + + /** + * 间隔大于0时,界面处加上间隔 + * 界面的间隔是针对显示,实际保存的大小不受间隔影响 + * ps:改变布局大小或者拖入、删除、拉伸都要重新考虑间隔 + * @param gap 间隔 + */ + public void addCompInterval(int gap) { + if (gap == 0) { + return; + } + int val = gap/2; + for (int i=0, len=this.getComponentCount(); i 0) { + bound.x += val; + bound.width -= val; + } + if (rec.width+rec.x < this.getWidth()) { + bound.width -= val; + } + if (rec.y > 0) { + bound.y += val; + bound.height -= val; + } + if (rec.height+rec.y < this.getHeight()) { + bound.height -= val; + } + comp.setBounds(bound); + } + this.hasCalGap = true; + } + + /** + * 去除原有的间隔 + * @param gap 间隔 + */ + public void moveCompInterval(int gap) { + if (gap == 0) { + return; + } + int val = gap/2; + for (int i=0, len=this.getComponentCount(); i 0) { + bound.x -= val; + bound.width += val; + } + if (rec.width+rec.x < this.getWidth()) { + bound.width += val; + } + if (rec.y > 0) { + bound.y -= val; + bound.height += val; + } + if (rec.height+rec.y < this.getHeight()) { + bound.height += val; + } + comp.setBounds(bound); + } + this.hasCalGap = false; + } + + /** + * 是否可以加入当前间隔 + * @param interval 间隔 + * @return 默认返回true + */ + public boolean canAddInterval(int interval) { + int val = interval/2; + for (int i=0, len=this.getComponentCount(); i 0) { bound.width -= val; } if (rec.width+rec.x < d.width) { @@ -984,106 +1007,106 @@ public class XWFitLayout extends XLayoutContainer { bound.height -= val; } return new Rectangle(bound); - } - - /** - * 缩小宽度或者高度时 存在间隔的话是否支持缩小 - */ - private boolean canReduceSize(double percent) { - int val = toData().getCompInterval()/2; - for (int i=0, len=this.getComponentCount(); i nameObjectList = new ArrayList<>(); + ArrayList nameObjectList = new ArrayList<>(); for (int i = 0, size = widget.getListenerSize(); i < size; i++) { Listener listener = widget.getListener(i); if (!listener.isDefault()) { - nameObjectList.add(i, new NameObject(switchLang(listener.getEventName()) + (i + 1), listener)); - } + nameObjectList.add(i, new NameObject(switchLang(listener.getEventName()) + (i + 1), listener)); + } } - populate(nameObjectList.toArray(new NameObject[widget.getListenerSize()])); + populate(nameObjectList.toArray(new NameObject[widget.getListenerSize()])); checkButtonEnabled(); this.repaint(); - } + } /** * 更新控件事件 * @param creator 控件 */ public void updateWidgetListener(XCreator creator) { - (creator.toData()).clearListeners(); - Nameable[] res = this.update(); - for (int i = 0; i < res.length; i++) { - NameObject nameObject = (NameObject)res[i]; - (creator.toData()).addListener((Listener) nameObject.getObject()); - } - - designer.fireTargetModified(); + (creator.toData()).clearListeners(); + Nameable[] res = this.update(); + for (int i = 0; i < res.length; i++) { + NameObject nameObject = (NameObject)res[i]; + (creator.toData()).addListener((Listener) nameObject.getObject()); + } + + designer.fireTargetModified(); checkButtonEnabled(); } @@ -135,9 +135,9 @@ public class EventPropertyTable extends UIListControlPane { @Override public void saveSettings() { - if (isPopulating) { - return; - } - updateWidgetListener(creator); - } + if (isPopulating) { + return; + } + updateWidgetListener(creator); + } } \ No newline at end of file diff --git a/designer-form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer-form/src/com/fr/design/form/parameter/FormParaDesigner.java index 0b39f987d..5c48f2c70 100644 --- a/designer-form/src/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer-form/src/com/fr/design/form/parameter/FormParaDesigner.java @@ -13,7 +13,6 @@ import java.awt.Rectangle; import java.util.ArrayList; import java.util.List; -import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; @@ -21,6 +20,7 @@ import javax.swing.JPanel; import com.fr.base.BaseUtils; import com.fr.base.Parameter; import com.fr.base.parameter.ParameterUI; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.designer.beans.actions.CopyAction; @@ -107,11 +107,10 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA); EastRegionContainerPane.getInstance().replaceWidgetLibPane( FormWidgetDetailPane.getInstance(this)); - if (!BaseUtils.isAuthorityEditing()) { - ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(this); + if (!DesignerMode.isAuthorityEditing()) { + ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(this); // 传入this的同时会更新参数面板高度 parameterPropertyPane.refreshState(); EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane); - EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height); EastRegionContainerPane.getInstance().replaceWidgetSettingsPane( WidgetPropertyPane.getInstance(this)); } else { diff --git a/designer-form/src/com/fr/design/form/util/XCreatorConstants.java b/designer-form/src/com/fr/design/form/util/XCreatorConstants.java index 91cd2007e..c504ed7ff 100644 --- a/designer-form/src/com/fr/design/form/util/XCreatorConstants.java +++ b/designer-form/src/com/fr/design/form/util/XCreatorConstants.java @@ -31,7 +31,7 @@ public class XCreatorConstants { public static final Color RESIZE_BOX_BORDER_COLOR = new Color(143, 171, 196); // 当前选取的组件的边框线着色 public static final Color SELECTION_COLOR = new Color(179, 209, 236); - public static final Color FORM_BORDER_COLOR = new Color(200, 201, 205); + public static final Color FORM_BORDER_COLOR = new Color(141, 194, 249); // 设计器区域外边框的颜色和粗细 public static final Border AREA_BORDER = BorderFactory.createLineBorder(new Color(224, 224, 255), 0); // 布局拖拽时的颜色 @@ -43,10 +43,14 @@ public class XCreatorConstants { public static final Color FIT_LAYOUT_POINT_COLOR = new Color(106, 168, 222); // 格子布局的分割线 public static final Color LAYOUT_SEP_COLOR = new Color(210, 210, 210); - + // 组件覆盖层颜色 + public static final Color COVER_COLOR = new Color(216, 242, 253); + //组件编辑按钮颜色 + public static final Color EDIT_COLOR = new Color(51, 51, 52); + // 伸缩表单操作条的颜色 public static final Color OP_COLOR = new Color(157,228,245); - + // 不同粗细的线 public static final BasicStroke STROKE = new BasicStroke(2); } \ No newline at end of file diff --git a/designer-form/src/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/com/fr/design/mainframe/FormCreatorDropTarget.java index 24cc147d9..29a06060c 100644 --- a/designer-form/src/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -8,31 +8,20 @@ import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.Painter; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.models.AddingModel; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWAbsoluteLayout; -import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.designer.creator.*; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; import com.fr.design.utils.ComponentUtils; import com.fr.form.share.SharableEditorProvider; import com.fr.form.share.ShareLoader; -import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.SharableWidgetBindInfo; import com.fr.form.ui.Widget; import com.fr.general.Inter; import com.fr.stable.Constants; -import javax.swing.BorderFactory; -import javax.swing.JWindow; -import java.awt.Color; -import java.awt.Component; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Toolkit; +import javax.swing.*; +import java.awt.*; import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; @@ -100,8 +89,9 @@ public class FormCreatorDropTarget extends DropTarget { Map tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource()); //合并数据集之后,可能会有数据集名称变化,做一下联动 //共享的组件拿的时候都是克隆的,这边改拖拽中克隆的对象而非新克隆对象,上面这个新克隆的对象只是为了拿数据集 - ElementCaseEditor elementCaseEditor = (ElementCaseEditor) widget; - elementCaseEditor.batchRenameTdName(tdNameMap); + for (Map.Entry entry : tdNameMap.entrySet()) { + designer.getTarget().renameTableData(widget, entry.getKey(), entry.getValue()); + } } } designer.getSelectionModel().setSelectedCreators( diff --git a/designer-form/src/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/com/fr/design/mainframe/FormDesigner.java index 5e1184c73..d986a3a88 100644 --- a/designer-form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/com/fr/design/mainframe/FormDesigner.java @@ -1,21 +1,14 @@ package com.fr.design.mainframe; -import com.fr.base.BaseUtils; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.actions.UpdateAction; import com.fr.design.designer.TargetComponent; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.Painter; -import com.fr.design.designer.beans.actions.CopyAction; -import com.fr.design.designer.beans.actions.CutAction; -import com.fr.design.designer.beans.actions.FormDeleteAction; -import com.fr.design.designer.beans.actions.MoveDownAction; -import com.fr.design.designer.beans.actions.MoveToBottomAction; -import com.fr.design.designer.beans.actions.MoveToTopAction; -import com.fr.design.designer.beans.actions.MoveUpAction; -import com.fr.design.designer.beans.actions.PasteAction; +import com.fr.design.designer.beans.actions.*; import com.fr.design.designer.beans.adapters.layout.FRParameterLayoutAdapter; import com.fr.design.designer.beans.events.CreatorEventListenerTable; import com.fr.design.designer.beans.events.DesignerEditListener; @@ -26,14 +19,7 @@ import com.fr.design.designer.beans.location.RootResizeDirection; import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.StateModel; -import com.fr.design.designer.creator.XChartEditor; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWAbsoluteBodyLayout; -import com.fr.design.designer.creator.XWAbsoluteLayout; -import com.fr.design.designer.creator.XWBorderLayout; -import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.designer.creator.*; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.file.HistoryTemplateListPane; @@ -58,29 +44,17 @@ import com.fr.form.ui.WidgetValue; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; import com.fr.general.Inter; -import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.bridge.StableFactory; -import javax.swing.Action; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.TransferHandler; +import javax.swing.*; import javax.swing.border.Border; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.TreePath; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Insets; -import java.awt.Point; -import java.awt.Rectangle; +import java.awt.*; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.lang.reflect.InvocationHandler; @@ -228,8 +202,7 @@ public class FormDesigner extends TargetComponent
implements TreeSelection } ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( getParameterArray() == null ? new Parameter[0] : getParameterArray()); - ParameterPropertyPane.getInstance().repaintContainer(); - EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height); + ParameterPropertyPane.getInstance(this).repaintContainer(); // 传入this的同时会更新参数面板高度 } private void removeSame(Parameter[] parameters, List namelist) { @@ -501,7 +474,6 @@ public class FormDesigner extends TargetComponent implements TreeSelection paraHeight = 0; paraComponent = null; formLayoutContainer.setSize(rootComponent.getWidth(), rootComponent.getHeight()); - EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(this.getEastDownPane()); //atat //EastRegionContainerPane.getInstance().addTitlePane(ParameterPropertyPane.getInstance(FormDesigner.this)); //删除后重绘下 @@ -1061,7 +1033,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection selected.add((XCreator) path.getLastPathComponent()); } - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { selectionModel.setSelectedCreators(selected); if (formArea != null) { @@ -1344,7 +1316,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection try { Thread.sleep(1500); } catch (InterruptedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + FRLogger.getLogger().error(e.getMessage(), e); } pane.setLayout(new BorderLayout()); @@ -1459,7 +1431,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection @Override public void fireCreatorModified(DesignerEvent evt) { - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { return; } if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED @@ -1471,7 +1443,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection if (paths == null) { return; } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { showAuthorityEditPane(); } diff --git a/designer-form/src/com/fr/design/mainframe/WidgetHelpDialog.java b/designer-form/src/com/fr/design/mainframe/WidgetHelpDialog.java new file mode 100644 index 000000000..d45c7c321 --- /dev/null +++ b/designer-form/src/com/fr/design/mainframe/WidgetHelpDialog.java @@ -0,0 +1,93 @@ +package com.fr.design.mainframe; + +import com.fr.design.dialog.UIDialog; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.itextarea.UITextArea; +import com.fr.general.Inter; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Point; +import java.awt.event.MouseEvent; + +/** + * @author zack + * @date 2016-10-14 + * @since 8.0 + */ +public class WidgetHelpDialog extends UIDialog { + + private static final int OUTER_WIDTH = 190; + private static final int OUTER_HEIGHT = 280; + private static final int DIALOG_X = 227; + private static final int DIALOG_Y = 165; + + + private String helpMsg; + private UIScrollPane helpArea; + + + public WidgetHelpDialog(Frame parent, String helpMsg) { + super(parent); + this.helpMsg = helpMsg; + initHelpArea(); + JPanel panel = (JPanel) getContentPane(); + initComponents(panel); + setSize(new Dimension(OUTER_WIDTH, OUTER_HEIGHT)); + } + + private void initHelpArea() { + UITextArea textArea = new UITextArea(helpMsg); + textArea.setEditable(false); + textArea.setBorder(null); + helpArea = new UIScrollPane(textArea); + helpArea.setBounds(0, 0, OUTER_WIDTH, OUTER_HEIGHT); + helpArea.setBorder(null); + } + + private void initComponents(JPanel contentPane) { + contentPane.setLayout(new BorderLayout()); + add(helpArea, BorderLayout.CENTER); + this.applyClosingAction(); + this.setTitle(Inter.getLocText("FR-Designer_Help")); + } + + /** + * 打开帮助框 + */ + public void showWindow() { + this.setResizable(false); + setVisible(true); + } + + /** + * 打开帮助框-e + */ + public void showWindow(MouseEvent e) { + int rX = WestRegionContainerPane.getInstance().getWidth() + e.getX() - DIALOG_X;//弹出框宽度190加上图标的宽度27加上10的偏移 + int rY = DIALOG_Y + e.getY();//165是设计器最上面几个面板的高度 + this.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY); + this.setResizable(false); + setVisible(true); + } + + /** + * 略 + */ + @Override + public void checkValid() throws Exception { + + } + + public void setLocationRelativeTo(JFrame c, int x, int y) { + int dx = 0, dy = 0; + Point compLocation = c.getLocationOnScreen();//获取设计器Jframe坐标作为相对位置原点 + setLocation(dx + x, dy + y); + dx = compLocation.x; + dy = compLocation.y + c.getRootPane().getY();//加上底层容器的y坐标(其实就是设计器最上方图标栏的高度) + setLocation(dx + x, dy + y); + } +} \ No newline at end of file diff --git a/designer-form/src/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/com/fr/design/mainframe/WidgetPropertyPane.java index 75a1bed35..c0baf9151 100644 --- a/designer-form/src/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/com/fr/design/mainframe/WidgetPropertyPane.java @@ -7,21 +7,18 @@ import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.*; import com.fr.design.designer.properties.EventPropertyTable; -import com.fr.design.dialog.BasicPane; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itable.AbstractPropertyTable; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.widget.ui.FormWidgetCardPane; import com.fr.design.widget.ui.designer.mobile.MobileWidgetDefinePane; -import com.fr.form.ui.Widget; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import javax.swing.*; -import javax.swing.border.LineBorder; -import javax.swing.table.JTableHeader; import java.awt.*; import java.util.ArrayList; import java.util.List; @@ -33,22 +30,15 @@ import java.util.Set; */ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane { - private static final String PARA = "para"; - private static final String BODY = "body"; + private static final int PADDING = 10; + private static final int PADDING_M = 12; private FormWidgetCardPane formWidgetCardPane; // 控件的属性表 private EventPropertyTable eventTable; // 控件的事件表 private List widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab private List mobileExtraPropertyPanes; // 保存9.0设计器下移动端拓展的属性tab,舍弃JTable private FormDesigner designer; // 当前designer private UIScrollPane psp; // 用来装载属性表table的容器 - private UIScrollPane esp; //用来装载事件table的容器 private JPanel wsp; // 装载移动端tab的容器,包括移动端属性表和控件拓展的移动端属性表 - private MobileParaWidgetTable mobileParaWidgetTable; // 参数面板的移动端属性tab(和body的移动端属性tab区别是没有标签名column) - private MobileWidgetTable mobileWidgetTable; // body的移动端属性tab - private UIScrollPane downPanel; // 这个滚动容器是用于装载centerPane的 - private JPanel centerPane; // 此centerPane采用的是cardLayout布局,装载着mobileWidgetTable和mobileBodyWidgetTable - private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable - private JTableHeader header;//把表头单独get出来作为一个组件 private UIHeadGroup tabsHeaderIconPane; private XComponent lastAffectedCreator; @@ -122,6 +112,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope if (mobileExtraPropertyPanes != null) { for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) { extraPane.initPropertyGroups(designer); + extraPane.populate(designer); } } if (widgetPropertyTables != null) { @@ -156,33 +147,10 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope //加上表头后,这里不再使用borderLayout布局,而采用BoxLayout布局 wsp = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); wsp.setBorder(null); - mobileParaWidgetTable = new MobileParaWidgetTable(designer); - mobileWidgetTable = new MobileWidgetTable(designer); designer.addDesignerEditListener(new MobileWidgetDesignerAdapter()); - centerPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - cardLayout = (CardLayout) centerPane.getLayout(); - centerPane.add(mobileParaWidgetTable, PARA); - // 采用卡片布局的容器必须指定卡片名字,如果没有卡片名字 - // 就会出现:Exception in thread "main" java.lang.IllegalArgumentException: - // cannot add to layout: constraint must be a string - // 第二个参数代表卡片的名字。后来show方法调用时通过名字找到要显示的卡片 - centerPane.add(mobileWidgetTable, BODY); //这两句代码,是把JTable放到一个JPanel中去了,表头不会显示, - //只有放到JScrollPanel中去表头才能正常显示,这就是MobileWidgetTable中定义了表头却没有显示的原因! - //解决方案:MobileWidgetTable实在无法直接放到JScrollPanel中去的时候,应该把表头get出来单独作为一个组件显示 - - if (hasSelectParaPane(designer)) { - cardLayout.show(centerPane, PARA); - header = mobileParaWidgetTable.getTableHeader(); - } else { - cardLayout.show(centerPane, BODY); - header = mobileWidgetTable.getTableHeader(); - } - downPanel = new UIScrollPane(centerPane); - downPanel.setBorder(new LineBorder(Color.GRAY)); //获取拓展移动端属性tab WidgetPropertyUIProvider[] widgetAttrProviders = getExtraPropertyUIProviders(); - addWidgetAttr(widgetAttrProviders); } @@ -217,13 +185,13 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope * @param widgetAttrProviders 拓展的tab */ private void addWidgetAttr(WidgetPropertyUIProvider[] widgetAttrProviders) { - if (widgetAttrProviders.length == 0) { // 判断有没有拓展的tab,没有就使用原来的 - wsp.add(header); - wsp.add(downPanel); + if (widgetAttrProviders.length == 0) { // 判断有没有拓展的tab,提示"无可用配置项" + wsp.add(getUnavailablePane()); } else { for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) { MobileWidgetDefinePane extraPane = (MobileWidgetDefinePane) widgetAttrProvider.createWidgetAttrPane(); if (extraPane != null) { + extraPane.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, PADDING, PADDING_M)); mobileExtraPropertyPanes.add(extraPane); wsp.add(extraPane); } @@ -232,29 +200,20 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope widgetPropertyTables.add(propertyTable); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane)); - UIScrollPane uiScrollPane = new UIScrollPane(getExtraBodyTable(propertyTable)); + UIScrollPane uiScrollPane = new UIScrollPane(propertyTable); wsp.add(uiScrollPane); } } } } - /** - * 如果是body的拓展属性表,那么要额外加上一张控件顺序表 - * - * @return - */ - private Component getExtraBodyTable(AbstractPropertyTable abstractPropertyTable) { - Widget selection = designer.getSelectionModel().getSelection().getSelectedCreator().toData(); - if ("body".equals(selection.getWidgetName())) { - JPanel jPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - jPanel.add(abstractPropertyTable); - MobileWidgetTable mobileWidgetTable = new MobileWidgetTable(designer); - jPanel.add(mobileWidgetTable.getTableHeader()); - jPanel.add(mobileWidgetTable); - return jPanel; - } - return abstractPropertyTable; + // "无可用配置项"面板 + private JPanel getUnavailablePane() { + JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + UILabel label = new UILabel(Inter.getLocText("FR-Designer_No_Settings_Available")); + label.setHorizontalAlignment(SwingConstants.CENTER); + panel.add(label); + return panel; } private void initTabPane() { @@ -406,7 +365,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope if (!isValid) { return; } - //fanglei:下面的注释不要删,只是暂时屏蔽 + //fanglei:下面的注释不要删,只是暂时屏蔽 // int value = downPanel.getVerticalScrollBar().getValue(); // if (hasSelectParaPane(getEditingFormDesigner())) { // cardLayout.show(centerPane, PARA); diff --git a/designer-form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java b/designer-form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java index 171bc09aa..4d7394620 100644 --- a/designer-form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java +++ b/designer-form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.actions; import com.fr.base.BaseUtils; +import com.fr.base.iofileattr.MobileOnlyTemplateAttrMark; import com.fr.design.actions.JTemplateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -8,7 +9,9 @@ import com.fr.design.form.mobile.FormMobileAttrPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormArea; import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.menu.MenuKeySet; +import com.fr.file.FILE; import com.fr.form.main.Form; import com.fr.form.main.mobile.FormMobileAttr; import com.fr.general.Inter; @@ -52,15 +55,27 @@ public class FormMobileAttrAction extends JTemplateAction { @Override public void doOk() { FormMobileAttr formMobileAttr = mobileAttrPane.updateBean(); - formTpl.setFormMobileAttr(formMobileAttr); - ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); - jf.fireTargetModified(); - if (formMobileAttr.isMobileOnly()) { - FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor(); - if (processor != null) { - processor.recordFunction(ReportFunctionProcessor.MOBILE_TEMPLATE_FRM); + if (formMobileAttr.isMobileOnly() && jf.getTarget().getAttrMark(MobileOnlyTemplateAttrMark.XML_TAG) == null) { + // 如果是老模板,选择手机专属之后需要另存为 + FILE editingFILE = jf.getEditingFILE(); + if (editingFILE != null && editingFILE.exists()) { + String fileName = editingFILE.getName().substring(0, editingFILE.getName().length() - jf.suffix().length()) + "_mobile"; + if (!jf.saveAsTemplate(true, fileName)) { + return; + } } + // 放到后面。如果提前 return 了,则仍然处于未设置状态,不要添加 + jf.getTarget().addAttrMark(new MobileOnlyTemplateAttrMark()); + } + // 记录功能点 + FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor(); + if (processor != null) { + processor.recordFunction(ReportFunctionProcessor.MOBILE_TEMPLATE_FRM); } + // 设置移动端属性并刷新界面 + formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 + ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); + WidgetPropertyPane.getInstance().refreshDockingView(); } }); dialog.setVisible(true); diff --git a/designer-form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java b/designer-form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java index 70c3b94f6..cbfbfb68c 100644 --- a/designer-form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java +++ b/designer-form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java @@ -18,9 +18,14 @@ import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.form.ui.ElementCaseEditor; import com.fr.general.Inter; +import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; /** * 报表块-移动端属性面板 @@ -28,6 +33,7 @@ import java.awt.*; * Created by fanglei on 2017/8/8. */ public class ElementCaseDefinePane extends MobileWidgetDefinePane{ + private static final double MAX_HEIGHT_LIMIT = 0.8; private static final Item[] ITEMS = { new Item(MobileFitAttrState.HORIZONTAL.description(), MobileFitAttrState.HORIZONTAL), new Item(MobileFitAttrState.VERTICAL.description(), MobileFitAttrState.VERTICAL), @@ -48,25 +54,6 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{ this.xCreator = xCreator; } - @Override - protected void initContentPane() {} - - @Override - protected JPanel createContentPane() { - return null; - } - - @Override - public String getIconPath() { - return ""; - } - - @Override - public String title4PopupWindow() { - return "ElementCase"; - } - - @Override public void initPropertyGroups(Object source) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -75,7 +62,25 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{ this.vComboBox = new UIComboBox(ITEMS); this.heightRestrictCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Mobile-Height-Limit")); this.maxHeightLabel = new UILabel(Inter.getLocText("FR-Designer_Mobile-Height-Percent"), SwingConstants.LEFT); - this.maxHeightSpinner = new UISpinner(0, 1, 0.01, 0.75); + this.maxHeightSpinner = new UISpinner(0, MAX_HEIGHT_LIMIT, 0.01, 0.75) { + public void setValue(double value) { + String warningText = StringUtils.EMPTY; + if (value > MAX_HEIGHT_LIMIT) { + warningText = Inter.getLocText("FR-Designer_Mobile-Warning"); + } else if (value < 0) { + // 弹窗提示 + warningText = Inter.getLocText("FR-Designer_Max_Height_Cannot_Be_Negative"); + } + if (StringUtils.isNotEmpty(warningText)) { + // 弹窗提示 + JOptionPane.showMessageDialog(null, + warningText, + Inter.getLocText("FR-Designer_Tooltips"), + JOptionPane.PLAIN_MESSAGE); + } + super.setValue(value); + } + }; maxHeightSpinner.setVisible(false); maxHeightLabel.setVisible(false); diff --git a/designer-form/src/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java b/designer-form/src/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java index 49d0b59a5..ac4de096a 100644 --- a/designer-form/src/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java +++ b/designer-form/src/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java @@ -3,6 +3,8 @@ package com.fr.design.widget.ui.designer.mobile; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.mainframe.FormDesigner; +import javax.swing.*; + /** * 所有移动端需要拓展的属性面板均继承此类 * @@ -23,4 +25,14 @@ public abstract class MobileWidgetDefinePane extends AbstractAttrNoScrollPane{ * 从属性面板把数据传到后台 */ public abstract void update(); + + // 暂不需要此方法 + @Override + protected void initContentPane() {} + + // 暂不需要此方法 + @Override + protected JPanel createContentPane() { + return new JPanel(); + } } diff --git a/designer-realize/src/com/fr/design/actions/report/ReportPrintSettingAction.java b/designer-realize/src/com/fr/design/actions/report/ReportPrintSettingAction.java new file mode 100644 index 000000000..ee07807ea --- /dev/null +++ b/designer-realize/src/com/fr/design/actions/report/ReportPrintSettingAction.java @@ -0,0 +1,75 @@ +package com.fr.design.actions.report; + +import com.fr.base.IconManager; +import com.fr.base.print.PrintSettingsAttrMark; +import com.fr.design.actions.JWorkBookAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JWorkBook; +import com.fr.design.menu.MenuKeySet; +import com.fr.design.webattr.printsettings.ReportPrintSettingPane; +import com.fr.general.IOUtils; +import com.fr.general.Inter; +import com.fr.main.TemplateWorkBook; +import com.fr.main.impl.WorkBook; +import com.fr.report.core.ReportUtils; + +import javax.swing.KeyStroke; +import java.awt.event.ActionEvent; + +/** + * Created by plough on 2018/3/5. + */ +public class ReportPrintSettingAction extends JWorkBookAction { + + public ReportPrintSettingAction(JWorkBook jwb) { + super(jwb); + this.setMenuKeySet(REPORT_APP_ATTR); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(IOUtils.readIcon(IconManager.PRINT.getPath())); + this.setSearchText(new ReportPrintSettingPane()); + } + + /** + * 执行动作 + * + * @return 是否执行成功 + */ + public void actionPerformed(ActionEvent evt) { + final JWorkBook jwb = getEditingComponent(); + if (jwb == null) { + return; + } + final WorkBook wbTpl = jwb.getTarget(); + PrintSettingsAttrMark printSettings = ReportUtils.getPrintSettingsFromWorkbook(wbTpl); + + final ReportPrintSettingPane reportPrintSettingPane = new ReportPrintSettingPane(); + reportPrintSettingPane.populate(printSettings); + BasicDialog dialog = reportPrintSettingPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + PrintSettingsAttrMark newPrintSettings = reportPrintSettingPane.updateBean(); + wbTpl.addAttrMark(newPrintSettings); + jwb.fireTargetModified(); + } + }); + dialog.setVisible(true); + } + + private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() { + @Override + public char getMnemonic() { return 'P'; } + + @Override + public String getMenuName() { + return Inter.getLocText("FR-Designer_Print_Setting"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; +} diff --git a/designer-realize/src/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/com/fr/design/mainframe/JWorkBook.java index 7f885b59f..bb75eda53 100644 --- a/designer-realize/src/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/com/fr/design/mainframe/JWorkBook.java @@ -22,6 +22,7 @@ import com.fr.design.actions.file.export.WordExportAction; import com.fr.design.actions.report.ReportExportAttrAction; import com.fr.design.actions.report.ReportMobileAttrAction; import com.fr.design.actions.report.ReportParameterAction; +import com.fr.design.actions.report.ReportPrintSettingAction; import com.fr.design.actions.report.ReportWatermarkAction; import com.fr.design.actions.report.ReportWebAttrAction; import com.fr.design.cell.bar.DynamicScrollBar; @@ -695,6 +696,7 @@ public class JWorkBook extends JTemplate { new ReportExportAttrAction(this), new ReportParameterAction(this), new ReportMobileAttrAction(this), + new ReportPrintSettingAction(this), new ReportWatermarkAction(this), new NameSeparator(Inter.getLocText("Utils-Current_Sheet")), }, this.reportComposite.getEditingReportComponent().shortcut4TemplateMenu()); diff --git a/designer-realize/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index fcbdd58ff..3d97fd92b 100644 --- a/designer-realize/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -7,13 +7,14 @@ import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.*; +import com.fr.design.layout.VerticalFlowLayout; +import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.JTemplate; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; @@ -63,8 +64,14 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private UICheckBox canBreakOnPaginateCheckBox; private UICheckBox repeatCheckBox; - private UICheckBox autoHeightCheckBox; - private UICheckBox autoWidthCheckBox; + + // 自动调整 + private UIRadioButton autoHeightRadioButton; // 自动调整行高 + private UIRadioButton autoWidthRadioButton; // 自动调整列宽 + private UIRadioButton noAutoRadioButton; // 不自动调整 + private UIRadioButton defaultAutoRadioButton; // 跟随页面设置(默认) + private UIRadioButton[] adjustRadioButtons; + // 插入行策略 private UIButtonGroup insertRowPolicy; private ValueEditorPane valueEditor; @@ -80,7 +87,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { */ public JPanel createContentPane() { JPanel downPane = new JPanel(new BorderLayout()); - downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), HEAD_WDITH, HEAD_HEIGTH, seniorPane()), BorderLayout.NORTH); + downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Auto_Adjust_Size"), HEAD_WDITH, HEAD_HEIGTH, seniorPane()), BorderLayout.NORTH); downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Pagination"), HEAD_WDITH, HEAD_HEIGTH, pagePane()), BorderLayout.CENTER); JPanel contentPane = new JPanel(new BorderLayout(0, 0)); contentPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), HEAD_WDITH, HEAD_HEIGTH, basicPane()), BorderLayout.NORTH); @@ -89,24 +96,36 @@ public class CellOtherSetPane extends AbstractCellAttrPane { return contentPane; } - private JPanel basicPane() { - autoHeightCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Height")); - autoWidthCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Wdith")); - autoHeightCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - autoWidthCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p}; - double[] columnSize = {p}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{null}, - new Component[]{autoHeightCheckBox}, - new Component[]{autoWidthCheckBox}, - new Component[]{null}, + defaultAutoRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Follow_Paper_Settings")); + noAutoRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_No_Auto_Adjust")); + autoHeightRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Auto_Adjust_Height")); + autoWidthRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Auto_Adjust_Width")); + adjustRadioButtons = new UIRadioButton[]{ + defaultAutoRadioButton, noAutoRadioButton, autoHeightRadioButton, autoWidthRadioButton }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE); + // 指定分组 + ButtonGroup autoBG = new ButtonGroup(); + for (UIRadioButton radioButton : adjustRadioButtons) { + autoBG.add(radioButton); + } + + JPanel basicPane = new JPanel() { + @Override + public Insets getInsets() { + return new Insets(LayoutConstants.VGAP_MEDIUM, 0, LayoutConstants.VGAP_MEDIUM, 0); + } + }; + VerticalFlowLayout verticalFlowLayout = new VerticalFlowLayout(VerticalFlowLayout.CENTER, 0, 0); + verticalFlowLayout.setAlignLeft(true); + basicPane.setLayout(verticalFlowLayout); + basicPane.add(defaultAutoRadioButton); + basicPane.add(noAutoRadioButton); + basicPane.add(autoHeightRadioButton); + basicPane.add(autoWidthRadioButton); + + return basicPane; } private JPanel seniorPane() { @@ -268,12 +287,13 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private void initAllNames() { -// autoshrik.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Size")); - autoHeightCheckBox.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Height")); - autoWidthCheckBox.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Wdith")); + defaultAutoRadioButton.setGlobalName(Inter.getLocText("FR-Designer_Follow_Paper_Settings")); + noAutoRadioButton.setGlobalName(Inter.getLocText("FR-Designer_No_Auto_Adjust")); + autoHeightRadioButton.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Height")); + autoWidthRadioButton.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Width")); previewCellContent.setGlobalName(Inter.getLocText("FR-Designer_Preview")); - printAndExportContent.setGlobalName(Inter.getLocText("CellWrite-Preview_Cell_Content")); - printAndExportBackground.setGlobalName(Inter.getLocText("CellWrite-Print_Background")); + printAndExportContent.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_Print_Content")); + printAndExportBackground.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_Print_Background")); showContent.setGlobalName(Inter.getLocText("FR-Designer_Show_Content")); fileNameTextField.setGlobalName(Inter.getLocText("FR-Designer_Show_Content")); tooltipTextField.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_ToolTip")); @@ -300,27 +320,32 @@ public class CellOtherSetPane extends AbstractCellAttrPane { if (cellGUIAttr == null) { cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR; } -// autoshrik.setSelectedIndex(cellGUIAttr.getAdjustMode()); + + // 是否在编辑表单中的报表块 + boolean isInForm = EastRegionContainerPane.getInstance().getCurrentMode().equals(EastRegionContainerPane.PropertyMode.FORM_REPORT); + + defaultAutoRadioButton.setVisible(!isInForm); switch (cellGUIAttr.getAdjustMode()) { - case 0: - autoHeightCheckBox.setSelected(false); - autoWidthCheckBox.setSelected(false); + case CellGUIAttr.ADJUST_MODE_NO_AUTO: + noAutoRadioButton.setSelected(true); break; - case 1: - autoHeightCheckBox.setSelected(true); - autoWidthCheckBox.setSelected(false); + case CellGUIAttr.ADJUST_MODE_AUTO_HEIGHT: + autoHeightRadioButton.setSelected(true); break; - case 2: - autoHeightCheckBox.setSelected(false); - autoWidthCheckBox.setSelected(true); + case CellGUIAttr.ADJUST_MODE_AUTO_WIDTH: + autoWidthRadioButton.setSelected(true); break; - case 3: - autoHeightCheckBox.setSelected(true); - autoWidthCheckBox.setSelected(true); + case CellGUIAttr.ADJUST_MODE_DEFAULT: + if (isInForm) { + autoHeightRadioButton.setSelected(true); + } else { + defaultAutoRadioButton.setSelected(true); + } break; default: break; } + previewCellContent.setSelected(cellGUIAttr.isPreviewContent()); printAndExportContent.setSelected(cellGUIAttr.isPrintContent()); printAndExportBackground.setSelected(cellGUIAttr.isPrintBackground()); @@ -384,32 +409,29 @@ public class CellOtherSetPane extends AbstractCellAttrPane { cellGUIAttr = new CellGUIAttr(); } -// if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Size"))) { -// cellGUIAttr.setAdjustMode(autoshrik.getSelectedIndex()); -// } - - if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Height")) || ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Wdith"))) { - int flag; - if (autoHeightCheckBox.isSelected()) { - if (autoWidthCheckBox.isSelected()) { - flag = 3; + for (UIRadioButton radioButton : adjustRadioButtons) { + if (ComparatorUtils.equals(getGlobalName(), radioButton.getGlobalName())) { + // 自动调整 + int flag; + if (defaultAutoRadioButton.isSelected()) { + flag = CellGUIAttr.ADJUST_MODE_DEFAULT; + } else if (autoWidthRadioButton.isSelected()) { + flag = CellGUIAttr.ADJUST_MODE_AUTO_WIDTH; + } else if (autoHeightRadioButton.isSelected()) { + flag = CellGUIAttr.ADJUST_MODE_AUTO_HEIGHT; } else { - flag = 1; + flag = CellGUIAttr.ADJUST_MODE_NO_AUTO; } - } else if (autoWidthCheckBox.isSelected()) { - flag = 2; - } else { - flag = 0; + cellGUIAttr.setAdjustMode(flag); + break; } - cellGUIAttr.setAdjustMode(flag); } - if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Preview"))) { cellGUIAttr.setPreviewContent(previewCellContent.isSelected()); } - if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Preview_Cell_Content"))) { + if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Print_Content"))) { cellGUIAttr.setPrintContent(printAndExportContent.isSelected()); } diff --git a/designer-realize/src/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java b/designer-realize/src/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java index 3e47457b5..d2740d681 100644 --- a/designer-realize/src/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java +++ b/designer-realize/src/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java @@ -21,6 +21,7 @@ import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.present.ConditionAttributesGroupPane; import com.fr.form.main.Form; +import com.fr.grid.Grid; import com.fr.js.NameJavaScriptGroup; import com.fr.page.ReportSettingsProvider; import com.fr.report.elementcase.TemplateElementCase; @@ -32,9 +33,13 @@ import com.fr.design.selection.SelectionListener; */ public class FormElementCasePaneDelegate extends ElementCasePane{ - public FormElementCasePaneDelegate(FormElementCase sheet, Form form) { + public FormElementCasePaneDelegate(FormElementCase sheet, Form form) { super(sheet); - this.getGrid().setShowPaginateLine(form.getFormMobileAttr().isMobileOnly()); + + this.getGrid().setPaginateLineShowType(form.getFormMobileAttr().isMobileOnly() + ? Grid.SINGLE_HORIZONTAL_PAGINATE_LINE + : Grid.NO_PAGINATE_LINE); + this.addSelectionChangeListener(new SelectionListener() { @Override public void selectionChanged(SelectionEvent e) { @@ -138,9 +143,9 @@ public class FormElementCasePaneDelegate extends ElementCasePane allPrinterName = new HashSet(); + + for (int i = 0, len = printServices.length; i < len; i++) { + allPrinterName.add(printServices[i].getName()); + } + + return allPrinterName.toArray(new String[allPrinterName.size()]); + } + + private JPanel getPaperSettingPane() { + predefinedPaperSizeComboBox = new UIComboBox(); + for (int i = 0; i < ReportConstants.PaperSizeNameSizeArray.length; i++) { + Object[] tmpPaperSizeNameArray = ReportConstants.PaperSizeNameSizeArray[i]; + predefinedPaperSizeComboBox.addItem(tmpPaperSizeNameArray[1]); + } + predefinedPaperSizeComboBox.setRenderer(new UIComboBoxRenderer() { + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + + if (value instanceof PaperSize) { + PaperSize paperSize = (PaperSize) value; + for (int i = 0; i < ReportConstants.PaperSizeNameSizeArray.length; i++) { + Object[] tmpPaperSizeNameArray = ReportConstants.PaperSizeNameSizeArray[i]; + + if (ComparatorUtils.equals(paperSize, tmpPaperSizeNameArray[1])) { + String sbuf = tmpPaperSizeNameArray[0].toString() + " [" + + Utils.convertNumberStringToString(paperSize.getWidth().toMMValue4Scale2()) + + 'x' + + Utils.convertNumberStringToString(paperSize.getHeight().toMMValue4Scale2()) + + ' ' + + Inter.getLocText("PageSetup-mm") + + ']'; + this.setText(sbuf); + break; + } + } + } + + return this; + } + }); + + JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + panel.add(predefinedPaperSizeComboBox); + panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0)); + return panel; + } + + private JPanel getLayoutSettingPane() { + JPanel layoutSettingPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + layoutSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + portraitRadioButton = new UIRadioButton(Inter.getLocText("PageSetup-Portrait")); + portraitRadioButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); + landscapeRadioButton = new UIRadioButton(Inter.getLocText("PageSetup-Landscape")); + layoutSettingPane.add(portraitRadioButton); + layoutSettingPane.add(landscapeRadioButton); + + ButtonGroup layoutButtonGroup = new ButtonGroup(); + layoutButtonGroup.add(portraitRadioButton); + layoutButtonGroup.add(landscapeRadioButton); + + portraitRadioButton.setSelected(true); + return layoutSettingPane; + } + + // 页码范围 + private JPanel getPrintAreaPane() { + allPageRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_All_Pages")); + currentPageRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Current_Page")); + customPageRadioButton = new UIRadioButton(Inter.getLocText("FR-Engine_HJS-Specified_Pages")); + ButtonGroup group = new ButtonGroup(); + group.add(allPageRadioButton); + group.add(currentPageRadioButton); + group.add(customPageRadioButton); + allPageRadioButton.setSelected(true); + + specifiedAreaField = new UITextField(20) { + @Override + public void setEnabled(boolean enabled) { + // 如果未选中"指定页",此输入框始终不可用 + if (enabled && !customPageRadioButton.isSelected()) { + return; + } + super.setEnabled(enabled); + } + }; + UILabel areaFieldTip = GUICoreUtils.createTipLabel(Inter.getLocText("FR-Designer_Print_Area_Tip")); + + // TableLayout + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p}; + double[] columnSize = {p, p, p}; + Component[][] components = { + {allPageRadioButton, null, null}, + {currentPageRadioButton, null, null}, + {customPageRadioButton, specifiedAreaField, areaFieldTip} + }; + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); + } + + // 返回包含一个标签的 panel,标签始终位于 panel 顶部 + private JPanel getTopAlignLabelPane(String labelText) { + JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + labelPane.add(new UILabel(labelText), BorderLayout.NORTH); + return labelPane; + } + + public void populate(NativePrintAttr nativePrintAttr) { + isShowDialogCheck.setSelected(nativePrintAttr.isShowDialog()); + printerComboBox.setSelectedItem(nativePrintAttr.getPrinterName()); + copySpinner.setValue(nativePrintAttr.getCopy()); + + if (nativePrintAttr.getPageType().equals(NativePrintAttr.PageType.ALL_PAGES)) { + allPageRadioButton.setSelected(true); + } else if (nativePrintAttr.getPageType().equals(NativePrintAttr.PageType.CURRENT_PAGE)) { + currentPageRadioButton.setSelected(true); + } else { + customPageRadioButton.setSelected(true); + specifiedAreaField.setText(nativePrintAttr.getArea()); + } + specifiedAreaField.setEnabled(customPageRadioButton.isSelected()); + + inheritPagePaperSettingCheck.setSelected(nativePrintAttr.isInheritPagePaperSetting()); + predefinedPaperSizeComboBox.setSelectedItem(nativePrintAttr.getPaperSize()); + inheritPageLayoutSettingCheck.setSelected(nativePrintAttr.isInheritPageLayoutSetting()); + if (nativePrintAttr.getOrientation() == ReportConstants.PORTRAIT) { + portraitRadioButton.setSelected(true); + } else { + landscapeRadioButton.setSelected(true); + } + inheritPageMarginSettingCheck.setSelected(nativePrintAttr.isInheritPageMarginSetting()); + pageMarginSettingPane.populate(nativePrintAttr.getMargin()); + fitPaperSizeCheck.setSelected(nativePrintAttr.isFitPaperSize()); + } + + public void update(NativePrintAttr nativePrintAttr) { + nativePrintAttr.setShowDialog(isShowDialogCheck.isSelected()); + if (printerComboBox.getSelectedItem() != null) { + nativePrintAttr.setPrinterName(printerComboBox.getSelectedItem().toString()); + } + nativePrintAttr.setCopy((int)copySpinner.getValue()); + + // 页码 + if (allPageRadioButton.isSelected()) { + nativePrintAttr.setPageType(NativePrintAttr.PageType.ALL_PAGES); + } else if (currentPageRadioButton.isSelected()) { + nativePrintAttr.setPageType(NativePrintAttr.PageType.CURRENT_PAGE); + } else { + nativePrintAttr.setPageType(NativePrintAttr.PageType.SPECIFIED_PAGES); + nativePrintAttr.setArea(specifiedAreaField.getText()); + } + + nativePrintAttr.setInheritPagePaperSetting(inheritPagePaperSettingCheck.isSelected()); + nativePrintAttr.setPaperSize((PaperSize) predefinedPaperSizeComboBox.getSelectedItem()); + nativePrintAttr.setInheritPageLayoutSetting(inheritPageLayoutSettingCheck.isSelected()); + nativePrintAttr.setOrientation(portraitRadioButton.isSelected() ? + ReportConstants.PORTRAIT : ReportConstants.LANDSCAPE); + nativePrintAttr.setInheritPageMarginSetting(inheritPageMarginSettingCheck.isSelected()); + nativePrintAttr.setMargin(pageMarginSettingPane.updateBean()); + nativePrintAttr.setFitPaperSize(fitPaperSizeCheck.isSelected()); + } + + // 刷新面板可用状态 + public void checkEnabled() { + GUICoreUtils.setEnabled(centerPane, !isShowDialogCheck.isSelected()); + } +} diff --git a/designer-realize/src/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java b/designer-realize/src/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java new file mode 100644 index 000000000..14ebc7c4a --- /dev/null +++ b/designer-realize/src/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java @@ -0,0 +1,103 @@ +package com.fr.design.webattr.printsettings; + +import com.fr.base.print.NoClientPrintAttr; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/** + * 零客户端打印设置面板 + * Created by plough on 2018/3/5. + */ +public class NoClientPrintSettingPane extends JPanel { + private UICheckBox setMarginWhenPrintCheck; + private UICheckBox inheritPageMarginSettingCheck; // 继承页面边距设置 + private PageMarginSettingPane pageMarginSettingPane; + private JPanel centerPane; + + public NoClientPrintSettingPane() { + initComponents(); + initListeners(); + } + + private void initComponents() { + JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + setMarginWhenPrintCheck = new UICheckBox(Inter.getLocText("FR-Engine_Set_Margin_When_Printing")); + setMarginWhenPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); + UILabel tipLabel = GUICoreUtils.createTipLabel(Inter.getLocText("FR-Designer_Tip_Use_Default_Print_Margin")); + JPanel northPane = GUICoreUtils.createFlowPane(new Component[] { + setMarginWhenPrintCheck, tipLabel}, FlowLayout.LEFT); + northPane.setBorder(BorderFactory.createEmptyBorder(8, 10, 10, 0)); + + printPane.add(northPane, BorderLayout.NORTH); + + centerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Default_Settings")); + + inheritPageMarginSettingCheck = GUICoreUtils.createNoBorderCheckBox(Inter.getLocText("FR-Designer_Inherit_Page_Margin_Setting")); + pageMarginSettingPane = new PageMarginSettingPane(); + pageMarginSettingPane.setBorder(BorderFactory.createEmptyBorder(10, -10, 0, 0)); + JPanel pageMarginCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(inheritPageMarginSettingCheck, pageMarginSettingPane, true); + + // TableLayout + double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] columnSize = {60, p}; + Component[][] components = { + {getTopAlignLabelPane(Inter.getLocText("FR-Designer_Margin") + ":"), pageMarginCheckPane} + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15); + + centerPane.add(panel); + + printPane.add(centerPane, BorderLayout.CENTER); + + this.setLayout(new BorderLayout()); + this.add(printPane, BorderLayout.CENTER); + } + + private void initListeners() { + setMarginWhenPrintCheck.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + checkEnabled(); + } + }); + } + + // 返回包含一个标签的 panel,标签始终位于 panel 顶部 + private JPanel getTopAlignLabelPane(String labelText) { + JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + labelPane.add(new UILabel(labelText), BorderLayout.NORTH); + return labelPane; + } + + public void populate(NoClientPrintAttr noClientPrintAttr) { + setMarginWhenPrintCheck.setSelected(noClientPrintAttr.isSetMarginOnPrint()); + inheritPageMarginSettingCheck.setSelected(noClientPrintAttr.isInheritPageMarginSetting()); + pageMarginSettingPane.populate(noClientPrintAttr.getMargin()); + } + + public void update(NoClientPrintAttr noClientPrintAttr) { + noClientPrintAttr.setSetMarginOnPrint(setMarginWhenPrintCheck.isSelected()); + noClientPrintAttr.setInheritPageMarginSetting(inheritPageMarginSettingCheck.isSelected()); + noClientPrintAttr.setMargin(pageMarginSettingPane.updateBean()); + } + + // 刷新面板可用状态 + public void checkEnabled() { + GUICoreUtils.setEnabled(centerPane, !setMarginWhenPrintCheck.isSelected()); + } +} diff --git a/designer-realize/src/com/fr/design/webattr/printsettings/PageMarginSettingPane.java b/designer-realize/src/com/fr/design/webattr/printsettings/PageMarginSettingPane.java new file mode 100644 index 000000000..8c63fa520 --- /dev/null +++ b/designer-realize/src/com/fr/design/webattr/printsettings/PageMarginSettingPane.java @@ -0,0 +1,79 @@ +package com.fr.design.webattr.printsettings; + +import com.fr.base.Margin; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.report.UnitFieldPane; +import com.fr.general.Inter; +import com.fr.stable.Constants; + +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * Created by plough on 2018/3/5. + */ +public class PageMarginSettingPane extends JPanel { + private UnitFieldPane marginTopUnitFieldPane; + private UnitFieldPane marginBottomUnitFieldPane; + private UnitFieldPane marginLeftUnitFieldPane; + private UnitFieldPane marginRightUnitFieldPane; + + public PageMarginSettingPane() { + initComponents(); + } + private void initComponents() { + // 页边距设置面板 + JPanel marginPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_M_Pane(); + // left + JPanel marginLeftPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); + marginPane.add(marginLeftPane); + + JPanel marginLeftTextPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + marginLeftPane.add(marginLeftTextPane); + marginLeftTextPane.add(new UILabel(Inter.getLocText("Top") + ":")); + marginTopUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); + marginLeftTextPane.add(marginTopUnitFieldPane); + JPanel marginLeftUnitPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + marginLeftPane.add(marginLeftUnitPane); + marginLeftUnitPane.add(new UILabel(Inter.getLocText("Bottom") + ":")); + marginBottomUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); + marginLeftUnitPane.add(marginBottomUnitFieldPane); + + // right + JPanel marginRightPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); + marginPane.add(marginRightPane); + + // peter:这个一个垂直的上下的字符panel. + JPanel marginRightTextPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + marginRightPane.add(marginRightTextPane); + marginRightTextPane.add(new UILabel(Inter.getLocText("Left") + ":")); + marginLeftUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); + marginRightTextPane.add(marginLeftUnitFieldPane); + + JPanel marginRightUnitPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + marginRightPane.add(marginRightUnitPane); + marginRightUnitPane.add(new UILabel(Inter.getLocText("Right") + ":")); + marginRightUnitFieldPane = new UnitFieldPane(Constants.UNIT_MM); + marginRightUnitPane.add(marginRightUnitFieldPane); + + this.setLayout(new BorderLayout()); + this.add(marginPane, BorderLayout.CENTER); + } + + public void populate(Margin margin) { + marginTopUnitFieldPane.setUnitValue(margin.getTop()); + marginLeftUnitFieldPane.setUnitValue(margin.getLeft()); + marginBottomUnitFieldPane.setUnitValue(margin.getBottom()); + marginRightUnitFieldPane.setUnitValue(margin.getRight()); + } + + public Margin updateBean() { + Margin margin = new Margin(); + margin.setTop(marginTopUnitFieldPane.getUnitValue()); + margin.setLeft(marginLeftUnitFieldPane.getUnitValue()); + margin.setBottom(marginBottomUnitFieldPane.getUnitValue()); + margin.setRight(marginRightUnitFieldPane.getUnitValue()); + return margin; + } +} diff --git a/designer-realize/src/com/fr/design/webattr/printsettings/PrintSettingPane.java b/designer-realize/src/com/fr/design/webattr/printsettings/PrintSettingPane.java new file mode 100644 index 000000000..bed697c3c --- /dev/null +++ b/designer-realize/src/com/fr/design/webattr/printsettings/PrintSettingPane.java @@ -0,0 +1,112 @@ +package com.fr.design.webattr.printsettings; + +import com.fr.base.print.PrintSettingsAttrMark; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/** + * Created by plough on 2018/3/1. + */ +public class PrintSettingPane extends BasicPane { + private UIRadioButton noClientPrintRadioButton = new UIRadioButton(Inter.getLocText("FR-Engine_No_Client_Print")); + private UIRadioButton nativePrintRadioButton = new UIRadioButton(Inter.getLocText("FR-Engine_Native_Print")); + + private NoClientPrintSettingPane noClientPrintSettingPane; + private NativePrintSettingPane nativePrintSettingPane; + private CardLayout printCard; + private JPanel printPane; + + public PrintSettingPane() { + initComponents(); + initListener(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel allPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + this.add(allPanel, BorderLayout.CENTER); + JPanel north = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); + allPanel.add(north, BorderLayout.NORTH); + ButtonGroup buttonGroup = new ButtonGroup(); + noClientPrintRadioButton.setSelected(true); + buttonGroup.add(noClientPrintRadioButton); + buttonGroup.add(nativePrintRadioButton); + noClientPrintRadioButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 50)); + JPanel radioGroupPane = GUICoreUtils.createFlowPane(new Component[] { + noClientPrintRadioButton, nativePrintRadioButton}, FlowLayout.LEFT, 0, 0); + north.add(radioGroupPane); + + noClientPrintSettingPane = new NoClientPrintSettingPane(); + nativePrintSettingPane = new NativePrintSettingPane(); + printCard = new CardLayout(); + printPane = new JPanel(); + printPane.setLayout(printCard); + printPane.add(noClientPrintRadioButton.getText(), noClientPrintSettingPane); + printPane.add(nativePrintRadioButton.getText(), nativePrintSettingPane); + + north.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + allPanel.add(printPane, BorderLayout.CENTER); + } + + private void initListener() { + noClientPrintRadioButton.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + printCard.show(printPane, noClientPrintRadioButton.getText()); + } + } + }); + nativePrintRadioButton.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + printCard.show(printPane, nativePrintRadioButton.getText()); + } + } + }); + } + + // 刷新面板可用状态 + public void checkEnabled() { + noClientPrintSettingPane.checkEnabled(); + nativePrintSettingPane.checkEnabled(); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Print_Setting"); + } + + public void populate(PrintSettingsAttrMark printSettings) { + if (printSettings.getPrintType() == PrintSettingsAttrMark.NO_CLIENT_PRINT) { + noClientPrintRadioButton.setSelected(true); + } else { + nativePrintRadioButton.setSelected(true); + } + noClientPrintSettingPane.populate(printSettings.getNoClientPrintAttr()); + nativePrintSettingPane.populate(printSettings.getNativePrintAttr()); + } + + public PrintSettingsAttrMark updateBean() { + PrintSettingsAttrMark printSettings = new PrintSettingsAttrMark(); + printSettings.setPrintType(noClientPrintRadioButton.isSelected() ? + PrintSettingsAttrMark.NO_CLIENT_PRINT : PrintSettingsAttrMark.NATIVE_PRINT); + noClientPrintSettingPane.update(printSettings.getNoClientPrintAttr()); + nativePrintSettingPane.update(printSettings.getNativePrintAttr()); + return printSettings; + } +} diff --git a/designer-realize/src/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java b/designer-realize/src/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java new file mode 100644 index 000000000..be2401f98 --- /dev/null +++ b/designer-realize/src/com/fr/design/webattr/printsettings/ReportPrintSettingPane.java @@ -0,0 +1,101 @@ +package com.fr.design.webattr.printsettings; + +import com.fr.base.print.PrintSettingsAttrMark; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; +import com.fr.report.core.ReportUtils; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/** + * 模版->打印设置 + * Created by plough on 2018/3/6. + */ +public class ReportPrintSettingPane extends BasicPane { + private static final String[] CHOOSEITEM = new String[] { + Inter.getLocText("FR-Designer_I_Want_To_Set_Single"), + Inter.getLocText("FR-Designer_Using_Server_Report_View_Settings") + }; + private static final int SINGLE_SET = 0; + private static final int SERVER_SET = 1; + + private UIComboBox chooseComboBox; + private PrintSettingPane printSettingPane; + + public ReportPrintSettingPane() { + initComponents(); + } + + private void initComponents() { + chooseComboBox = new UIComboBox(CHOOSEITEM); + chooseComboBox.addItemListener(itemListener); + UILabel belowSetLabel = new UILabel(Inter.getLocText("FR-Designer_Blow_set") + ":"); + JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[] { + belowSetLabel, chooseComboBox}, FlowLayout.LEFT, 0, 0); + buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 0)); + + printSettingPane = new PrintSettingPane(); + this.setLayout(new BorderLayout()); + this.add(buttonPane, BorderLayout.NORTH); + this.add(printSettingPane, BorderLayout.CENTER); + } + + private ItemListener itemListener = new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + if (chooseComboBox.getSelectedIndex() == 0) { + setSettingPaneEnabled(true); + } else { + populateServerSettings(); + setSettingPaneEnabled(false); + } + } + } + }; + + private void setSettingPaneEnabled(boolean enabled) { + // GUICoreUtils.setEnabled 会遍历所有 Component。所以要先设置外层,如果是生效的,再设置内层 + GUICoreUtils.setEnabled(printSettingPane, enabled); + if (enabled) { + printSettingPane.checkEnabled(); + } + } + + private void populateServerSettings() { + PrintSettingsAttrMark printSettings = ReportUtils.getPrintSettingsFromServerConfig(); + printSettingPane.populate(printSettings); + } + + public void populate(PrintSettingsAttrMark printSettings) { + if (!printSettings.isValid()) { // 采用服务器配置 + chooseComboBox.setSelectedIndex(SERVER_SET); + populateServerSettings(); + return; + } + chooseComboBox.setSelectedIndex(SINGLE_SET); + printSettingPane.populate(printSettings); + } + + public PrintSettingsAttrMark updateBean() { + PrintSettingsAttrMark printSettings = printSettingPane.updateBean(); + if (chooseComboBox.getSelectedIndex() == SERVER_SET) { + printSettings.setValid(false); + } + return printSettings; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Print_Setting"); + } +} diff --git a/designer-realize/src/com/fr/grid/Grid.java b/designer-realize/src/com/fr/grid/Grid.java index 45bcf3884..16b892473 100644 --- a/designer-realize/src/com/fr/grid/Grid.java +++ b/designer-realize/src/com/fr/grid/Grid.java @@ -61,6 +61,9 @@ public class Grid extends BaseGridComponent { /** * If editing, the Component that is handling the editing. */ + public static final int NO_PAGINATE_LINE = 0; // 不显示分页线 + public static final int MULTIPLE_PAGINATE_LINE = 1; // 绘制多条分页线 + public static final int SINGLE_HORIZONTAL_PAGINATE_LINE = 2; // 仅绘制一条水平分页线 private static final int VERTICAL_EXTENT_INITIAL_VALUE = 50; private static final int HORIZONTAL_EXTENT_INITIAL_VALUE = 40; transient protected Component editorComponent; @@ -70,7 +73,7 @@ public class Grid extends BaseGridComponent { private boolean showGridLine = true; private Color gridLineColor = UIConstants.RULER_LINE_COLOR; // line color. - private boolean isShowPaginateLine = true; + private int paginateLineShowType = MULTIPLE_PAGINATE_LINE; // 分页线类型 private Color paginationLineColor = Color.RED; // line color of paper private boolean isShowVerticalFrozenLine = true; @@ -216,25 +219,6 @@ public class Grid extends BaseGridComponent { this.getElementCasePane().repaint(); } - /** - * 是否显示分页线 - * - * @return 是否显示分页线 - * @date 2014-12-21-下午6:31:45 - */ - public boolean isShowPaginateLine() { - return isShowPaginateLine; - } - - /** - * Sets to show pagination line. - */ - public void setShowPaginateLine(boolean showPaginateLine) { - this.isShowPaginateLine = showPaginateLine; - - this.getElementCasePane().repaint(); - } - /** * Gets pagination line color. */ @@ -1456,8 +1440,12 @@ public class Grid extends BaseGridComponent { this.tooltipLocation.setLocation(x, y); } -// @Override -// public void requestFocus() { -// super.requestFocus(); -// } + public int getPaginateLineShowType() { + return paginateLineShowType; + } + + public void setPaginateLineShowType(int paginateLineShowType) { + this.paginateLineShowType = paginateLineShowType; + this.getElementCasePane().repaint(); + } } \ No newline at end of file diff --git a/designer-realize/src/com/fr/grid/GridUI.java b/designer-realize/src/com/fr/grid/GridUI.java index 0f9438306..7320b955c 100644 --- a/designer-realize/src/com/fr/grid/GridUI.java +++ b/designer-realize/src/com/fr/grid/GridUI.java @@ -127,7 +127,7 @@ public class GridUI extends ComponentUI { // richer;聚合报表设计中,最初的ElementCase还没有加到Report中,所以elementCase.getReport()可能为空 ReportSettingsProvider reportSettings = getReportSettings(elementCase); PaperSettingProvider psetting = reportSettings.getPaperSetting(); - if (grid.isShowPaginateLine()) {// paint paper margin line. + if (grid.getPaginateLineShowType() != Grid.NO_PAGINATE_LINE) {// paint paper margin line. PaperSize paperSize = psetting.getPaperSize(); Margin margin = psetting.getMargin(); @@ -173,7 +173,7 @@ public class GridUI extends ComponentUI { private void paintScrollBackground(Graphics2D g2d, Grid grid, Background background, PaperSettingProvider psetting, ReportSettingsProvider reportSettings) { boolean isCanDrawImage = grid.isEditable() || isAuthority; if (isCanDrawImage && (background instanceof ImageFileBackground)) { - if (!grid.isShowPaginateLine()) { + if (grid.getPaginateLineShowType() == Grid.NO_PAGINATE_LINE) { calculatePaper(psetting, reportSettings); } @@ -239,12 +239,15 @@ public class GridUI extends ComponentUI { // 分页线 paginateLineList.clear(); + boolean isShowVerticalPaginateLine = grid.getPaginateLineShowType() == Grid.MULTIPLE_PAGINATE_LINE; + boolean isShowHorizontalPaginateLine = grid.getPaginateLineShowType() != Grid.NO_PAGINATE_LINE; + new DrawVerticalLineHelper(grid.getVerticalBeginValue(), verticalEndValue, - grid.isShowGridLine(), grid.isShowPaginateLine(), rowHeightList, paperPaintHeight, + grid.isShowGridLine(), isShowVerticalPaginateLine, rowHeightList, paperPaintHeight, paginateLineList, realWidth, resolution).iterateStart2End(g2d); new DrawHorizontalLineHelper(grid.getHorizontalBeginValue(), horizontalEndValue, - grid.isShowGridLine(), grid.isShowPaginateLine(), columnWidthList, paperPaintWidth, + grid.isShowGridLine(), isShowHorizontalPaginateLine, columnWidthList, paperPaintWidth, paginateLineList, realHeight, resolution).iterateStart2End(g2d); } @@ -609,8 +612,12 @@ public class GridUI extends ComponentUI { //g2d.setXORMode(Utils.getXORColor(grid.getPaginationLineColor())); GraphHelper.setStroke(g2d, GraphHelper.getStroke(Constants.LINE_DASH_DOT)); - for (int i = 0, len = paginateLineList.size(); i < len; i++) { - g2d.draw((Shape) paginateLineList.get(i)); + if (grid.getPaginateLineShowType() == Grid.SINGLE_HORIZONTAL_PAGINATE_LINE) { + g2d.draw((Shape) paginateLineList.get(0)); + } else { + for (int i = 0, len = paginateLineList.size(); i < len; i++) { + g2d.draw((Shape) paginateLineList.get(i)); + } } g2d.setPaintMode(); diff --git a/designer-realize/src/com/fr/start/module/DesignerStartup.java b/designer-realize/src/com/fr/start/module/DesignerStartup.java index dd2b09c53..f38ba8f0c 100644 --- a/designer-realize/src/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/com/fr/start/module/DesignerStartup.java @@ -7,6 +7,7 @@ import com.fr.start.Designer; import com.fr.start.EnvSwitcher; import com.fr.start.ReportSplashPane; import com.fr.start.SplashWindow; +import com.fr.startup.EnvInitializer; import com.fr.startup.activators.BasicActivator; /** @@ -16,7 +17,6 @@ public class DesignerStartup extends Activator { @Override public void start() { - startSub(PreStartActivator.class); //启动基础部分 startSub(BasicActivator.class);