Browse Source

REPORT-43198 预定义样式功能优化代码回退

feature/big-screen
kerry 4 years ago
parent
commit
184c97428d
  1. 2
      designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java
  2. 6
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundNoImagePane.java
  3. 8
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java
  4. 6
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java
  5. 104
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  6. 40
      designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java
  7. 56
      designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractTemplateInfoCollector.java
  8. 5
      designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointCollector.java
  9. 4
      designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java
  10. 140
      designer-base/src/main/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollector.java
  11. 2
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ReportPredefinedStylePane.java
  12. 6
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ColorDetailPane.java
  13. 7
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentFrameStylePane.java
  14. 7
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentTitleStylePane.java
  15. 2
      designer-base/src/main/java/com/fr/design/mainframe/template/info/SendHelper.java
  16. 4
      designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java
  17. 7
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  18. 36
      designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java
  19. 192
      designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java
  20. 29
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java
  21. 6
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  22. 59
      designer-base/src/main/java/com/fr/design/utils/PredefinedStyleUtils.java
  23. 97
      designer-base/src/test/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollectorTest.java
  24. 2
      designer-base/src/test/resources/com/fr/design/mainframe/predefined/info/predefinedStyle.info
  25. 13
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java
  26. 11
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  27. 17
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  28. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
  29. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  30. 17
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  31. 4
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  32. 1
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  33. 3
      designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java
  34. 13
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/BorderStyleWidgetDefinePane.java
  35. 13
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
  36. 35
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  37. 32
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  38. 17
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java
  39. 17
      designer-realize/src/main/java/com/fr/design/actions/cell/GlobalStyleMenuDef.java
  40. 9
      designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java
  41. 4
      designer-realize/src/main/java/com/fr/design/actions/server/predefined/ServerPredefinedStyleAction.java
  42. 6
      designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java
  43. 2
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java
  44. 14
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  45. 16
      designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java
  46. 4
      designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java
  47. 92
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  48. 4
      designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java
  49. 2
      designer-realize/src/main/java/com/fr/design/report/ReportPredefinedBackgroundPane.java
  50. 4
      designer-realize/src/main/java/com/fr/design/style/BorderUtils.java
  51. 6
      designer-realize/src/main/java/com/fr/grid/Grid.java
  52. 28
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  53. 14
      designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java
  54. 5
      designer-realize/src/main/java/com/fr/start/MainDesigner.java

2
designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java

@ -55,7 +55,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
private static final int ANGEL = 90;
private static final int GAP = 23;
private static final int VERGAP = 3;
private static final Dimension SPINNER_DIMENSION = new Dimension(70, 20);
private static final Dimension SPINNER_DIMENSION = new Dimension(75, 20);
private static final String[] TEXT = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Wrap_Text"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Single_Line"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Single_Line(Adjust_Font)"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Multi_Line(Adjust_Font)")};

6
designer-base/src/main/java/com/fr/design/gui/style/BackgroundNoImagePane.java

@ -28,7 +28,7 @@ public class BackgroundNoImagePane extends BackgroundPane{
fireStateChanged();
}
});
GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane();
GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() {
@Override
@ -42,8 +42,4 @@ public class BackgroundNoImagePane extends BackgroundPane{
gradientPane
};
}
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){
return new GradientBackgroundQuickPane();
}
}

8
designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java

