Browse Source

Pull request #2787: REPORT-35149 bug修复

Merge in DESIGN/design from ~KERRY/design_10.0:release/10.0 to release/10.0

* commit '6dd9eb4f9fda46a28b8f10f6a44e6793d683045b':
  用uiutil
  代码修改
  代码修改
  REPORT-35149 bug修复
feature/big-screen
ju.ju 4 years ago
parent
commit
94bc4454c0
  1. 14
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  2. 33
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  3. 17
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java
  4. 9
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleSettingPane.java
  5. 6
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ReportPredefinedStylePane.java
  6. 14
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java
  7. 21
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/CellStyleListControlPane.java
  8. 2
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ImageDetailPane.java
  9. 12
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/cell/CustomPredefinedStylePane.java
  10. 44
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ComponentPreviewPane.java
  11. 130
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ElementCasePreview.java
  12. 6
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java
  13. 7
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  14. 8
      designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java
  15. 1
      designer-base/src/main/resources/com/fr/design/mainframe/predefined/previewData
  16. 12
      designer-form/src/main/java/com/fr/design/gui/xpane/FormPredefinedBackgroundPane.java
  17. 10
      designer-form/src/main/java/com/fr/design/gui/xpane/PredefinedComponentStyleSettingPane.java
  18. 1
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  19. 20
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  20. 16
      designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java
  21. 5
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  22. 37
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java
  23. 10
      designer-realize/src/main/java/com/fr/design/report/ReportPredefinedBackgroundPane.java

14
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -13,6 +13,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JTemplateFactory;
import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.ui.util.UIUtil;
import com.fr.file.FILE;
import com.fr.file.FileNodeFILE;
import com.fr.file.StashedFILE;
@ -22,6 +23,7 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.io.FilenameUtils;
import javax.swing.SwingUtilities;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Collections;
@ -427,4 +429,16 @@ public class HistoryTemplateListCache implements CallbackEvent {
jt.refreshResource();
}
}
/**
* 重绘当前模板
*/
public void repaintCurrentEditingTemplate(){
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
getCurrentEditingTemplate().repaint();
}
});
}
}

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

@ -51,6 +51,7 @@ 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.DesignUtils;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
import com.fr.design.write.submit.DBManipulationPane;
@ -120,6 +121,7 @@ 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;
@ -570,6 +572,18 @@ 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);
}
}
});
}
/**
* 停止编辑, 判断保存属性 *
*/
@ -1323,7 +1337,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
for (DesignerFrameUpButtonProvider provider : providers) {
uiButtons = ArrayUtils.addAll(uiButtons, provider.getUpButtons(getMenuState()));
}
UIButton predefinedBtn = createPreDefinedButton();
predefinedBtn = createPreDefinedButton();
if (predefinedBtn != null) {
uiButtons = ArrayUtils.addAll(uiButtons, new UIButton[]{predefinedBtn});
}
@ -1341,7 +1355,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
@Override
public void actionPerformed(ActionEvent e) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
ReportPredefinedStylePane stylePane = new ReportPredefinedStylePane(JTemplate.this, preferenceButton);
ReportPredefinedStylePane stylePane = new ReportPredefinedStylePane(JTemplate.this);
ReportPredefinedStyleDialog dialog = new ReportPredefinedStyleDialog(designerFrame, stylePane);
PredefinedStyleInfoCollector.getInstance().collectClickNumber();
dialog.setVisible(true);
@ -1360,12 +1374,17 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
predefinedBtn.setPreferredSize(new Dimension(Math.min(metrics.stringWidth(text) + PREDEFINED_ICON_WIDTH, 100), 20));
}
public void resetPredefinedStyle(String styleName, UIButton predefinedBtn) {
public void resetPredefinedStyle(String styleName) {
this.getTarget().setPredefinedStyleName(styleName, true);
predefinedBtn.setText(getTemplatePredefinedStyle());
setPredefinedButtonSize(predefinedBtn);
this.fireTargetModified();
this.repaint();
refreshPredefinedState();
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
JTemplate.this.fireTargetModified();
JTemplate.this.repaint();
}
});
}
public String getTemplatePredefinedStyle(){

17
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java

@ -12,6 +12,7 @@ import com.fr.config.predefined.PredefinedStyle;
import com.fr.config.predefined.PredefinedStyleConfig;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.frpane.UITabbedPane;
@ -25,10 +26,13 @@ import com.fr.design.mainframe.predefined.ui.detail.PredefinedBackgroundSettingP
import com.fr.design.mainframe.predefined.ui.detail.ComponentStyleSettingPane;
import com.fr.design.mainframe.predefined.ui.detail.CellStyleListControlPane;
import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -185,6 +189,12 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
this.cellStyleSettingPane = new CellStyleListControlPane();
this.cellStyleSettingPane.registerAttrChangeListener(new AttributeChangeListener() {
@Override
public void attributeChange() {
valueChangeAction();
}
});
jPanel.add(this.cellStyleSettingPane);
return jPanel;
}
@ -288,7 +298,7 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
if (!saveStyle(previewObject)) {
return false;
}
DesignUtils.refreshDesignerFrame();
HistoryTemplateListCache.getInstance().repaintCurrentEditingTemplate();
return true;
}
@ -302,7 +312,12 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
}
config.add(previewObject);
PredefinedStyleConfig sortedConfig = resortConfigStyles(previewObject, config);
Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) {
@Override
public void run() {
ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(sortedConfig);
}
});
selectPane.refreshPane();
return true;
}

