Browse Source

Merge branch 'feature/x' of https://code.fineres.com/scm/~fly.li/design into feature/x

feature/x
fly.li 3 years ago
parent
commit
30748629ae
  1. 11
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 79
      designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java
  3. 13
      designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
  4. 52
      designer-base/src/main/java/com/fr/design/config/DesignerProperties.java
  5. 5
      designer-base/src/main/java/com/fr/design/constants/TableDataConstants.java
  6. 16
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  7. 7
      designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java
  8. 7
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  9. 1689
      designer-base/src/main/java/com/fr/design/formula/FRFormulaLexer.java
  10. 8
      designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java
  11. 63
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  12. 2
      designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java
  13. 8
      designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java
  14. 13
      designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java
  15. 42
      designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java
  16. 4
      designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java
  17. 4
      designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java
  18. 96
      designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java
  19. 8
      designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java
  20. 18
      designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java
  21. 4
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  22. 2
      designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java
  23. 101
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  24. 2
      designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java
  25. 4
      designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java
  26. 22
      designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java
  27. 86
      designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java
  28. 17
      designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedFeatureController.java
  29. 18
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java
  30. 21
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java
  31. 3
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartFontPane.java
  32. 7
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  33. 2
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  34. 10
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  35. 12
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  36. 9
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  37. 6
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithThemeStyle.java
  38. 29
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java
  39. 66
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java
  40. 15
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java
  41. 14
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java
  42. 5
      designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java
  43. 26
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  44. 22
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  45. 11
      designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java
  46. 2
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  47. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
  48. 3
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetPackageBlock.java
  49. 7
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java
  50. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/SimpleWidgetBlock.java
  51. 16
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java
  52. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java
  53. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java
  54. 12
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java
  55. 10
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java
  56. 7
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java
  57. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java
  58. 7
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java
  59. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  60. 60
      designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java
  61. 33
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  62. 15
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java
  63. 27
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java
  64. 54
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/NameStyleListPane.java
  65. 36
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  66. 16
      designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java
  67. 68
      designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java
  68. 85
      designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java
  69. 96
      designer-realize/src/main/java/com/fr/design/style/BorderUtils.java
  70. 13
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

11
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -19,6 +19,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.ProductImproveMark;
import com.fr.design.login.DesignerLoginType;
import com.fr.design.login.config.DesignerLoginConfigManager;
import com.fr.design.mainframe.ComponentReuseNotifyUtil;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.notification.SnapChatConfig;
@ -415,6 +416,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private void compatibilityPrevVersion(File prevEnvFile) {
try {
XMLTools.readFileXML(designerEnvManager, prevEnvFile);
clearOldVersionDesignerEnvProperties();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
@ -424,6 +426,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
designerEnvManager.saveXMLFile();
}
private void clearOldVersionDesignerEnvProperties() {
SnapChatConfig snapChatConfig = designerEnvManager.getSnapChatConfig();
snapChatConfig.resetRead(ComponentReuseNotifyUtil.COMPONENT_SNAP_CHAT_KEY);
}
public static void setEnvFile(File envFile) {
DesignerEnvManager.envFile = envFile;
}
@ -2332,4 +2339,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
DesignerExiter.getInstance().execute();
}
}
public SnapChatConfig getSnapChatConfig() {
return snapChatConfig;
}
}

79
designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java

@ -0,0 +1,79 @@
package com.fr.design.cell;
import com.fr.report.cell.CellElementBorderSourceFlag;
import com.fr.base.CellBorderStyle;
import com.fr.base.Style;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.report.cell.TemplateCellElement;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.GridLayout;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/3
*/
public class CellRectangleStylePreviewPane extends JPanel {
private static final int ROW_COUNT = 2;
private static final int COLUMN_COUNT = 2;
private final TemplateCellElement[][] cellElementGrid = new TemplateCellElement[ROW_COUNT][COLUMN_COUNT];
private final CellStylePreviewPane[][] cellStylePreviewPaneGrid = new CellStylePreviewPane[ROW_COUNT][COLUMN_COUNT];
public CellRectangleStylePreviewPane() {
setLayout(new GridLayout(2, 2));
for (int r = 0; r < ROW_COUNT; r++) {
for (int c = 0; c < COLUMN_COUNT; c++) {
CellStylePreviewPane pane = new CellStylePreviewPane();
TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r);
int flags = CellElementBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
if (r != 0) {
flags |= CellElementBorderSourceFlag.TOP_BORDER_SOURCE_INNER;
}
if (r != ROW_COUNT - 1) {
flags |= CellElementBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER;
}
if (c != 0) {
flags |= CellElementBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
}
if (c != COLUMN_COUNT - 1) {
flags |= CellElementBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
}
cellElement.setBorderSourceFlags(flags);
pane.setStyle(cellElement.getStyle());
add(pane);
cellElementGrid[r][c] = cellElement;
cellStylePreviewPaneGrid[r][c] = pane;
}
}
}
public void setPlainText(String text) {
cellStylePreviewPaneGrid[0][1].setPaintText(text);
cellStylePreviewPaneGrid[1][1].setPaintText(text);
repaint();
}
public void setStyle(Style style, CellBorderStyle borderStyle) {
for (int i = 0; i < ROW_COUNT; i++) {
for (int j = 0; j < COLUMN_COUNT; j++) {
CellStylePreviewPane pane = cellStylePreviewPaneGrid[i][j];
TemplateCellElement cellElement = cellElementGrid[i][j];
cellElement.setStyle(style, borderStyle);
pane.setStyle(cellElement.getStyle());
}
}
repaint();
}
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
}
}

13
designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java

@ -33,14 +33,21 @@ public class CellStylePreviewPane extends JPanel {
transparentBackgroundHeight = transparentBackgroundImage.getHeight(null);
}
public void setPaintText(String paintText) {
this.paintText = paintText;
repaint();
}
public void setStyle(Style style) {
this.style = style;
if (style instanceof NameStyle) {
paintText = ((NameStyle) style).getName();
}
repaint();
}
public void setStyle(NameStyle style) {
paintText = style.getName();
setStyle(style.getRealStyle());
}
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;

52
designer-base/src/main/java/com/fr/design/config/DesignerProperties.java

@ -0,0 +1,52 @@
package com.fr.design.config;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Properties;
public class DesignerProperties {
private static DesignerProperties holder = null;
private boolean supportLoginEntry = true;
public DesignerProperties() {
String filePath = StableUtils.pathJoin(StableUtils.getInstallHome(), "/config/config.properties");
InputStream is = null;
try {
is = new BufferedInputStream(new FileInputStream(filePath));
Properties ps = new Properties();
ps.load(is);
this.initProperties(ps);
} catch (FileNotFoundException e) {
// ignore
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
} finally {
IOUtils.close(is);
}
}
public static DesignerProperties getInstance() {
if (holder == null) {
holder = new DesignerProperties();
}
return holder;
}
private void initProperties(Properties ps) {
String supportLoginEntry = ps.getProperty("supportLoginEntry");
if (StringUtils.isNotEmpty(supportLoginEntry)) {
this.supportLoginEntry = Boolean.valueOf(supportLoginEntry);
}
}
public boolean isSupportLoginEntry() {
return supportLoginEntry;
}
}

5
designer-base/src/main/java/com/fr/design/constants/TableDataConstants.java

@ -0,0 +1,5 @@
package com.fr.design.constants;
public class TableDataConstants {
public static final String SEPARATOR = "_";
}

