Browse Source

Merge pull request #577 in DESIGN/design from ~XIAOXIA/design-10:feature/10.0 to feature/10.0

* commit '0c07b5851256f174dc464c2e593ebc2831d5fb69':
  修改包名, 移除ReportFitAttrProvider接口
  REPORT-10591 自适应插件内置 设计器部分
  REPORT-10591 自适应插件内置 设计器部分
  修改下接口
  REPORT-10591 自适应插件内置 设计器部分
  REPORT-10591 自适应插件内置 设计器部分
  REPORT-10591 自适应插件内置  国际化
  REPORT-10591 自适应插件内置  设计器部分
research/10.0
xiaoxia 6 years ago
parent
commit
74851737e9
  1. 31
      designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProcessor.java
  2. 15
      designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProvider.java
  3. 44
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java
  4. 21
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java
  5. 76
      designer-base/src/main/java/com/fr/design/reportfit/FitType.java
  6. 231
      designer-base/src/main/java/com/fr/design/reportfit/menupane/BrowserFitAttrPane.java
  7. 74
      designer-base/src/main/java/com/fr/design/reportfit/menupane/FitPreviewPane.java
  8. 80
      designer-base/src/main/java/com/fr/design/reportfit/menupane/FitRadioGroup.java
  9. 17
      designer-base/src/main/java/com/fr/design/reportfit/menupane/FontRadioGroup.java
  10. 107
      designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrAction.java
  11. 56
      designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrPane.java
  12. 76
      designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateBrowserFitAttrPane.java
  13. 55
      designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateFitAttrPane.java
  14. 12
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  15. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/fit.png
  16. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/preview/00.png
  17. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/preview/10.png
  18. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/preview/11.png
  19. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/preview/20.png
  20. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/preview/21.png
  21. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/preview/30.png
  22. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/preview/gray/00.png
  23. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/preview/gray/10.png
  24. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/preview/gray/11.png
  25. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/preview/gray/20.png
  26. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/preview/gray/21.png
  27. BIN
      designer-base/src/main/resources/com/fr/design/images/reportfit/preview/gray/30.png
  28. 34
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  29. 6
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  30. 21
      designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java
  31. 47
      designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitEditor.java
  32. 45
      designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java
  33. 10
      designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitRender.java
  34. 9
      designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitWrapper.java
  35. 2
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

31
designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProcessor.java

@ -1,31 +0,0 @@
package com.fr.design.fun;
import com.fr.stable.fun.ReportFitAttrProvider;
import com.fr.stable.fun.mark.Immutable;
import java.beans.PropertyDescriptor;
/**
* Created by Slpire on 2016/10/28.
*/
public interface FormElementCaseEditorProcessor extends Immutable {
String MARK_STRING = "PropertyEditor";
int CURRENT_LEVEL = 1;
/**
* 生成属性表
* @param temp 传入当前操作的class
* @param reportFitAttr 传入的自适应属性
* @return 返回属性表
*/
PropertyDescriptor[] createPropertyDescriptor(Class<?> temp, ReportFitAttrProvider reportFitAttr);
/**
* 返回pc自适应属性值
* @param fitAttrProvider 传入的自适应属性
* @return 返回pc自适应属性值
*/
int getFitStateInPC(ReportFitAttrProvider fitAttrProvider);
}

15
designer-base/src/main/java/com/fr/design/fun/FormElementCaseEditorProvider.java

@ -2,7 +2,6 @@ package com.fr.design.fun;
import com.fr.form.FormProvider; import com.fr.form.FormProvider;
import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.form.ui.ElementCaseEditorProvider;
import com.fr.stable.fun.ReportFitAttrProvider;
import com.fr.stable.fun.mark.Mutable; import com.fr.stable.fun.mark.Mutable;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
@ -18,18 +17,4 @@ public interface FormElementCaseEditorProvider extends Mutable {
PropertyDescriptor[] createPropertyDescriptor(Class<?> temp, FormProvider formProvider, ElementCaseEditorProvider editor); PropertyDescriptor[] createPropertyDescriptor(Class<?> temp, FormProvider formProvider, ElementCaseEditorProvider editor);
/**
* 生成属性表
* @param temp 传入当前操作的class
* @param reportFitAttr 传入的自适应属性
* @return 返回属性表
*/
PropertyDescriptor[] createPropertyDescriptor(Class<?> temp, ReportFitAttrProvider reportFitAttr);
/**
* 返回pc自适应属性值
* @param fitAttrProvider 传入的自适应属性
* @return 返回pc自适应属性值
*/
int getFitStateInPC(ReportFitAttrProvider fitAttrProvider);
} }

44
designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java

