Browse Source

REPORT-42887 && REPORT-42450 新建多sheet背景不生效; 单元格设置预定义样式的时候,使用工具栏设置边框设置失败

feature/big-screen
kerry 4 years ago
parent
commit
d7f62063d6
  1. 10
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 32
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  3. 56
      designer-base/src/main/java/com/fr/design/utils/PredefinedStyleUtils.java
  4. 4
      designer-realize/src/main/java/com/fr/design/actions/server/predefined/ServerPredefinedStyleAction.java
  5. 6
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  6. 3
      designer-realize/src/main/java/com/fr/design/style/BorderUtils.java
  7. 6
      designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java

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

@ -52,7 +52,7 @@ 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.DesignUtils;
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;
@ -160,10 +160,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
setPredefinedInfo(isNewFile);
}
private void setPredefinedInfo(boolean isNewFile){
private void setPredefinedInfo(boolean isNewFile) {
if (this.template.getAttrMark(PredefinedStyleAttrMark.XML_TAG) == null) {
PredefinedStyleAttrMark attrMark = PredefinedStyleAttrMark.createDefaultStyleMark();
if (!isNewFile || !DesignUtils.isDesignerEnvMatch()) {
PredefinedStyleAttrMark attrMark = PredefinedStyleAttrMark.createDefaultStyleMark();
if (!isNewFile || !PredefinedStyleUtils.isAllowPredefinedSetting()) {
attrMark.setPreferenceStyleName(InterProviderFactory.getProvider().getLocText("Fine-Engine_Predefined_Style_Compatibility"));
}
this.template.addAttrMark(attrMark);
@ -1362,7 +1362,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
});
preferenceButton.setEnabled(DesignUtils.isDesignerEnvMatch());
preferenceButton.setEnabled(PredefinedStyleUtils.isAllowPredefinedSetting());
return preferenceButton;
}

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

@ -63,21 +63,6 @@ public class DesignUtils {
private static boolean started = false;
/**
* 设计器和工作目录环境版本是否匹配标志
*/
private static boolean designerEnvMatch = true;
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
designerEnvMatch = checkDesignerEnvMatch();
}
});
}
private DesignUtils() {
}
@ -90,10 +75,6 @@ public class DesignUtils {
return port;
}
public static boolean isDesignerEnvMatch() {
return designerEnvMatch;
}
/**
* 判断设计器有没有启动
*
@ -439,17 +420,4 @@ public class DesignUtils {
return true;
}
public static boolean checkDesignerEnvMatch() {
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();
}
}

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

@ -0,0 +1,56 @@
package com.fr.design.utils;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.stable.EnvChangedListener;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.predefined.PredefinedStyleOperator;
/**
* Created by kerry on 2020-11-06
*/
public class PredefinedStyleUtils {
/**
* 判断当前环境是否支持预定义样式的设置
*/
private static Boolean allowPredefinedSetting = null;
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
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();
}
}

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.DesignUtils;
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(DesignUtils.isDesignerEnvMatch());
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/cell/settingpane/CellStylePane.java

@ -54,7 +54,7 @@ public class CellStylePane extends AbstractCellAttrPane {
@Override
public void updateBeans() {
Style s = stylePane.updateStyle();
Style style = stylePane.updateStyle();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int cellRectangleCount = cs.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) {
@ -68,11 +68,13 @@ public class CellStylePane extends AbstractCellAttrPane {
cellElement = new DefaultPredefinedTemplateCellElement(column, row);
elementCase.addCellElement(cellElement);
}
cellElement.setStyle(s);
cellElement.setStyle(style);
}
}
}
if (!(style instanceof NameStyle)) {
stylePane.updateBorder();// border必须特别处理
}
}
@Override

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

@ -517,9 +517,6 @@ public abstract class BorderUtils {
report.addCellElement(tmpCellElement);
}
Style style = tmpCellElement.getStyle();
if (style instanceof NameStyle && ((NameStyle) style).usePredefinedStyle()) {
continue;
}
style = inspectStyle(row, column, rowSpan, columnSpan, cellBorderStyle, newCellBorderStyle, tmpCellElement, style);
tmpCellElement.setStyle(style);
}

6
designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java

@ -8,6 +8,7 @@ import com.fr.base.Margin;
import com.fr.base.PaperSize;
import com.fr.base.ScreenResolution;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.utils.ComponentUtils;
import com.fr.general.Background;
@ -82,6 +83,7 @@ public class PolyDesignUI extends ComponentUI {
g2d.setPaint(Color.WHITE);
GraphHelper.fillRect(g, 0, 0, d.width, d.height);
ReportSettingsProvider rs = report.getReportSettings();
rs.getNameBackground().resetPreferenceStyle(getGlobalPredefinedStyleName());
if (rs != null) {
Background bg = rs.getBackground();
if (bg != null) {
@ -91,6 +93,10 @@ public class PolyDesignUI extends ComponentUI {
}
}
private String getGlobalPredefinedStyleName() {
return HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplatePredefinedStyle();
}
@Override
public void paint(Graphics g, JComponent c) {
this.resolution = ((PolyArea)c).getResolution();

Loading…
Cancel
Save