Browse Source

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

feature/big-screen
kerry 4 years ago
parent
commit
d7f62063d6
  1. 8
      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

8
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.menu.ShortCut;
import com.fr.design.preview.PagePreview; import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil; 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.DBManipulationInWidgetEventPane;
import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.DBManipulationPane;
import com.fr.file.FILE; import com.fr.file.FILE;
@ -160,10 +160,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
setPredefinedInfo(isNewFile); setPredefinedInfo(isNewFile);
} }
private void setPredefinedInfo(boolean isNewFile){ private void setPredefinedInfo(boolean isNewFile) {
if (this.template.getAttrMark(PredefinedStyleAttrMark.XML_TAG) == null) { if (this.template.getAttrMark(PredefinedStyleAttrMark.XML_TAG) == null) {
PredefinedStyleAttrMark attrMark = PredefinedStyleAttrMark.createDefaultStyleMark(); PredefinedStyleAttrMark attrMark = PredefinedStyleAttrMark.createDefaultStyleMark();
if (!isNewFile || !DesignUtils.isDesignerEnvMatch()) { if (!isNewFile || !PredefinedStyleUtils.isAllowPredefinedSetting()) {
attrMark.setPreferenceStyleName(InterProviderFactory.getProvider().getLocText("Fine-Engine_Predefined_Style_Compatibility")); attrMark.setPreferenceStyleName(InterProviderFactory.getProvider().getLocText("Fine-Engine_Predefined_Style_Compatibility"));
} }
this.template.addAttrMark(attrMark); 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; 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 started = false;
/**
* 设计器和工作目录环境版本是否匹配标志
*/
private static boolean designerEnvMatch = true;
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
designerEnvMatch = checkDesignerEnvMatch();
}
});
}
private DesignUtils() { private DesignUtils() {
} }
@ -90,10 +75,6 @@ public class DesignUtils {
return port; return port;
} }
public static boolean isDesignerEnvMatch() {
return designerEnvMatch;
}
/** /**
* 判断设计器有没有启动 * 判断设计器有没有启动
* *
@ -439,17 +420,4 @@ public class DesignUtils {
return true; 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.MenuKeySet;
import com.fr.design.menu.SnapChatUpdateAction; import com.fr.design.menu.SnapChatUpdateAction;
import com.fr.design.notification.SnapChatKey; import com.fr.design.notification.SnapChatKey;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.PredefinedStyleUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
@ -21,7 +21,7 @@ public class ServerPredefinedStyleAction extends SnapChatUpdateAction {
public ServerPredefinedStyleAction(SnapChatKey uniqueKey) { public ServerPredefinedStyleAction(SnapChatKey uniqueKey) {
super(uniqueKey); super(uniqueKey);
this.setEnabled(DesignUtils.isDesignerEnvMatch()); this.setEnabled(PredefinedStyleUtils.isAllowPredefinedSetting());
this.setMenuKeySet(PREDEFINED_STYLES); this.setMenuKeySet(PREDEFINED_STYLES);
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); 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 @Override
public void updateBeans() { public void updateBeans() {
Style s = stylePane.updateStyle(); Style style = stylePane.updateStyle();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int cellRectangleCount = cs.getCellRectangleCount(); int cellRectangleCount = cs.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) { for (int rect = 0; rect < cellRectangleCount; rect++) {
@ -68,12 +68,14 @@ public class CellStylePane extends AbstractCellAttrPane {
cellElement = new DefaultPredefinedTemplateCellElement(column, row); cellElement = new DefaultPredefinedTemplateCellElement(column, row);
elementCase.addCellElement(cellElement); elementCase.addCellElement(cellElement);
} }
cellElement.setStyle(s); cellElement.setStyle(style);
} }
} }
} }
if (!(style instanceof NameStyle)) {
stylePane.updateBorder();// border必须特别处理 stylePane.updateBorder();// border必须特别处理
} }
}
@Override @Override
protected void populateBean() { protected void populateBean() {

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

@ -517,9 +517,6 @@ public abstract class BorderUtils {
report.addCellElement(tmpCellElement); report.addCellElement(tmpCellElement);
} }
Style style = tmpCellElement.getStyle(); Style style = tmpCellElement.getStyle();
if (style instanceof NameStyle && ((NameStyle) style).usePredefinedStyle()) {
continue;
}
style = inspectStyle(row, column, rowSpan, columnSpan, cellBorderStyle, newCellBorderStyle, tmpCellElement, style); style = inspectStyle(row, column, rowSpan, columnSpan, cellBorderStyle, newCellBorderStyle, tmpCellElement, style);
tmpCellElement.setStyle(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.PaperSize;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.general.Background; import com.fr.general.Background;
@ -82,6 +83,7 @@ public class PolyDesignUI extends ComponentUI {
g2d.setPaint(Color.WHITE); g2d.setPaint(Color.WHITE);
GraphHelper.fillRect(g, 0, 0, d.width, d.height); GraphHelper.fillRect(g, 0, 0, d.width, d.height);
ReportSettingsProvider rs = report.getReportSettings(); ReportSettingsProvider rs = report.getReportSettings();
rs.getNameBackground().resetPreferenceStyle(getGlobalPredefinedStyleName());
if (rs != null) { if (rs != null) {
Background bg = rs.getBackground(); Background bg = rs.getBackground();
if (bg != null) { if (bg != null) {
@ -91,6 +93,10 @@ public class PolyDesignUI extends ComponentUI {
} }
} }
private String getGlobalPredefinedStyleName() {
return HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplatePredefinedStyle();
}
@Override @Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
this.resolution = ((PolyArea)c).getResolution(); this.resolution = ((PolyArea)c).getResolution();

Loading…
Cancel
Save