@ -1,44 +0,0 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.FormElementCaseEditorProcessor;
import com.fr.stable.fun.ReportFitAttrProvider;
import com.fr.stable.fun.mark.API;
import java.beans.PropertyDescriptor;
/**
* Created by zhouping on 2015/9/10.
*/
@API(level = FormElementCaseEditorProcessor.CURRENT_LEVEL)
public abstract class AbstractFormElementCaseEditorProcessor implements FormElementCaseEditorProcessor {
public int currentAPILevel() {
return CURRENT_LEVEL;
}
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
/**
* 生成属性表
* @param temp 传入当前操作的class
* @param reportFitAttr 传入的自适应属性
* @return 返回属性表
*/
@Override
public PropertyDescriptor[] createPropertyDescriptor(Class<?> temp, ReportFitAttrProvider reportFitAttr) {
return new PropertyDescriptor[0];
}
/**
* 返回pc自适应属性值
* @param fitAttrProvider 传入的自适应属性
* @return 返回pc自适应属性值
*/
@Override
public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) {
return 0;
}
}

21
designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java

@ -3,7 +3,6 @@ package com.fr.design.fun.impl;
import com.fr.design.fun.FormElementCaseEditorProvider; import com.fr.design.fun.FormElementCaseEditorProvider;
import com.fr.form.FormProvider; import com.fr.form.FormProvider;
import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.form.ui.ElementCaseEditorProvider;
import com.fr.stable.fun.ReportFitAttrProvider;
import com.fr.stable.fun.mark.API; import com.fr.stable.fun.mark.API;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
@ -28,24 +27,4 @@ public abstract class AbstractFormElementCaseEditorProvider implements FormEleme
return new PropertyDescriptor[0]; return new PropertyDescriptor[0];
} }
/**
* 生成属性表
* @param temp 传入当前操作的class
* @param reportFitAttr 传入的自适应属性
* @return 返回属性表
*/
@Override
public PropertyDescriptor[] createPropertyDescriptor(Class<?> temp, ReportFitAttrProvider reportFitAttr) {
return new PropertyDescriptor[0];
}
/**
* 返回pc自适应属性值
* @param fitAttrProvider 传入的自适应属性
* @return 返回pc自适应属性值
*/
@Override
public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) {
return 0;
}
} }

76
designer-base/src/main/java/com/fr/design/reportfit/FitType.java

@ -0,0 +1,76 @@
package com.fr.design.reportfit;
import com.fr.design.designer.properties.items.Item;
import com.fr.report.reportfit.ReportFitAttr;
import com.fr.stable.StringUtils;
/**
* Created by Administrator on 2016/4/13/0013.
*/
public enum FitType {
DEFAULT(0) {
@Override
public String description() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Default");
}
},
// 横向自适应, 纵向根据横向的比例来适配
HORIZONTAL_FIT(1) {
@Override
public String description() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Horizontal");
}
},
// 双向自适应, 横纵向都是根据页面宽高来计算
DOUBLE_FIT(2) {
@Override
public String description() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Horizontal_Vertical");
}
},
NOT_FIT(3) {
@Override
public String description() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-No");
}
};
private int state;
FitType(int state) {
this.state = state;
}
public static FitType parse(ReportFitAttr attr) {
if (attr == null) {
return DEFAULT;
}
for (FitType attrState : values()) {
if (attrState.state == attr.fitStateInPC()) {
return attrState;
}
}
return DEFAULT;
}
public int getState() {
return this.state;
}
public String description() {
return StringUtils.EMPTY;
}
public Item propertyItem() {
return new Item(this.description(), this.getState());
}
}

231
designer-base/src/main/java/com/fr/design/reportfit/menupane/BrowserFitAttrPane.java