@ -71,7 +71,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill"), SwingConstants.LEFT),typeComboBox},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill") + " ", SwingConstants.LEFT),typeComboBox},
new Component[]{null, centerPane}
};
double[] rowSize = {p, p, p};
@ -89,7 +89,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
kinds.add(new TextureBackgroundQuickPane());
kinds.add(new PatternBackgroundQuickPane());
kinds.add(new ImageBackgroundQuickPane());
kinds.add(createGradientBackgroundQuickPane());
kinds.add(new GradientBackgroundQuickPane());
Set<BackgroundQuickUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(BackgroundQuickUIProvider.MARK_STRING);
for (BackgroundQuickUIProvider provider : providers) {
kinds.add(provider.appearanceForBackground());
@ -98,10 +98,6 @@ public class BackgroundPane extends AbstractBasicStylePane {
return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
}
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){
return new GradientBackgroundQuickPane();
}
/**
* 事件监听

6
designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java

@ -39,7 +39,7 @@ public class BackgroundSpecialPane extends BackgroundPane{
fireStateChanged();
}
});
GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane();
GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
@ -68,8 +68,4 @@ public class BackgroundSpecialPane extends BackgroundPane{
return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
}
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){
return new GradientBackgroundQuickPane();
}
}

104
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -6,7 +6,6 @@ import com.fr.base.Parameter;
import com.fr.base.ScreenResolution;
import com.fr.base.io.BaseBook;
import com.fr.base.iofile.attr.DesignBanCopyAttrMark;
import com.fr.base.iofile.attr.PredefinedStyleAttrMark;
import com.fr.base.iofile.attr.TemplateIdAttrMark;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter;
@ -39,9 +38,6 @@ import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.predefined.info.PredefinedStyleInfoCollector;
import com.fr.design.mainframe.predefined.ui.ReportPredefinedStylePane;
import com.fr.design.mainframe.predefined.ui.dialog.ReportPredefinedStyleDialog;
import com.fr.design.mainframe.template.info.TemplateInfoCollector;
import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.design.mainframe.template.info.TimeConsumeTimer;
@ -51,8 +47,6 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut;
import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.PredefinedStyleUtils;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.file.FILE;
@ -61,7 +55,6 @@ import com.fr.file.MemFILE;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
@ -80,17 +73,13 @@ import com.fr.stable.StringUtils;
import com.fr.stable.core.UUID;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Set;
@ -101,8 +90,6 @@ import java.awt.BorderLayout;
* 报表设计和表单设计的编辑区域(设计器编辑的IO文件)
*/
public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>> extends TargetComponent<T> implements ToolBarMenuDockPlus, DesignerProxy {
private static final int PREDEFINED_ICON_WIDTH = 27;
// TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null
private static final int PREFIX_NUM = 3000;
private FILE editingFILE = null;
@ -121,7 +108,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
private PreviewProvider previewType;
protected TimeConsumeTimer consumeTimer = new TimeConsumeTimer();
public int resolution = ScreenResolution.getScreenResolution();
private UIButton predefinedBtn;
private PluginEventListener pluginListener;
@ -156,21 +142,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
consumeTimer.setEnabled(shouldInitForCollectInfo(isNewFile));
initAndStartPlugin();
setPredefinedInfo(isNewFile);
}
private void setPredefinedInfo(boolean isNewFile) {
if (this.template.getAttrMark(PredefinedStyleAttrMark.XML_TAG) == null) {
PredefinedStyleAttrMark attrMark = PredefinedStyleAttrMark.createDefaultStyleMark();
if (!isNewFile || !PredefinedStyleUtils.isAllowPredefinedSetting()) {
attrMark.setPreferenceStyleName(InterProviderFactory.getProvider().getLocText("Fine-Engine_Predefined_Style_Compatibility"));
}
this.template.addAttrMark(attrMark);
}
}
private void initAndStartPlugin() {
initPluginPane();
startListenPlugin();
@ -572,18 +545,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
protected abstract void applyUndoState(U u);
protected void refreshPredefinedState() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if(predefinedBtn != null){
JTemplate.this.predefinedBtn.setText(getTemplatePredefinedStyle());
setPredefinedButtonSize(predefinedBtn);
}
}
});
}
/**
* 停止编辑, 判断保存属性 *
*/
@ -835,9 +796,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (editingFILE == null || editingFILE instanceof MemFILE) {
return false;
}
PredefinedStyleInfoCollector.getInstance().collectUseNumber(this.getTemplatePredefinedStyle());
try {
this.getTarget().setPredefinedStyleName(this.getTemplatePredefinedStyle(), false);
this.getTarget().export(editingFILE.asOutputStream());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -1337,65 +1296,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
for (DesignerFrameUpButtonProvider provider : providers) {
uiButtons = ArrayUtils.addAll(uiButtons, provider.getUpButtons(getMenuState()));
}
predefinedBtn = createPreDefinedButton();
if (predefinedBtn != null) {
uiButtons = ArrayUtils.addAll(uiButtons, new UIButton[]{predefinedBtn});
}
return uiButtons;
}
private UIButton createPreDefinedButton() {
UIButton preferenceButton = new UIButton(BaseUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png"));
preferenceButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Template_Style"));
preferenceButton.setText(getTemplatePredefinedStyle());
preferenceButton.setAlignmentX(SwingConstants.LEFT);
setPredefinedButtonSize(preferenceButton);
preferenceButton.set4ToolbarButton();
preferenceButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
ReportPredefinedStylePane stylePane = new ReportPredefinedStylePane(JTemplate.this);
ReportPredefinedStyleDialog dialog = new ReportPredefinedStyleDialog(designerFrame, stylePane);
PredefinedStyleInfoCollector.getInstance().collectClickNumber();
dialog.setVisible(true);
}
});
preferenceButton.setEnabled(PredefinedStyleUtils.isAllowPredefinedSetting());
return preferenceButton;
}
private void setPredefinedButtonSize(UIButton predefinedBtn) {
String text = predefinedBtn.getText();
FontMetrics metrics = predefinedBtn.getFontMetrics(predefinedBtn.getFont());
predefinedBtn.setPreferredSize(new Dimension(Math.min(metrics.stringWidth(text) + PREDEFINED_ICON_WIDTH, 100), 20));
}
public void resetPredefinedStyle(String styleName) {
this.getTarget().setPredefinedStyleName(styleName, true);
refreshPredefinedState();
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
JTemplate.this.fireTargetModified();
JTemplate.this.repaint();
}
});
}
public String getTemplatePredefinedStyle(){
PredefinedStyleAttrMark attrMark = this.getTarget().getAttrMark(PredefinedStyleAttrMark.XML_TAG);
if (attrMark == null){
attrMark = PredefinedStyleAttrMark.createDefaultStyleMark();
}
return attrMark.getPreferenceStyleName();
return uiButtons;
}
/**
* 由于老版本的模板没有模板ID当勾选使用参数模板时候就加一个模板ID attr
*
@ -1419,4 +1323,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return getEditingFILE().getName();
}
public String getTemplatePredefinedStyle(){
return StringUtils.EMPTY;
}
}

40
designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.burying.point;
import com.fr.base.FRContext;
import com.fr.base.io.XMLReadHelper;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.template.info.SendHelper;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
@ -19,20 +20,25 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-02-21
*/
public abstract class AbstractPointCollector implements BasePointCollector {
public abstract class AbstractPointCollector<T extends AbstractPointInfo> implements BasePointCollector {
protected Map<String, T> pointInfoMap;
private static final int MAX_SIZE = 512 * 1024 * 1024;
public AbstractPointCollector() {
pointInfoMap = new ConcurrentHashMap<>();
loadFromFile();
}
/**
@ -42,6 +48,34 @@ public abstract class AbstractPointCollector implements BasePointCollector {
return FileUtils.sizeOf(getInfoFile()) <= MAX_SIZE && DesignerEnvManager.getEnvManager().isJoinProductImprove() && FRContext.isChineseEnv();
}
@Override
public void sendPointInfo() {
addIdleDayCount();
List<String> removeList = new ArrayList<>();
List<String> sendList = new ArrayList<>();
for (String key : pointInfoMap.keySet()) {
AbstractPointInfo pointInfo = pointInfoMap.get(key);
pointInfo.selectPoint(removeList, sendList);
}
// 发送记录
for (String key : sendList) {
if(SendHelper.sendPointInfo(pointInfoMap.get(key))){
removeList.add(key);
}
}
// 清空记录
for (String key : removeList) {
pointInfoMap.remove(key);
}
saveInfo();
}
/**
* 从文件中读取埋点信息
*/

56
designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractTemplateInfoCollector.java

@ -1,56 +0,0 @@
package com.fr.design.mainframe.burying.point;
import com.fr.design.mainframe.template.info.SendHelper;
import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Created by kerry on 2020-09-04
*/
public abstract class AbstractTemplateInfoCollector<T extends AbstractPointInfo> extends AbstractPointCollector {
protected Map<String, T> pointInfoMap;
public AbstractTemplateInfoCollector() {
pointInfoMap = new ConcurrentHashMap<>();
loadFromFile();
}
/**
* 保存埋点的信息到本地
*/
public abstract void collectInfo(String templateID, String originID, TemplateProcessInfo processInfo, int timeConsume);
@Override
public void sendPointInfo() {
addIdleDayCount();
List<String> removeList = new ArrayList<>();
List<String> sendList = new ArrayList<>();
for (String key : pointInfoMap.keySet()) {
BasePointInfo pointInfo = pointInfoMap.get(key);
pointInfo.selectPoint(removeList, sendList);
}
// 发送记录
for (String key : sendList) {
if(SendHelper.sendPointInfo(pointInfoMap.get(key))){
removeList.add(key);
}
}
// 清空记录
for (String key : removeList) {
pointInfoMap.remove(key);
}
saveInfo();
}
}

5
designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointCollector.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.burying.point;
import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLWriter;
@ -15,4 +16,8 @@ public interface BasePointCollector extends XMLReadable, XMLWriter {
*/
public void sendPointInfo();
/**
* 保存埋点的信息到本地
*/
public void collectInfo(String templateID, String originID, TemplateProcessInfo processInfo, int timeConsume);
}

4
designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java

@ -4,7 +4,7 @@ import com.fr.base.io.BaseBook;
import com.fr.chartx.attr.ChartProvider;
import com.fr.chartx.config.info.AbstractConfig;
import com.fr.chartx.config.info.constant.ConfigType;
import com.fr.design.mainframe.burying.point.AbstractTemplateInfoCollector;
import com.fr.design.mainframe.burying.point.AbstractPointCollector;
import com.fr.design.mainframe.template.info.TemplateInfo;
import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.general.ComparatorUtils;
@ -21,7 +21,7 @@ import java.util.Map;
* @version 10.0
* Created by Bjorn on 2020-02-18
*/
public class ChartInfoCollector extends AbstractTemplateInfoCollector<ChartInfo> {
public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
private static final String XML_TAG = "ChartInfoCollector";
private static final String XML_LAST_EDIT_DAY = "lastEditDay";

140
designer-base/src/main/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollector.java

@ -1,140 +0,0 @@
package com.fr.design.mainframe.predefined.info;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.burying.point.AbstractPointCollector;
import com.fr.design.mainframe.template.info.SendHelper;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.json.JSONObject;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.joda.time.DateTime;
/**
* Created by kerry on 2020-09-04
*/
public class PredefinedStyleInfoCollector extends AbstractPointCollector {
//每三天上传一次
private static final long DELTA = 3 * 24 * 3600 * 1000L;
private static final String SIMPLE_DATE_PATTERN = "yyyy-MM-dd";
private static final String XML_TAG = "PredefinedStyleInfo";
private static final String XML_FILE_NAME = "predefinedStyle.info";
private static final String CLOUD_URL = CloudCenter.getInstance().acquireUrlByKind("design.collector") + "/single";
private static final String FUNCTION_NAME = "predefinedStyle";
private static final String FUNCTION_ID = "FR-F7003";
private static final String ATTR_FUNCTION_NAME = "functionName";
private static final String ATTR_FUNCTION_ID = "functionId";
private static final String ATTR_UUID = "uuid";
private static final String ATTR_UID = "uid";
private static final String ATTR_JAR_TIME = "jatTime";
private static final String ATTR_CLICK_NUMBER = "clickNumber";
private static final String ATTR_USE_NUMBER = "useNumber";
private static final String ATTR_TIME = "time";
private static final String XML_LAST_TIME = "lastSendTime";
/**
* 上一次的发送时间
*/
private long lastSendTime;
private int clickNumber = 0;
private int useNumber = 0;
public int getClickNumber() {
return clickNumber;
}
public int getUseNumber() {
return useNumber;
}
private static class Holder {
private static PredefinedStyleInfoCollector collector = new PredefinedStyleInfoCollector();
}
private PredefinedStyleInfoCollector() {
loadFromFile();
}
public static PredefinedStyleInfoCollector getInstance() {
return Holder.collector;
}
public void collectClickNumber() {
clickNumber++;
saveInfo();
}
public void collectUseNumber(String predefinedName) {
if (!ComparatorUtils.equals(Toolkit.i18nText("Fine-Engine_Predefined_Style_Compatibility"), predefinedName) &&
!ComparatorUtils.equals(Toolkit.i18nText("Fine-Engine_Report_DEFAULT"), predefinedName)) {
useNumber++;
}
saveInfo();
}
@Override
protected String getInfoFilePath() {
return XML_FILE_NAME;
}
@Override
protected void addIdleDayCount() {
}
@Override
public void sendPointInfo() {
if (System.currentTimeMillis() - lastSendTime < DELTA) {
return;
}
String content = generateTotalInfo();
SendHelper.sendSinglePointInfo(CLOUD_URL, content);
this.lastSendTime = System.currentTimeMillis();
this.clickNumber = 0;
this.useNumber = 0;
saveInfo();
}
public String generateTotalInfo() {
JSONObject jo = JSONObject.create();
jo.put(ATTR_FUNCTION_NAME, FUNCTION_NAME);
jo.put(ATTR_FUNCTION_ID, FUNCTION_ID);
jo.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID());
jo.put(ATTR_UID, MarketConfig.getInstance().getBBSAttr().getBbsUid());
jo.put(ATTR_JAR_TIME, GeneralUtils.readFullVersionNO());
jo.put(ATTR_CLICK_NUMBER, this.clickNumber);
jo.put(ATTR_USE_NUMBER, this.useNumber);
jo.put(ATTR_TIME, DateTime.now().toString(SIMPLE_DATE_PATTERN));
return jo.toString();
}
@Override
public void readXML(XMLableReader reader) {
if (reader.isAttr()) {
String name = reader.getTagName();
if (XML_TAG.equals(name)) {
this.clickNumber = reader.getAttrAsInt(ATTR_CLICK_NUMBER, 0);
this.useNumber = reader.getAttrAsInt(ATTR_USE_NUMBER, 0);
this.lastSendTime = reader.getAttrAsLong(XML_LAST_TIME, System.currentTimeMillis());
}
}
}
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG(XML_TAG);
writer.attr(ATTR_CLICK_NUMBER, this.clickNumber).attr(ATTR_USE_NUMBER, this.useNumber)
.attr(XML_LAST_TIME, this.lastSendTime);
writer.end();
}
}

2
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ReportPredefinedStylePane.java

@ -36,7 +36,7 @@ public class ReportPredefinedStylePane extends BasicPane {
public void update() {
PredefinedStyle style = selectPane.update();
if (style != null) {
currentTemplate.resetPredefinedStyle(style.getStyleName());
// currentTemplate.resetPredefinedStyle(style.getStyleName());
}
}

6
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ColorDetailPane.java

@ -72,7 +72,8 @@ public class ColorDetailPane extends AbstractBackgroundDetailPane<ColorBackgroun
}
private JPanel createNorthPane() {
UIButton transpanrentBtn = createTranspanrentButton();
// UIButton transpanrentBtn = createTranspanrentButton();
UIButton transpanrentBtn = new UIButton();
transpanrentBtn.setPreferredSize(new Dimension(160, 20));
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Color")),
@ -82,7 +83,8 @@ public class ColorDetailPane extends AbstractBackgroundDetailPane<ColorBackgroun
}
protected JPanel createCenterPane() {
JPanel centerPane = super.createCenterPane();
// JPanel centerPane = super.createCenterPane();
JPanel centerPane = new JPanel();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(" "), centerPane}}, TableLayoutHelper.FILL_NONE, 33, 5);