16
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -36,8 +36,6 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import java.util.HashSet;
import java.util.Set;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.DefaultCellEditor;
@ -55,8 +53,10 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
/**
* Coder: zack
@ -83,6 +83,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
protected String[] allDSNames;
protected ConnectionTableAction connectionTableAction;
protected ToolBarDef toolbarDef;
protected TableDataTreePaneListener listener = null;
private String type = "";
@ -142,6 +143,17 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
public abstract void dgEdit(final AbstractTableDataPane<?> uPanel, String originalName, boolean isUpdate);
public void showEditPane(final AbstractTableDataPane<?> tableDataPane, String originalName, TableDataTreePaneListener listener) {
this.listener = listener;
dgEdit(tableDataPane, originalName);
}
public interface TableDataTreePaneListener {
void doOk();
void doCancel();
}
protected void doPropertyChange(BasicDialog dg, BasicPane.NamePane nPanel, final String oldName) {
type = dg.getTitle();
nPanel.setShowText(StringUtils.BLANK);

7
designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java

@ -1,6 +1,7 @@
package com.fr.design.data;
import com.fr.data.TableDataSource;
import com.fr.design.constants.TableDataConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
@ -11,8 +12,6 @@ import com.fr.stable.StringUtils;
* Created by hades on 2020/4/27
*/
public abstract class BasicTableDataUtils {
private static final String SEPARATOR = "_";
private static final int LEN = 2;
@ -38,10 +37,10 @@ public abstract class BasicTableDataUtils {
public static String getTableDataName(boolean isCover, TableDataSource tds, String tdName, String srcName, boolean isDsNameRepeaded) {
if (isCover) {
return srcName + SEPARATOR + tdName;
return srcName + TableDataConstants.SEPARATOR + tdName;
}
if (tds.getTableData(tdName) != null || isDsNameRepeaded) {//如果有同名的就拼上来源名称
tdName = srcName + SEPARATOR + tdName;
tdName = srcName + TableDataConstants.SEPARATOR + tdName;
}
int i = 0;
while (tds.getTableData(tdName) != null) {

7
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -361,11 +361,18 @@ public class TableDataTreePane extends BasicTableDataTreePane {
//单独编辑数据集关闭,修改缓存配置状态,刷新下一键开启/关闭按钮
checkButtonEnabled();
if (listener != null) {
listener.doOk();
}
}
@Override
public void doCancel() {
super.doCancel();
if (listener != null) {
listener.doCancel();
}
}
});
tdNamePanel.addPropertyChangeListener(new PropertyChangeAdapter() {

1689
designer-base/src/main/java/com/fr/design/formula/FRFormulaLexer.java

File diff suppressed because it is too large Load Diff

8
designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java

@ -2,7 +2,6 @@ package com.fr.design.formula;
import com.fr.design.formula.exception.FormulaExceptionTipsProcessor;
import com.fr.design.i18n.Toolkit;
import com.fr.parser.FRLexer;
import com.fr.parser.FRParser;
import com.fr.script.checker.FunctionCheckerDispatcher;
import com.fr.script.checker.result.FormulaCheckResult;
@ -25,11 +24,12 @@ public class FormulaChecker {
public static FormulaCheckResult check(String formulaText) {
if (StringUtils.isEmpty(formulaText) || formulaText.equals(Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Tips"))) {
return new FormulaCheckResult(true, VALID_FORMULA, FormulaCoordinates.INVALID);
return new FormulaCheckResult(true, VALID_FORMULA, FormulaCoordinates.INVALID, true);
}
//过滤一些空格等符号
StringReader in = new StringReader(formulaText);
FRLexer lexer = new FRLexer(in);
//此lexer为公式校验定制
FRFormulaLexer lexer = new FRFormulaLexer(in);
FRParser parser = new FRParser(lexer);
try {
@ -37,7 +37,7 @@ public class FormulaChecker {
Node node = expression.getConditionalExpression();
boolean valid = FunctionCheckerDispatcher.getInstance().getFunctionChecker(node).checkFunction(formulaText, node);
return new FormulaCheckResult(valid, valid ? Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") :
Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula"), FormulaCoordinates.INVALID);
Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula"), FormulaCoordinates.INVALID, true);
} catch (Exception e) {
if (e instanceof TokenStreamRecognitionException) {
return processor.getExceptionTips(((TokenStreamRecognitionException) e).recog);

63
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -46,6 +46,7 @@ import com.fr.parser.BlockIntervalLiteral;
import com.fr.parser.ColumnRowRangeInPage;
import com.fr.parser.NumberLiteral;
import com.fr.parser.SheetIntervalLiteral;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.report.core.namespace.SimpleCellValueNameSpace;
import com.fr.script.Calculator;
import com.fr.script.ScriptConstants;
@ -54,7 +55,6 @@ import com.fr.stable.EncodeConstants;
import com.fr.stable.EssentialUtils;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.UtilEvalError;
import com.fr.stable.script.CRAddress;
import com.fr.stable.script.ColumnRowRange;
import com.fr.stable.script.Expression;
@ -122,6 +122,7 @@ import java.util.Set;
* @editor zhou
* @since 2012-3-29下午1:50:53
*/
@EnableMetrics
public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
public static final int DEFUAL_FOMULA_LENGTH = 103;
public static final String ELLIPSIS = "...";
@ -139,6 +140,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
protected static UICheckBox autoCompletionCheck;
protected static UICheckBox checkBeforeColse;
private JList tipsList;
private JPopupMenu popupMenu;
protected DefaultListModel listModel = new DefaultListModel();
private int ifHasBeenWriten = 0;
private DefaultListModel functionTypeListModel = new DefaultListModel();
@ -340,11 +342,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
public void focusGained(FocusEvent e) {
// 获得焦点时 安装
if (autoCompletion == null && autoCompletionCheck.isSelected()) {
CompletionProvider provider = createCompletionProvider();
autoCompletion = new FormulaPaneAutoCompletion(provider);
autoCompletion.setListCellRenderer(new CompletionCellRenderer());
autoCompletion.install(formulaTextArea);
autoCompletion.installVariableTree(variableTreeAndDescriptionArea);
installAutoCompletion();
}
}
@ -387,7 +385,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
}
completionProvider.addCompletion(new FormulaCompletion(completionProvider, paramWithoutPre, BaseUtils.readIcon(PARAM_ICON)));
}
completionProvider.addCompletion(new FormulaCompletion(completionProvider, "$$$", BaseUtils.readIcon(PARAM_ICON)));
return completionProvider;
}
@ -409,6 +406,14 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
}
}
private void installAutoCompletion() {
CompletionProvider provider = createCompletionProvider();
autoCompletion = new FormulaPaneAutoCompletion(provider);
autoCompletion.setListCellRenderer(new CompletionCellRenderer());
autoCompletion.install(formulaTextArea);
autoCompletion.installVariableTree(variableTreeAndDescriptionArea);
}
protected void extendCheckBoxPane(JPanel checkBoxPane) {
@ -458,6 +463,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
if (ComparatorUtils.equals((String) listModel.getElementAt(index), doublePressContent)) {
doubleClickActuator(doublePressContent);
}
if (popupMenu != null) {
popupMenu.setVisible(false);
}
}
}
}
@ -617,7 +625,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
}
private void popTips() {
JPopupMenu popupMenu = new JPopupMenu();
popupMenu = new JPopupMenu();
JScrollPane tipsScrollPane = new JScrollPane(tipsList);
popupMenu.add(tipsScrollPane);
tipsScrollPane.setPreferredSize(new Dimension(240, 146));
@ -787,14 +795,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
// Execute Formula default cell element.
String formulaText = formulaTextArea.getText().trim();
FormulaCheckResult checkResult = FormulaChecker.check(formulaText);
confirmCheckResult(checkResult);
confirmCheckResult(checkResult, checkResult.getTips());
}
};
private final ActionListener calculateActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
private void calculateFormula() {
String formulaText = formulaTextArea.getText().trim();
String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText);
if (unSupportFormula != null) {
@ -804,7 +809,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
String messageTips;
FormulaCheckResult checkResult = FormulaChecker.check(formulaText);
if (checkResult.isValid()) {
if (checkResult.grammarValid()) {
messageTips = checkResult.getTips() + NEWLINE;
Map<String, Object> paramsMap = setParamsIfExist(formulaText);
Calculator calculator = Calculator.createCalculator();
@ -820,28 +825,40 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
}
BaseFormula baseFormula = BaseFormula.createFormulaBuilder().build(formulaText);
Object calResult;
try {
Object value = calculator.evalValue(baseFormula);
String objectToString = EssentialUtils.objectToString(value);
calResult = calculator.evalValue(baseFormula);
String objectToString = EssentialUtils.objectToString(calResult);
String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ?
objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString;
messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result;
FineLoggerFactory.getLogger().info("value:{}", value);
} catch (UtilEvalError utilEvalError) {
FineLoggerFactory.getLogger().error(utilEvalError.getMessage(), utilEvalError);
} catch (Exception ce) {
//模拟计算如果出现错误,则抛出错误
calResult = ce.getMessage();
FineLoggerFactory.getLogger().error(ce.getMessage(), ce);
messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult;
}
FineLoggerFactory.getLogger().info("value:{}", calResult);
} else {
messageTips = checkResult.getTips();
}
if (checkResult.isValid()) {
showMessageDialog(messageTips, checkResult.isValid());
} else {
confirmCheckResult(checkResult);
confirmCheckResult(checkResult, messageTips);
}
}
private final ActionListener calculateActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
calculateFormula();
}
};
private boolean confirmCheckResult(FormulaCheckResult checkResult) {
private boolean confirmCheckResult(FormulaCheckResult checkResult, String messageTips) {
if (checkResult.isValid()) {
showMessageDialog(checkResult.getTips(), checkResult.isValid());
} else {
@ -849,7 +866,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
+ Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + " ";
int confirmDialog = FineJOptionPane.showConfirmDialog(
FormulaPane.this,
position + checkResult.getTips(),
position + messageTips,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE,
@ -902,7 +919,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
String formula = formulaTextArea.getText().trim();
FormulaCheckResult checkResult = FormulaChecker.check(formula);
if (!checkResult.isValid()) {
return confirmCheckResult(checkResult);
return confirmCheckResult(checkResult, checkResult.getTips());
}
}
return true;

2
designer-base/src/main/java/com/fr/design/formula/exception/FormulaExceptionTipsProcessor.java

@ -38,7 +38,7 @@ public class FormulaExceptionTipsProcessor {
public FormulaCheckResult getExceptionTips(Exception e) {
return EXCEPTION_TIPS.getOrDefault(e.getClass(),
e1 -> new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID))
e1 -> new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID, false))
.apply(e);
}

8
designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java

@ -41,9 +41,9 @@ public class FormulaCheckWrongFunction implements Function<Exception, FormulaChe
errorMsg.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Or"));
}
}
return new FormulaCheckResult(false, errorMsg.toString(), new FormulaCoordinates(1, indexPosition(ce.getFormulaText(), ce.getNode().toString())));
return new FormulaCheckResult(false, errorMsg.toString(), new FormulaCoordinates(1, indexPosition(ce.getFormulaText(), ce.getNode().toString())), true);
}
return new FormulaCheckResult(false, StringUtils.EMPTY, new FormulaCoordinates(-1, -1));
return new FormulaCheckResult(false, StringUtils.EMPTY, new FormulaCoordinates(-1, -1), true);
}
private static String getTypeString(FunctionParameterType type) {
@ -69,6 +69,10 @@ public class FormulaCheckWrongFunction implements Function<Exception, FormulaChe
}
private int indexPosition(String formulaText, String invalidFormula) {
//处理一下自己FunctionCall自己拼的逗号逻辑
if (invalidFormula.contains(",")) {
invalidFormula = invalidFormula.substring(0, invalidFormula.indexOf(","));
}
return formulaText.indexOf(invalidFormula);
}
}

13
designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java

@ -20,9 +20,9 @@ public class MismatchedCharFunction implements Function<Exception, FormulaCheckR
if (e instanceof MismatchedCharException) {
MismatchedCharException charException = (MismatchedCharException) e;
FormulaCoordinates formulaCoordinates = new FormulaCoordinates(charException.line, charException.column - 1);
return new FormulaCheckResult(false, getMessage(charException), formulaCoordinates);
return new FormulaCheckResult(false, getMessage(charException), formulaCoordinates, false);
}
return new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID);
return new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID, false);
}
public static Function<Exception, FormulaCheckResult> getFunction() {
@ -35,10 +35,6 @@ public class MismatchedCharFunction implements Function<Exception, FormulaCheckR
case 1:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting") + ": ");
appendCharName(sb, charException.expecting);
sb.append(FormulaCheckConstants.COMMON)
.append(FormulaCheckConstants.BLANK)
.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"));
appendCharName(sb, charException.foundChar);
break;
case 2:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting_Anything") + ": ")
@ -58,8 +54,6 @@ public class MismatchedCharFunction implements Function<Exception, FormulaCheckR
appendCharName(sb, charException.expecting);
sb.append("..");
appendCharName(sb, charException.upper);
sb.append(", ").append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"));
appendCharName(sb, charException.foundChar);
break;
case 5:
case 6:
@ -71,9 +65,6 @@ public class MismatchedCharFunction implements Function<Exception, FormulaCheckR
for (int i = 0; i < elems.length; ++i) {
appendCharName(sb, elems[i]);
}
sb.append("), ").append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"));
appendCharName(sb, charException.foundChar);
break;
default:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_Char"));

42
designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java

@ -24,9 +24,9 @@ public class MismatchedTokenFunction implements Function<Exception, FormulaCheck
if (e instanceof MismatchedTokenException) {
MismatchedTokenException charException = (MismatchedTokenException) e;
FormulaCoordinates formulaCoordinates = new FormulaCoordinates(charException.line, charException.column - 1);
return new FormulaCheckResult(false, getMessage(charException), formulaCoordinates);
return new FormulaCheckResult(false, getMessage(charException), formulaCoordinates, false);
}
return new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID);
return new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID, false);
}
public static Function<Exception, FormulaCheckResult> getFunction() {
@ -40,11 +40,7 @@ public class MismatchedTokenFunction implements Function<Exception, FormulaCheck
switch (exception.mismatchType) {
case 1:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting") + ": ")
.append(tokenName(exception.expecting, exception))
.append(", ")
.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"))
.append(FormulaCheckConstants.BLANK + FormulaCheckConstants.SINGLE_QUOTES)
.append(tokenText).append("'");
.append(tokenName(exception.expecting, exception));
break;
case 2:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting_Anything") + ": ")
@ -59,9 +55,7 @@ public class MismatchedTokenFunction implements Function<Exception, FormulaCheck
.append(": ")
.append(tokenName(exception.expecting, exception))
.append("..")
.append(tokenName(exception.upper, exception))
.append(", ").append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"))
.append("'").append(tokenText).append("'");
.append(tokenName(exception.upper, exception));
break;
case 4:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting") + ": ")
@ -71,12 +65,7 @@ public class MismatchedTokenFunction implements Function<Exception, FormulaCheck
.append(": ")
.append(tokenName(exception.expecting, exception))
.append("..")
.append(tokenName(exception.upper, exception))
.append(",").
append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"))
.append(" '")
.append(tokenText)
.append("'");
.append(tokenName(exception.upper, exception));
break;
case 5:
case 6:
@ -90,11 +79,6 @@ public class MismatchedTokenFunction implements Function<Exception, FormulaCheck
sb.append(tokenName(elms[i], exception));
}
sb.append("),")
.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"))
.append("'")
.append(tokenText)
.append("'");
break;
default:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_Token"));
@ -108,24 +92,10 @@ public class MismatchedTokenFunction implements Function<Exception, FormulaCheck
return "<Set of tokens>";
} else {
String[] tokenNames = (String[]) getFieldValue(exception, "tokenNames");
return tokenType >= 0 && tokenType < tokenNames.length ? translateToken(tokenNames[tokenType]) : "<" + tokenType + ">";
return tokenType >= 0 && tokenType < tokenNames.length ? TranslateTokenUtils.translateToken(tokenNames[tokenType]) : "<" + tokenType + ">";
}
}
private String translateToken(String token) {
switch (token) {
case ("RPAREN"):
return ")";
case ("LPAREN"):
return "(";
case ("COMMA"):
return ",";
case ("COLON"):
return ":";
default:
return token;
}
}
private Object getFieldValue(Object object, String fieldName) {
try {

4
designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java

@ -20,9 +20,9 @@ public class NoViableAltForCharFunction implements Function<Exception, FormulaCh
if (e instanceof NoViableAltForCharException) {
NoViableAltForCharException charException = (NoViableAltForCharException) e;
FormulaCoordinates formulaCoordinates = new FormulaCoordinates(charException.line, charException.column - 1);
return new FormulaCheckResult(false, getMessage(charException), formulaCoordinates);
return new FormulaCheckResult(false, getMessage(charException), formulaCoordinates, false);
}
return new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID);
return new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID, false);
}
public static Function<Exception, FormulaCheckResult> getFunction() {

4
designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltFunction.java

@ -21,9 +21,9 @@ public class NoViableAltFunction implements Function<Exception, FormulaCheckResu
if (e instanceof NoViableAltException) {
NoViableAltException altException = (NoViableAltException) e;
FormulaCoordinates formulaCoordinates = new FormulaCoordinates(altException.line, altException.column - 1);
return new FormulaCheckResult(false, getMessage(altException), formulaCoordinates);
return new FormulaCheckResult(false, getMessage(altException), formulaCoordinates, false);
}
return new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID);
return new FormulaCheckResult(false, FormulaChecker.INVALID_FORMULA, FormulaCoordinates.INVALID, false);
}
public static Function<Exception, FormulaCheckResult> getFunction() {

96
designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java

@ -0,0 +1,96 @@
package com.fr.design.formula.exception.function;
import com.fr.design.i18n.Toolkit;
/**
* @author Hoky
* @date 2021/11/30
*/
public class TranslateTokenUtils {
public static String translateToken(String token) {
switch (token) {
case ("RPAREN"):
return ")";
case ("LPAREN"):
return "(";
case ("COMMA"):
return ",";
case ("COLON"):
return ":";
case ("EOF"):
return Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_EOF");
case ("DOT"):
return ".";
case ("FLOT_NUM"):
return Toolkit.i18nText("Fine-Design_Basic_Formula_Float_Number");
case ("LOR"):
return "||";
case ("LAND"):
return "&&";
case ("EQUAL"):
return "=";
case ("EQUAL2"):
return "=";
case ("NOT_EQUAL"):
return "!=";
case ("NOT_EQUAL2"):
return "!=";
case ("GE"):
return ">=";
case ("LE"):
return "<=";
case ("LT"):
return "<";
case ("PLUS"):
return "+";
case ("MINUS"):
return "-";
case ("STAR"):
return "*";
case ("DIV"):
return "/";
case ("MOD"):
return "%";
case ("POWER"):
return "^";
case ("LNOT"):
return "!";
case ("WAVE"):
return "~";
case ("LBRACK"):
return "[";
case ("SEMI"):
return ";";
case ("RBRACK"):
return "]";
case ("LCURLY"):
return "{";
case ("RCURLY"):
return "}";
case ("DCOLON"):
return ";";
case ("INT_NUM"):
return Toolkit.i18nText("Fine-Design_Basic_Formula_Integer");
case ("CR_ADRESS"):
return "\n";
case ("SHARP"):
return "#";
case ("AT"):
return "@";
case ("QUESTION"):
return "?";
case ("BOR"):
return "||";
case ("BAND"):
return "&&";
case ("Char"):
return Toolkit.i18nText("Fine-Design_Basic_Formula_Character");
case ("DIGIT"):
return Toolkit.i18nText("Fine-Design_Basic_Formula_Digital");
case ("XDIGIT"):
return Toolkit.i18nText("Fine-Design_Basic_Formula_Hexadecimal_Digital");
default:
return token;
}
}
}

8
designer-base/src/main/java/com/fr/design/gui/autocomplete/FormulaAutoCompletePopupWindow.java

@ -371,11 +371,8 @@ class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener,
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
if (e.getClickCount() == 2 && e.getButton() == 1) {
insertSelectedCompletion();
refreshInstallComp();
} else if (e.getClickCount() == 1) {
refreshInstallComp();
}
}
@ -389,6 +386,7 @@ class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener,
public void mousePressed(MouseEvent e) {
refreshInstallComp();
}
@ -818,6 +816,7 @@ class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener,
public void actionPerformed(ActionEvent e) {
if (isVisible()) {
selectNextItem();
refreshInstallComp();
}
}
@ -994,6 +993,7 @@ class FormulaAutoCompletePopupWindow extends JWindow implements CaretListener,
public void actionPerformed(ActionEvent e) {
if (isVisible()) {
selectPreviousItem();
refreshInstallComp();
}
}