@ -0,0 +1,231 @@
package com.fr.design.reportfit.menupane;
import com.fr.design.reportfit.FitType;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton;
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.log.FineLoggerFactory;
import com.fr.report.reportfit.ReportFitAttr;
import com.fr.reportfit.ReportFitConfig;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* Created by Administrator on 2016/5/5/0005.
*/
public class BrowserFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected FontRadioGroup fontRadioGroup;
protected FitRadioGroup fitRadionGroup;
protected UICheckBox globalCheck;
protected FitPreviewPane fitPreviewPane;
protected ReportFitAttr localFitAttr;
protected UIRadioButton defaultRadio;
protected UIRadioButton horizonRadio;
protected UIRadioButton doubleRadio;
protected UIRadioButton notFitRadio;
protected UIRadioButton fontFitRadio;
protected UIRadioButton fontNotFitRadio;
private UIButton editGlobalOps;
private JPanel borderPane;
private JPanel globalOpsPane;
private JPanel fitOpsPane;
public BrowserFitAttrPane() {
initComponents(ReportFitConfig.getInstance().getFrmFitAttr());
}
protected void initComponents(ReportFitAttr globalFitAttr) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
globalOpsPane = initGlobalOpsPane(globalFitAttr);
this.add(globalOpsPane, BorderLayout.NORTH);
fitOpsPane = initFitOpsPane();
}
protected void initBorderPane(String title) {
borderPane = FRGUIPaneFactory.createTitledBorderPaneCenter(title);
borderPane.add(fitOpsPane, BorderLayout.CENTER);
fitPreviewPane = new FitPreviewPane();
borderPane.add(fitPreviewPane, BorderLayout.SOUTH);
this.add(borderPane, BorderLayout.CENTER);
}
private JPanel initFitOpsPane() {
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, p, p, p, p};
ActionListener actionListener = getPreviewActionListener();
fontRadioGroup = new FontRadioGroup();
fontFitRadio = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit"));
fontFitRadio.setSelected(true);
fontNotFitRadio = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-No"));
addRadioToGroup(fontRadioGroup, fontFitRadio, fontNotFitRadio);
fontRadioGroup.addActionListener(actionListener);
fitRadionGroup = new FitRadioGroup();
defaultRadio = new UIRadioButton(FitType.DEFAULT.description());
horizonRadio = new UIRadioButton(FitType.HORIZONTAL_FIT.description());
doubleRadio = new UIRadioButton(FitType.DOUBLE_FIT.description());
notFitRadio = new UIRadioButton(FitType.NOT_FIT.description());
addRadioToGroup(fitRadionGroup, defaultRadio, horizonRadio, doubleRadio, notFitRadio);
fitRadionGroup.addActionListener(actionListener);
JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(initFitComponents(), rowSize, columnSize);
fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
return fitOpsPane;
}
protected Component[][] initFitComponents() {
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Font")), fontFitRadio, null, fontNotFitRadio},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Element")), defaultRadio, horizonRadio, doubleRadio, notFitRadio}
};
return components;
}
private void addRadioToGroup(ButtonGroup buttonGroup, UIRadioButton... radios) {
for (UIRadioButton radio : radios) {
buttonGroup.add(radio);
}
}
private JPanel initGlobalOpsPane(final ReportFitAttr globalFitAttr) {
final JPanel globalOpsPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
globalCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-UseGlobal"));
globalOpsPane.add(globalCheck);
globalCheck.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean isLocalConfig = !globalCheck.isSelected();
//勾选全局时,采用全局保存的自适应属性更新界面
if (!isLocalConfig) {
ReportFitAttr attr = globalFitAttr;
fontRadioGroup.selectFontFit(((ReportFitAttr) attr).isFitFont());
fitRadionGroup.selectIndexButton(attr.fitStateInPC());
fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled());
remove(BrowserFitAttrPane.this.borderPane);
initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Global"));
} else {
ReportFitAttr attr = localFitAttr;
fontRadioGroup.selectFontFit(((ReportFitAttr) attr).isFitFont());
fitRadionGroup.selectIndexButton(attr.fitStateInPC());
fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled());
remove(BrowserFitAttrPane.this.borderPane);
initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Local"));
}
fontRadioGroup.setEnabled(isLocalConfig);
fitRadionGroup.setEnabled(isLocalConfig);
editGlobalOps.setVisible(!isLocalConfig);
String fitOptions = getCurrentFitOptions();
fitPreviewPane.refreshPreview(fitOptions, fitRadionGroup.isEnabled());
}
});
editGlobalOps = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-EditGlobal"));
editGlobalOps.setVisible(false);
editGlobalOps.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
fontRadioGroup.setEnabled(true);
fitRadionGroup.setEnabled(true);
String fitOptions = getCurrentFitOptions();
fitPreviewPane.refreshPreview(fitOptions, fitRadionGroup.isEnabled());
}
public void mouseEntered(MouseEvent e) {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
public void mouseExited(MouseEvent e) {
setCursor(Cursor.getDefaultCursor());
}
});
globalOpsPane.add(editGlobalOps);
return globalOpsPane;
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-AttrSet");
}
@Override
public void populateBean(ReportFitAttr attr) {
if (attr == null) {
//如果为空, 就用全局的
attr = ReportFitConfig.getInstance().getFrmFitAttr();
populateGlobalComponents();
} else {
initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Local"));
}
this.localFitAttr = attr;
fontRadioGroup.selectFontFit((attr).isFitFont());
fitRadionGroup.selectIndexButton(attr.fitStateInPC());
fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled());
}
protected void populateGlobalComponents() {
globalCheck.setSelected(true);
fontRadioGroup.setEnabled(false);
fitRadionGroup.setEnabled(false);
editGlobalOps.setVisible(true);
initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Global"));
}
//有八种组合, 不过有意义的就是6种, 以此为key去缓存里找对应的预览图片
public String getCurrentFitOptions() {
return fitRadionGroup.getSelectRadioIndex() + "" + fontRadioGroup.getSelectRadioIndex();
}
private ActionListener getPreviewActionListener() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String fitOptions = getCurrentFitOptions();
fitPreviewPane.refreshPreview(fitOptions, fontRadioGroup.isEnabled());
}
};
}
@Override
public ReportFitAttr updateBean() {
ReportFitAttr attr = new ReportFitAttr();
attr.setFitFont(fontRadioGroup.isFontFit());
attr.setFitStateInPC(fitRadionGroup.getSelectRadioIndex());
// 直接用全局的
if (globalCheck.isSelected()) {
updateGlobalConfig(attr);
return null;
}
this.localFitAttr = attr;
return attr;
}
private void updateGlobalConfig(ReportFitAttr attr) {
try {
ReportFitConfig manager = ReportFitConfig.getInstance();
manager.setFrmFitAttr(attr);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
}

74
designer-base/src/main/java/com/fr/design/reportfit/menupane/FitPreviewPane.java

@ -0,0 +1,74 @@
package com.fr.design.reportfit.menupane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.IOUtils;
import javax.swing.ImageIcon;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Administrator on 2016/5/5/0005.
*/
public class FitPreviewPane extends BasicPane {
private static final String DEFAULT_FONT_TAG = "00";
private static final String DEFAULT_TAG = "01";
private static final String HORIZON_FONT_TAG = "10";
private static final String HORIZON_TAG = "11";
private static final String DOUBLE_FONT_TAG = "20";
private static final String DOUBLE_TAG = "21";
private static final String NOT_FONT_TAG = "30";
private static final String NOT_TAG = "31";
private UILabel imageLabel;
private Map<String, ImageIcon> cachedPreviewImage = new HashMap<String, ImageIcon>();
private Map<String, ImageIcon> globalCachedPreviewImage = new HashMap<String, ImageIcon>();
public FitPreviewPane() {
//初始化缓存图片, 有些无意义的组合.
initCacheImage();
//初始化组件
initComponents();
}
//默认和不自适应时,字体自适应不起效,只有6张图
private void initCacheImage() {
globalCachedPreviewImage.put(DEFAULT_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + DEFAULT_FONT_TAG + ".png")));
globalCachedPreviewImage.put(DEFAULT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + DEFAULT_FONT_TAG + ".png")));
globalCachedPreviewImage.put(HORIZON_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + HORIZON_FONT_TAG + ".png")));
globalCachedPreviewImage.put(HORIZON_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + HORIZON_TAG + ".png")));
globalCachedPreviewImage.put(DOUBLE_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + DOUBLE_FONT_TAG + ".png")));
globalCachedPreviewImage.put(DOUBLE_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + DOUBLE_TAG + ".png")));
globalCachedPreviewImage.put(NOT_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + NOT_FONT_TAG + ".png")));
globalCachedPreviewImage.put(NOT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/gray/" + NOT_FONT_TAG + ".png")));
cachedPreviewImage.put(DEFAULT_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + DEFAULT_FONT_TAG + ".png")));
cachedPreviewImage.put(DEFAULT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + DEFAULT_FONT_TAG + ".png")));
cachedPreviewImage.put(HORIZON_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + HORIZON_FONT_TAG + ".png")));
cachedPreviewImage.put(HORIZON_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + HORIZON_TAG + ".png")));
cachedPreviewImage.put(DOUBLE_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + DOUBLE_FONT_TAG + ".png")));
cachedPreviewImage.put(DOUBLE_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + DOUBLE_TAG + ".png")));
cachedPreviewImage.put(NOT_FONT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + NOT_FONT_TAG + ".png")));
cachedPreviewImage.put(NOT_TAG, new ImageIcon(IOUtils.readImage("/com/fr/design/images/reportfit/preview/" + NOT_FONT_TAG + ".png")));
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
imageLabel = new UILabel();
imageLabel.setIcon(cachedPreviewImage.get(DEFAULT_TAG));
this.add(imageLabel);
}
public void refreshPreview(String index, boolean isEditedable) {
ImageIcon newImageIcon = isEditedable ? cachedPreviewImage.get(index) : globalCachedPreviewImage.get(index);
imageLabel.setIcon(newImageIcon);
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Preview");
}
}