7
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentFrameStylePane.java

@ -71,12 +71,7 @@ public class ComponentFrameStylePane extends ComponentStylePane {
currentLineColorPane.setPreferredSize(new Dimension(20, 20));
JPanel buttonPane = new JPanel(new BorderLayout());
buttonPane.add(currentLineColorPane, BorderLayout.WEST);
backgroundPane = new BackgroundSpecialPane(){
@Override
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){
return new GradientBackgroundQuickPane(119);
}
};
backgroundPane = new BackgroundSpecialPane();
JPanel transparencyPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.numberDragPane = new UINumberDragPane(0, 100);
transparencyPane.add(numberDragPane, BorderLayout.CENTER);

7
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/component/ComponentTitleStylePane.java

@ -95,12 +95,7 @@ public class ComponentTitleStylePane extends ComponentStylePane {
JPanel hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
hPaneContainer.add(hAlignmentPane);
titleBackgroundPane = new BackgroundNoImagePane(){
@Override
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane(){
return new GradientBackgroundQuickPane(119);
}
};
titleBackgroundPane = new BackgroundNoImagePane();
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p};

2
designer-base/src/main/java/com/fr/design/mainframe/template/info/SendHelper.java

@ -27,7 +27,7 @@ public class SendHelper {
return success;
}
public static boolean sendSinglePointInfo(String url, String content) {
private static boolean sendSinglePointInfo(String url, String content) {
Map<String, Object> para = new HashMap<>();
para.put("token", SiteCenterToken.generateToken());
para.put("content", content);

4
designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.template.info;
import com.fr.design.mainframe.burying.point.AbstractPointCollector;
import com.fr.design.mainframe.burying.point.AbstractPointInfo;
import com.fr.design.mainframe.burying.point.AbstractTemplateInfoCollector;
import com.fr.json.JSON;
import com.fr.json.JSONFactory;
import com.fr.json.JSONObject;
@ -18,7 +18,7 @@ import java.util.concurrent.ConcurrentHashMap;
* 做模板的过程和耗时收集辅助类
* Created by plough on 2017/2/21.
*/
public class TemplateInfoCollector extends AbstractTemplateInfoCollector<TemplateInfo> {
public class TemplateInfoCollector extends AbstractPointCollector<TemplateInfo> {
private static final String XML_TAG = "TplInfo";
private static final String XML_TEMPLATE_INFO_LIST = "TemplateInfoList";
private static final String XML_FILE_NAME = "tpl.info";

7
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -54,9 +54,7 @@ import com.fr.design.mainframe.ToolBarNewTemplatePane;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.SnapChatMenuDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.notification.SnapChatAllTypes;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
@ -74,6 +72,7 @@ import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext;
@ -469,9 +468,7 @@ public abstract class ToolBarMenuDock {
}
protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) {
MenuDef menuDef = new SnapChatMenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic__M_Server"), 'S',
SnapChatAllTypes.Menu.SERVER);
MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic__M_Server"), 'S');
if (!DesignerMode.isAuthorityEditing()) {
menuDef.addShortCut(

36
designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java

@ -12,13 +12,7 @@ public abstract class SnapChatAllTypes {
/**
* 社区按钮
*/
BBS("BBS"),
/**
* 服务器按钮
*/
SERVER("SERVER");
BBS("BBS");
private static final String SIGN = "0001";
@ -41,32 +35,4 @@ public abstract class SnapChatAllTypes {
}
}
public enum UpdateAction implements SnapChatKey {
/**
* 服务器预定义样式
*/
PREDEFINED_STYLE("PREDEFINED_STYLE");
private static final String SIGN = "0002";
private String key;
UpdateAction(String key) {
this.key = key;
}
public String getKey() {
return key;
}
@Override
public String calc() {
return CommonUtils.join(
new String[]{SIGN, getKey()}, "-"
);
}
}
}

192
designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java

@ -1,59 +1,197 @@
package com.fr.design.style.background.impl;
import com.fr.base.GraphHelper;
import com.fr.base.background.TextureBackground;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.design.style.background.texture.TextureDetailPane;
import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.Rectangle2D;
/**
* Texture background pane. TODO kunsnat: 拆出去. 真特么的长..
*/
public class TextureBackgroundPane extends BackgroundDetailPane {
private TextureDetailPane detailPane;
public class TextureBackgroundPane extends BPane {
private static final TexturePaint[] EMBED_TEXTURE_PAINT_ARRAY = new TexturePaint[]{
TextureBackground.NEWSPRINT_TEXTURE_PAINT,
TextureBackground.RECYCLED_PAPER_TEXTURE_PAINT,
TextureBackground.PARCHMENT_TEXTURE_PAINT,
TextureBackground.STATIONERY_TEXTURE_PAINT,
TextureBackground.GREEN_MARBLE_TEXTURE_PAINT,
TextureBackground.WHITE_MARBLE_TEXTURE_PAINT,
TextureBackground.BROWN_MARBLE_TEXTURE_PAINT,
TextureBackground.GRANITE_TEXTURE_PAINT,
TextureBackground.BLUE_TISSUE_PAPER_TEXTURE_PAINT,
TextureBackground.PINK_TISSUE_PAPER_TEXTURE_PAINT,
TextureBackground.PURPLE_MESH_TEXTURE_PAINT,
TextureBackground.BOUQUET_TEXTURE_PAINT,
TextureBackground.PAPYRUS_TEXTURE_PAINT,
TextureBackground.CANVAS_TEXTURE_PAINT,
TextureBackground.DENIM_TEXTURE_PAINT,
TextureBackground.WOVEN_MAT_TEXTURE_PAINT,
TextureBackground.WATER_DROPLETS_TEXTURE_PAINT,
TextureBackground.PAPER_BAG_TEXTURE_PAINT,
TextureBackground.FISH_FOSSIL_TEXTURE_PAINT,
TextureBackground.SAND_TEXTURE_PAINT,
TextureBackground.CORK_TEXTURE_PAINT,
TextureBackground.WALNUT_TEXTURE_PAINT,
TextureBackground.OAK_TEXTURE_PAINT,
TextureBackground.MEDIUM_WOOD_TEXTURE_PAINT};
private static final String[] EMBED_TEXTURE_PAINT_DES_ARRAY = new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Newsprint"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Recycled_Paper"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Parchment"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Stationery"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Green_Marble"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_White_Marble"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Brown_Marble"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Granite"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Blue_Tissue_Paper"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Pink_Tissue_Paper"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Purple_Mesh"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Bouquet"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Papyrus"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Canvas"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Denim"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Woven_Mat"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Water_Droplets"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_PaperBag"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_FishFossil"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Sand"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Cork"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Walnut"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Oak"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture_Medium_Wood")
};
private TexturePaint texturePaint;
private TextureButton[] textureButtonArray;
public TextureBackgroundPane() {
this(8);// 默认的.
super(8);// 默认的.
}
public TextureBackgroundPane(int column) {
this.detailPane = TextureDetailPane.createNormalTextureDetailPane(column);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
this.add(contentPane, BorderLayout.NORTH);
JPanel typePane = FRGUIPaneFactory.createTitledBorderPane(titleOfTypePane());
contentPane.add(typePane);
typePane.add(this.detailPane);
public TextureBackgroundPane(int colum) {
super(colum);// 自定义的.
}
protected LayoutManager layoutOfTypePane(int nColumn) {
return FRGUIPaneFactory.createNColumnGridLayout(nColumn);
}
protected String titleOfTypePane() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Texture");
}
protected void setChildrenOfTypePane(JPanel typePane2) {
ButtonGroup patternButtonGroup = new ButtonGroup();
textureButtonArray = new TextureButton[EMBED_TEXTURE_PAINT_ARRAY.length];
for (int i = 0; i < EMBED_TEXTURE_PAINT_ARRAY.length; i++) {
textureButtonArray[i] = new TextureButton(
EMBED_TEXTURE_PAINT_ARRAY[i], EMBED_TEXTURE_PAINT_DES_ARRAY[i]);
patternButtonGroup.add(textureButtonArray[i]);
typePane2.add(textureButtonArray[i]);
}
}
public void populate(Background background) {
this.detailPane.populate(background);
if (background instanceof TextureBackground) {
TextureBackground textureBackground = (TextureBackground) background;
this.texturePaint = textureBackground.getTexturePaint();
for (int i = 0; i < textureButtonArray.length; i++) {
if (ComparatorUtils.equals(textureButtonArray[i].getTexturePaint(), this.texturePaint)) {
textureButtonArray[i].setSelected(true);
break;
}
}
} else {
this.textureButtonArray[0].setSelected(true);
this.texturePaint = textureButtonArray[0].getTexturePaint();
}
}
public Background update() throws Exception {
return this.detailPane.update();
return new TextureBackground(this.texturePaint);
}
@Override
public void addChangeListener(ChangeListener changeListener) {
this.detailPane.addChangeListener(changeListener);
for (int i = 0; i < this.textureButtonArray.length; i++) {
this.textureButtonArray[i].addChangeListener(changeListener);
}
}
/**
* Texture type button.
*/
class TextureButton extends JToggleButton implements ActionListener {
private TexturePaint buttonTexturePaint;
public TextureButton(TexturePaint buttonTexturePaint, String tooltip) {
this.buttonTexturePaint = buttonTexturePaint;
this.setToolTipText(tooltip);
this.setCursor(new Cursor(Cursor.HAND_CURSOR));
this.addActionListener(this);
this.setBorder(null);
}
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
g2d.setPaint(this.buttonTexturePaint);
GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1d,
d.height - 1d));
if (ComparatorUtils.equals(texturePaint, this.buttonTexturePaint)) {// it's
// selected.
g2d.setPaint(Color.black);
} else {
g2d.setPaint(Color.gray);
}
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1d,
d.height - 1d));
}
public Dimension getPreferredSize() {
return new Dimension(36, 32);
}
public TexturePaint getTexturePaint() {
return this.buttonTexturePaint;
}
/**
* set Pattern setIndex.
*/
public void actionPerformed(ActionEvent evt) {
TextureBackgroundPane.this.texturePaint = this.getTexturePaint();
fireChagneListener();
TextureBackgroundPane.this.repaint(); // repaint.
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
private void fireChagneListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
}
}