18
designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java

@ -242,12 +242,22 @@ public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previe
rtd = treeTableDataComboBox.getSelcetedTableData();
name = treeTableDataComboBox.getSelectedItem().getTableDataName();
}
final String tableDataName = name;
AbstractTableDataWrapper atdw = new TemplateTableDataWrapper(rtd, "");
tdtp.dgEdit(atdw.creatTableDataPane(), name);
tdtp.showEditPane(atdw.creatTableDataPane(), name, new BasicTableDataTreePane.TableDataTreePaneListener() {
@Override
public void doOk() {
// 去除缓存列,后面刷新会重新选中
DesignTableDataManager.removeSelectedColumnNames(tableDataName);
treeTableDataComboBox.refresh();
treeTableDataComboBox.setSelectedTableDataByName(name);
textPane.populate(1);
valuePane.populate(1);
treeTableDataComboBox.setSelectedTableDataByName(tableDataName);
}
@Override
public void doCancel() {
}
});
}
}

4
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -389,9 +389,9 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver, UIOb
* @param l
*/
public void addChangeListener(ChangeListener l) {
listenerList.add(ChangeListener.class, l);
for (int i = 0; i < labelButtonList.size(); i++) {
labelButtonList.get(i).addChangeListener(l);
listenerList.add(ChangeListener.class, l);
}
}
@ -399,9 +399,9 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver, UIOb
* @param l
*/
public void removeChangeListener(ChangeListener l) {
listenerList.remove(ChangeListener.class, l);
for (int i = 0; i < labelButtonList.size(); i++) {
labelButtonList.get(i).removeChangeListener(l);
listenerList.remove(ChangeListener.class, l);
}
}

2
designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java

@ -153,7 +153,7 @@ public class ColorSchemeComboBox extends UIComboBox {
if (selectedIndex == itemCount - 2) {
return SelectType.COMBINATION_COLOR;
}
if (selectedIndex == 0) {
if (selectedIndex == 0 && ChartEditContext.supportTheme()) {
return SelectType.DEFAULT;
}
return SelectType.NORMAL;

101
designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java

@ -4,7 +4,6 @@ package com.fr.design.gui.style;
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/
import com.fr.base.BaseUtils;
import com.fr.base.CellBorderStyle;
import com.fr.base.Style;
import com.fr.design.constants.LayoutConstants;
@ -17,14 +16,20 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.general.IOUtils;
import com.fr.stable.Constants;
import com.fr.stable.CoreConstants;
import javax.swing.*;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@ -38,7 +43,6 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton",
"leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"};
private static final Set<String> BORDER_SET = new HashSet<>(Arrays.asList(BORDERARRAY));
private boolean insideMode = false;
private UIToggleButton topToggleButton;
private UIToggleButton horizontalToggleButton;
@ -50,11 +54,8 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
private UIToggleButton innerToggleButton;
private UIToggleButton outerToggleButton;
private LineComboBox currentLineCombo;
private NewColorSelectBox currentLineColorPane;
private JPanel panel;
private JPanel borderPanel;
private JPanel backgroundPanel;
protected LineComboBox currentLineCombo;
protected NewColorSelectBox currentLineColorPane;
private BackgroundPane backgroundPane;
private GlobalNameListener globalNameListener = null;
@ -81,18 +82,18 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color") + " ", SwingConstants.LEFT), currentLineColorPane},
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Out_Border") + " ", SwingConstants.LEFT), outerToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("com/fr/design/images/m_format/out.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/out_white.png")}, false)},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Out_Border") + " ", SwingConstants.LEFT), outerToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("com/fr/design/images/m_format/out.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/out_white.png")}, false)},
new Component[]{null, externalPane},
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_In_Border") + " ", SwingConstants.LEFT), innerToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("com/fr/design/images/m_format/in.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/in_white.png")}, false)},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_In_Border") + " ", SwingConstants.LEFT), innerToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("com/fr/design/images/m_format/in.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/in_white.png")}, false)},
new Component[]{null, insidePane},
new Component[]{null, null}
};
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
borderPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), 280, 24, panel);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
JPanel borderPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), 280, 24, panel);
this.add(borderPanel, BorderLayout.NORTH);
UILabel backgroundFillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Background_Fill"));
@ -102,7 +103,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
JPanel backgroundContainPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{backgroundFillLabel, backgroundPane}},
TableLayoutHelper.FILL_LASTCOLUMN, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
backgroundPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 280, 24, backgroundContainPane);
JPanel backgroundPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 280, 24, backgroundContainPane);
this.add(backgroundPanel, BorderLayout.CENTER);
initAllNames();
outerToggleButton.addChangeListener(outerToggleButtonChangeListener);
@ -130,12 +131,12 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
};
private void initButtonsWithIcon() {
topToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/top_white.png")}, false);
leftToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/left_white.png")}, false);
bottomToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bottom_white.png")}, false);
rightToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/right_white.png")}, false);
horizontalToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/horizontal_white.png")}, false);
verticalToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/vertical_white.png")}, false);
topToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/top.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/top_white.png")}, false);
leftToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/left.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/left_white.png")}, false);
bottomToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bottom_white.png")}, false);
rightToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/right_white.png")}, false);
horizontalToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/horizontal_white.png")}, false);
verticalToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/vertical_white.png")}, false);
this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
this.currentLineColorPane = new NewColorSelectBox(100);
}
@ -174,15 +175,15 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
cellBorderStyle.setRightStyle(style.getBorderRight());
cellBorderStyle.setRightColor(style.getBorderRightColor());
this.backgroundPane.populateBean(style.getBackground());
this.populateBean(cellBorderStyle, false, style.getBorderTop(), style.getBorderTopColor());
this.populateBean(cellBorderStyle, false);
}
public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, int currentStyle, Color currentColor) {
this.insideMode = insideMode;
public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode) {
populateBean(cellBorderStyle, insideMode, true);
}
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getTopStyle() == Constants.LINE_NONE ? Constants.LINE_THIN : cellBorderStyle.getTopStyle());
this.currentLineColorPane.setSelectObject(cellBorderStyle.getTopColor());
public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, boolean onlyInspectTop) {
this.topToggleButton.setSelected(cellBorderStyle.getTopStyle() != Constants.LINE_NONE);
this.bottomToggleButton.setSelected(cellBorderStyle.getBottomStyle() != Constants.LINE_NONE);
@ -195,9 +196,39 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
this.innerToggleButton.setSelected(cellBorderStyle.getInnerBorder() != Constants.LINE_NONE);
this.outerToggleButton.setSelected(cellBorderStyle.getOuterBorderStyle() != Constants.LINE_NONE);
this.innerToggleButton.setEnabled(this.insideMode);
this.horizontalToggleButton.setEnabled(this.insideMode);
this.verticalToggleButton.setEnabled(this.insideMode);
this.innerToggleButton.setEnabled(insideMode);
this.horizontalToggleButton.setEnabled(insideMode);
this.verticalToggleButton.setEnabled(insideMode);
populateLineStyleAndColor(cellBorderStyle, onlyInspectTop);
}
public void populateLineStyleAndColor(CellBorderStyle cellBorderStyle, boolean onlyInspectTop) {
if (cellBorderStyle.getTopStyle() != Constants.LINE_NONE) {
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getTopStyle());
this.currentLineColorPane.setSelectObject(cellBorderStyle.getTopColor());
} else if (!onlyInspectTop) {
if (cellBorderStyle.getBottomStyle() != Constants.LINE_NONE) {
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getBottomStyle());
this.currentLineColorPane.setSelectObject(cellBorderStyle.getBottomColor());
} else if (cellBorderStyle.getLeftStyle() != Constants.LINE_NONE) {
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getLeftStyle());
this.currentLineColorPane.setSelectObject(cellBorderStyle.getLeftColor());
} else if (cellBorderStyle.getRightStyle() != Constants.LINE_NONE) {
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getRightStyle());
this.currentLineColorPane.setSelectObject(cellBorderStyle.getRightColor());
} else if (cellBorderStyle.getVerticalStyle() != Constants.LINE_NONE) {
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getVerticalStyle());
this.currentLineColorPane.setSelectObject(cellBorderStyle.getVerticalColor());
} else if (cellBorderStyle.getHorizontalStyle() != Constants.LINE_NONE) {
this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getHorizontalStyle());
this.currentLineColorPane.setSelectObject(cellBorderStyle.getHorizontalColor());
}
}
if (this.currentLineCombo.getSelectedLineStyle() == Constants.LINE_NONE) {
this.currentLineCombo.setSelectedLineStyle(Constants.LINE_THIN);
}
}
@Override
@ -253,16 +284,8 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
}
cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
if (leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()) {
outerToggleButton.setSelected(true);
} else {
outerToggleButton.setSelected(false);
}
if (verticalToggleButton.isSelected() && horizontalToggleButton.isSelected()) {
innerToggleButton.setSelected(true);
} else {
innerToggleButton.setSelected(false);
}
outerToggleButton.setSelected(leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected());
innerToggleButton.setSelected(verticalToggleButton.isSelected() && horizontalToggleButton.isSelected());
return cellBorderStyle;
}

2
designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java

@ -12,7 +12,7 @@ import com.fr.design.notification.SnapChatKey;
* Created by kerry on 5/8/21
*/
public class ComponentReuseNotifyUtil {
private static final String COMPONENT_SNAP_CHAT_KEY = "com.fr.component.share-components";
public static final String COMPONENT_SNAP_CHAT_KEY = "com.fr.component.share-components";
private ComponentReuseNotifyUtil() {

4
designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java

@ -151,7 +151,7 @@ public class NorthRegionContainerPane extends JPanel {
public void execute(Object... objects) {
bbsLoginPane[0] = ad.createBBSLoginPane();
}
}, SupportOSImpl.USERINFOPANE);
}, SupportOSImpl. BBS_USER_LOGIN_PANE);
processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]);
}
northEastPane.add(ad.createAlphaFinePane());
@ -166,7 +166,7 @@ public class NorthRegionContainerPane extends JPanel {
public void execute(Object... objects) {
northEastPane.add(ad.createBBSLoginPane());
}
}, SupportOSImpl.USERINFOPANE);
}, SupportOSImpl.BBS_USER_LOGIN_PANE);
}

22
designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java

@ -343,21 +343,12 @@ public class ComponentCollector implements XMLable {
}
public void clickComponentSetting() {
if (!ComponentShareUtil.needShowEmbedFilterPane()) {
return;
}
boolean changed = false;
int firstShowReact = ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed() ? 2 : -1;
if (this.firstShowReact != firstShowReact) {
this.firstShowReact = firstShowReact;
changed = true;
collectFirstShowReact(firstShowReact);
}
if (this.embededFilterReact == 0 && ComponentReuseNotificationInfo.getInstance().isWidgetLibHasRefreshed()) {
this.embededFilterReact = -1;
changed = true;
}
if (changed) {
saveInfo();
collectEmbededFilterReact(-1);
}
}
@ -374,11 +365,16 @@ public class ComponentCollector implements XMLable {
return;
}
if (System.currentTimeMillis() - ComponentReuseNotificationInfo.getInstance().getFirstDragEndTime() <= ONE_MINUTE) {
this.dynamicEffectReact = 1;
saveInfo();
collectDynamicEffectReactFlag(1);
}
}
public void collectDynamicEffectReactFlag(int flag) {
this.dynamicEffectReact = flag;
saveInfo();
}
public void clearSortType() {
sortType = JSONFactory.createJSON(JSON.ARRAY);
}