80
designer-base/src/main/java/com/fr/design/reportfit/menupane/FitRadioGroup.java

@ -0,0 +1,80 @@
package com.fr.design.reportfit.menupane;
import com.fr.design.gui.ibutton.UIRadioButton;
import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* 自适应四个按钮选项的group
* <p>
* Created by Administrator on 2016/5/5/0005.
*/
public class FitRadioGroup extends ButtonGroup {
private List<UIRadioButton> radioButtons = new ArrayList<UIRadioButton>();
@Override
public void add(AbstractButton button) {
super.add(button);
UIRadioButton radioButton = (UIRadioButton) button;
radioButtons.add(radioButton);
}
/**
* 设置按钮状态
*/
public boolean isEnabled() {
return radioButtons.get(0).isEnabled();
}
/**
* 设置按钮状态
*/
public void setEnabled(boolean enabled) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.setEnabled(enabled);
}
}
/**
* 获取当前选中的按钮index
*
* @return 按钮index
*/
public int getSelectRadioIndex() {
for (int i = 0, len = radioButtons.size(); i < len; i++) {
if (radioButtons.get(i).isSelected()) {
return i;
}
}
return 0;
}
/**
* 选中指定index的按钮
*/
public void selectIndexButton(int index) {
if (index < 0 || index > radioButtons.size() - 1) {
return;
}
UIRadioButton button = radioButtons.get(index);
button.setSelected(true);
}
/**
* 给所有的按钮加上监听
*/
public void addActionListener(ActionListener actionListener) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.addActionListener(actionListener);
}
}
}