9
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleSettingPane.java

@ -9,7 +9,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.predefined.ui.preview.StyleSettingPreviewPane;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -68,6 +67,7 @@ public abstract class PredefinedStyleSettingPane<T> extends AbstractAttrNoScroll
predefinedRadioBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
populateCustomPane();
tabbedPane.show(center, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Predefined"));
}
});
@ -125,6 +125,13 @@ public abstract class PredefinedStyleSettingPane<T> extends AbstractAttrNoScroll
return template.getTemplatePredefinedStyle();
}
/**
* 用于在切换到预定义样式后重置自定义样式的设置
*/
protected abstract void populateCustomPane();
/**
* 展示数据
*

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

@ -16,11 +16,9 @@ import java.awt.FlowLayout;
public class ReportPredefinedStylePane extends BasicPane {
private PredefinedStyleSelectPane selectPane;
private JTemplate currentTemplate;
private UIButton preferenceBtn;
public ReportPredefinedStylePane(JTemplate jTemplate, UIButton preferenceButton) {
public ReportPredefinedStylePane(JTemplate jTemplate) {
this.currentTemplate = jTemplate;
this.preferenceBtn = preferenceButton;
initPane();
}
@ -38,7 +36,7 @@ public class ReportPredefinedStylePane extends BasicPane {
public void update() {
PredefinedStyle style = selectPane.update();
if (style != null) {
currentTemplate.resetPredefinedStyle(style.getStyleName(), preferenceBtn);
currentTemplate.resetPredefinedStyle(style.getStyleName());
}
}

14
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java

@ -21,6 +21,8 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.StringUtils;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
@ -138,8 +140,12 @@ public class ServerPredefinedStylePane extends BasicPane {
if (style != null) {
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig();
config.setDefaultPredefinedStyle(style.getStyleName());
Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) {
@Override
public void run() {
ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config);
DesignUtils.refreshDesignerFrame();
}
});
}
}
@ -201,8 +207,12 @@ public class ServerPredefinedStylePane extends BasicPane {
private void removeStyle(String name) {
PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig();
config.removeStyle(name);
Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) {
@Override
public void run() {
ServerPreferenceConfig.getInstance().setPreferenceStyleConfig(config);
DesignUtils.refreshDesignerFrame();
}
});
}
}

21
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/CellStyleListControlPane.java

@ -14,6 +14,7 @@ import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.gui.style.AlignmentPane;
@ -24,6 +25,7 @@ import com.fr.design.mainframe.predefined.ui.detail.cell.CustomPredefinedStylePa
import com.fr.design.menu.ShortCut;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
@ -49,6 +51,9 @@ import java.util.List;
*/
public class CellStyleListControlPane extends JListControlPane {
private boolean namePermitted = true;
private AttributeChangeListener attributeChangeListener;
public CellStyleListControlPane() {
super();
@ -73,6 +78,13 @@ public class CellStyleListControlPane extends JListControlPane {
});
}
public void registerAttrChangeListener(AttributeChangeListener listener){
this.attributeChangeListener = listener;
}
private void showTipDialogAndReset(String content, int index) {
nameableList.stopEditing();
@ -98,6 +110,15 @@ public class CellStyleListControlPane extends JListControlPane {
PredefinedCellStyle.class, CustomPredefinedStylePane.class)};
}
@Override
public BasicBeanPane createPaneByCreators(NameableCreator creator) {
CustomPredefinedStylePane stylePane = (CustomPredefinedStylePane) super.createPaneByCreators(creator);
stylePane.registerAttrChangeListener(attributeChangeListener);
return stylePane;
}
@Override
protected String title4PopupWindow() {
return StringUtils.EMPTY;

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

@ -98,7 +98,7 @@ public class ImageDetailPane extends AbstractBackgroundDetailPane<ImageBackgroun
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Fill_Mode")), jp}
};
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_NONE,
IntervalConstants.INTERVAL_W4, IntervalConstants.INTERVAL_L1);
IntervalConstants.INTERVAL_L4, IntervalConstants.INTERVAL_L1);
selectFilePane.add(centerPane, BorderLayout.CENTER);
return selectFilePane;
}