29
designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java

@ -53,19 +53,25 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable
initialCompents(isSupportTransparent);
}
protected void initialCompents(boolean isSupportTransparent) {
private void initialCompents(boolean isSupportTransparent) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5));
if (isSupportTransparent) {
this.add(createTranspanrentButton(), BorderLayout.NORTH);
UIButton transpanrentButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency"));
this.add(transpanrentButton, BorderLayout.NORTH);
transpanrentButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
doTransparent();
}
});
}
this.add(createCenterPane(), BorderLayout.CENTER);
}
protected JPanel createCenterPane(){
// center
JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
this.add(centerPane, BorderLayout.CENTER);
centerPane.add(getRow1Pane());
@ -92,19 +98,6 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable
centerPane1.setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8));
centerPane1.add(customButton, BorderLayout.NORTH);
centerPane.add(centerPane1);
return centerPane;
}
protected UIButton createTranspanrentButton(){
UIButton transpanrentButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency"));
transpanrentButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
doTransparent();
}
});
return transpanrentButton;
}
protected JPanel getMenuColorPane() {

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

@ -16,18 +16,14 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CommonCodeUtils;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.start.ServerStarter;
import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.predefined.PredefinedStyleOperator;
import org.jetbrains.annotations.NotNull;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
@ -61,6 +57,7 @@ import java.util.concurrent.TimeoutException;
public class DesignUtils {
private static int port = DesignerPort.getInstance().getMessagePort();
private static boolean started = false;
@ -75,6 +72,7 @@ public class DesignUtils {
return port;
}
/**
* 判断设计器有没有启动
*

59
designer-base/src/main/java/com/fr/design/utils/PredefinedStyleUtils.java

@ -1,59 +0,0 @@
package com.fr.design.utils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.log.FineLoggerFactory;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
import com.fr.workspace.server.predefined.PredefinedStyleOperator;
/**
* Created by kerry on 2020-11-06
*/
public class PredefinedStyleUtils {
/**
* 判断当前环境是否支持预定义样式的设置
*/
private static Boolean allowPredefinedSetting = null;
static {
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
@Override
public void on(Event event, Workspace param) {
allowPredefinedSetting = checkAllowPredefinedSetting();
}
});
}
/**
* 判断当前环境是否支持预定义样式的设置
* @return boolean
*/
public synchronized static boolean isAllowPredefinedSetting() {
if (allowPredefinedSetting == null) {
allowPredefinedSetting = checkAllowPredefinedSetting();
}
return allowPredefinedSetting;
}
private PredefinedStyleUtils() {
}
private static boolean checkAllowPredefinedSetting() {
if (WorkContext.getCurrent().isLocal()) {
return true;
}
return WorkContext.getCurrent().get(PredefinedStyleOperator.class, new ExceptionHandler() {
@Override
public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) {
FineLoggerFactory.getLogger().error(exceptionInfo.getException().getMessage(), exceptionInfo.getException());
return false;
}
}).allowPredefinedSetting();
}
}

97
designer-base/src/test/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollectorTest.java

@ -1,97 +0,0 @@
package com.fr.design.mainframe.predefined.info;
import com.fr.config.BBSAttr;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.general.GeneralUtils;
import com.fr.json.JSON;
import com.fr.json.JSONFactory;
import com.fr.json.JSONObject;
import com.fr.stable.ProductConstants;
import com.fr.third.org.apache.commons.io.FileUtils;
import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
import java.io.File;
import java.io.IOException;
/**
* Created by kerry on 2020-09-05
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({ProductConstants.class, MarketConfig.class, DesignerEnvManager.class, GeneralUtils.class})
@SuppressStaticInitializationFor({"com.fr.jvm.assist.FineAssist"})
public class PredefinedStyleInfoCollectorTest {
private String filePath;
private String initialFileContent;
@Before
public void setUp() throws IOException {
PowerMock.mockStatic(ProductConstants.class);
filePath = getClass().getResource("predefinedStyle.info").getPath();
String dirPath = filePath.substring(0, filePath.indexOf("predefinedStyle.info"));
EasyMock.expect(ProductConstants.getEnvHome()).andReturn(dirPath).anyTimes();
EasyMock.replay();
PowerMock.replayAll();
initialFileContent = FileUtils.readFileToString(new File(filePath), "utf-8");
}
@After
public void tearDown() throws IOException {
FileUtils.writeStringToFile(new File(filePath), initialFileContent, "utf-8");
}
@Test
public void testCollectClickNumber() {
PredefinedStyleInfoCollector.getInstance().collectClickNumber();
Assert.assertEquals(1, PredefinedStyleInfoCollector.getInstance().getClickNumber());
}
@Test
public void testCollectUseNumber() {
PredefinedStyleInfoCollector.getInstance().collectUseNumber("test");
Assert.assertEquals(1, PredefinedStyleInfoCollector.getInstance().getUseNumber());
}
@Test
public void testGenerateTotalInfo() {
PowerMock.mockStatic(DesignerEnvManager.class);
PowerMock.mockStatic(MarketConfig.class);
PowerMock.mockStatic(GeneralUtils.class);
DesignerEnvManager envManager = EasyMock.mock(DesignerEnvManager.class);
EasyMock.expect(envManager.getUUID()).andReturn("xxxxx-12345-xxxxx").once();
EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(envManager).once();
MarketConfig marketConfig = EasyMock.mock(MarketConfig.class);
BBSAttr bbsAttr = new BBSAttr();
bbsAttr.setBbsUid(12345);
EasyMock.expect(marketConfig.getBBSAttr()).andReturn(bbsAttr).once();
EasyMock.expect(MarketConfig.getInstance()).andReturn(marketConfig).once();
EasyMock.expect(GeneralUtils.readFullVersionNO()).andReturn("10.0.9.2020.0817.final");
EasyMock.replay(envManager, marketConfig);
PowerMock.replayAll();
String content = PredefinedStyleInfoCollector.getInstance().generateTotalInfo();
JSONObject jsonObject = JSONFactory.createJSON(JSON.OBJECT, content);
Assert.assertEquals("predefinedStyle", jsonObject.getString("functionName"));
Assert.assertEquals("FR-F7003", jsonObject.getString("functionId"));
Assert.assertEquals("xxxxx-12345-xxxxx", jsonObject.getString("uuid"));
Assert.assertEquals(12345, jsonObject.getInt("uid"));
Assert.assertEquals("10.0.9.2020.0817.final", jsonObject.getString("jatTime"));
}
}

2
designer-base/src/test/resources/com/fr/design/mainframe/predefined/info/predefinedStyle.info

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<PredefinedStyleInfo xmlVersion="20170720" releaseVersion="10.0.0" clickNumber="0" useNumber="0"/>

13
designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java

@ -20,8 +20,6 @@ import com.fr.design.mainframe.HelpDialogManager;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.module.DesignModuleFactory;
import com.fr.form.ui.BaseChartEditor;
import com.fr.form.ui.NameComponentBackground;
import com.fr.form.ui.NameLayoutBorderStyle;
import com.fr.form.ui.Widget;
import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter;
@ -230,7 +228,6 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
* 渲染Painter
*/
public void paint(Graphics g) {
initBorderStyle();
designerEditor.paintEditor(g, this.getSize());
if (coverPanel != null) {
coverPanel.setSize(this.getSize());
@ -365,14 +362,4 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
return false;
}
/**
* 初始化组件的预定义信息
*/
public void initWidgetPredefinedInfo(String styleName){
this.toData().setNameBorderStyle(NameLayoutBorderStyle.createPredefinedStyle(styleName));
this.toData().setNameBackground(NameComponentBackground.createPredefinedStyle(styleName));
initBorderStyle();
}
}