17
designer-base/src/main/java/com/fr/design/reportfit/menupane/FontRadioGroup.java

@ -0,0 +1,17 @@
package com.fr.design.reportfit.menupane;
/**
* 字体的两个选项组成的group
* <p>
* Created by Administrator on 2016/5/5/0005.
*/
public class FontRadioGroup extends FitRadioGroup {
public void selectFontFit(boolean isFontFit) {
selectIndexButton(isFontFit ? 0 : 1);
}
public boolean isFontFit() {
return getSelectRadioIndex() == 0;
}
}

107
designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrAction.java

@ -0,0 +1,107 @@
package com.fr.design.reportfit.menupane;
import com.fr.base.BaseUtils;
import com.fr.design.actions.JTemplateAction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
import com.fr.report.reportfit.FitProvider;
import com.fr.report.reportfit.ReportFitAttr;
import javax.swing.KeyStroke;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
/**
* Created by Administrator on 2015/7/6 0006.
*/
public class ReportFitAttrAction extends JTemplateAction {
private static final Dimension MEDIUM = new Dimension(430, 400);
private static final MenuKeySet REPORT_FIT_ATTR = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'T';
}
@Override
public String getMenuName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Template");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'T';
}
@Override
public String getMenuName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Elementcase");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
public ReportFitAttrAction(JTemplate jTemplate) {
super(jTemplate);
initMenuStyle();
}
private void initMenuStyle() {
JTemplate jTemplate = getEditingComponent();
if (jTemplate.isJWorkBook()) {
this.setMenuKeySet(REPORT_FIT_ATTR);
} else {
this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE);
}
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/reportfit/fit.png"));
}
/**
* Action触发事件
*
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
final JTemplate jwb = getEditingComponent();
if (jwb == null) {
return;
}
final FitProvider wbTpl = (FitProvider) jwb.getTarget();
ReportFitAttr fitAttr = wbTpl.getReportFitAttr();
if (jwb.isJWorkBook()) {
final TemplateFitAttrPane attrPane = new TemplateFitAttrPane();
showReportFitDialog(fitAttr, jwb, wbTpl, attrPane);
} else {
final ReportFitAttrPane attrPane = new ReportFitAttrPane();
showReportFitDialog(fitAttr, jwb, wbTpl, attrPane);
}
}
private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane<ReportFitAttr> attrPane) {
attrPane.populateBean(fitAttr);
UIDialog dialog = attrPane.showUnsizedWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
wbTpl.setReportFitAttr(attrPane.updateBean());
jwb.fireTargetModified();
}
});
dialog.setSize(MEDIUM);
dialog.setVisible(true);
}
}

56
designer-base/src/main/java/com/fr/design/reportfit/menupane/ReportFitAttrPane.java

@ -0,0 +1,56 @@
package com.fr.design.reportfit.menupane;
import com.fr.design.beans.BasicBeanPane;
import com.fr.report.reportfit.ReportFitAttr;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
/**
* Created by Administrator on 2015/7/6 0006.
*/
public class ReportFitAttrPane extends BasicBeanPane<ReportFitAttr> {
private BrowserFitAttrPane attrPane;
public ReportFitAttrPane() {
initComponents();
}
private void initComponents() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
attrPane = new BrowserFitAttrPane();
this.add(attrPane);
}
/**
* 展示界面
*
* @param fitAttr 自适应属性
*/
public void populateBean(ReportFitAttr fitAttr) {
attrPane.populateBean(fitAttr);
}
/**
* 提交数据
*
* @return 界面上的更新数据
*/
public ReportFitAttr updateBean() {
return attrPane.updateBean();
}
/**
* 标题
*
* @return 标题
*/
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Attr");
}
}