12
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/cell/CustomPredefinedStylePane.java

@ -39,6 +39,7 @@ public class CustomPredefinedStylePane extends MultiTabPane<PredefinedCellStyle>
private PredefinedCellStyle cellStyle;
private PreviewArea previewArea;
private boolean populating;
private AttributeChangeListener attributeChangeListener;
public CustomPredefinedStylePane() {
@ -49,6 +50,16 @@ public class CustomPredefinedStylePane extends MultiTabPane<PredefinedCellStyle>
tabPane.setLayout(new GridLayout(1, 3, 0, 0));
}
public void registerAttrChangeListener(AttributeChangeListener listener){
this.attributeChangeListener = listener;
}
private void fireAttrChangeListener() {
if (this.attributeChangeListener != null) {
this.attributeChangeListener.attributeChange();
}
}
/**
* @return
*/
@ -141,6 +152,7 @@ public class CustomPredefinedStylePane extends MultiTabPane<PredefinedCellStyle>
if (cellStyle != null) {
previewArea.preview(cellStyle.getStyle());
}
fireAttrChangeListener();
}
});
BasicScrollPane basicScrollPane = new AttrScrollPane() {

44
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ComponentPreviewPane.java

@ -8,6 +8,7 @@ import com.fr.general.Background;
import com.fr.general.FRFont;
import com.fr.general.act.BorderPacker;
import com.fr.general.act.TitlePacker;
import com.fr.stable.Constants;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -24,7 +25,7 @@ import java.awt.geom.Rectangle2D;
*/
public abstract class ComponentPreviewPane extends StyleSettingPreviewPane {
private PredefinedStyle style = new PredefinedStyle();
private static final int SMALL_GAP = 5;
private static final int SMALL_GAP = 10;
private static final int GAP = 10;
private JPanel contentPane;
private TitlePreviewPane titlePane;
@ -53,23 +54,16 @@ public abstract class ComponentPreviewPane extends StyleSettingPreviewPane {
this.style = style;
}
@Override
public void paint(Graphics g) {
paintContent(g);
}
public void paintContent(Graphics g) {
public void paintComponents(Graphics g) {
BorderPacker borderStyle = style.getComponentStyle().getBorderStyle();
updateBorders(g, borderStyle);
paintTitle(g, borderStyle.getTitle());
paintContentPane(g,borderStyle);
paintContentPane(g, borderStyle);
super.paintComponents(g);
}
private void paintContentPane(Graphics g, BorderPacker borderStyle) {
@ -79,18 +73,15 @@ public abstract class ComponentPreviewPane extends StyleSettingPreviewPane {
if (borderStyle.getBackground() != null) {
borderStyle.getBackground().paint(clipg, clipg.getClipBounds());
}
this.contentPane.paint(clipg);
clipg.dispose();
}
private void paintTitle(Graphics g, TitlePacker titlePacker) {
FRFont font = titlePacker.getFrFont();
Background background = titlePacker.getBackground();
if (background != null) {
background.paint(g, new Rectangle2D.Double(10, 5, this.titlePane.getWidth(), this.titlePane.getHeight()));
}
titlePane.setFontObject(font);
titlePane.setTitleObject(titlePacker);
titlePane.paintComponent(g);
}
@ -103,6 +94,7 @@ public abstract class ComponentPreviewPane extends StyleSettingPreviewPane {
private class TitlePreviewPane extends JPanel {
private FRFont frFont = null;
private int titlePosition = Constants.LEFT;
public TitlePreviewPane() {
this.setBackground(null);
@ -127,19 +119,23 @@ public abstract class ComponentPreviewPane extends StyleSettingPreviewPane {
} else {
g2d.setColor(new Color(237, 237, 237));
}
g2d.setFont(frFont.applySize(14).applyResolutionNP(96));
int startY = 0;
startY = (d.height + fm.getHeight()) / 2;
drawTabBack(g2d, startY);
g2d.setFont(frFont.applyResolutionNP(96));
String paintText = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Preview_Title_Text");
int startY = 0, startX = 0;
startX = (d.width - fm.stringWidth(paintText)) / 2;
startY = (d.height - fm.getHeight()) / 2 + fm.getAscent();
if (this.titlePosition == Constants.LEFT) {
startX = GAP;
} else if (this.titlePosition == Constants.RIGHT) {
startX = d.width - fm.stringWidth(paintText) - GAP - fm.getMaxAdvance();
}
GraphHelper.drawString(g2d, paintText, startX, startY);
private void drawTabBack(Graphics2D g2d, int startY) {
String paintText = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Preview_Title_Text");
GraphHelper.drawString(g2d, paintText, GAP, 32);
}
public void setFontObject(FRFont font) {
this.frFont = font;
public void setTitleObject(TitlePacker titlePacker) {
this.frFont = titlePacker.getFrFont();
this.titlePosition = titlePacker.getPosition();
}
}

130
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ElementCasePreview.java

@ -1,21 +1,26 @@
package com.fr.design.mainframe.predefined.ui.preview;
import com.fr.design.gui.ilable.UILabel;
import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.config.predefined.PredefinedCellStyle;
import com.fr.config.predefined.PredefinedCellStyleConfig;
import com.fr.config.predefined.PredefinedStyle;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
import com.fr.third.javax.annotation.Nonnull;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
/**
* Created by kerry on 2020-09-04
@ -23,6 +28,7 @@ import java.awt.Dimension;
public class ElementCasePreview extends ComponentPreviewPane {
private static final List<String[]> PREVIEW_DATA_LIST = new ArrayList<>();
private static final String BLANK_CHAR = " ";
private List<GridRowPane> gridRowPanes;
static {
readPreviewData();
@ -44,56 +50,122 @@ public class ElementCasePreview extends ComponentPreviewPane {
}
}
@Override
protected JPanel createContentPane() {
gridRowPanes = new ArrayList<>();
JPanel jPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
jPanel.setOpaque(false);
jPanel.setBackground(null);
FRFont font = FRFont.getInstance();
font = font.applySize(11);
FRFont titleFont = font.applySize(14).applyForeground(Color.decode("#63B2EE"));
FRFont endFont = font.applySize(11).applyForeground(Color.decode("#1B97FF"));
for (int i = 0; i < PREVIEW_DATA_LIST.size(); i++) {
FRFont frFont = font;
GridRowPane gridRowPane = new GridRowPane(PREVIEW_DATA_LIST.get(i), Style.DEFAULT_STYLE);
gridRowPanes.add(gridRowPane);
jPanel.add(gridRowPane);
}
return jPanel;
}
public void refresh(PredefinedStyle style) {
super.refresh(style);
PredefinedCellStyleConfig cellStyleConfig = style.getCellStyleConfig();
for (int i = 0; i < gridRowPanes.size(); i++) {
Style renderStyle = getMainContentStyle(cellStyleConfig);
if (i == 0) {
frFont = titleFont;
renderStyle = getReportHeaderStyle(cellStyleConfig);
}
if (i == PREVIEW_DATA_LIST.size() - 1) {
frFont = endFont;
renderStyle = getHighLightStyle(cellStyleConfig);
}
gridRowPanes.get(i).preview(renderStyle);
}
}
jPanel.add(new GridRowPane(frFont, PREVIEW_DATA_LIST.get(i)));
private Style getReportHeaderStyle(PredefinedCellStyleConfig config) {
return getCellStyle(config, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
}
return jPanel;
private Style getMainContentStyle(PredefinedCellStyleConfig config) {
return getCellStyle(config, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text"));
}
private Style getHighLightStyle(PredefinedCellStyleConfig config) {
return getCellStyle(config, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text"));
}
@Nonnull
private Style getCellStyle(PredefinedCellStyleConfig config, String styleName) {
PredefinedCellStyle cellStyle = config.getStyle(styleName);
if (cellStyle == null) {
return Style.DEFAULT_STYLE;
}
return cellStyle.getStyle();
}
class GridRowPane extends JPanel {
public GridRowPane(FRFont frFont, String[] data) {
private List<GridPreview> gridPreviews = new ArrayList<>();
public GridRowPane(String[] data, Style style) {
this.setOpaque(false);
this.setBackground(null);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel panel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(4, 20, 10);
JPanel panel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(4, 0, 0);
panel.setOpaque(false);
panel.setBackground(null);
for (String text : data) {
panel.add(createLabel(text, frFont));
GridPreview gridPreview = new GridPreview(text);
gridPreviews.add(gridPreview);
panel.add(gridPreview);
}
this.add(panel, BorderLayout.CENTER);
JSeparator jSeparator = new JSeparator();
jSeparator.setPreferredSize(new Dimension(246, 2));
this.add(jSeparator, BorderLayout.SOUTH);
preview(style);
}
public void preview(Style style) {
for (GridPreview grid : gridPreviews) {
grid.preview(style);
}
}
}
private static class GridPreview extends JComponent {
private Style style = Style.DEFAULT_STYLE;
private String value;
public GridPreview(String value) {
this.value = value;
setPreferredSize(new Dimension(125, 30));
}
private UILabel createLabel(String text, FRFont frFont) {
UILabel label = new UILabel(text);
label.setFont(frFont);
label.setForeground(frFont.getForeground());
label.setBackground(null);
return label;
public void preview(Style style) {
this.style = style;
}
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
int resolution = ScreenResolution.getScreenResolution();
if (style == Style.DEFAULT_STYLE) {
Style.paintContent(g2d, value, style, getWidth() - 3, getHeight() - 3, resolution);
return;
}
Style.paintBackground(g2d, style, getWidth(), getHeight());
Style.paintContent(g2d, value, style, getWidth() - 3, getHeight() - 3, resolution);
Style.paintBorder(g2d, style, getWidth() , getHeight() );
}
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
}
}
}

6
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java

@ -37,7 +37,7 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen
private ChartPreStylePreView columnChartPane;
private int COLUMN_CHART_WIDTH = 517;
private int COLUMN_CHART_HEIGHT = 300;
private int COLUMN_CHART_HEIGHT = 290;
private JPanel parent;
@ -51,7 +51,7 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen
this.setBackground(Color.WHITE);
this.elementCasePreview = new ElementCasePreview();
this.add(initChartPreViewPane());
this.elementCasePreview.setPreferredSize(new Dimension(517, 190));
this.elementCasePreview.setPreferredSize(new Dimension(517, 200));
this.add(this.elementCasePreview);
}
@ -120,7 +120,7 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen
this.columnChartPane.paintComponent(g);
g.translate(0, COLUMN_CHART_HEIGHT);
this.elementCasePreview.paintContent(g);
this.elementCasePreview.paintComponents(g);
g.translate(0, -COLUMN_CHART_HEIGHT);
// 恢复双缓冲
ComponentUtils.resetBuffer(dbcomponents);

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

@ -54,7 +54,9 @@ 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;
@ -72,7 +74,6 @@ 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;
@ -468,7 +469,9 @@ public abstract class ToolBarMenuDock {
}
protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) {
MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic__M_Server"), 'S');
MenuDef menuDef = new SnapChatMenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic__M_Server"), 'S',
SnapChatAllTypes.Menu.SERVER);
if (!DesignerMode.isAuthorityEditing()) {
menuDef.addShortCut(

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

@ -12,7 +12,13 @@ public abstract class SnapChatAllTypes {
/**
* 社区按钮
*/
BBS("BBS");
BBS("BBS"),
/**
* 服务器按钮
*/
SERVER("SERVER");
private static final String SIGN = "0001";

1
designer-base/src/main/resources/com/fr/design/mainframe/predefined/previewData

@ -2,5 +2,4 @@
南通市 324,646 324,646 100%
合肥市 248,938 348,938 140%
邵阳市 248,938 348,938 140%
苏州市 248,938 348,938 140%
合计 1,071,460 1,371,460 128%

12
designer-form/src/main/java/com/fr/design/gui/xpane/FormPredefinedBackgroundPane.java

@ -63,13 +63,21 @@ public class FormPredefinedBackgroundPane extends PredefinedStyleSettingPane<Nam
private BackgroundWithAlpha getCurrentValue() {
if (this.predefinedRadioBtn.isSelected()) {
NameComponentBackground componentBackground = NameFormBackground.createPredefinedStyle(getPredefinedStyleName());
return componentBackground.createRealStyle();
return updatePredefinedStyle();
} else {
return this.backgroundPane.updateBean();
}
}
private BackgroundWithAlpha updatePredefinedStyle(){
NameComponentBackground componentBackground = NameFormBackground.createPredefinedStyle(getPredefinedStyleName());
return componentBackground.createRealStyle();
}
protected void populateCustomPane(){
this.backgroundPane.populateBean(updatePredefinedStyle());
}
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background");

10
designer-form/src/main/java/com/fr/design/gui/xpane/PredefinedComponentStyleSettingPane.java

@ -61,11 +61,19 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP
@Override
public NameLayoutBorderStyle updateBean() {
if (predefinedRadioBtn.isSelected()) {
return updatePredefinedStyle();
}
return styleSettingPane.updateBean();
}
private NameLayoutBorderStyle updatePredefinedStyle() {
NameLayoutBorderStyle layoutBorderStyle = NameLayoutBorderStyle.createPredefinedStyle(getPredefinedStyleName());
layoutBorderStyle.setTitleText(formulaPane.updateBean());
return layoutBorderStyle;
}
return styleSettingPane.updateBean();
protected void populateCustomPane() {
this.styleSettingPane.populateBean(updatePredefinedStyle());
}
@Override

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

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

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

@ -32,8 +32,6 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.PreviewProvider;
@ -94,7 +92,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.report.Report;
import com.fr.report.stable.ReportSettings;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils;
@ -137,22 +134,18 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private int resolution = ScreenResolution.getScreenResolution();
public JWorkBook() {
super(new WorkBook(new WorkSheet()), DEFAULT_WB_FILE_PREFIX);
initPredefinedInfo();
super(new WorkBook(createPredefinedWorkSheet()), DEFAULT_WB_FILE_PREFIX);
populateReportParameterAttr();
}
private void initPredefinedInfo() {
WorkBook workBook = this.getTarget();
for (int i = 0; i < workBook.getReportCount(); i++) {
Report report = workBook.getReport(i);
if (report != null) {
private static WorkSheet createPredefinedWorkSheet() {
WorkSheet sheet = new WorkSheet();
NameBackground initBackground = NameBackground.createPredefinedStyle(StringUtils.EMPTY);
((ReportSettings) report.getReportSettings()).setNameBackground(initBackground);
}
}
((ReportSettings) sheet.getReportSettings()).setNameBackground(initBackground);
return sheet;
}
public JWorkBook(WorkBookX workBookX) {
super(new WorkBookAdapter(workBookX), DEFAULT_WBX_FILE_PREFIX);
populateReportParameterAttr();
@ -794,6 +787,7 @@ 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,6 +38,7 @@ 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;
@ -45,7 +46,9 @@ 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
@ -847,11 +850,18 @@ 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() {
return new WorkSheet();
WorkSheet workSheet = new WorkSheet();
initPredefinedInfo(workSheet);
return workSheet;
}
@Override
@ -863,7 +873,9 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
protected class PolyReportInsertAction extends SheetInsertAction {
@Override
protected TemplateReport newTemplateReport() {
return new PolyWorkSheet();
PolyWorkSheet polyWorkSheet = new PolyWorkSheet();
initPredefinedInfo(polyWorkSheet);
return polyWorkSheet;
}
@Override

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

@ -43,19 +43,18 @@ 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.updateBean());
cellElement.setStyle(stylePane.updateStyle());
}
@Override
public void updateBeans() {
NameStyle s = stylePane.updateBean();
Style s = stylePane.updateStyle();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int cellRectangleCount = cs.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) {

37
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java

@ -16,7 +16,6 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.AbstractBasicStylePane;
import com.fr.design.gui.style.AlignmentPane;
import com.fr.design.gui.style.BackgroundPane;
import com.fr.design.gui.style.BorderPane;
import com.fr.design.gui.style.FormatPane;
import com.fr.design.layout.FRGUIPaneFactory;
@ -29,6 +28,7 @@ import com.fr.design.style.BorderUtils;
import com.fr.predefined.PredefinedPatternStyleManager;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.third.javax.annotation.Nonnull;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -85,9 +85,7 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane<N
public void populateBean(NameStyle ob) {
this.setPopulating(true);
super.populate(ob);
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
String styleName = template.getTemplatePredefinedStyle();
PredefinedStyle currentStyle = PredefinedPatternStyleManager.INSTANCE.getStyleFromName(styleName);
PredefinedStyle currentStyle = PredefinedPatternStyleManager.INSTANCE.getStyleFromName(getPredefinedStyleName());
PredefinedCellStyleConfig config = currentStyle.getCellStyleConfig();
Map<String, PredefinedCellStyle> allStyle = config.getAllStyles();
this.applicationFormat.clearBoxItems();
@ -103,6 +101,13 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane<N
this.setPopulating(false);
}
protected void populateCustomPane(){
this.customPredefinedStylePane.populateBean(updatePredefinedStyle());
}
public void dealWithBorder(ElementCasePane ePane) {
this.customPredefinedStylePane.dealWithBorder(ePane);
@ -113,18 +118,27 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane<N
}
@Override
@Nonnull
public NameStyle updateBean() {
NameStyle nameStyle = null;
Style style = updateStyle();
if (!(style instanceof NameStyle)) {
return NameStyle.createCustomStyle(style);
}
return (NameStyle) style;
}
@Nonnull
public Style updateStyle() {
if (this.predefinedRadioBtn.isSelected()) {
Object selectItem = this.applicationFormat.getSelectedItem();
nameStyle = NameStyle.createPredefinedStyle(getPredefinedStyleName(), selectItem == null ? StringUtils.EMPTY : selectItem.toString(), Style.getInstance());
return updatePredefinedStyle();
} else {
Style style = this.customPredefinedStylePane.updateBean();
if (!(style instanceof NameStyle)) {
nameStyle = NameStyle.createCustomStyle(style);
return this.customPredefinedStylePane.updateBean();
}
}
return nameStyle;
private NameStyle updatePredefinedStyle() {
Object selectItem = this.applicationFormat.getSelectedItem();
return NameStyle.createPredefinedStyle(getPredefinedStyleName(), selectItem == null ? StringUtils.EMPTY : selectItem.toString(), Style.getInstance());
}
class CustomStylePane extends MultiTabPane<Style> {
@ -132,7 +146,6 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane<N
private static final int THREE_INDEX = 3;
private static final int ONE_INDEX = 1;
private ElementCasePane reportPane;
private BackgroundPane backgroundPane = null;
public CustomStylePane() {

10
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(NameBackground.createPredefinedStyle(getPredefinedStyleName()));
((ReportSettings) reportSettings).setNameBackground(updatePredefinedStyle());
} else {
reportSettings.setBackground(this.backgroundPane.updateBean());
}
@ -92,6 +92,14 @@ public class ReportPredefinedBackgroundPane extends PredefinedStyleSettingPane<R
reportSettings.setExportBackground(this.isExportBackgroundCheckBox.isSelected());
}
private NameBackground updatePredefinedStyle() {
return NameBackground.createPredefinedStyle(getPredefinedStyleName());
}
protected void populateCustomPane() {
this.backgroundPane.populateBean(updatePredefinedStyle().createRealStyle());
}
private Background getCurrentValue() {
if (this.predefinedRadioBtn.isSelected()) {
NameBackground nameReportBackground = NameBackground.createPredefinedStyle(getPredefinedStyleName());

Loading…
Cancel
Save