11
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -816,13 +816,12 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
return true;
}
/**
* 初始化组件的预定义信息
*/
public void initWidgetPredefinedInfo(String styleName){
}
/**
* 初始化组件的预定义信息
*/
public void initWidgetPredefinedInfo(){
}
}

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

@ -19,11 +19,12 @@ import com.fr.form.FormProvider;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.ElementCaseEditorProvider;
import com.fr.form.ui.NameComponentBackground;
import com.fr.form.ui.NameLayoutBorderStyle;
import com.fr.form.ui.NamePaddingMargin;
import com.fr.report.fit.ReportFitAttr;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.report.fit.FitProvider;
@ -374,20 +375,6 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
return true;
}
/**
* 初始化组件的预定义信息
*/
public void initWidgetPredefinedInfo(String styleName){
this.toData().setNameBorderStyle(NameLayoutBorderStyle.createPredefinedStyle(styleName));
this.toData().setNameBackground(NameComponentBackground.createPredefinedStyle(styleName));
initBorderStyle();
}
@Override
public void paint(Graphics g) {
super.paint(g);
initBorderStyle();
}
}

6
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java

@ -138,10 +138,4 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
return false;
}
/**
* 初始化组件的预定义信息
*/
public void initWidgetPredefinedInfo(String styleName){
this.toData().setNameBackground(NameFormBackground.createPredefinedStyle(styleName));
}
}

6
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -1344,11 +1344,5 @@ public class XWFitLayout extends XLayoutContainer {
}
}
}
/**
* 初始化组件的预定义信息
*/
public void initWidgetPredefinedInfo(String styleName){
this.toData().setNameBackground(NameFormBackground.createPredefinedStyle(styleName));
}
}

17
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -8,22 +8,27 @@ import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI;
import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.ButtonTypeEditor;
import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.NameComponentBackground;
import com.fr.form.ui.NameFormBackground;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.border.Border;
@ -640,14 +645,4 @@ public class XWTabFitLayout extends XWFitLayout {
public boolean isTopable() {
return true;
}
/**
* 初始化组件的预定义信息
*/
public void initWidgetPredefinedInfo(String styleName){
this.toData().setNameBackground(NameComponentBackground.createPredefinedStyle(styleName));
}
}

4
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -37,10 +37,10 @@ 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.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.RightSelectionHandlerProvider;
@ -969,9 +969,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
private void refreshCenter(Widget centerWidget, XLayoutContainer formLayoutContainer) {
// 不存在center块, 说明是新建的模板
if (centerWidget == null) {
String styleName = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplatePredefinedStyle();
XLayoutContainer layoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(new WFitLayout("body"));
layoutContainer.initWidgetPredefinedInfo(styleName);
layoutContainer.setSize(LARGE_PREFERRED_SIZE);
setRootComponent(layoutContainer);
formLayoutContainer.add(rootComponent, WBorderLayout.CENTER);

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

@ -644,7 +644,6 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} else {
this.undoState = u;
}
refreshPredefinedState();
}
@Override

3
designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java