76
designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateBrowserFitAttrPane.java

@ -0,0 +1,76 @@
package com.fr.design.reportfit.menupane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.log.FineLoggerFactory;
import com.fr.report.reportfit.ReportFitAttr;
import com.fr.reportfit.ReportFitConfig;
import java.awt.Component;
/**
* Created by 夏翔 on 2016/6/24.
*/
public class TemplateBrowserFitAttrPane extends BrowserFitAttrPane {
public TemplateBrowserFitAttrPane() {
initComponents(ReportFitConfig.getInstance().getCptFitAttr());
}
@Override
protected Component[][] initFitComponents() {
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Font")), fontFitRadio, null, fontNotFitRadio},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Element")), horizonRadio, doubleRadio, notFitRadio}
};
return components;
}
@Override
public void populateBean(ReportFitAttr attr) {
//模板界面,自适应选项去掉了默认,这边的判断为了兼容之前的设置
if (attr != null && attr.fitStateInPC() == 0) {
attr.setFitStateInPC(3);
}
ReportFitAttr fitAttr = ReportFitConfig.getInstance().getCptFitAttr();
if (attr == null) {
//如果为空, 就用全局的
attr = fitAttr;
populateGlobalComponents();
} else if (fitAttr.fitStateInPC() == 0) {
attr = new ReportFitAttr();
attr.setFitStateInPC(3);
initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Local"));
} else {
initBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Local"));
}
this.localFitAttr = attr;
fontRadioGroup.selectFontFit((attr).isFitFont());
fitRadionGroup.selectIndexButton(attr.fitStateInPC());
fitPreviewPane.refreshPreview(getCurrentFitOptions(), fitRadionGroup.isEnabled());
}
@Override
public ReportFitAttr updateBean() {
ReportFitAttr attr = new ReportFitAttr();
attr.setFitFont(fontRadioGroup.isFontFit());
attr.setFitStateInPC(fitRadionGroup.getSelectRadioIndex());
// 直接用全局的
if (globalCheck.isSelected()) {
updateGlobalConfig(attr);
return null;
}
this.localFitAttr = attr;
return attr;
}
private void updateGlobalConfig(ReportFitAttr attr) {
try {
ReportFitConfig manager = ReportFitConfig.getInstance();
manager.setCptFitAttr(attr);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
}

55
designer-base/src/main/java/com/fr/design/reportfit/menupane/TemplateFitAttrPane.java

@ -0,0 +1,55 @@
package com.fr.design.reportfit.menupane;
import com.fr.design.beans.BasicBeanPane;
import com.fr.report.reportfit.ReportFitAttr;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
/**
* Created by 夏翔 on 2016/6/24.
*/
public class TemplateFitAttrPane extends BasicBeanPane<ReportFitAttr> {
private TemplateBrowserFitAttrPane attrPane;
public TemplateFitAttrPane() {
initComponents();
}
private void initComponents() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
attrPane = new TemplateBrowserFitAttrPane();
this.add(attrPane);
}
/**
* 展示界面
*
* @param fitAttr 自适应属性
*/
public void populateBean(ReportFitAttr fitAttr) {
attrPane.populateBean(fitAttr);
}
/**
* 提交数据
*
* @return 界面上的更新数据
*/
public ReportFitAttr updateBean() {
return attrPane.updateBean();
}
/**
* 标题
*
* @return 标题
*/
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Attr");
}
}