86
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java → designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java

@ -1,17 +1,15 @@
package com.fr.design.mainframe.cell.settingpane.style;
package com.fr.design.mainframe.theme;
import com.fr.base.NameStyle;
import com.fr.base.Style;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.cell.CellRectangleStylePreviewPane;
import com.fr.design.cell.CellStylePreviewPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerBean;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils;
@ -30,18 +28,22 @@ import java.awt.Dimension;
import java.io.Serializable;
import java.util.List;
public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> implements DesignerBean {
public class ThemedCellStyleListPane extends FurtherBasicBeanPane<ThemedCellStyle> implements DesignerBean {
private static final int LEFT_BORDER = 10;
private static final int RIGHT_BORDER = 10;
private final DefaultListModel<NameStyle> defaultListModel;
private final JList<NameStyle> styleList;
private final DefaultListModel<ThemedCellStyle> defaultListModel;
private final JList<ThemedCellStyle> styleList;
private ChangeListener changeListener;
public ThemedCellStyleListPane() {
this(false);
}
public ThemedCellStyleListPane(boolean supportCellRange) {
defaultListModel = new DefaultListModel<>();
styleList = new JList<>(defaultListModel);
styleList.setCellRenderer(new RadioButtonListCellRenderer());
styleList.setCellRenderer(supportCellRange ? new RadioButtonListCellRangeRenderer() : new RadioButtonListCellRenderer());
styleList.setOpaque(false);
styleList.setBackground(null);
styleList.addListSelectionListener(new ListSelectionListener() {
@ -55,15 +57,8 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
setLayout(FRGUIPaneFactory.createBorderLayout());
add(styleList, BorderLayout.CENTER);
setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, RIGHT_BORDER));
DesignerContext.setDesignerBean("predefinedStyle", this);
}
/**
* 添加改变监听
*
* @param changeListener 监听事件
*/
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
@ -77,7 +72,7 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
}
@Override
public void populateBean(NameStyle ob) {
public void populateBean(ThemedCellStyle ob) {
refreshBeanElement();
if (ob == null) {
styleList.setSelectedIndex(0);
@ -92,32 +87,21 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
}
@Override
public NameStyle updateBean() {
public ThemedCellStyle updateBean() {
return styleList.getSelectedValue();
}
/**
* 获取面板标题
*
* @return 标题
*/
@Override
public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Report_Predefined_Style");
}
/**
* 是否可以接纳对象
*
* @param ob 组件对象
* @return 是否可以接纳对象
*/
@Override
public boolean accept(Object ob) {
return ob instanceof NameStyle;
return ob instanceof ThemedCellStyle;
}
/**
* 刷新组件对象
*/
@Override
public void refreshBeanElement() {
defaultListModel.removeAllElements();
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
@ -125,16 +109,13 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
TemplateTheme theme = template.getTemplateTheme();
List<ThemedCellStyle> styleList = theme.getCellStyleList().getCellStyleList();
for (ThemedCellStyle themedCellStyle: styleList) {
String name = themedCellStyle.getName();
Style realStyle = themedCellStyle.getStyle();
NameStyle nameStyle = NameStyle.getPassiveInstance(name, realStyle);
defaultListModel.addElement(nameStyle);
defaultListModel.addElement(themedCellStyle);
}
}
styleList.setModel(defaultListModel);
}
private static class RadioButtonListCellRenderer extends JPanel implements ListCellRenderer<Object>, Serializable {
private static class RadioButtonListCellRenderer extends JPanel implements ListCellRenderer<ThemedCellStyle>, Serializable {
private final UIRadioButton button;
private final CellStylePreviewPane previewArea;
@ -151,9 +132,36 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
}
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
public Component getListCellRendererComponent(JList<? extends ThemedCellStyle> list, ThemedCellStyle value, int index, boolean isSelected, boolean cellHasFocus) {
button.setSelected(isSelected);
previewArea.setPaintText(value.getName());
previewArea.setStyle(value.getStyle());
return this;
}
}
private static class RadioButtonListCellRangeRenderer extends JPanel implements ListCellRenderer<ThemedCellStyle>, Serializable {
private final UIRadioButton button;
private final CellRectangleStylePreviewPane previewArea;
public RadioButtonListCellRangeRenderer() {
super();
setLayout(new BorderLayout(5, 0));
setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
setPreferredSize(new Dimension(getPreferredSize().width, 80));
button = new UIRadioButton();
button.setBorder(BorderFactory.createEmptyBorder());
previewArea = new CellRectangleStylePreviewPane();
add(button, BorderLayout.WEST);
add(previewArea, BorderLayout.CENTER);
}
@Override
public Component getListCellRendererComponent(JList<? extends ThemedCellStyle> list, ThemedCellStyle value, int index, boolean isSelected, boolean cellHasFocus) {
button.setSelected(isSelected);
previewArea.setStyle((Style) value);
previewArea.setPlainText(value.getName());
previewArea.setStyle(value.getStyle(), value.getCellBorderStyle());
return this;
}
}

17
designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedFeatureController.java

@ -0,0 +1,17 @@
package com.fr.design.mainframe.theme;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.theme.SupportThemedCellInnerBorderFeature;
import com.fr.workspace.server.theme.ThemedCellBorderFeature;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/11/26
*/
public class ThemedFeatureController {
public static boolean isCellStyleSupportInnerBorder() {
ThemedCellBorderFeature controller = WorkContext.getCurrent().get(ThemedCellBorderFeature.class);
return controller instanceof SupportThemedCellInnerBorderFeature;
}
}

18
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java

@ -1,9 +1,7 @@
package com.fr.design.mainframe.theme.edit;
import com.fr.base.Style;
import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.config.predefined.PredefinedCellStyle;
import com.fr.design.actions.UpdateAction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.FineJOptionPane;
@ -122,7 +120,7 @@ public class CellStyleListEditPane extends JListControlPane {
}
@Override
public BasicBeanPane createPaneByCreators(NameableCreator creator) {
public BasicBeanPane<?> createPaneByCreators(NameableCreator creator) {
CellStyleEditPane stylePane = (CellStyleEditPane) super.createPaneByCreators(creator);
stylePane.registerAttrChangeListener(attributeChangeListener);
return stylePane;
@ -256,23 +254,15 @@ public class CellStyleListEditPane extends JListControlPane {
this(CellStyleEditPane.class);
}
public CellStyleNameObjectCreator(Class<? extends BasicBeanPane> updatePane) {
public CellStyleNameObjectCreator(Class<? extends BasicBeanPane<?>> updatePane) {
super(i18nText("Fine-Design_Predefined_Cell_New_Style"), ThemedCellStyle.class, updatePane);
}
@Override
public Nameable createNameable(UnrepeatedNameHelper helper) {
ThemedCellStyle cellStyle = new ThemedCellStyle();
ThemedCellStyle cellStyle = ThemedCellStyle.createInstanceUsed4New();
cellStyle.setName(menuName);
cellStyle.setStyle(Style.getInstance());
cellStyle.setRemovable(true);
cellStyle.setUse4Default(false);
cellStyle.setUse4BigTitle(false);
cellStyle.setUse4SmallTitle(false);
cellStyle.setUse4Header(false);
cellStyle.setUse4MainText(false);
cellStyle.setUse4SupportInfo(false);
cellStyle.setUse4HighlightText(false);
return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle);
}

21
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.theme.edit.cell;
import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.design.cell.CellStylePreviewPane;
import com.fr.design.cell.CellRectangleStylePreviewPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.dialog.BasicPane;
@ -14,6 +14,7 @@ import com.fr.design.gui.style.AlignmentPane;
import com.fr.design.gui.style.BorderPane;
import com.fr.design.gui.style.TextFontTippedPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.theme.ThemedFeatureController;
import com.fr.design.mainframe.theme.ui.BorderUtils;
import javax.swing.BorderFactory;
@ -35,7 +36,7 @@ import static com.fr.design.i18n.Toolkit.i18nText;
*/
public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
private ThemedCellStyle cellStyle;
private CellStylePreviewPane previewArea;
private CellRectangleStylePreviewPane previewArea;
private boolean populating;
private AttributeChangeListener attributeChangeListener;
@ -74,7 +75,11 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
for (BasicPane basicPane : paneList) {
((AbstractBasicStylePane) basicPane).populateBean(ob.getStyle());
previewArea.setStyle(ob.getStyle());
previewArea.setPlainText(ob.getName());
previewArea.setStyle(ob.getStyle(), ob.getCellBorderStyle());
if (ThemedFeatureController.isCellStyleSupportInnerBorder() && basicPane instanceof BorderPane) {
((BorderPane) basicPane).populateBean(ob.getCellBorderStyle(), true, false);
}
}
this.populating = false;
}
@ -83,6 +88,9 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
public ThemedCellStyle updateBean() {
AbstractBasicStylePane basicStylePane = (AbstractBasicStylePane) paneList.get(tabPane.getSelectedIndex());
this.cellStyle.setStyle(basicStylePane.update(this.cellStyle.getStyle()));
if (ThemedFeatureController.isCellStyleSupportInnerBorder() && basicStylePane instanceof BorderPane) {
this.cellStyle.setCellBorderStyle(((BorderPane) basicStylePane).update());
}
return this.cellStyle;
}
@ -108,8 +116,8 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
jPanel.setLayout(new BorderLayout(0, 4));
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
previewArea = new CellStylePreviewPane();
previewArea.setPreferredSize(new Dimension(223, 30));
previewArea = new CellRectangleStylePreviewPane();
previewArea.setPreferredSize(new Dimension(223, 60));
previewPane.setBorder(BorderUtils.createTitleBorder(i18nText("Fine-Design_Basic_Preview")));
previewPane.add(previewArea, BorderLayout.CENTER);
@ -135,7 +143,8 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
}
ThemedCellStyle cellStyle = updateBean();
if (cellStyle != null) {
previewArea.setStyle(cellStyle.getStyle());
previewArea.setPlainText(cellStyle.getName());
previewArea.setStyle(cellStyle.getStyle(), cellStyle.getCellBorderStyle());
}
fireAttrChangeListener();
}

3
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartFontPane.java

@ -7,6 +7,7 @@ import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIColorButtonWithAuto;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
@ -56,7 +57,7 @@ public class ChartFontPane extends BasicPane {
fontSizeComboBox = new UIComboBox(FONT_SIZES);
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));
fontColor = new UIColorButton();
fontColor = new UIColorButtonWithAuto();
}
protected void initComponents() {

7
designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java

@ -1,6 +1,7 @@
package com.fr.design.os.impl;
import com.fr.base.FRContext;
import com.fr.design.config.DesignerProperties;
import com.fr.design.jdk.JdkVersion;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
@ -22,11 +23,11 @@ import java.util.Locale;
public enum SupportOSImpl implements SupportOS {
/**
* ARM下屏蔽登录
* 屏蔽登录入口
*/
USERINFOPANE{
BBS_USER_LOGIN_PANE {
public boolean support(){
return Arch.getArch() != Arch.ARM;
return Arch.getArch() != Arch.ARM && DesignerProperties.getInstance().isSupportLoginEntry();
}
},
/**

2
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -32,6 +32,7 @@ import com.fr.process.engine.core.CarryMessageEvent;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.stable.OperatingSystem;
import com.fr.workspace.base.WorkspaceStatus;
import java.awt.Window;
import java.io.File;
import java.lang.reflect.Method;
@ -84,6 +85,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
if (eventPipe != null) {
eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue()));
}
EventDispatcher.fire(WorkspaceStatus.Prepared);
collectUserInformation();
}
});

10
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -11,10 +11,9 @@ import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
@ -155,12 +154,7 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
}
}
if (!ChartEditContext.supportTheme() && chart4Update instanceof VanChart) {
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) chart4Update).setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart4Update);
update(chart4Update);
}

12
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java

@ -12,14 +12,13 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.ChartHyperEditPane;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
import java.util.HashMap;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.HashMap;
/**
* 类说明: 图表超链 -- 弹出 悬浮窗.
@ -73,12 +72,7 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane<ChartHyperPopli
if (chart != null) {
try {
ChartProvider clone = (ChartProvider) chart.clone();
if (!ChartEditContext.supportTheme() && clone instanceof VanChart) {
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) clone).setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(clone);
cc.addChart(clone);
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

9
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -18,11 +18,11 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.StringUtils;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
@ -155,12 +155,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
addButton.addActionListener((e) -> {
String name = getNewChartName();
ChartProvider chart = getChangeStateNewChart();
if (!ChartEditContext.supportTheme() && chart instanceof VanChart) {
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) chart).setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart);
checkInForm(chart);
addNewChart(chart, name, editingCollection.getChartCount());
});

6
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithThemeStyle.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.chart.gui.style;
import com.fr.chart.base.TextAttr;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIColorButtonWithAuto;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
@ -74,6 +75,11 @@ public class ChartTextAttrPaneWithThemeStyle extends ChartTextAttrPane {
textFontPane.setVisible(preButton.getSelectedIndex() == CUSTOM);
}
@Override
protected void initFontColorState() {
setFontColor(new UIColorButtonWithAuto());
}
protected double[] getRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p};

29
designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java

@ -64,28 +64,39 @@ public class DefaultStyleConstants {
static final Background BACK = null;
//新特新
public static String COLOR_NAME_1;
//经典高亮
private static String COLOR_NAME_2;
static {
try {
COLOR_NAME_1 = CodeUtils.cjkDecode("\u65b0\u7279\u6027");
COLOR_NAME_2 = CodeUtils.cjkDecode("\u7ecf\u5178\u9ad8\u4eae");
} catch (Exception e) {
e.printStackTrace();
}
}
static String COLORS = null;
static {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
try {
DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u7ecf\u5178\u9ad8\u4eae");
COLORS = COLOR_NAME_2;
// 没有经典高亮, 用新特性
if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) {
DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u65b0\u7279\u6027");
if (config.getPreStyle(COLORS) == null) {
COLORS = COLOR_NAME_1;
}
// 没有新特性, 用第一个配色
if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) {
if (config.getPreStyle(COLORS) == null) {
if (config.names().hasNext()) {
String name = GeneralUtils.objectToString(config.names().next());
if (config.getPreStyle(name) != null) {
DefaultStyleConstants.COLORS = name;
COLORS = name;
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

66
designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java

@ -1,11 +1,14 @@
package com.fr.van.chart.config;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.chart.base.AttrBorder;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.DataSheet;
import com.fr.chartx.attr.ChartProvider;
import com.fr.config.predefined.ColorFillStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.plugin.chart.PiePlot4VanChart;
@ -19,6 +22,7 @@ import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.plugin.chart.vanchart.VanChart;
/**
* @author shine
@ -28,8 +32,27 @@ import com.fr.plugin.chart.type.GaugeStyle;
*/
public class DefaultStyleHelper4Van {
private static boolean duchampMode() {
try {
return ChartEditContext.duchampMode();
} catch (Throwable e) {
//tomcat预览 默认数据的图表
return true;
}
}
public static void checkChartDefaultStyle4Duchamp(ChartProvider chartProvider) {
if (!ChartEditContext.supportTheme() && chartProvider instanceof VanChart) {
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) chartProvider).setThemeCustom();
dealChartColor((VanChart) chartProvider);
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
}
public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) {
if (!ChartEditContext.duchampMode()) {
if (!duchampMode()) {
return;
}
dealVanPlotCommonAttr(plot);
@ -60,7 +83,7 @@ public class DefaultStyleHelper4Van {
}
public static VanChartAxis dealAxisDefault(VanChartAxis axis) {
if (!ChartEditContext.duchampMode()) {
if (!duchampMode()) {
return axis;
}
axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE);
@ -71,28 +94,20 @@ public class DefaultStyleHelper4Van {
}
public static void dealAxisAlert(VanChartAlertValue vanChartAlertValue) {
if (!ChartEditContext.duchampMode()) {
if (!duchampMode()) {
return;
}
vanChartAlertValue.setAlertFont(DefaultStyleConstants.ALERT_FONT);
}
static void dealVanPlotCommonAttr(Plot plot) {
if (!ChartEditContext.duchampMode()) {
if (!duchampMode()) {
return;
}
if (plot instanceof VanChartPlot) {
VanChartPlot vanChartPlot = (VanChartPlot) plot;
ColorFillStyle colorFillStyle = new ColorFillStyle();
colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC);
colorFillStyle.setFillStyleName(DefaultStyleConstants.COLORS);
AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle();
if (plotFillStyle == null) {
plotFillStyle = new AttrFillStyle();
vanChartPlot.setPlotFillStyle(plotFillStyle);
}
plotFillStyle.setColorFillStyle(colorFillStyle);
dealChartColor(vanChartPlot);
if (vanChartPlot.getLegend() != null) {
vanChartPlot.getLegend().setFRFont(DefaultStyleConstants.LEGEND);
@ -118,6 +133,31 @@ public class DefaultStyleHelper4Van {
}
private static void dealChartColor(VanChart vanChart) {
dealChartColor(vanChart.getPlot());
}
private static void dealChartColor(VanChartPlot vanChartPlot) {
ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance();
Object preStyle = manager.getPreStyle(DefaultStyleConstants.COLORS);
if (preStyle instanceof ChartColorMatching) {
ColorFillStyle colorFillStyle = new ColorFillStyle();
//default是默认的意思,为服务器默认配色方案
//acc为多个颜色组合
//gradient为渐变颜色
colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC);
colorFillStyle.setFillStyleName(DefaultStyleConstants.COLORS);
colorFillStyle.setColorList(((ChartColorMatching) preStyle).getColorList());
AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle();
if (plotFillStyle == null) {
plotFillStyle = new AttrFillStyle();
vanChartPlot.setPlotFillStyle(plotFillStyle);
}
plotFillStyle.setColorFillStyle(colorFillStyle);
}
}
private static void dealBorder(VanChartPlot vanChartPlot) {
ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr();
AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class);

15
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java

@ -32,6 +32,7 @@ import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -145,12 +146,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Van
chart.setPlot(cloneOldPlot2New(oldPlot, newPlot));
resetChartAttr4SamePlot(chart);
ChartInfoCollector.getInstance().updateChartMiniType(chart);
if (!ChartEditContext.supportTheme()) {
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
chart.setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart);
} else if (!samePlot) {
//不同的图表类型切換
resetChartAttr(chart, newPlot);
@ -158,12 +154,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Van
newPlot.setCategoryNum(oldPlot.getCategoryNum());
//切换类型埋点
ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID());
if (!ChartEditContext.supportTheme()) {
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
chart.setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart);
}
if (!ChartEditContext.supportTheme()) {
chart.setAutoThemeCustom();

14
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java

@ -1,13 +1,13 @@
package com.fr.van.chart.funnel.designer.style;
import com.fr.chart.chartattr.Plot;
import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.plugin.chart.funnel.FunnelSortType;
import com.fr.plugin.chart.funnel.VanChartFunnelPlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
@ -51,7 +51,11 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane {
private JPanel createFunnelStylePane() {
useSameSlantAngle = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Same_Slant_Angle"), Toolkit.i18nText("Fine-Design_Chart_Use_Diff_Slant_Angle")});
sort = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto_Sort"), Toolkit.i18nText("Fine-Design_Chart_Origin")});
sort = new UIButtonGroup(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Ascending_Sort"),
Toolkit.i18nText("Fine-Design_Chart_Descending_Sort"),
Toolkit.i18nText("Fine-Design_Chart_Origin_Sort")
});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -78,7 +82,7 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane {
if(plot instanceof VanChartFunnelPlot){
useSameSlantAngle.setSelectedIndex(((VanChartFunnelPlot) plot).isUseSameSlantAngle() ? 0 : 1);
sort.setSelectedIndex(((VanChartFunnelPlot) plot).isSort() ? 0 : 1);
sort.setSelectedIndex(((VanChartFunnelPlot) plot).getSortType().getSortType());
}
}
@ -94,7 +98,7 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane {
if(plot instanceof VanChartFunnelPlot){
((VanChartFunnelPlot) plot).setUseSameSlantAngle(useSameSlantAngle.getSelectedIndex() == 0);
((VanChartFunnelPlot) plot).setSort(sort.getSelectedIndex() == 0);
((VanChartFunnelPlot) plot).setSortType(FunnelSortType.parseSortType(sort.getSelectedIndex()));
}
}
}

5
designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java

@ -1,13 +1,14 @@
package com.fr.van.chart.pie.style;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSummaryValueFormat;
import com.fr.plugin.chart.pie.attr.PieCategoryLabelContent;
import com.fr.plugin.chart.type.FontAutoType;
import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SummaryValueFormatPaneWithCheckBox;
@ -86,7 +87,7 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan
}
public JPanel createCommonStylePane() {
setTextAttrPane(new ChartTextAttrPane());
setTextAttrPane(new ChartTextAttrPaneWithAuto(FontAutoType.COLOR));
return getTextAttrPane();
}

26
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -71,6 +71,7 @@ import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.invoke.Reflect;
@ -82,6 +83,7 @@ import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.StringUtils;
import com.fr.third.javax.annotation.Nonnull;
import java.util.Set;
import org.jetbrains.annotations.Nullable;
import javax.swing.Icon;
@ -446,4 +448,28 @@ public class XCreatorUtils {
return xCreator;
}
public static boolean isExtraContainer(XCreator creator) {
Set<FormWidgetOptionProvider> set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG);
for (FormWidgetOptionProvider provider : set) {
if (provider.isContainer()
&& ComparatorUtils.equals(provider.appearanceForWidget(), provider.appearanceForWidget())
&& ComparatorUtils.equals(provider.classForWidget(), creator.toData().getClass())) {
return true;
}
}
return false;
}
public static XLayoutContainer getParent(XCreator source) {
if (source.acceptType(XWCardTagLayout.class) ) {
return (XLayoutContainer)source.getParent();
}
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
boolean accept = (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) && !isExtraContainer(source);
if (accept) {
container = null;
}
return container;
}
}

22
designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -18,6 +18,7 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants;
@ -31,12 +32,15 @@ import com.fr.form.share.SharableWidgetProvider;
import com.fr.form.share.ShareLoader;
import com.fr.form.share.editor.SharableEditorProvider;
import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Color;
import java.awt.Component;
import java.awt.Point;
@ -316,6 +320,24 @@ public class FormCreatorDropTarget extends DropTarget {
*/
@Override
public synchronized void drop(DropTargetDropEvent dtde) {
try {
dropXCreator(dtde);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
if (addingModel.getXCreator().isShared()) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Drag_Component_Error_Info"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")
);
}
dtde.rejectDrop();
}
}
private void dropXCreator(DropTargetDropEvent dtde) {
Point loc = dtde.getLocation();
this.adding(designer.getRelativeX(loc.x), designer.getRelativeY(loc.y));
// 放到事件末尾执行

11
designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java

@ -7,6 +7,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.gui.chart.ChartXMLTag;
import com.fr.design.gui.core.FormWidgetOption;
@ -18,6 +19,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.i18n.Toolkit;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.UserDefinedWidgetConfig;
import com.fr.form.ui.Widget;
@ -98,6 +100,15 @@ public class FormParaWidgetPane extends JPanel {
synchronized (FormParaWidgetPane.class) {
THIS = null;
}
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null && !template.isJWorkBook()) {
DesignerContext.getDesignerFrame().resetToolkitByPlus(template);
}
}
});
}
}, new PluginFilter() {

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

@ -1110,7 +1110,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
}
Iterator tdIterator = sharableEditor.getTableDataSource().getTableDataNameIterator();
while (tdIterator.hasNext()) {
String tdName = bindInfo.getName() + "-" + tdIterator.next();
String tdName = bindInfo.getName() + TableDataConstants.SEPARATOR + tdIterator.next();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).removeTableData(tdName);
}
}