@ -3,7 +3,6 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.core.WidgetOption;
@ -94,9 +93,7 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio
creatorSource = no.getNameOption().createWidget();
}
if (creatorSource != null) {
String styleName = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplatePredefinedStyle();
XCreator xCreator = XCreatorUtils.createXCreator(creatorSource);
xCreator.initWidgetPredefinedInfo(styleName);
WidgetToolBarPane.getTarget().startDraggingBean(xCreator);
FormDesignerUtils.addWidgetProcessInfo(xCreator.toData());
lastPressEvent = null;

13
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/BorderStyleWidgetDefinePane.java

@ -7,10 +7,10 @@ import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleBorderStyleEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.NameLayoutBorderStyle;
import com.fr.form.ui.LayoutBorderStyle;
import javax.swing.*;
@ -20,7 +20,7 @@ import java.awt.*;
* Created by kerry on 2017/8/29.
*/
public class BorderStyleWidgetDefinePane extends AbstractDataModify<AbstractBorderStyleWidget> {
private AccessibleBorderStyleEditor borderStyleEditor;
private AccessibleWLayoutBorderStyleEditor borderStyleEditor;
public BorderStyleWidgetDefinePane(XCreator xCreator) {
super(xCreator);
@ -29,7 +29,7 @@ public class BorderStyleWidgetDefinePane extends AbstractDataModify<AbstractBord
public void initComponent() {
borderStyleEditor = new AccessibleBorderStyleEditor();
borderStyleEditor = new AccessibleWLayoutBorderStyleEditor();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
@ -50,15 +50,14 @@ public class BorderStyleWidgetDefinePane extends AbstractDataModify<AbstractBord
@Override
public void populateBean(AbstractBorderStyleWidget ob) {
borderStyleEditor.setValue(ob.getNameBorderStyle());
borderStyleEditor.setValue(ob.getBorderStyle());
}
@Override
public AbstractBorderStyleWidget updateBean() {
AbstractBorderStyleWidget abstractBorderStyleWidget = (AbstractBorderStyleWidget)creator.toData();
NameLayoutBorderStyle componentStyle = (NameLayoutBorderStyle) borderStyleEditor.getValue();
abstractBorderStyleWidget.setNameBorderStyle(componentStyle);
abstractBorderStyleWidget.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue());
return abstractBorderStyleWidget;
}

13
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java

@ -11,6 +11,7 @@ import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.web.FormToolBarManager;
import com.fr.general.ComparatorUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -38,13 +39,11 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseE
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_EC_Toolbar")), elementCaseToolBarEditor},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
CRPropertyDescriptor[] extraTableEditor = ((XElementCase) creator).getExtraTableEditor();
extraPropertyGroupPane = new PropertyGroupPane(extraTableEditor, creator);
centerPane.add(panel, BorderLayout.NORTH);
if (extraTableEditor.length > 0) {
extraPropertyGroupPane = new PropertyGroupPane(extraTableEditor, creator);
centerPane.add(extraPropertyGroupPane, BorderLayout.CENTER);
}
centerPane.add(extraPropertyGroupPane, BorderLayout.CENTER);
return centerPane;
}
@ -61,9 +60,7 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseE
protected void populateSubBean(ElementCaseEditor ob) {
paddingBoundPane.populate(ob);
elementCaseToolBarEditor.setValue(ob.getToolBars());
if (extraPropertyGroupPane != null) {
extraPropertyGroupPane.populate(ob);
}
extraPropertyGroupPane.populate(ob);
}
}

35
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

@ -8,7 +8,6 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.items.FRLayoutTypeItems;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
@ -16,13 +15,12 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleBodyBackgroundEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.design.widget.ui.designer.component.WidgetBoundPane;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.NameComponentBackground;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType;
@ -40,7 +38,7 @@ import java.awt.Component;
public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
private static final int MAX_LABEL_WIDTH = 80;
private AccessibleBodyBackgroundEditor backgroundEditor;
private AccessibleWLayoutBorderStyleEditor borderStyleEditor;
private AccessibleBodyWatermarkEditor watermarkEditor;
private WidgetBoundPane boundPane;
@ -57,11 +55,11 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
boundPane = new WidgetBoundPane(creator);
centerPane.add(boundPane, BorderLayout.CENTER);
backgroundEditor = new AccessibleBodyBackgroundEditor();
borderStyleEditor = new AccessibleWLayoutBorderStyleEditor();
watermarkEditor = new AccessibleBodyWatermarkEditor();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background")), backgroundEditor},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style")), borderStyleEditor},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), watermarkEditor}
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -115,9 +113,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
public void populateSubPane(WAbsoluteLayout ob) {
layoutCombox.setSelectedIndex(1);
NameComponentBackground formBackground = ob.getNameBackground();
backgroundEditor.setValue(formBackground);
borderStyleEditor.setValue(ob.getBorderStyle());
boundPane.populate();
watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile()));
}
@ -135,29 +131,16 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
if (layoutType == WBodyLayoutType.ABSOLUTE) {
((XWFitLayout) creator.getBackupParent()).toData().resetStyle();
if (state == WBodyLayoutType.FIT.getTypeValue()) {
XWFitLayout xwFitLayout = ((XWFitLayout) creator.getBackupParent());
String predefinedName = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplatePredefinedStyle();
xwFitLayout.initWidgetPredefinedInfo(predefinedName);
xwFitLayout.switch2FitBodyLayout(creator);
copyLayoutAttr(layout, xwFitLayout.toData());
XWFitLayout xwFitLayout = ((XWFitLayout)creator.getBackupParent());
xwFitLayout.switch2FitBodyLayout(creator);
copyLayoutAttr(layout, xwFitLayout.toData());
}
}
LayoutBorderStyle borderStyle = new LayoutBorderStyle();
NameComponentBackground background = (NameComponentBackground) backgroundEditor.getValue();
updateBodyBackground(background, borderStyle);
layout.setBorderStyle(borderStyle);
layout.setNameBackground(background);
layout.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue());
updateWatermark();
return layout;
}
private void updateBodyBackground(NameComponentBackground background, LayoutBorderStyle borderStyle) {
if (background != null) {
borderStyle.setBackground(background.createRealStyle().getBackground());
borderStyle.setAlpha(background.getBackgroundAlphaValue());
}
}
private void updateWatermark() {
WatermarkAttr watermark = (WatermarkAttr) watermarkEditor.getValue();
if (watermark != null) {

32
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -12,7 +12,6 @@ import com.fr.design.designer.creator.XWScaleLayout;
import com.fr.design.designer.properties.items.FRFitConstraintsItems;
import com.fr.design.designer.properties.items.FRLayoutTypeItems;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
@ -23,13 +22,12 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleBodyBackgroundEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.NameComponentBackground;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout;
@ -57,7 +55,7 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
private UIComboBox adaptComboBox;
private UISpinner componentIntervel;
private PaddingBoundPane paddingBound;
private AccessibleBodyBackgroundEditor stylePane;
private AccessibleWLayoutBorderStyleEditor stylePane;
private AccessibleBodyWatermarkEditor watermarkEditor;
public FRFitLayoutDefinePane(XCreator xCreator) {
@ -79,12 +77,12 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
public JPanel createAdvancePane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
stylePane = new AccessibleBodyBackgroundEditor();
stylePane = new AccessibleWLayoutBorderStyleEditor();
watermarkEditor = new AccessibleBodyWatermarkEditor();
paddingBound = new PaddingBoundPane();
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background")), stylePane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style")), stylePane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), watermarkEditor}
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
jp2.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
@ -156,8 +154,7 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue());
adaptComboBox.setSelectedIndex(ob.getCompState());
componentIntervel.setValue(ob.getCompInterval());
NameComponentBackground formBackground = ob.getNameBackground();
stylePane.setValue(formBackground);
stylePane.setValue(ob.getBorderStyle());
watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile()));
}
@ -176,12 +173,10 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate"))) {
paddingBound.update(layout);
}
LayoutBorderStyle borderStyle = new LayoutBorderStyle();
NameComponentBackground background = (NameComponentBackground) stylePane.getValue();
updateBodyBackground(background, borderStyle);
layout.setBorderStyle(borderStyle);
layout.setNameBackground(background);
LayoutBorderStyle borderStyle = (LayoutBorderStyle) stylePane.getValue();
if (borderStyle != null) {
layout.setBorderStyle(borderStyle);
}
updateWatermark();
Item item = (Item) layoutComboBox.getSelectedItem();
Object value = item.getValue();
@ -195,13 +190,11 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
try {
if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) {
WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body");
String predefinedName = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplatePredefinedStyle();
wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED);
Component[] components = xWFitLayout.getComponents();
xWFitLayout.removeAll();
layout.resetStyle();
XWAbsoluteBodyLayout xwAbsoluteBodyLayout = xWFitLayout.getBackupParent() == null ? new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)) : (XWAbsoluteBodyLayout) xWFitLayout.getBackupParent();
xwAbsoluteBodyLayout.initWidgetPredefinedInfo(predefinedName);
xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0);
for (Component component : components) {
XCreator xCreator = (XCreator) component;
@ -234,13 +227,6 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
return layout;
}
private void updateBodyBackground(NameComponentBackground background, LayoutBorderStyle borderStyle) {
if (background != null) {
borderStyle.setBackground(background.createRealStyle().getBackground());
borderStyle.setAlpha(background.getBackgroundAlphaValue());
}
}
private void updateWatermark() {
WatermarkAttr watermark = (WatermarkAttr) watermarkEditor.getValue();
if (watermark != null) {

17
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

@ -7,10 +7,12 @@ 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.mainframe.widget.accessibles.AccessibleBorderStyleEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.NameLayoutBorderStyle;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.general.ComparatorUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -22,7 +24,7 @@ import java.awt.Component;
* Created by ibm on 2017/8/3.
*/
public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget> extends AbstractDataModify<T> {
private AccessibleBorderStyleEditor borderStyleEditor;
private AccessibleWLayoutBorderStyleEditor borderStyleEditor;
public WTitleLayoutDefinePane(XCreator xCreator) {
super(xCreator);
@ -32,7 +34,7 @@ public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
borderStyleEditor = new AccessibleBorderStyleEditor();
borderStyleEditor = new AccessibleWLayoutBorderStyleEditor();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
@ -67,15 +69,16 @@ public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget
@Override
public void populateBean(T ob) {
populateSubBean(ob);
borderStyleEditor.setValue(ob.getNameBorderStyle());
borderStyleEditor.setValue(ob.getBorderStyle());
}
@Override
public T updateBean() {
T e = updateSubBean();
NameLayoutBorderStyle componentStyle = (NameLayoutBorderStyle) borderStyleEditor.getValue();
e.setNameBorderStyle(componentStyle);
if(!ComparatorUtils.equals(borderStyleEditor.getValue(), e.getBorderStyle())){
e.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue());
}
return e;
}

17
designer-realize/src/main/java/com/fr/design/actions/cell/GlobalStyleMenuDef.java

@ -6,11 +6,9 @@ package com.fr.design.actions.cell;
import com.fr.base.BaseUtils;
import com.fr.base.NameStyle;
import com.fr.base.Style;
import com.fr.config.predefined.PredefinedStyle;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.actions.SelectionListenerAction;
import com.fr.design.actions.UpdateAction;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.ElementCasePane;
@ -19,7 +17,6 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.selection.SelectionListener;
import com.fr.design.style.StylePane;
import com.fr.predefined.PredefinedPatternStyleManager;
import com.fr.stable.StringUtils;
import com.fr.stable.pinyin.PinyinHelper;
@ -75,13 +72,11 @@ public class GlobalStyleMenuDef extends MenuDef {
public void updateMenu() {
UIMenu createdMenu = this.createJMenu();
createdMenu.removeAll();
String styleName = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplatePredefinedStyle();
PredefinedStyle currentStyle = PredefinedPatternStyleManager.INSTANCE.getStyleFromName(styleName);
Iterator iterator = currentStyle.getCellStyleConfig().getStyleNameIterator();
Iterator iterator = ServerPreferenceConfig.getInstance().getStyleNameIterator();
while (iterator.hasNext()) {
String name = (String) iterator.next();
NameStyle nameStyle = NameStyle.createPredefinedStyle(styleName, name, Style.getInstance());
UpdateAction.UseMenuItem useMenuItem = new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem();
NameStyle nameStyle = NameStyle.getInstance(name);
UpdateAction.UseMenuItem useMenuItem =new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem();
useMenuItem.setNameStyle(nameStyle);
createdMenu.add(useMenuItem);
}
@ -179,9 +174,9 @@ public class GlobalStyleMenuDef extends MenuDef {
if (StringUtils.isEmpty(this.getName())) {
stylePane.setGlobalStyle(this.getNameStyle());
} else {
String styleName = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplatePredefinedStyle();
stylePane.setGlobalStyle(NameStyle.createPredefinedStyle(styleName, this.getName(), Style.getInstance()));
stylePane.setGlobalStyle(NameStyle.getInstance(this.getName()));
}
stylePane.updateGlobalStyle(getEditingComponent());
CellElementPropertyPane.getInstance().GoToPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style"));
return true;

9
designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java

@ -5,11 +5,12 @@ package com.fr.design.actions.report;
import com.fr.base.BaseUtils;
import com.fr.design.actions.ReportComponentAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ReportComponent;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.ReportBackgroundPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.report.ReportPredefinedBackgroundPane;
import com.fr.report.core.ReportUtils;
/**
@ -34,13 +35,13 @@ public class ReportBackgroundAction extends ReportComponentAction<ReportComponen
if (reportPane == null) {
return false;
}
final ReportPredefinedBackgroundPane bPane = new ReportPredefinedBackgroundPane();
bPane.populateBean(ReportUtils.getReportSettings(reportPane.getTemplateReport()));
final ReportBackgroundPane bPane = new ReportBackgroundPane();
bPane.populate(ReportUtils.getReportSettings(reportPane.getTemplateReport()));
bPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
bPane.updateBean(reportPane.getTemplateReport().getReportSettings());
bPane.update(reportPane.getTemplateReport().getReportSettings());
reportPane.fireTargetModified();
}
}).setVisible(true);

4
designer-realize/src/main/java/com/fr/design/actions/server/predefined/ServerPredefinedStyleAction.java

@ -7,7 +7,7 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.menu.SnapChatUpdateAction;
import com.fr.design.notification.SnapChatKey;
import com.fr.design.utils.PredefinedStyleUtils;
//import com.fr.design.utils.PredefinedStyleUtils;
import com.fr.general.IOUtils;
import javax.swing.KeyStroke;
@ -21,7 +21,7 @@ public class ServerPredefinedStyleAction extends SnapChatUpdateAction {
public ServerPredefinedStyleAction(SnapChatKey uniqueKey) {
super(uniqueKey);
this.setEnabled(PredefinedStyleUtils.isAllowPredefinedSetting());
// this.setEnabled(PredefinedStyleUtils.isAllowPredefinedSetting());
this.setMenuKeySet(PREDEFINED_STYLES);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());

6
designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -11,7 +11,7 @@ import com.fr.grid.selection.Selection;
import com.fr.log.FineLoggerFactory;
import com.fr.privilege.finegrain.WidgetPrivilegeControl;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultPredefinedTemplateCellElement;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
@ -59,7 +59,7 @@ public class CellWidgetPropertyPane extends BasicPane {
public void populate(TemplateCellElement cellElement) {
if (cellElement == null) {// 利用默认的CellElement.
cellElement = new DefaultPredefinedTemplateCellElement(0, 0, null);
cellElement = new DefaultTemplateCellElement(0, 0, null);
}
Widget cellWidget = cellElement.getWidget();
@ -88,7 +88,7 @@ public class CellWidgetPropertyPane extends BasicPane {
final TemplateElementCase tplEC = ePane.getEditingElementCase();
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) {
editCellElement = new DefaultPredefinedTemplateCellElement(cs.getColumn(), cs.getRow());
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
}
this.cellElement = editCellElement;
this.populate(editCellElement);

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

@ -11,7 +11,6 @@ import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.errorinfo.ErrorInfoUploader;
import com.fr.design.mainframe.messagecollect.impl.FocusPointMessageUploader;
import com.fr.design.mainframe.messagecollect.solid.SolidCollector;
import com.fr.design.mainframe.predefined.info.PredefinedStyleInfoCollector;
import com.fr.design.mainframe.template.info.TemplateInfoCollector;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
@ -242,7 +241,6 @@ public class InformationCollector implements XMLReadable, XMLWriter {
TemplateInfoCollector.getInstance().sendPointInfo();
ChartInfoCollector.getInstance().sendPointInfo();
ErrorInfoUploader.getInstance().sendErrorInfo();
PredefinedStyleInfoCollector.getInstance().sendPointInfo();
}
}, SEND_DELAY, TimeUnit.MILLISECONDS);
service.shutdown();

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

@ -2,7 +2,6 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.form.ui.NameBackground;
import com.fr.base.Parameter;
import com.fr.base.ScreenResolution;
import com.fr.base.extension.FileExtension;
@ -92,7 +91,6 @@ import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.stable.ReportSettings;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils;
import com.fr.stable.AssistUtils;
@ -134,18 +132,10 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private int resolution = ScreenResolution.getScreenResolution();
public JWorkBook() {
super(new WorkBook(createPredefinedWorkSheet()), DEFAULT_WB_FILE_PREFIX);
super(new WorkBook(new WorkSheet()), DEFAULT_WB_FILE_PREFIX);
populateReportParameterAttr();
}
private static WorkSheet createPredefinedWorkSheet() {
WorkSheet sheet = new WorkSheet();
NameBackground initBackground = NameBackground.createPredefinedStyle(StringUtils.EMPTY);
((ReportSettings) sheet.getReportSettings()).setNameBackground(initBackground);
return sheet;
}
public JWorkBook(WorkBookX workBookX) {
super(new WorkBookAdapter(workBookX), DEFAULT_WBX_FILE_PREFIX);
populateReportParameterAttr();
@ -161,7 +151,6 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
populateReportParameterAttr();
}
@Override
protected void addPane(PropertyItemPaneProvider provider) {
PaneHolder<JWorkBook> holder = provider.getPaneHolder(JWorkBook.class);
@ -787,7 +776,6 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
refreshPredefinedState();
}
private void applyAll(WorkBookUndoState u) {

16
designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java

@ -38,7 +38,6 @@ import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.form.ui.NameBackground;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
@ -46,9 +45,7 @@ import com.fr.main.impl.WorkBook;
import com.fr.poly.PolyDesigner;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.report.TemplateReport;
import com.fr.report.stable.ReportSettings;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.StringUtils;
/**
* NameTabPane of sheets
@ -850,18 +847,11 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
protected abstract String getTemplateReportType();
}
private void initPredefinedInfo(TemplateReport report){
NameBackground initBackground = NameBackground.createPredefinedStyle(StringUtils.EMPTY);
((ReportSettings) report.getReportSettings()).setNameBackground(initBackground);
}
protected class GridReportInsertAction extends SheetInsertAction {
@Override
protected TemplateReport newTemplateReport() {
WorkSheet workSheet = new WorkSheet();
initPredefinedInfo(workSheet);
return workSheet;
return new WorkSheet();
}
@Override
@ -873,9 +863,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
protected class PolyReportInsertAction extends SheetInsertAction {
@Override
protected TemplateReport newTemplateReport() {
PolyWorkSheet polyWorkSheet = new PolyWorkSheet();
initPredefinedInfo(polyWorkSheet);
return polyWorkSheet;
return new PolyWorkSheet();
}
@Override

4
designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -14,7 +14,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultPredefinedTemplateCellElement;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
@ -112,7 +112,7 @@ public class CellElementEditPane extends BasicPane {
CellElement cellElement = elementCase.getCellElement(cs.getColumn(), cs.getRow());
if (cellElement == null) {
cellElement = new DefaultPredefinedTemplateCellElement(cs.getColumn(), cs.getRow());
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
//默认选中的是A1单元格,所以若是A1单元格没有加到列表时要加上,否则在聚合报表时会出错
if (cs.isSelectedOneCell(elementCasePane) && (cs.getColumn() + cs.getRow() == 0)) {
elementCase.addCellElement((TemplateCellElement) cellElement);

92
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -1,16 +1,17 @@
package com.fr.design.mainframe.cell.settingpane;
import com.fr.base.NameStyle;
import com.fr.base.Style;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.cell.settingpane.style.CellPredefinedStyleSettingPane;
import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.cell.DefaultPredefinedTemplateCellElement;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
/**
@ -18,15 +19,26 @@ import java.awt.*;
* @since 2012-5-11下午3:59:39
*/
public class CellStylePane extends AbstractCellAttrPane {
private CellPredefinedStyleSettingPane stylePane;
private StylePane stylePane;
@Override
public JPanel createContentPane() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder());
stylePane = new CellPredefinedStyleSettingPane();
stylePane = new StylePane();
content.add(stylePane, BorderLayout.CENTER);
stylePane.setBorder(UIConstants.CELL_ATTR_PRESENTBORDER);
stylePane.addPredefinedChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
attributeChanged();
}
});
stylePane.addCustomTabChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
adjustValues();// 里面的Tab切换后要及时调整滚动条,因为一些界面可能不需要滚动条
}
});
return content;
}
@ -43,49 +55,68 @@ public class CellStylePane extends AbstractCellAttrPane {
@Override
public String getIconPath() {
// return "com/fr/design/images/m_format/cell.png";
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Style");
}
@Override
public void updateBean(TemplateCellElement cellElement) {
cellElement.setStyle(stylePane.updateStyle());
cellElement.setStyle(stylePane.updateBean());
}
@Override
public void updateBeans() {
Style style = stylePane.updateStyle();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int cellRectangleCount = cs.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) {
Rectangle cellRectangle = cs.getCellRectangle(rect);
for (int j = 0; j < cellRectangle.height; j++) {
for (int i = 0; i < cellRectangle.width; i++) {
int column = i + cellRectangle.x;
int row = j + cellRectangle.y;
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement == null) {
cellElement = new DefaultPredefinedTemplateCellElement(column, row);
elementCase.addCellElement(cellElement);
if (stylePane.getSelectedIndex() == 1) {
Style s = stylePane.updateBean();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int cellRectangleCount = cs.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) {
Rectangle cellRectangle = cs.getCellRectangle(rect);
for (int j = 0; j < cellRectangle.height; j++) {
for (int i = 0; i < cellRectangle.width; i++) {
int column = i + cellRectangle.x;
int row = j + cellRectangle.y;
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(column, row);
elementCase.addCellElement(cellElement);
}
cellElement.setStyle(s);
}
}
}
} else {
TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int cellRectangleCount = cs.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) {
Rectangle cellRectangle = cs.getCellRectangle(rect);
for (int j = 0; j < cellRectangle.height; j++) {
for (int i = 0; i < cellRectangle.width; i++) {
int column = i + cellRectangle.x;
int row = j + cellRectangle.y;
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(column, row);
elementCase.addCellElement(cellElement);
}
Style style = cellElement.getStyle();
if (style == null) {
style = Style.DEFAULT_STYLE;
}
style = stylePane.updateStyle(style);
cellElement.setStyle(style);
}
cellElement.setStyle(style);
}
}
}
if (!(style instanceof NameStyle)) {
stylePane.updateBorder();// border必须特别处理
}
}
@Override
protected void populateBean() {
Style style = cellElement.getStyle();
if (style instanceof NameStyle) {
stylePane.populateBean((NameStyle) style);
} else {
//说明是未经过转换的
stylePane.populateBean(NameStyle.createCustomStyle(cellElement.getStyle()));
}
stylePane.populateBean(cellElement.getStyle());
stylePane.dealWithBorder(elementCasePane);
}
@ -95,6 +126,7 @@ public class CellStylePane extends AbstractCellAttrPane {
}
public void setSelectedByIds(int level, String... id) {
stylePane.setSelctedByName(id[level]);
}
}