12
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -65,12 +65,12 @@ public class DesignUtils {
* @return 启动了返回true * @return 启动了返回true
*/ */
public static boolean isStarted() { public static boolean isStarted() {
try { // try {
new Socket("localhost", port); // new Socket("localhost", port);
return true; // return true;
} catch (Exception exp) { // } catch (Exception exp) {
//
} // }
return false; return false;
} }

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/fit.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 B

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/preview/00.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/preview/10.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/preview/11.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/preview/20.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/preview/21.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 B

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/preview/30.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 B

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/preview/gray/00.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/preview/gray/10.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/preview/gray/11.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/preview/gray/20.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/preview/gray/21.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

BIN
designer-base/src/main/resources/com/fr/design/images/reportfit/preview/gray/30.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

34
designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java

@ -4,7 +4,6 @@ import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; import com.fr.design.designer.properties.mobile.ElementCasePropertyUI;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.FormElementCaseEditorProcessor;
import com.fr.design.fun.FormElementCaseEditorProvider; import com.fr.design.fun.FormElementCaseEditorProvider;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider; import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider;
@ -13,17 +12,18 @@ import com.fr.design.mainframe.*;
import com.fr.design.mainframe.widget.editors.ElementCaseToolBarEditor; import com.fr.design.mainframe.widget.editors.ElementCaseToolBarEditor;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.propertypane.BrowserFitPropertyEditor;
import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider; import com.fr.form.FormElementCaseProvider;
import com.fr.form.FormProvider; import com.fr.form.FormProvider;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.form.ui.ElementCaseEditorProvider;
import com.fr.report.reportfit.ReportFitAttr;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.stable.fun.FitProvider; import com.fr.report.reportfit.FitProvider;
import com.fr.stable.fun.ReportFitAttrProvider;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -104,35 +104,39 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
new CRPropertyDescriptor("toolBars", this.data.getClass()).setEditorClass(ElementCaseToolBarEditor.class) new CRPropertyDescriptor("toolBars", this.data.getClass()).setEditorClass(ElementCaseToolBarEditor.class)
.setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_EC_Toolbar")) .setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_EC_Toolbar"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced")
}; };
CRPropertyDescriptor[] extraTableEditor = getExtraTableEditor(); CRPropertyDescriptor[] extraTableEditor = getExtraTableEditor();
return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraTableEditor); return ArrayUtils.addAll(propertyTableEditor, extraTableEditor);
} }
public CRPropertyDescriptor[] getExtraTableEditor(){ public CRPropertyDescriptor[] getExtraTableEditor(){
CRPropertyDescriptor[] extraTableEditor = resolveCompatible(); CRPropertyDescriptor[] extraTableEditor = resolveCompatible();
FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING); return ArrayUtils.addAll(extraTableEditor, new CRPropertyDescriptor[] {getReportFitEditor()});
if (processor == null) { }
return extraTableEditor;
} private CRPropertyDescriptor getReportFitEditor() {
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
FitProvider wbTpl = (FitProvider) designer.getTarget(); FitProvider wbTpl = designer.getTarget();
ReportFitAttrProvider fitAttr = wbTpl.getFitAttr(); ReportFitAttr fitAttr = wbTpl.getReportFitAttr();
ElementCaseEditor editor = this.toData(); ElementCaseEditor editor = this.toData();
//兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应) //兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应)
if (editor.getFitStateInPC() == 0) { if (editor.getFitStateInPC() == 0) {
editor.setReportFitAttr(null); editor.setReportFitAttr(null);
} }
ReportFitAttrProvider reportFit = editor.getReportFitAttr(); ReportFitAttr reportFit = editor.getReportFitAttr();
if(fitAttr != null){ if(fitAttr != null){
reportFit = fitAttr.fitInBrowser() ? editor.getReportFitAttr() : fitAttr; reportFit = fitAttr.fitInBrowser() ? editor.getReportFitAttr() : fitAttr;
} }
ReportFitAttrProvider reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : reportFit; ReportFitAttr reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : reportFit;
PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass(), reportFitAttr); BrowserFitPropertyEditor browserFitPropertyEditor = new BrowserFitPropertyEditor();
CRPropertyDescriptor extraEditor = browserFitPropertyEditor.createPropertyDescriptor(this.data.getClass(), reportFitAttr);
if (editor.getReportFitAttr() == null) { if (editor.getReportFitAttr() == null) {
editor.setReportFitInPc(processor.getFitStateInPC(fitAttr)); editor.setReportFitInPc(browserFitPropertyEditor.getFitStateInPC(fitAttr));
} }
return (CRPropertyDescriptor[]) ArrayUtils.addAll(extraTableEditor, extraEditor); return extraEditor;
} }

6
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -32,10 +32,10 @@ import com.fr.design.gui.xpane.FormHyperlinkGroupPane;
import com.fr.design.gui.xpane.FormHyperlinkGroupPaneNoPop; import com.fr.design.gui.xpane.FormHyperlinkGroupPaneNoPop;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.actions.EmbeddedFormExportExportAction; import com.fr.design.mainframe.actions.EmbeddedFormExportExportAction;
import com.fr.design.mainframe.actions.FormMobileAttrAction;
import com.fr.design.mainframe.actions.TemplateParameterAction; import com.fr.design.mainframe.actions.TemplateParameterAction;
import com.fr.design.mainframe.form.FormECCompositeProvider; import com.fr.design.mainframe.form.FormECCompositeProvider;
import com.fr.design.mainframe.form.FormECDesignerProvider; import com.fr.design.mainframe.form.FormECDesignerProvider;
import com.fr.design.reportfit.menupane.ReportFitAttrAction;
import com.fr.design.mainframe.templateinfo.JFormProcessInfo; import com.fr.design.mainframe.templateinfo.JFormProcessInfo;
import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
@ -503,9 +503,9 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override @Override
public ShortCut[] shortcut4TemplateMenu() { public ShortCut[] shortcut4TemplateMenu() {
if (this.index == FORM_TAB) { if (this.index == FORM_TAB) {
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this)}, new ShortCut[0]); return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]);
} else { } else {
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu());
} }
} }