6
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java

@ -95,6 +95,10 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
resetCover(image);
}
public boolean checkValid(Object key) {
return this.parentPane == key;
}
private Image getDefaultDisplayImage(){
return ShareComponentConstants.DEFAULT_COVER;
}
@ -110,7 +114,7 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
if (e.getButton() == MouseEvent.BUTTON3) {
CarouselStateManger.getInstance().suspend(CarouselStateManger.MOUSE_HOVER);
CarouselStateManger.getInstance().suspend(CarouselStateManger.RIGHT_CLICK);
this.parentPane.hidePreviewPane();
JPopupMenu rightClickPopupMenu = getRightClickPopupMenu();
GUICoreUtils.showPopupMenu(rightClickPopupMenu, this, e.getX(), e.getY());

3
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetPackageBlock.java

@ -41,6 +41,9 @@ public class OnlineWidgetPackageBlock extends AbstractOnlineWidgetBlock {
southPane.add(detailLabel, BorderLayout.EAST);
return southPane;
}
protected boolean supportFirstDragAnimate(){
return false;
}
protected Dimension getCoverDimension() {
return new Dimension(ShareComponentConstants.SHARE_PACKAGE_BLOCK_WIDTH, IMAGE_HEIGHT);

7
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java

@ -148,7 +148,8 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
@Override
public void mouseEntered(MouseEvent e) {
hover = true;
if (ComponentShareUtil.needShowFirstDragAnimate() && !FormWidgetDetailPane.getInstance().hasTouched() && checkWidget()) {
if (ComponentShareUtil.needShowFirstDragAnimate() && supportFirstDragAnimate() &&
!FormWidgetDetailPane.getInstance().hasTouched() && checkWidget()) {
schedule(ANIMATE_START_TIME);
awtEventListener = event -> {
if (!this.isShowing()) {
@ -169,6 +170,10 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
}
}
protected boolean supportFirstDragAnimate(){
return true;
}
protected boolean checkWidget() {
return true;
}

5
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/SimpleWidgetBlock.java

@ -14,4 +14,9 @@ public class SimpleWidgetBlock extends OnlineWidgetBlock {
this.removeListener();
this.setFocusable(false);
}
protected boolean supportFirstDragAnimate(){
return false;
}
}

16
designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java

@ -119,10 +119,12 @@ public class LocalWidgetRepoPane extends BasicPane {
content.add(LabelUtils.createAutoWrapLabel(Toolkit.i18nText("Fine-Design_Share_Upgrade_Tip"), new Color(0x333334)), BorderLayout.CENTER);
JPanel actionsPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0));
actionsPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, -5));
actionsPane.setOpaque(false);
actionsPane.setBackground(null);
UIButton cancelUpgradeButton = new UIButton(Toolkit.i18nText("Fine-Design_Share_Upgrade_Cancel"));
cancelUpgradeButton.setRoundBorder(true);
cancelUpgradeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -132,6 +134,8 @@ public class LocalWidgetRepoPane extends BasicPane {
UIButton startUpgradeButton = new UIButton(Toolkit.i18nText("Fine-Design_Share_Upgrade_All"));
startUpgradeButton.setSelected(true);
startUpgradeButton.setRoundBorder(true);
startUpgradeButton.setBorderPainted(false);
startUpgradeButton.setForeground(Color.WHITE);
startUpgradeButton.addActionListener(new ActionListener() {
@Override
@ -389,15 +393,19 @@ public class LocalWidgetRepoPane extends BasicPane {
public void onFetchedAfter(boolean success, Map<String, OnlineShareWidget> remoteLatestWidgets) {
if (success) {
List<SharableWidgetProvider> updatableWidgetProviders = LocalWidgetRepoUpdater.getInstance().getUpdatableWidgetProviders();
updateTipPane.setVisible(updatableWidgetProviders.size() > 0);
if (updatableWidgetProviders.size() > 0) {
refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT);
}
onRemoteWidgetUpdatesChanged(updatableWidgetProviders.size() > 0);
}
}
});
}
public void onRemoteWidgetUpdatesChanged(boolean hasUpdates) {
updateTipPane.setVisible(hasUpdates);
if (hasUpdates) {
refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT);
}
}
public void doQuitUpdateComponents() {
LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance();
updater.clearUpdate();

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetSelectPane.java

@ -170,7 +170,7 @@ public abstract class AbstractOnlineWidgetSelectPane extends AbstractWidgetSele
if (!OnlineShopUtils.testConnection()) {
return OnlineWidgetSelectPane.PaneStatue.DISCONNECTED;
}
OnlineResourceManager.getInstance().cancelLoad();
OnlineResourceManager.getInstance().cancelLoad(this);
contentPane.removeAll();
scrollPane = createScrollPane();

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java

@ -87,7 +87,7 @@ public class EmbedPane extends JPanel {
private JPanel getFilterTipPane() {
String remark = Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Tip");
UILabel label = new UILabel();
label.setSize(new Dimension(212, 30));
label.setSize(new Dimension(229, 30));
//用THML标签进行拼接,以实现自动换行
StringBuilder builder = new StringBuilder("<html>");

12
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java

@ -40,6 +40,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
private static final String CAROUSEL_PREVIEW = "carousel_preview";
private static final int CAROUSE_IMAGE_LOAD_TIMEOUT = 2000;
private OnlineShareWidget[] showWidgets;
private static final int NOT_CAROUSE_WIDGET_NUM = 30;
private PreviewDialog previewDialog;
private JPanel widgetPane;
@ -56,8 +57,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
Point selectPanePoint = OnlineEmbedFilterSelectPane.this.getLocationOnScreen();
Dimension selectPaneDimension = OnlineEmbedFilterSelectPane.this.getSize();
Rectangle selectPaneRec = new Rectangle(selectPanePoint.x, selectPanePoint.y, selectPaneDimension.width, selectPaneDimension.height);
if (CarouselStateManger.getInstance().running() &&
!selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) {
if (!selectPaneRec.contains(((MouseEvent) event).getLocationOnScreen())) {
CarouselStateManger.getInstance().stop();
}
} catch (Exception e) {
@ -144,7 +144,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
stopCarouse(integer);
return;
}
if (integer.get() == 0) {
if (integer.get() == NOT_CAROUSE_WIDGET_NUM) {
CarouselStateManger.getInstance().stop();
stopCarouse(integer);
previewDialog.setVisible(false);
@ -172,6 +172,12 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane
}
if (!CarouselStateManger.getInstance().isSuspend()) {
previewDialog.setVisible(true);
//再做一次检查,避免因并发导致的previewDialog始终展示的问题
if (CarouselStateManger.getInstance().stopped()) {
stopCarouse(integer);
service.shutdown();
return;
}
showCurrentLoadBlock(integer, widgetPane);
service.shutdown();
}

10
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/OnlineResourceManager.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.share.ui.online.resource;
import javax.swing.SwingWorker;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.function.Predicate;
/**
* Created by kerry on 2020-12-10
@ -25,11 +26,16 @@ public class OnlineResourceManager {
private final BlockingQueue<ResourceLoader> loaderBlockingQueue = new ArrayBlockingQueue<ResourceLoader>(100);
public void cancelLoad() {
public void cancelLoad(Object key) {
if (swingWorker != null) {
swingWorker.cancel(true);
}
this.loaderBlockingQueue.clear();
loaderBlockingQueue.removeIf(new Predicate<ResourceLoader>() {
@Override
public boolean test(ResourceLoader resourceLoader) {
return resourceLoader.checkValid(key);
}
});
}
public void addLoader(ResourceLoader loader) {

7
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/resource/ResourceLoader.java

@ -10,4 +10,11 @@ public interface ResourceLoader {
*/
void load();
/**
* 检查resource是否属于某分类
* @param key 分类标识
* @return boolean
*/
boolean checkValid(Object key);
}

2
designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java

@ -54,7 +54,7 @@ public class OnlineShopUtils {
}
private static String getWidgetFilterPath() {
return StableUtils.pathJoin(getReuInfoPath(), "filter");
return StableUtils.pathJoin(getReuInfoPath(), "/all/filter/");
}
private static String getGetCompositeSortParaPath() {

7
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java

@ -65,12 +65,9 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane {
initDefinePane();
}
@Deprecated
public XLayoutContainer getParent(XCreator source) {
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
container = null;
}
return container;
return XCreatorUtils.getParent(source);
}
public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) {

10
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -61,15 +61,9 @@ public class WidgetBoundPane extends BasicPane {
initBoundPane();
}
@Deprecated
public XLayoutContainer getParent(XCreator source) {
if(source.acceptType(XWCardTagLayout.class)){
return (XLayoutContainer)source.getParent();
}
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
container = null;
}
return container;
return XCreatorUtils.getParent(source);
}
public void initBoundPane() {

60
designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java

@ -3,17 +3,27 @@
*/
package com.fr.design.actions.cell;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.BaseUtils;
import com.fr.base.CellBorderStyle;
import com.fr.base.NameStyle;
import com.fr.base.Style;
import com.fr.design.actions.ElementCaseAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.style.BorderUtils;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.report.cell.CellElementBorderSourceFlag;
import com.fr.report.cell.FloatElement;
import com.fr.report.cell.StyleProvider;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.design.mainframe.ElementCasePane;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Rectangle;
/**
* Border.
@ -65,7 +75,45 @@ public class BorderAction extends ElementCaseAction implements ChangeListener {
return (JComponent) object;
}
public boolean update(ElementCasePane elementCasePane) {
public void resetElementStyleToCustom(StyleProvider provider) {
Style style = provider.getStyle();
if (style instanceof NameStyle) {
style = ((NameStyle) style).getRealStyle();
}
provider.setStyle(style);
}
public void resetSelectedElementsStyleToCustom(ElementCasePane<?> elementCasePane) {
Selection selection = elementCasePane.getSelection();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
if (selection instanceof FloatSelection) {
FloatSelection floatSelection = (FloatSelection) selection;
FloatElement selectedFloatElement = elementCase.getFloatElement(floatSelection.getSelectedFloatName());
resetElementStyleToCustom(selectedFloatElement);
} else {
CellSelection cellSelection = (CellSelection) selection;
int cellRectangleCount = cellSelection.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) {
Rectangle cellRectangle = cellSelection.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) {
resetElementStyleToCustom(cellElement);
cellElement.setBorderSourceFlags(CellElementBorderSourceFlag.INVALID_BORDER_SOURCE);
};
}
}
}
}
}
public boolean update(ElementCasePane<?> elementCasePane) {
resetSelectedElementsStyleToCustom(elementCasePane);
if (oldCellBorderStyle.isNoneBorderStyle()) {
//无边框格式
return BorderUtils.updateCellBorderStyle(elementCasePane, oldCellBorderStyle);

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

@ -1,8 +1,10 @@
package com.fr.design.mainframe.cell.settingpane;
import com.fr.base.CellBorderStyle;
import com.fr.base.Style;
import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.style.BorderPane;
import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.design.style.BorderUtils;
@ -70,8 +72,6 @@ public class CellStylePane extends AbstractCellAttrPane {
@Override
public void updateBeans() {
Object[] selectionCellBorderObjects = BorderUtils.createCellBorderObject(elementCasePane);
if (stylePane.getSelectedIndex() == 0) {
Style s = stylePane.updateBean();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int cellRectangleCount = cs.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) {
@ -85,36 +85,15 @@ public class CellStylePane extends AbstractCellAttrPane {
cellElement = DefaultThemedTemplateCellElementCase.createInstance(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 = DefaultThemedTemplateCellElementCase.createInstance(column, row);
elementCase.addCellElement(cellElement);
}
Style style = cellElement.getStyle();
if (style == null) {
style = Style.DEFAULT_STYLE;
}
style = stylePane.updateStyle(style);
Style style = stylePane.updateBean();
cellElement.setStyle(style);
}
}
}
// border必须特别处理
stylePane.updateBorder(selectionCellBorderObjects);
CellBorderStyle cellBorderStyle = stylePane.updateBorderStyle();
if (cellBorderStyle != null) {
BorderUtils.update(elementCasePane, selectionCellBorderObjects, cellBorderStyle);
}
}

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

@ -3,15 +3,11 @@ package com.fr.design.mainframe.cell.settingpane.style;
import com.fr.base.CellBorderStyle;
import com.fr.base.NameStyle;
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.actions.utils.ReportActionUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.MultiTabPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.AbstractBasicStylePane;
@ -21,25 +17,20 @@ import com.fr.design.gui.style.FormatPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane;
import com.fr.design.mainframe.predefined.ui.preview.StyleSettingPreviewPane;
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;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by kerry on 2020-09-02
@ -212,11 +203,9 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane<N
if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) {
if (fourObjectArray.length == LENGTH_FOUR) {
((BorderPane) paneList.get(ONE_INDEX)).populateBean((CellBorderStyle) fourObjectArray[0], ((Boolean) fourObjectArray[1]).booleanValue(), ((Integer) fourObjectArray[2]).intValue(),
(Color) fourObjectArray[THREE_INDEX]);
((BorderPane) paneList.get(ONE_INDEX)).populateBean((CellBorderStyle) fourObjectArray[0], ((Boolean) fourObjectArray[1]).booleanValue());
} else {
((BorderPane) paneList.get(ONE_INDEX)).populateBean(new CellBorderStyle(), Boolean.TRUE, Constants.LINE_NONE,
(Color) fourObjectArray[THREE_INDEX]);
((BorderPane) paneList.get(ONE_INDEX)).populateBean(new CellBorderStyle(), Boolean.TRUE);
}
}

27
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java

@ -11,8 +11,6 @@ import com.fr.design.gui.style.*;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.style.BorderUtils;
import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.event.ChangeListener;
import java.awt.*;
@ -115,19 +113,25 @@ public class CustomStylePane extends MultiTabPane<Style> {
}
public void dealWithBorder() {
dealWithBorder(true);
}
public void dealWithBorder(boolean onlyInspectTop) {
if (reportPane == null) {
return;
}
Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane);
if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) {
if (fourObjectArray.length % LENGTH_FOUR == 0) {
CellBorderStyle cellBorderStyle = new CellBorderStyle();
boolean insideMode = true;
if (fourObjectArray.length == LENGTH_FOUR) {
((BorderPane) paneList.get(ONE_INDEX)).populateBean((CellBorderStyle) fourObjectArray[0], ((Boolean) fourObjectArray[1]).booleanValue(), ((Integer) fourObjectArray[2]).intValue(),
(Color) fourObjectArray[THREE_INDEX]);
} else {
((BorderPane) paneList.get(ONE_INDEX)).populateBean(new CellBorderStyle(), Boolean.TRUE, Constants.LINE_NONE,
(Color) fourObjectArray[THREE_INDEX]);
cellBorderStyle = (CellBorderStyle) fourObjectArray[0];
insideMode = (Boolean) fourObjectArray[1];
}
BorderPane borderPane = (BorderPane) paneList.get(ONE_INDEX);
borderPane.populateBean(cellBorderStyle, insideMode, onlyInspectTop);
}
}
@ -139,11 +143,8 @@ public class CustomStylePane extends MultiTabPane<Style> {
dealWithBorder();
}
/**
*
*/
public void updateBorder(Object[] selectionCellBorderObjects) {
BorderUtils.update(reportPane, selectionCellBorderObjects, ((BorderPane) paneList.get(ONE_INDEX)).update());
public CellBorderStyle updateBorderStyle() {
return ((BorderPane) paneList.get(ONE_INDEX)).update();
}
/**

54
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/NameStyleListPane.java

@ -0,0 +1,54 @@
package com.fr.design.mainframe.cell.settingpane.style;
import com.fr.base.CellBorderStyle;
import com.fr.base.NameStyle;
import com.fr.base.Style;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.theme.ThemedCellStyleListPane;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/11/23
*/
public class NameStyleListPane extends ThemedCellStyleListPane {
public NameStyleListPane() {
}
public NameStyleListPane(boolean supportCellRange) {
super(supportCellRange);
}
public void populateNameStyle(NameStyle style) {
String name = style.getName();
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
TemplateTheme theme = template.getTemplateTheme();
ThemedCellStyle themedCellStyle = theme.getCellStyleList().find(name);
populateBean(themedCellStyle);
}
}
public NameStyle updateNameStyle() {
ThemedCellStyle themedCellStyle = updateBean();
if (themedCellStyle != null) {
String name = themedCellStyle.getName();
Style style = themedCellStyle.getStyle();
return NameStyle.getPassiveInstance(name, style);
}
return null;
}
public CellBorderStyle updateBorderStyle() {
ThemedCellStyle nameStyle = updateBean();
if (nameStyle != null) {
return nameStyle.getCellBorderStyle();
}
return null;
}
}

36
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.cell.settingpane.style;
import com.fr.base.CellBorderStyle;
import com.fr.base.NameStyle;
import com.fr.base.Style;
import com.fr.design.designer.IntervalConstants;
@ -41,7 +42,7 @@ public class StylePane extends BasicPane implements UIObserver {
private final UIButtonGroup<String> followingThemeButtonGroup;
private JPanel followingThemePane;
private final CustomStylePane customStylePane;
private final ThemedCellStyleListPane themedCellStyleListPane;
private final NameStyleListPane nameStyleListPane;
private final CardLayout cardLayout;
private final JComponent[] panes = new JComponent[2];
@ -55,7 +56,7 @@ public class StylePane extends BasicPane implements UIObserver {
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
followingThemeButtonGroup.setAutoFireStateChanged(false);
customStylePane = new CustomStylePane();
themedCellStyleListPane = new ThemedCellStyleListPane();
nameStyleListPane = new NameStyleListPane(true);
panes[0] = createThemedStylePane();
panes[1] = createCustomStylePane();
cardLayout = new CardLayout();
@ -102,7 +103,7 @@ public class StylePane extends BasicPane implements UIObserver {
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[selectedIndex]);
if (!isFollowingTheme) {
// 对于同一个单元格,跟随主题切换到自定义,自定义中的配置与其保持一致
NameStyle lastSelectedNameStyle = themedCellStyleListPane.updateBean();
NameStyle lastSelectedNameStyle = nameStyleListPane.updateNameStyle();
if (lastSelectedNameStyle != null) {
Style lastSelectedRealStyle = lastSelectedNameStyle.getRealStyle();
try {
@ -117,7 +118,7 @@ public class StylePane extends BasicPane implements UIObserver {
}
} else {
// 对于同一个单元格,自定义切换到跟随主题,跟随主题选中"默认"样式,并使用默认样式设置选中的单元格
themedCellStyleListPane.reset();
nameStyleListPane.reset();
}
}
@ -143,11 +144,11 @@ public class StylePane extends BasicPane implements UIObserver {
private JPanel createThemedStylePane() {
JPanel container = new JPanel(new BorderLayout(0, IntervalConstants.INTERVAL_L1));
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Style_Selecting"));
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Style_Applying"));
uiLabel.setPreferredSize(new Dimension(uiLabel.getPreferredSize().width, 20));
container.add(uiLabel, BorderLayout.NORTH);
themedCellStyleListPane.setBorder(BorderFactory.createEmptyBorder());
container.add(themedCellStyleListPane, BorderLayout.CENTER);
nameStyleListPane.setBorder(BorderFactory.createEmptyBorder());
container.add(nameStyleListPane, BorderLayout.CENTER);
return container;
}
@ -172,19 +173,13 @@ public class StylePane extends BasicPane implements UIObserver {
}
public void addPredefinedChangeListener(ChangeListener changeListener) {
themedCellStyleListPane.addChangeListener(changeListener);
nameStyleListPane.addChangeListener(changeListener);
}
public void addCustomTabChangeListener(ChangeListener changeListener) {
customStylePane.addTabChangeListener(changeListener);
}
public void updateBorder(Object[] selectionCellBorderObjects) {
if (getSelectedIndex() == 1 && customStylePane.isBorderPaneSelected()) {
customStylePane.updateBorder(selectionCellBorderObjects);
}
}
public void dealWithBorder(ElementCasePane ePane) {
customStylePane.dealWithBorder(ePane);
}
@ -193,14 +188,19 @@ public class StylePane extends BasicPane implements UIObserver {
setSelectedIndex(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom"), id)? 1 : 0);
}
public Style updateStyle(Style style) {
return customStylePane.updateStyle(style);
public CellBorderStyle updateBorderStyle() {
if (getSelectedIndex() == 0) {
return nameStyleListPane.updateBorderStyle();
} else if (customStylePane.isBorderPaneSelected()) {
return customStylePane.updateBorderStyle();
}
return null;
}
public Style updateBean() {
Style finalStyle = null;
if (getSelectedIndex() == 0) {
finalStyle = themedCellStyleListPane.updateBean();
finalStyle = nameStyleListPane.updateNameStyle();
}
if (finalStyle == null) {
finalStyle = customStylePane.updateBean();
@ -216,7 +216,7 @@ public class StylePane extends BasicPane implements UIObserver {
if (style instanceof NameStyle) {
NameStyle nameStyle = (NameStyle) style;
setSelectedIndex(0);
themedCellStyleListPane.populateBean(nameStyle);
nameStyleListPane.populateNameStyle(nameStyle);
Style realStyle = nameStyle.getRealStyle();
try {
realStyle = (Style) realStyle.clone();

16
designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

@ -18,7 +18,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.cell.settingpane.style.ThemedCellStyleListPane;
import com.fr.design.mainframe.cell.settingpane.style.NameStyleListPane;
import com.fr.design.mainframe.theme.ui.NoEdgeTitleBorder;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.design.style.AlignmentPane;
@ -531,7 +531,7 @@ public class ReportStylePane extends BasicPane {
private static class ThemedFloatStyleSettingPane extends BasicPane implements ChangeListener {
private final ThemedCellStyleListPane themedCellStyleListPane;
private final NameStyleListPane nameStyleListPane;
private final FormatPane formatPane;
private final List<ChangeListener> changeListeners = new ArrayList<>();
@ -541,9 +541,9 @@ public class ReportStylePane extends BasicPane {
UITabbedPane mainTabbedPane = new UITabbedPane();
setLayout(FRGUIPaneFactory.createBorderLayout());
themedCellStyleListPane = new ThemedCellStyleListPane();
themedCellStyleListPane.setBorder(BorderFactory.createEmptyBorder());
UIScrollPane scrollPane = new UIScrollPane(themedCellStyleListPane);
nameStyleListPane = new NameStyleListPane();
nameStyleListPane.setBorder(BorderFactory.createEmptyBorder());
UIScrollPane scrollPane = new UIScrollPane(nameStyleListPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 0));
scrollPane.setPreferredSize(new Dimension(620, scrollPane.getPreferredSize().height));
add(scrollPane, BorderLayout.CENTER);
@ -558,17 +558,17 @@ public class ReportStylePane extends BasicPane {
}
public void populateBean(NameStyle style) {
themedCellStyleListPane.populateBean(style);
nameStyleListPane.populateNameStyle(style);
formatPane.populate(style.getFormat());
}
public NameStyle updateBean() {
NameStyle style = themedCellStyleListPane.updateBean();
NameStyle style = nameStyleListPane.updateNameStyle();
return (NameStyle) style.deriveFormat(formatPane.update());
}
public void reset(Style style) {
themedCellStyleListPane.reset();
nameStyleListPane.reset();
formatPane.populate(style.getFormat());
}

68
designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java

@ -5,6 +5,8 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.event.ChangeEvent;
import com.fr.design.event.ChangeListener;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
@ -33,15 +35,12 @@ import com.fr.form.share.group.DefaultShareGroupManager;
import com.fr.form.share.record.ShareWidgetInfoManager;
import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
@ -113,57 +112,17 @@ public class ShareGeneratePane extends BasicPane {
this.mainPane.add(simplePane, ShareUIUtils.convertStateChange(ItemEvent.DESELECTED));
this.mainPane.add(uploadPane, ShareUIUtils.convertStateChange(ItemEvent.SELECTED));
simplePane.getNameField().getDocument().addDocumentListener(new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
validInput();
}
@Override
public void insertUpdate(DocumentEvent e) {
validInput();
}
simplePane.addRequiredSettingChangeListener(new ChangeListener() {
@Override
public void removeUpdate(DocumentEvent e) {
validInput();
public void fireChanged(ChangeEvent event) {
checkRequiredSettings();
}
});
simplePane.getDesignerVersionField().getDocument().addDocumentListener(new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
validInput();
}
@Override
public void insertUpdate(DocumentEvent e) {
validInput();
}
uploadPane.addRequiredSettingChangeListener(new ChangeListener() {
@Override
public void removeUpdate(DocumentEvent e) {
validInput();
}
});
uploadPane.getNameField().getDocument().addDocumentListener(new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
validInput();
}
@Override
public void insertUpdate(DocumentEvent e) {
validInput();
}
@Override
public void removeUpdate(DocumentEvent e) {
validInput();
public void fireChanged(ChangeEvent event) {
checkRequiredSettings();
}
});
@ -176,14 +135,9 @@ public class ShareGeneratePane extends BasicPane {
return pane;
}
private void validInput() {
String name = getSelectMainPane().getNameField().getText().trim();
boolean isValidName = StringUtils.isNotEmpty(name);
boolean isValidDesignerVersion = getSelectMainPane().getDesignerVersionField().isValidVersion();
boolean isValidInput = isValidName && isValidDesignerVersion;
dialog.setButtonEnabled(isValidInput);
private void checkRequiredSettings() {
boolean isSettingsRequired = getSelectMainPane().checkRequiredSettings();
dialog.setButtonEnabled(isSettingsRequired);
}

85
designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java

@ -5,6 +5,8 @@ import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.event.ChangeEvent;
import com.fr.design.event.ChangeListener;
import com.fr.design.extra.LoginWebBridge;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
@ -62,6 +64,8 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.MatteBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
@ -142,6 +146,9 @@ public class ShareMainPane extends JPanel {
private List<EffectItemGroup> effectItemGroups;
private final boolean needContentTip;
// 监听必填项
private ChangeListener requiredSettingChangeListener;
public ShareMainPane(Image shareCover, Rectangle rec, boolean upload, List<EffectItemGroup> effectItemGroups, boolean needContentTip) {
this.shareCover = shareCover;
@ -402,6 +409,15 @@ public class ShareMainPane extends JPanel {
childClassify.clearBoxItems();
childClassify.refreshBoxItems(children);
}
notifyRequiredSettingChanged(new ChangeEvent(parentClassify));
}
});
childClassify.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
notifyRequiredSettingChanged(new ChangeEvent(parentClassify));
}
});
@ -410,11 +426,31 @@ public class ShareMainPane extends JPanel {
pane.add(parentClassify);
pane.add(childClassify);
UILabel validSymbol = new UILabel(" *");
pane.add(validSymbol);
return pane;
}
private JPanel createDesignerVersionFiledPane() {
designerVersionField.setPreferredSize(new Dimension(TEXT_FIELD_WIDTH, TEXT_FIELD_HEIGHT));
designerVersionField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
notifyRequiredSettingChanged(new ChangeEvent(designerVersionField));
}
@Override
public void insertUpdate(DocumentEvent e) {
notifyRequiredSettingChanged(new ChangeEvent(designerVersionField));
}
@Override
public void removeUpdate(DocumentEvent e) {
notifyRequiredSettingChanged(new ChangeEvent(designerVersionField));
}
});
JPanel symbolTextFiled = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel validSymbol = new UILabel(" *");
symbolTextFiled.add(designerVersionField, BorderLayout.CENTER);
@ -546,6 +582,23 @@ public class ShareMainPane extends JPanel {
nameField.setPlaceholder(Toolkit.i18nText("Fine-Design_Share_Name_Placeholder"));
nameField.setPreferredSize(new Dimension(TEXT_FIELD_WIDTH, TEXT_FIELD_HEIGHT));
nameField.setDocument(nameLimited);
nameField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
notifyRequiredSettingChanged(new ChangeEvent(nameField));
}
@Override
public void insertUpdate(DocumentEvent e) {
notifyRequiredSettingChanged(new ChangeEvent(nameField));
}
@Override
public void removeUpdate(DocumentEvent e) {
notifyRequiredSettingChanged(new ChangeEvent(nameField));
}
});
JPanel symbolTextFiled = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel validSymbol = new UILabel(" *");
symbolTextFiled.add(nameField, BorderLayout.CENTER);
@ -672,16 +725,29 @@ public class ShareMainPane extends JPanel {
return provider;
}
public Group getSelectGroup() {
return (Group) localGroup.getSelectedItem();
public boolean checkRequiredSettings() {
String name = nameField.getText().trim();
boolean isNameRequired = StringUtils.isNotEmpty(name);
boolean isDesignerVersionRequired = designerVersionField.isValidVersion();
boolean isClassifyRequired = parentClassify.getSelectedItem() != null && childClassify.getSelectedItem() != null;
return isNameRequired && isDesignerVersionRequired && isClassifyRequired;
}
public void addRequiredSettingChangeListener(ChangeListener changeListener) {
this.requiredSettingChangeListener = changeListener;
}
public UITextField getNameField() {
return nameField;
private void notifyRequiredSettingChanged(ChangeEvent event) {
if (this.requiredSettingChangeListener != null) {
this.requiredSettingChangeListener.fireChanged(event);
}
}
public VersionIntervalField getDesignerVersionField() {
return designerVersionField;
public Group getSelectGroup() {
return (Group) localGroup.getSelectedItem();
}
private String classify(Object classify) {
@ -761,14 +827,17 @@ public class ShareMainPane extends JPanel {
@Override
public void insertString(int offset, String str, AttributeSet attrSet) throws BadLocationException {
if (str == null) {
return;
throw new BadLocationException(null, offset);
}
int count = str.length();
for (int i = 0; i < count; i++) {
char c = str.charAt(i);
if (allowCharAsString.indexOf(c) < 0) {
java.awt.Toolkit.getDefaultToolkit().beep();
return;
// REPORT-63194
// 合成文本,如中文等存在输入-删除-替换的机制 JTextComponent#replaceInputMethodText()
// 所以这里不能直接return,而应该抛出异常中断后续字符处理,否则在处理中文等合成文本时会导致原有字符被删除
throw new BadLocationException(str, offset);
}
}
super.insertString(offset, str, attrSet);

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

@ -6,9 +6,12 @@ import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import com.fr.report.cell.CellElementBorderSourceFlag;
import com.fr.base.CellBorderStyle;
import com.fr.base.NameStyle;
import com.fr.base.Style;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.theme.ThemedFeatureController;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection;
@ -463,24 +466,24 @@ public abstract class BorderUtils {
* Update ElementCasePane. Return whether cell border changed. true is
* changed, need to support undo/redo
*/
public static boolean update(ElementCasePane reportPane, CellBorderStyle newCellBorderStyle) {
public static boolean update(ElementCasePane<?> reportPane, CellBorderStyle newCellBorderStyle) {
Object[] selectionCellBorderObjects = createCellBorderObject(reportPane);
return update(reportPane, selectionCellBorderObjects, newCellBorderStyle);
}
public static boolean update(ElementCasePane reportPane, Object[] selectionCellBorderObjects, CellBorderStyle newCellBorderStyle) {
public static boolean update(ElementCasePane<?> reportPane, Object[] selectionCellBorderObjects, CellBorderStyle newCellBorderStyle) {
boolean isBorderColorStyleChanged = false;
Object[] fourObjectArray = selectionCellBorderObjects;
if (fourObjectArray == null || fourObjectArray.length < NUMBER) {
return false;
}
CellBorderStyle cellBorderStyle = (CellBorderStyle) fourObjectArray[0];
TemplateElementCase report = reportPane.getEditingElementCase();
Selection sel = reportPane.getSelection();
if (sel instanceof FloatSelection) {
CellBorderStyle oldCellBorderStyle = (CellBorderStyle) fourObjectArray[0];
FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection) sel).getSelectedFloatName());
// Border变化了.
if (!ComparatorUtils.equals(cellBorderStyle, newCellBorderStyle)) {
if (!ComparatorUtils.equals(oldCellBorderStyle, newCellBorderStyle)) {
isBorderColorStyleChanged = true;
// peter:复制边框.
Style style = selectedFloatElement.getStyle();
@ -493,7 +496,7 @@ public abstract class BorderUtils {
} else {
int cellRectangleCount = ((CellSelection) sel).getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) {
cellBorderStyle = (CellBorderStyle) fourObjectArray[rect * NUMBER];
CellBorderStyle oldCellBorderStyle = (CellBorderStyle) fourObjectArray[rect * NUMBER];
Rectangle cellRectangle = ((CellSelection) sel).getCellRectangle(rect);
int column = cellRectangle.x;
int row = cellRectangle.y;
@ -501,9 +504,9 @@ public abstract class BorderUtils {
int rowSpan = cellRectangle.height;
// Border变化了.
if (!ComparatorUtils.equals(cellBorderStyle, newCellBorderStyle)) {
if (!ComparatorUtils.equals(oldCellBorderStyle, newCellBorderStyle)) {
isBorderColorStyleChanged = true;
setStyle(row, column, rowSpan, columnSpan, report, cellBorderStyle, newCellBorderStyle);
setStyle(row, column, rowSpan, columnSpan, report, newCellBorderStyle);
}
}
}
@ -511,7 +514,7 @@ public abstract class BorderUtils {
return isBorderColorStyleChanged;
}
private static void setStyle(int row, int column, int rowSpan, int columnSpan, TemplateElementCase report, CellBorderStyle cellBorderStyle, CellBorderStyle newCellBorderStyle) {
private static void setStyle(int row, int column, int rowSpan, int columnSpan, TemplateElementCase report, CellBorderStyle newCellBorderStyle) {
for (int i = column; i < column + columnSpan; i++) {
for (int j = row; j < row + rowSpan; j++) {
TemplateCellElement tmpCellElement = report.getTemplateCellElement(i, j);
@ -520,74 +523,21 @@ public abstract class BorderUtils {
report.addCellElement(tmpCellElement);
}
Style style = tmpCellElement.getStyle();
style = inspectStyle(row, column, rowSpan, columnSpan, cellBorderStyle, newCellBorderStyle, tmpCellElement, style);
tmpCellElement.setStyle(style);
}
}
}
private static Style inspectStyle(int row, int column, int rowSpan, int columnSpan, CellBorderStyle cellBorderStyle, CellBorderStyle newCellBorderStyle, TemplateCellElement tmpCellElement, Style style) {
if (tmpCellElement.getColumn() == column) {
if (cellBorderStyle.getLeftStyle() != newCellBorderStyle.getLeftStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getLeftColor(), newCellBorderStyle.getLeftColor())) {
style = style.deriveBorderLeft(newCellBorderStyle.getLeftStyle(), newCellBorderStyle.getLeftColor());
} else {
style = style.deriveBorderLeft(cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor());
}
} else {
if (cellBorderStyle.getVerticalStyle() != newCellBorderStyle.getVerticalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getVerticalColor(), newCellBorderStyle.getVerticalColor())) {
style = style.deriveBorderLeft(newCellBorderStyle.getVerticalStyle(), newCellBorderStyle.getVerticalColor());
} else {
style = style.deriveBorderLeft(cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor());
int cellColumn = tmpCellElement.getColumn();
int cellColumnSpan = tmpCellElement.getColumnSpan();
int cellRow = tmpCellElement.getRow();
int cellRowSpan = tmpCellElement.getRowSpan();
int borderSourceFlags = CellElementBorderSourceFlag.inspectBorderSourceFlag(
column, row, column + columnSpan, row + rowSpan,
cellColumn, cellRow, cellColumn + cellColumnSpan, cellRow + cellRowSpan
);
tmpCellElement.setBorderSourceFlags(borderSourceFlags);
if (style instanceof NameStyle && !ThemedFeatureController.isCellStyleSupportInnerBorder()) {
tmpCellElement.setBorderSourceFlags(CellElementBorderSourceFlag.INVALID_BORDER_SOURCE);
}
}
if (tmpCellElement.getColumn() + tmpCellElement.getColumnSpan() == column + columnSpan) {
if (cellBorderStyle.getRightStyle() != newCellBorderStyle.getRightStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getRightColor(), newCellBorderStyle.getRightColor())) {
style = style.deriveBorderRight(newCellBorderStyle.getRightStyle(), newCellBorderStyle.getRightColor());
} else {
style = style.deriveBorderRight(cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
}
} else {
if (cellBorderStyle.getVerticalStyle() != newCellBorderStyle.getVerticalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getVerticalColor(), newCellBorderStyle.getVerticalColor())) {
style = style.deriveBorderRight(newCellBorderStyle.getVerticalStyle(), newCellBorderStyle.getVerticalColor());
} else {
style = style.deriveBorderRight(cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor());
tmpCellElement.setStyle(style, newCellBorderStyle);
}
}
if (tmpCellElement.getRow() == row) {
if (cellBorderStyle.getTopStyle() != newCellBorderStyle.getTopStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getTopColor(), newCellBorderStyle.getTopColor())) {
style = style.deriveBorderTop(newCellBorderStyle.getTopStyle(), newCellBorderStyle.getTopColor());
} else {
style = style.deriveBorderTop(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor());
}
} else {
if (cellBorderStyle.getHorizontalStyle() != newCellBorderStyle.getHorizontalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getHorizontalColor(), newCellBorderStyle.getHorizontalColor())) {
style = style.deriveBorderTop(newCellBorderStyle.getHorizontalStyle(), newCellBorderStyle.getHorizontalColor());
} else {
style = style.deriveBorderTop(cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor());
}
}
if (tmpCellElement.getRow() + tmpCellElement.getRowSpan() == row + rowSpan) {
if (cellBorderStyle.getBottomStyle() != newCellBorderStyle.getBottomStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getBottomColor(), newCellBorderStyle.getBottomColor())) {
style = style.deriveBorderBottom(newCellBorderStyle.getBottomStyle(), newCellBorderStyle.getBottomColor());
} else {
style = style.deriveBorderBottom(cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor());
}
} else {
if (cellBorderStyle.getHorizontalStyle() != newCellBorderStyle.getHorizontalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getHorizontalColor(), newCellBorderStyle.getHorizontalColor())) {
style = style.deriveBorderBottom(newCellBorderStyle.getHorizontalStyle(), newCellBorderStyle.getHorizontalColor());
} else {
style = style.deriveBorderBottom(cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor());
}
}
return style;
}
private static boolean isAllEquals(List borderStyleColorList) {

13
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -6,10 +6,10 @@ import com.fr.base.MultiFieldParameter;
import com.fr.base.passport.FinePassportListenerAdapter;
import com.fr.base.passport.FinePassportManager;
import com.fr.base.process.ProcessOperator;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.config.MarketConfig;
import com.fr.base.theme.migrator.FormThemeConfigMigrator;
import com.fr.base.theme.migrator.ReportThemeConfigMigrator;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.config.MarketConfig;
import com.fr.decision.update.backup.RecoverManager;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
@ -29,9 +29,9 @@ import com.fr.design.actions.insert.flot.ImageFloatAction;
import com.fr.design.actions.insert.flot.TextBoxFloatAction;
import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.env.DesignerWorkspaceLoader;
import com.fr.design.fit.NewJForm;
import com.fr.design.fit.common.TemplateTool;
import com.fr.design.env.DesignerWorkspaceLoader;
import com.fr.design.form.parameter.FormParaDesigner;
import com.fr.design.fun.ElementUIProvider;
import com.fr.design.gui.controlpane.NameObjectCreator;
@ -62,7 +62,6 @@ import com.fr.design.mainframe.form.FormECDesignerProvider;
import com.fr.design.mainframe.form.FormElementCaseDesigner;
import com.fr.design.mainframe.form.FormReportComponentComposite;
import com.fr.design.mainframe.guide.GuideRegister;
import com.fr.design.mainframe.guide.collect.GuideCollector;
import com.fr.design.mainframe.loghandler.DesignerLogAppender;
import com.fr.design.mainframe.share.constants.ShareEntryKey;
import com.fr.design.mainframe.socketio.DesignerSocketIO;
@ -131,11 +130,11 @@ import com.fr.task.Once;
import com.fr.workspace.WorkContext;
import com.fr.xml.ReportXMLUtils;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.awt.Image;
import java.awt.image.BufferedImage;
/**
* Created by juhaoyu on 2018/1/31.
@ -175,7 +174,7 @@ public class DesignerActivator extends Activator implements Prepare {
public void execute(Object... objects) {
UserInfoPane.getInstance().updateBBSUserInfo();
}
}, SupportOSImpl.USERINFOPANE);
}, SupportOSImpl.BBS_USER_LOGIN_PANE);
storePassport();
AlphaFineHelper.switchConfig4Locale();
RecoverManager.register(new RecoverForDesigner());

Loading…
Cancel
Save