diff --git a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java b/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java index 50d6448b8..b188cb5aa 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java +++ b/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)")}; diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundNoImagePane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundNoImagePane.java index 556b27c21..d3ed4f1af 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundNoImagePane.java +++ b/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(); - } } diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java index 407c522ce..13dd9e3c9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java +++ b/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 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(); - } - /** * 事件监听 diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java index 3713fca7b..7fa266423 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java +++ b/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(); - } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index d27407e62..73d5d0bb1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/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> extends TargetComponent 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> 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> 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> 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> 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> 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> return getEditingFILE().getName(); } + public String getTemplatePredefinedStyle(){ + return StringUtils.EMPTY; + } + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java index 6ac14505a..15291211c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java +++ b/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 implements BasePointCollector { + protected Map 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 removeList = new ArrayList<>(); + List 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(); + } + /** * 从文件中读取埋点信息 */ diff --git a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractTemplateInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractTemplateInfoCollector.java deleted file mode 100644 index 34dc5ea2a..000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractTemplateInfoCollector.java +++ /dev/null @@ -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 extends AbstractPointCollector { - protected Map 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 removeList = new ArrayList<>(); - List 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(); - } - -} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointCollector.java index e2a3c778c..f10f1682e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointCollector.java +++ b/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); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java index 428e5625c..cd651fc6b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java +++ b/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 { +public class ChartInfoCollector extends AbstractPointCollector { private static final String XML_TAG = "ChartInfoCollector"; private static final String XML_LAST_EDIT_DAY = "lastEditDay"; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollector.java deleted file mode 100644 index 9dfe2e9db..000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollector.java +++ /dev/null @@ -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(); - } -} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ReportPredefinedStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ReportPredefinedStylePane.java index 45d2ca9fe..b29e7ffdf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ReportPredefinedStylePane.java +++ b/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()); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ColorDetailPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ColorDetailPane.java index ce4f923cb..b7034fd66 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ColorDetailPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ColorDetailPane.java @@ -72,7 +72,8 @@ public class ColorDetailPane extends AbstractBackgroundDetailPane para = new HashMap<>(); para.put("token", SiteCenterToken.generateToken()); para.put("content", content); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java index e41759d24..23c07ea3a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java +++ b/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 { +public class TemplateInfoCollector extends AbstractPointCollector { 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"; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 894ebe1c1..d1abb908b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/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( diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java index 94779d9d7..d94da0c88 100644 --- a/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java +++ b/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()}, "-" - ); - } - } - } diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java index 9d1cb168c..3dd59bd5b 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java +++ b/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); + } + } + } } diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java index 437b3c8c4..c82eac0c0 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java +++ b/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() { diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 3eba512a4..58f5d2a5f 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/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; } + /** * 判断设计器有没有启动 * diff --git a/designer-base/src/main/java/com/fr/design/utils/PredefinedStyleUtils.java b/designer-base/src/main/java/com/fr/design/utils/PredefinedStyleUtils.java deleted file mode 100644 index 9b9ae335b..000000000 --- a/designer-base/src/main/java/com/fr/design/utils/PredefinedStyleUtils.java +++ /dev/null @@ -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() { - @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(); - } -} diff --git a/designer-base/src/test/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollectorTest.java b/designer-base/src/test/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollectorTest.java deleted file mode 100644 index c3c3242bd..000000000 --- a/designer-base/src/test/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollectorTest.java +++ /dev/null @@ -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")); - } - -} diff --git a/designer-base/src/test/resources/com/fr/design/mainframe/predefined/info/predefinedStyle.info b/designer-base/src/test/resources/com/fr/design/mainframe/predefined/info/predefinedStyle.info deleted file mode 100644 index 1d66b6107..000000000 --- a/designer-base/src/test/resources/com/fr/design/mainframe/predefined/info/predefinedStyle.info +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java index a565f4bf4..c002bceb3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java +++ b/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(); - } - - } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index f3218e9a5..ba049aee8 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/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(){ + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index a0f902112..a315b7117 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/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(); - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java index 917b73434..db0b0618a 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java +++ b/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)); - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index 7379b8310..5b271a7cf 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/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)); - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java index 076bd24d9..c925b3a5c 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java +++ b/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)); - } - } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 7923c3fa2..62c89b9ca 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/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
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); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 7f1aef52b..b7fb90fcb 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -644,7 +644,6 @@ public class JForm extends JTemplate implements BaseJForm { - private AccessibleBorderStyleEditor borderStyleEditor; + private AccessibleWLayoutBorderStyleEditor borderStyleEditor; public BorderStyleWidgetDefinePane(XCreator xCreator) { super(xCreator); @@ -29,7 +29,7 @@ public class BorderStyleWidgetDefinePane extends AbstractDataModify 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 extends AbstractDataModify { - private AccessibleBorderStyleEditor borderStyleEditor; + private AccessibleWLayoutBorderStyleEditor borderStyleEditor; public WTitleLayoutDefinePane(XCreator xCreator) { super(xCreator); @@ -32,7 +34,7 @@ public abstract class WTitleLayoutDefinePane { 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 { populateReportParameterAttr(); } - @Override protected void addPane(PropertyItemPaneProvider provider) { PaneHolder holder = provider.getPaneHolder(JWorkBook.class); @@ -787,7 +776,6 @@ public class JWorkBook extends JTemplate { } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } - refreshPredefinedState(); } private void applyAll(WorkBookUndoState u) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java index bfe525eb7..ead1cf2f1 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java +++ b/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 diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java index 108cad815..487214a80 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java +++ b/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); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java index 95645acaf..370677860 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java +++ b/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]); } } diff --git a/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java b/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java index cb5acdf86..ad0c57b51 100644 --- a/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java +++ b/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); // 不知道这行代码的作用,怕去掉之后会出问题,先放在这里 diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportPredefinedBackgroundPane.java b/designer-realize/src/main/java/com/fr/design/report/ReportPredefinedBackgroundPane.java index 5df13c242..5fcee4ba9 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportPredefinedBackgroundPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportPredefinedBackgroundPane.java @@ -84,7 +84,7 @@ public class ReportPredefinedBackgroundPane extends PredefinedStyleSettingPane