21
designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitAlignmentItems.java

@ -0,0 +1,21 @@
package com.fr.design.mainframe.widget.propertypane;
import com.fr.design.reportfit.FitType;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.designer.properties.items.ItemProvider;
public class BrowserFitAlignmentItems implements ItemProvider {
private static Item[] VALUE_ITEMS = {
FitType.HORIZONTAL_FIT.propertyItem(),
FitType.DOUBLE_FIT.propertyItem(),
FitType.NOT_FIT.propertyItem(),
};
@Override
public Item[] getItems() {
return VALUE_ITEMS;
}
}

47
designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitEditor.java

@ -0,0 +1,47 @@
package com.fr.design.mainframe.widget.propertypane;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.designer.properties.items.ItemProvider;
import com.fr.design.mainframe.widget.editors.ComboEditor;
import java.util.Vector;
public class BrowserFitEditor extends ComboEditor {
public BrowserFitEditor() {
this(new BrowserFitAlignmentItems());
}
public BrowserFitEditor(ItemProvider provider) {
this(provider.getItems());
}
public BrowserFitEditor(Item[] items) {
super(items);
}
public BrowserFitEditor(Vector<Item> items) {
super(items);
}
@Override
public Object getValue() {
Item item = (Item) comboBox.getSelectedItem();
return item.getValue();
}
@Override
public void setValue(Object value) {
Item item = new Item("", value);
comboBox.setSelectedItem(item);
}
/**
* 是否立即刷新
*
* @return 是或者否
*/
@Override
public boolean refreshInTime() {
return false;
}
}

45
designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitPropertyEditor.java

@ -0,0 +1,45 @@
package com.fr.design.mainframe.widget.propertypane;
import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.report.reportfit.ReportFitAttr;
import com.fr.reportfit.ReportFitConfig;
import java.beans.IntrospectionException;
/**
* Created by zhouping on 2015/9/10.
*/
public class BrowserFitPropertyEditor {
/**
* 生成属性表
*
* @param temp 传入当前操作的class
* @param reportFitAttr 传入的自适应属性
* @return 返回属性表
*/
public CRPropertyDescriptor createPropertyDescriptor(Class<?> temp, ReportFitAttr reportFitAttr) {
if (getFitStateInPC(reportFitAttr) == 0) {
return null;
}
try {
CRPropertyDescriptor propertyDescriptors = new CRPropertyDescriptor("fitStateInPC", temp).setEditorClass(BrowserFitEditor.class)
.setRendererClass(BrowserFitRender.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-In-Web"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced");
return propertyDescriptors;
} catch (IntrospectionException e) {
return null;
}
}
public int getFitStateInPC(ReportFitAttr fitAttrProvider) {
if (fitAttrProvider != null) {
return fitAttrProvider.fitStateInPC();
}
return ReportFitConfig.getInstance().getFrmFitAttr().fitStateInPC();
}
}

10
designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitRender.java

@ -0,0 +1,10 @@
package com.fr.design.mainframe.widget.propertypane;
import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer;
public class BrowserFitRender extends EncoderCellRenderer {
public BrowserFitRender() {
super(new BrowserFitWrapper());
}
}

9
designer-form/src/main/java/com/fr/design/mainframe/widget/propertypane/BrowserFitWrapper.java

@ -0,0 +1,9 @@
package com.fr.design.mainframe.widget.propertypane;
import com.fr.design.designer.properties.ItemWrapper;
public class BrowserFitWrapper extends ItemWrapper {
public BrowserFitWrapper() {
super(new BrowserFitAlignmentItems());
}
}

2
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -41,6 +41,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.gui.icontainer.UIModeControlContainer;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.reportfit.menupane.ReportFitAttrAction;
import com.fr.design.mainframe.templateinfo.JWorkBookProcessInfo; import com.fr.design.mainframe.templateinfo.JWorkBookProcessInfo;
import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
@ -698,6 +699,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
new ReportWebAttrAction(this), new ReportWebAttrAction(this),
new ReportExportAttrAction(this), new ReportExportAttrAction(this),
new ReportParameterAction(this), new ReportParameterAction(this),
new ReportFitAttrAction(this),
new ReportMobileAttrAction(this), new ReportMobileAttrAction(this),
new ReportPrintSettingAction(this), new ReportPrintSettingAction(this),
new ReportWatermarkAction(this), new ReportWatermarkAction(this),

Loading…
Cancel
Save