4
designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java

@ -12,7 +12,7 @@ import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.log.FineLoggerFactory;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultPredefinedTemplateCellElement;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.highlight.DefaultHighlight;
import com.fr.report.cell.cellattr.highlight.Highlight;
@ -82,7 +82,7 @@ public class ConditionAttributesGroupPane extends UIListControlPane {
final TemplateElementCase tplEC = ePane.getEditingElementCase();
editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) {
editCellElement = new DefaultPredefinedTemplateCellElement(cs.getColumn(), cs.getRow());
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
}
SheetUtils.calculateDefaultParent(tplEC); // 不知道这行代码的作用,怕去掉之后会出问题,先放在这里

2
designer-realize/src/main/java/com/fr/design/report/ReportPredefinedBackgroundPane.java

@ -84,7 +84,7 @@ public class ReportPredefinedBackgroundPane extends PredefinedStyleSettingPane<R
public void updateBean(ReportSettingsProvider reportSettings) {
if (this.predefinedRadioBtn.isSelected()) {
((ReportSettings) reportSettings).setNameBackground(updatePredefinedStyle());
// ((ReportSettings) reportSettings).setNameBackground(updatePredefinedStyle());
} else {
reportSettings.setBackground(this.backgroundPane.updateBean());
}

4
designer-realize/src/main/java/com/fr/design/style/BorderUtils.java

@ -7,7 +7,6 @@ import java.util.Hashtable;
import java.util.List;
import com.fr.base.CellBorderStyle;
import com.fr.base.NameStyle;
import com.fr.base.Style;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.general.ComparatorUtils;
@ -15,7 +14,6 @@ import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultPredefinedTemplateCellElement;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.FloatElement;
import com.fr.report.cell.TemplateCellElement;
@ -513,7 +511,7 @@ public abstract class BorderUtils {
for (int j = row; j < row + rowSpan; j++) {
TemplateCellElement tmpCellElement = report.getTemplateCellElement(i, j);
if (tmpCellElement == null) {
tmpCellElement = new DefaultPredefinedTemplateCellElement(i, j);
tmpCellElement = new DefaultTemplateCellElement(i, j);
report.addCellElement(tmpCellElement);
}
Style style = tmpCellElement.getStyle();

6
designer-realize/src/main/java/com/fr/grid/Grid.java

@ -28,7 +28,7 @@ import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.report.ReportHelper;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultPredefinedTemplateCellElement;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.FloatElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellGUIAttr;
@ -865,7 +865,7 @@ public class Grid extends BaseGridComponent {
}
// 必须保证editingCellElement不是null。
if (editingCellElement == null) {
editingCellElement = new DefaultPredefinedTemplateCellElement(column, row);
editingCellElement = new DefaultTemplateCellElement(column, row);
}
editorComponent = getCellEditingComp();
if (editorComponent == null) {
@ -1029,7 +1029,7 @@ public class Grid extends BaseGridComponent {
}
// 必须保证editingCellElement不是null。
if (editingCellElement == null) {
editingCellElement = new DefaultPredefinedTemplateCellElement(editingColumn, editingRow);
editingCellElement = new DefaultTemplateCellElement(editingColumn, editingRow);
tplEC.addCellElement(editingCellElement);
}
if (setValue4EditingElement(newValue)) {

28
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -4,16 +4,13 @@ import com.fr.base.BaseFormula;
import com.fr.base.DynamicUnitList;
import com.fr.base.GraphHelper;
import com.fr.base.Margin;
import com.fr.base.NameStyle;
import com.fr.base.PaperSize;
import com.fr.base.Utils;
import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageFileBackground;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
@ -46,19 +43,16 @@ import com.fr.report.stable.ReportConstants;
import com.fr.report.stable.ReportSettings;
import com.fr.report.worksheet.FormElementCase;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.AssistUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.Constants;
import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU;
import com.fr.stable.AssistUtils;
import com.fr.third.antlr.ANTLRException;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
@ -76,6 +70,9 @@ import java.awt.geom.Line2D;
import java.awt.geom.Line2D.Double;
import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class GridUI extends ComponentUI {
@ -169,8 +166,6 @@ public class GridUI extends ComponentUI {
- reportSettings.getFooterHeight().toPixD(resolution);
}
//绘制背景之前需要先将全局预定义样式名称刷新到报表配置中
reportSettings.getNameBackground().resetPreferenceStyle(getGlobalPredefinedStyleName());
// denny:画背景.Background
Background background = reportSettings.getBackground();
@ -185,10 +180,6 @@ public class GridUI extends ComponentUI {
}
}
private String getGlobalPredefinedStyleName() {
return HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplatePredefinedStyle();
}
private void clearBackground(Graphics2D g2d, Grid grid) {
if (grid.isEnabled()) {
g2d.setPaint(Color.WHITE);
@ -309,7 +300,7 @@ public class GridUI extends ComponentUI {
private int resolution;
private static final double THRESHOLD = 1.0E-4D;
private static final double THRESHOLD = 1.0E-4D;
DrawLineHelper(int startIndex, int endIndex, boolean showGridLine,
boolean showPaginateLine, DynamicUnitList sizeList, double paperPaintSize,
@ -510,12 +501,6 @@ public class GridUI extends ComponentUI {
double cellWidth = this.tmpRectangle.getWidth();
double cellHeight = this.tmpRectangle.getHeight();
if (tmpCellElement.getStyle() instanceof NameStyle) {
((NameStyle) tmpCellElement.getStyle()).setPredefinedStyleName(getGlobalPredefinedStyleName());
}
if (tmpCellElement.getValue() instanceof BaseChartCollection) {
((BaseChartCollection) tmpCellElement.getValue()).setPredefinedStyleName(getGlobalPredefinedStyleName(), false);
}
// denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框
painter.paintBackground(g2d, report, tmpCellElement, cellWidth - 1, cellHeight - 1);
@ -962,9 +947,6 @@ public class GridUI extends ComponentUI {
g2d.translate(floatX, floatY);
if (tmpFloatElement.getValue() instanceof BaseChartCollection) {
((BaseChartCollection) tmpFloatElement.getValue()).setPredefinedStyleName(getGlobalPredefinedStyleName(), false);
}
PaintUtils.paintFloatElement(g2d, tmpFloatElement,
tmpFloatElement.getWidth().toPixI(resolution),
tmpFloatElement.getHeight().toPixI(resolution), resolution);

14
designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java

@ -3,12 +3,10 @@ package com.fr.grid.selection;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils;
import com.fr.base.NameStyle;
import com.fr.base.Style;
import com.fr.base.Utils;
import com.fr.base.vcs.DesignerMode;
import com.fr.cache.list.IntList;
import com.fr.config.ServerPreferenceConfig;
import com.fr.config.predefined.PredefinedStyle;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.CellAttributeAction;
import com.fr.design.actions.cell.CellExpandAttrAction;
@ -30,7 +28,6 @@ import com.fr.design.cell.clipboard.ElementsTransferable;
import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIPopupMenu;
@ -44,7 +41,6 @@ import com.fr.design.report.RowColumnPane;
import com.fr.design.selection.QuickEditor;
import com.fr.grid.GridUtils;
import com.fr.predefined.PredefinedPatternStyleManager;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
@ -480,13 +476,11 @@ public class CellSelection extends Selection {
if (!ServerPreferenceConfig.getInstance().hasStyle()) {
UIMenu styleMenu = new UIMenu(KeySetUtils.GLOBAL_STYLE.getMenuName());
styleMenu.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png"));
String styleName = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplatePredefinedStyle();
PredefinedStyle currentStyle = PredefinedPatternStyleManager.INSTANCE.getStyleFromName(styleName);
Iterator iterator = currentStyle.getCellStyleConfig().getStyleNameIterator();
while (iterator.hasNext()) {
String name = (String) iterator.next();
Iterator iterato = ServerPreferenceConfig.getInstance().getStyleNameIterator();
while (iterato.hasNext()) {
String name = (String) iterato.next();
name = GlobalStyleMenuDef.judgeChina(name);
NameStyle nameStyle = NameStyle.createPredefinedStyle(styleName, name, Style.getInstance());
NameStyle nameStyle = NameStyle.getInstance(name);
UpdateAction.UseMenuItem useMenuItem = new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem();
useMenuItem.setNameStyle(nameStyle);
styleMenu.add(useMenuItem);

5
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -7,7 +7,6 @@ import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.actions.file.newReport.NewPolyReportAction;
import com.fr.design.actions.file.newReport.NewWorkBookAction;
import com.fr.design.actions.server.ServerConfigManagerAction;
import com.fr.design.actions.server.predefined.ServerPredefinedStyleAction;
import com.fr.design.actions.server.StyleListAction;
import com.fr.design.actions.server.WidgetManagerAction;
import com.fr.design.base.mode.DesignModeContext;
@ -37,7 +36,6 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.module.ChartEmptyDataStyleAction;
import com.fr.design.module.ChartPreStyleAction;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.notification.SnapChatAllTypes;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event;
@ -163,8 +161,7 @@ public class MainDesigner extends BaseDesigner {
menuDef.addShortCut(SeparatorDef.DEFAULT);
if (WorkContext.getCurrent().isRoot()) {
menuDef.addShortCut(new ServerConfigManagerAction(), new ServerPredefinedStyleAction(SnapChatAllTypes.UpdateAction.PREDEFINED_STYLE),
new WidgetManagerAction());
menuDef.addShortCut(new ServerConfigManagerAction(), new StyleListAction(), new WidgetManagerAction());
menuDef.addShortCut(new ChartPreStyleAction(), new ChartEmptyDataStyleAction(),new ChartMapEditorAction());
}

Loading…
Cancel
Save