Browse Source

Merge branch 'release/11.0' of ssh://code.fineres.com:7999/~tommy/design into release/11.0

bugfix/11.0
Tommy 3 years ago
parent
commit
fa6eb6a145
  1. 16
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  2. 7
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  3. 4
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  4. 9
      designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedCharFunction.java
  5. 38
      designer-base/src/main/java/com/fr/design/formula/exception/function/MismatchedTokenFunction.java
  6. 96
      designer-base/src/main/java/com/fr/design/formula/exception/function/TranslateTokenUtils.java
  7. 18
      designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java
  8. 10
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  9. 12
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  10. 9
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  11. 29
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java
  12. 66
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java
  13. 15
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java
  14. 12
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java
  15. 9
      designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java

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.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import java.util.HashSet;
import java.util.Set;
import javax.swing.AbstractButton; import javax.swing.AbstractButton;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.DefaultCellEditor; import javax.swing.DefaultCellEditor;
@ -55,8 +53,10 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.EventObject; import java.util.EventObject;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set;
/** /**
* Coder: zack * Coder: zack
@ -83,6 +83,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
protected String[] allDSNames; protected String[] allDSNames;
protected ConnectionTableAction connectionTableAction; protected ConnectionTableAction connectionTableAction;
protected ToolBarDef toolbarDef; protected ToolBarDef toolbarDef;
protected TableDataTreePaneListener listener = null;
private String type = ""; 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 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) { protected void doPropertyChange(BasicDialog dg, BasicPane.NamePane nPanel, final String oldName) {
type = dg.getTitle(); type = dg.getTitle();
nPanel.setShowText(StringUtils.BLANK); nPanel.setShowText(StringUtils.BLANK);

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

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

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

@ -341,8 +341,10 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
@Override @Override
public void focusGained(FocusEvent e) { public void focusGained(FocusEvent e) {
// 获得焦点时 安装 // 获得焦点时 安装
if (autoCompletion == null && autoCompletionCheck.isSelected()) {
installAutoCompletion(); installAutoCompletion();
} }
}
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
@ -405,14 +407,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
} }
private void installAutoCompletion() { private void installAutoCompletion() {
if (autoCompletion == null && autoCompletionCheck.isSelected()) {
CompletionProvider provider = createCompletionProvider(); CompletionProvider provider = createCompletionProvider();
autoCompletion = new FormulaPaneAutoCompletion(provider); autoCompletion = new FormulaPaneAutoCompletion(provider);
autoCompletion.setListCellRenderer(new CompletionCellRenderer()); autoCompletion.setListCellRenderer(new CompletionCellRenderer());
autoCompletion.install(formulaTextArea); autoCompletion.install(formulaTextArea);
autoCompletion.installVariableTree(variableTreeAndDescriptionArea); autoCompletion.installVariableTree(variableTreeAndDescriptionArea);
} }
}
protected void extendCheckBoxPane(JPanel checkBoxPane) { protected void extendCheckBoxPane(JPanel checkBoxPane) {

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

@ -35,10 +35,6 @@ public class MismatchedCharFunction implements Function<Exception, FormulaCheckR
case 1: case 1:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting") + ": "); sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting") + ": ");
appendCharName(sb, charException.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; break;
case 2: case 2:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting_Anything") + ": ") 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); appendCharName(sb, charException.expecting);
sb.append(".."); sb.append("..");
appendCharName(sb, charException.upper); appendCharName(sb, charException.upper);
sb.append(", ").append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"));
appendCharName(sb, charException.foundChar);
break; break;
case 5: case 5:
case 6: case 6:
@ -71,9 +65,6 @@ public class MismatchedCharFunction implements Function<Exception, FormulaCheckR
for (int i = 0; i < elems.length; ++i) { for (int i = 0; i < elems.length; ++i) {
appendCharName(sb, elems[i]); appendCharName(sb, elems[i]);
} }
sb.append("), ").append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"));
appendCharName(sb, charException.foundChar);
break; break;
default: default:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_Char")); sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_Char"));

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

@ -40,11 +40,7 @@ public class MismatchedTokenFunction implements Function<Exception, FormulaCheck
switch (exception.mismatchType) { switch (exception.mismatchType) {
case 1: case 1:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting") + ": ") sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting") + ": ")
.append(tokenName(exception.expecting, exception)) .append(tokenName(exception.expecting, exception));
.append(", ")
.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"))
.append(FormulaCheckConstants.BLANK + FormulaCheckConstants.SINGLE_QUOTES)
.append(tokenText).append("'");
break; break;
case 2: case 2:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting_Anything") + ": ") sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting_Anything") + ": ")
@ -59,9 +55,7 @@ public class MismatchedTokenFunction implements Function<Exception, FormulaCheck
.append(": ") .append(": ")
.append(tokenName(exception.expecting, exception)) .append(tokenName(exception.expecting, exception))
.append("..") .append("..")
.append(tokenName(exception.upper, exception)) .append(tokenName(exception.upper, exception));
.append(", ").append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"))
.append("'").append(tokenText).append("'");
break; break;
case 4: case 4:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting") + ": ") sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Expecting") + ": ")
@ -71,12 +65,7 @@ public class MismatchedTokenFunction implements Function<Exception, FormulaCheck
.append(": ") .append(": ")
.append(tokenName(exception.expecting, exception)) .append(tokenName(exception.expecting, exception))
.append("..") .append("..")
.append(tokenName(exception.upper, exception)) .append(tokenName(exception.upper, exception));
.append(",").
append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"))
.append(" '")
.append(tokenText)
.append("'");
break; break;
case 5: case 5:
case 6: case 6:
@ -90,11 +79,6 @@ public class MismatchedTokenFunction implements Function<Exception, FormulaCheck
sb.append(tokenName(elms[i], exception)); sb.append(tokenName(elms[i], exception));
} }
sb.append("),")
.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Found"))
.append("'")
.append(tokenText)
.append("'");
break; break;
default: default:
sb.append(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Mismatched_Token")); 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>"; return "<Set of tokens>";
} else { } else {
String[] tokenNames = (String[]) getFieldValue(exception, "tokenNames"); 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) { private Object getFieldValue(Object object, String fieldName) {
try { try {

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;
}
}
}

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(); rtd = treeTableDataComboBox.getSelcetedTableData();
name = treeTableDataComboBox.getSelectedItem().getTableDataName(); name = treeTableDataComboBox.getSelectedItem().getTableDataName();
} }
final String tableDataName = name;
AbstractTableDataWrapper atdw = new TemplateTableDataWrapper(rtd, ""); 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.refresh();
treeTableDataComboBox.setSelectedTableDataByName(name); treeTableDataComboBox.setSelectedTableDataByName(tableDataName);
textPane.populate(1); }
valuePane.populate(1);
@Override
public void doCancel() {
}
});
} }
} }

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.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; 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.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory; 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.BorderFactory;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
@ -155,12 +154,7 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
} }
} }
if (!ChartEditContext.supportTheme() && chart4Update instanceof VanChart) { DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart4Update);
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) chart4Update).setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
update(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.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.ChartHyperEditPane; 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.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory; 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.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.HashMap;
/** /**
* 类说明: 图表超链 -- 弹出 悬浮窗. * 类说明: 图表超链 -- 弹出 悬浮窗.
@ -73,12 +72,7 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane<ChartHyperPopli
if (chart != null) { if (chart != null) {
try { try {
ChartProvider clone = (ChartProvider) chart.clone(); ChartProvider clone = (ChartProvider) chart.clone();
if (!ChartEditContext.supportTheme() && clone instanceof VanChart) { DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(clone);
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) clone).setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
cc.addChart(clone); cc.addChart(clone);
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), 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.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
@ -155,12 +155,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
addButton.addActionListener((e) -> { addButton.addActionListener((e) -> {
String name = getNewChartName(); String name = getNewChartName();
ChartProvider chart = getChangeStateNewChart(); ChartProvider chart = getChangeStateNewChart();
if (!ChartEditContext.supportTheme() && chart instanceof VanChart) { DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart);
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) chart).setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
checkInForm(chart); checkInForm(chart);
addNewChart(chart, name, editingCollection.getChartCount()); addNewChart(chart, name, editingCollection.getChartCount());
}); });

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; 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 String COLORS = null;
static { static {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
try {
DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u7ecf\u5178\u9ad8\u4eae"); COLORS = COLOR_NAME_2;
// 没有经典高亮, 用新特性 // 没有经典高亮, 用新特性
if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) { if (config.getPreStyle(COLORS) == null) {
DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u65b0\u7279\u6027"); COLORS = COLOR_NAME_1;
} }
// 没有新特性, 用第一个配色 // 没有新特性, 用第一个配色
if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) { if (config.getPreStyle(COLORS) == null) {
if (config.names().hasNext()) { if (config.names().hasNext()) {
String name = GeneralUtils.objectToString(config.names().next()); String name = GeneralUtils.objectToString(config.names().next());
if (config.getPreStyle(name) != null) { 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; 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.AttrBorder;
import com.fr.chart.base.AttrFillStyle; import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.ChartConstants; import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.DataSheet; import com.fr.chart.chartglyph.DataSheet;
import com.fr.chartx.attr.ChartProvider;
import com.fr.config.predefined.ColorFillStyle; import com.fr.config.predefined.ColorFillStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.plugin.chart.PiePlot4VanChart; 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.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.plugin.chart.vanchart.VanChart;
/** /**
* @author shine * @author shine
@ -28,8 +32,27 @@ import com.fr.plugin.chart.type.GaugeStyle;
*/ */
public class DefaultStyleHelper4Van { 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) { public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) {
if (!ChartEditContext.duchampMode()) { if (!duchampMode()) {
return; return;
} }
dealVanPlotCommonAttr(plot); dealVanPlotCommonAttr(plot);
@ -60,7 +83,7 @@ public class DefaultStyleHelper4Van {
} }
public static VanChartAxis dealAxisDefault(VanChartAxis axis) { public static VanChartAxis dealAxisDefault(VanChartAxis axis) {
if (!ChartEditContext.duchampMode()) { if (!duchampMode()) {
return axis; return axis;
} }
axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE);
@ -71,28 +94,20 @@ public class DefaultStyleHelper4Van {
} }
public static void dealAxisAlert(VanChartAlertValue vanChartAlertValue) { public static void dealAxisAlert(VanChartAlertValue vanChartAlertValue) {
if (!ChartEditContext.duchampMode()) { if (!duchampMode()) {
return; return;
} }
vanChartAlertValue.setAlertFont(DefaultStyleConstants.ALERT_FONT); vanChartAlertValue.setAlertFont(DefaultStyleConstants.ALERT_FONT);
} }
static void dealVanPlotCommonAttr(Plot plot) { static void dealVanPlotCommonAttr(Plot plot) {
if (!ChartEditContext.duchampMode()) { if (!duchampMode()) {
return; return;
} }
if (plot instanceof VanChartPlot) { if (plot instanceof VanChartPlot) {
VanChartPlot vanChartPlot = (VanChartPlot) plot; VanChartPlot vanChartPlot = (VanChartPlot) plot;
ColorFillStyle colorFillStyle = new ColorFillStyle(); dealChartColor(vanChartPlot);
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);
if (vanChartPlot.getLegend() != null) { if (vanChartPlot.getLegend() != null) {
vanChartPlot.getLegend().setFRFont(DefaultStyleConstants.LEGEND); 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) { private static void dealBorder(VanChartPlot vanChartPlot) {
ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr(); ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr();
AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); 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.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom; import com.fr.plugin.chart.base.VanChartZoom;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -145,12 +146,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Van
chart.setPlot(cloneOldPlot2New(oldPlot, newPlot)); chart.setPlot(cloneOldPlot2New(oldPlot, newPlot));
resetChartAttr4SamePlot(chart); resetChartAttr4SamePlot(chart);
ChartInfoCollector.getInstance().updateChartMiniType(chart); ChartInfoCollector.getInstance().updateChartMiniType(chart);
if (!ChartEditContext.supportTheme()) { DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart);
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
chart.setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
} else if (!samePlot) { } else if (!samePlot) {
//不同的图表类型切換 //不同的图表类型切換
resetChartAttr(chart, newPlot); resetChartAttr(chart, newPlot);
@ -158,12 +154,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Van
newPlot.setCategoryNum(oldPlot.getCategoryNum()); newPlot.setCategoryNum(oldPlot.getCategoryNum());
//切换类型埋点 //切换类型埋点
ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID()); ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID());
if (!ChartEditContext.supportTheme()) { DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart);
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
chart.setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
} }
if (!ChartEditContext.supportTheme()) { if (!ChartEditContext.supportTheme()) {
chart.setAutoThemeCustom(); chart.setAutoThemeCustom();

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

@ -393,15 +393,19 @@ public class LocalWidgetRepoPane extends BasicPane {
public void onFetchedAfter(boolean success, Map<String, OnlineShareWidget> remoteLatestWidgets) { public void onFetchedAfter(boolean success, Map<String, OnlineShareWidget> remoteLatestWidgets) {
if (success) { if (success) {
List<SharableWidgetProvider> updatableWidgetProviders = LocalWidgetRepoUpdater.getInstance().getUpdatableWidgetProviders(); List<SharableWidgetProvider> updatableWidgetProviders = LocalWidgetRepoUpdater.getInstance().getUpdatableWidgetProviders();
updateTipPane.setVisible(updatableWidgetProviders.size() > 0); onRemoteWidgetUpdatesChanged(updatableWidgetProviders.size() > 0);
if (updatableWidgetProviders.size() > 0) {
refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT);
}
} }
} }
}); });
} }
public void onRemoteWidgetUpdatesChanged(boolean hasUpdates) {
updateTipPane.setVisible(hasUpdates);
if (hasUpdates) {
refreshAllGroupPane(GroupPane.GroupCreateStrategy.DEFAULT);
}
}
public void doQuitUpdateComponents() { public void doQuitUpdateComponents() {
LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance(); LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance();
updater.clearUpdate(); updater.clearUpdate();

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

@ -409,6 +409,15 @@ public class ShareMainPane extends JPanel {
childClassify.clearBoxItems(); childClassify.clearBoxItems();
childClassify.refreshBoxItems(children); childClassify.refreshBoxItems(children);
} }
notifyRequiredSettingChanged(new ChangeEvent(parentClassify));
}
});
childClassify.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
notifyRequiredSettingChanged(new ChangeEvent(parentClassify));
} }
}); });

Loading…
Cancel
Save