Browse Source

Merge branch 'release/10.0' of ssh://cloud.finedevelop.com:7999/~eason/design into release/10.0

feature/big-screen
eason-skx 5 years ago
parent
commit
5bc05b40ea
  1. 21
      designer-base/src/main/java/com/fr/common/report/ReportState.java
  2. 29
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  3. 11
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  4. 4
      designer-base/src/main/java/com/fr/design/RestartHelper.java
  5. 10
      designer-base/src/main/java/com/fr/design/dialog/TipDialog.java
  6. 73
      designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java
  7. 25
      designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java
  8. 25
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java
  9. 5
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  10. 7
      designer-base/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java
  11. 3
      designer-base/src/main/java/com/fr/design/mainframe/messagecollect/StartErrorMessageCollector.java
  12. 0
      designer-base/src/main/java/com/fr/design/mainframe/messagecollect/entity/DesignerErrorMessage.java
  13. 43
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java
  14. 21
      designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java
  15. 4
      designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBar.java
  16. 61
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java
  17. 10
      designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java
  18. 7
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java
  19. 15
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java
  20. 12
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  21. 8
      designer-base/src/main/java/com/fr/exit/DesignerExiter.java
  22. 1
      designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java
  23. 28
      designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java
  24. 39
      designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java
  25. 174
      designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java
  26. 245
      designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java
  27. 238
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java
  28. 19
      designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java
  29. 7
      designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java
  30. 3
      designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java
  31. 1
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java
  32. 5
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java
  33. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java
  34. 212
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java
  35. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeAxisPane.java
  36. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  37. 27
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java
  38. 1
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java
  39. 6
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java
  40. 22
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java
  41. 5
      designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java
  42. 6
      designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java
  43. 47
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java
  44. 7
      designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java
  45. 1
      designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java
  46. 3
      designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java
  47. 1
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java
  48. 7
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java
  49. 7
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java
  50. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  51. 2
      designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java
  52. 7
      designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java
  53. 8
      designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java
  54. 30
      designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java

21
designer-base/src/main/java/com/fr/common/report/ReportState.java

@ -0,0 +1,21 @@
package com.fr.common.report;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/27
*/
public enum ReportState {
STOP("stop"), ACTIVE("active");
private String value;
ReportState(String value) {
this.value = value;
}
public String getValue() {
return this.value;
}
}

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

@ -8,18 +8,21 @@ import com.fr.base.Utils;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.ErrorDialog;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.ProductImproveMark;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.update.push.DesignerPushUpdateConfigManager;
import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignerPort;
import com.fr.exit.DesignerExiter;
import com.fr.file.FILEFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter;
@ -199,6 +202,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
XmlHandler.Self.handle(e);
}
// james:如果没有env定义,要设置一个默认的
@ -345,6 +349,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
XmlHandler.Self.handle(e);
} finally {
if (null != fileWriter) {
try {
@ -2039,4 +2044,28 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public void setVcsConfigManager(VcsConfigManager vcsConfigManager) {
this.vcsConfigManager = vcsConfigManager;
}
enum XmlHandler {
Self;
public void handle(Throwable throwable) {
ErrorDialog dialog = new ErrorDialog(null,
Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"),
Toolkit.i18nText("Fine-Design_Error_Start_Report"),
throwable.getMessage()) {
@Override
protected void okEvent() {
dispose();
DesignerExiter.getInstance().execute();
}
@Override
protected void restartEvent() {
dispose();
RestartHelper.restart();
}
};
dialog.setVisible(true);
DesignerExiter.getInstance().execute();
}
};
}

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

@ -1,5 +1,6 @@
package com.fr.design;
import com.fr.common.report.ReportState;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
@ -24,6 +25,9 @@ import com.fr.json.JSONArray;
import com.fr.license.exception.RegistEditionException;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.CarryMessageEvent;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.rpc.Result;
import com.fr.stable.AssistUtils;
import com.fr.stable.EnvChangedListener;
@ -407,6 +411,10 @@ public class EnvChangeEntrance {
@Override
public void doOk() {
ProcessEventPipe pipe = FineProcessContext.getParentPipe();
if (FineProcessContext.getParentPipe() != null) {
pipe.fire(new CarryMessageEvent(ReportState.ACTIVE.getValue()));
}
if (!envListOkAction(envListPane, PopTipStrategy.NOW)) {
DesignerExiter.getInstance().execute();
}
@ -414,7 +422,8 @@ public class EnvChangeEntrance {
@Override
public void doCancel() {
DesignerExiter.getInstance().execute(); }
DesignerExiter.getInstance().execute();
}
});
envListDialog.setVisible(true);
}

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

@ -202,7 +202,11 @@ public class RestartHelper {
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (DesignerContext.getDesignerFrame() != null) {
DesignerContext.getDesignerFrame().exit();
} else {
DesignerExiter.getInstance().execute();
}
}
}
}

10
designer-base/src/main/java/com/fr/design/dialog/TipDialog.java

@ -6,6 +6,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.BorderLayout;
@ -39,7 +40,14 @@ public abstract class TipDialog extends JDialog implements ActionListener {
northPane.add(iconPane, BorderLayout.WEST);
northPane.add(tipPane, BorderLayout.CENTER);
JTextArea area = new JTextArea(type);
JTextPane area = new JTextPane();
UILabel typeLabel = new UILabel(type);
area.insertComponent(typeLabel);
if (StringUtils.isNotEmpty(type)) {
UILabel logoIconLabel = new UILabel();
logoIconLabel.setIcon(IOUtils.readIcon("com/fr/base/images/oem/logo.png"));
area.insertComponent(logoIconLabel);
}
area.setPreferredSize(new Dimension(400, 100));
area.setEnabled(true);
area.setEditable(false);

73
designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java vendored

@ -1,15 +1,40 @@
package com.fr.design.env;
import com.fr.common.report.ReportState;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.EnvChangeEntrance;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector;
import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.CarryMessageEvent;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceClient;
import javax.swing.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* 根据配置生成运行环境
*/
public class DesignerWorkspaceGenerator {
public static Workspace generate(DesignerWorkspaceInfo config) throws Exception {
private static final int WAIT_FREQ = 60;
private static ExecutorService service = Executors.newCachedThreadPool(
new NamedThreadFactory("DesignerWorkspaceGenerator"));
public static Workspace generate(final DesignerWorkspaceInfo config) throws Exception {
if (config == null || config.getType() == null) {
return null;
@ -22,7 +47,19 @@ public class DesignerWorkspaceGenerator {
break;
}
case Remote: {
WorkspaceClient client = WorkContext.getConnector().connect(config.getConnection());
Future<WorkspaceClient> future = service.submit(new Callable<WorkspaceClient>() {
@Override
public WorkspaceClient call() throws Exception {
return WorkContext.getConnector().connect(config.getConnection());
}
});
WorkspaceClient client = null;
try {
client = future.get(WAIT_FREQ, TimeUnit.SECONDS);
} catch (TimeoutException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
RemoteHandler.handle(config);
}
if (client != null) {
workspace = new RemoteWorkspace(client, config.getConnection());
}
@ -31,4 +68,36 @@ public class DesignerWorkspaceGenerator {
}
return workspace;
}
enum RemoteHandler {
SELF;
public static void handle(DesignerWorkspaceInfo config) {
ProcessEventPipe eventPipe = FineProcessContext.getParentPipe();
if (eventPipe != null) {
eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue()));
}
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.REMOTE_DESIGN_NO_RESPONSE.getId(),
DesignerErrorMessage.REMOTE_DESIGN_NO_RESPONSE.getMessage(),
StringUtils.EMPTY);
int result = FineJOptionPane.showOptionDialog(null,
Toolkit.i18nText("Fine-Design_Error_Remote_No_Response_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Error_Tittle"),
JOptionPane.YES_NO_OPTION,
JOptionPane.ERROR_MESSAGE,
IOUtils.readIcon("com/fr/design/images/error/error2.png"),
new Object[] {Toolkit.i18nText("Fine-Design_Error_Remote_No_Response_Wait"), Toolkit.i18nText("Fine-Design_Error_Remote_No_Response_Switch")},
null);
if (result == JOptionPane.YES_OPTION) {
try {
generate(config);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
}
public static void stop() {
service.shutdown();
}
}

25
designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java

@ -0,0 +1,25 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.stable.fun.mark.Mutable;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/31
*/
public interface MobileTemplateStyleProvider extends Mutable {
String XML_TAG = "MobileTemplateStyleProvider";
int CURRENT_LEVEL = 1;
Class<? extends MobileTemplateStyle> classFroMobileTemplateStyle();
Class<? extends BasicBeanPane<MobileTemplateStyle>> classFroMobileTemplateStyleAppearance();
String displayName();
}

25
designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java

@ -0,0 +1,25 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.MobileTemplateStyleProvider;
import com.fr.design.fun.MobileWidgetStyleProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/31
*/
@API(level = MobileWidgetStyleProvider.CURRENT_LEVEL)
public abstract class AbstractMobileTemplateStyleProvider extends AbstractProvider implements MobileTemplateStyleProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

5
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -1104,10 +1104,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
if (tplFile != null) {
int index = HistoryTemplateListCache.getInstance().contains(tplFile);
if (index != -1) {
HistoryTemplateListCache.getInstance().getHistoryList().get(index).activeOldJTemplate();
JTemplate jt = HistoryTemplateListCache.getInstance().getHistoryList().get(index);
if (!(jt instanceof JVirtualTemplate)) {
jt.activeOldJTemplate();
return;
}
}
}
JTemplate jt = JTemplateFactory.createJTemplate(tplFile);
if (jt == null) {

7
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java → designer-base/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java

@ -21,6 +21,9 @@ import java.util.Date;
*/
public class ErrorInfo {
private static final String SUFFIX = ".json";
private static final String FOLDER_NAME = "errorInfo";
private String username;
private String uuid;
private String activekey;
@ -128,8 +131,8 @@ public class ErrorInfo {
public void saveFileToCache(JSONObject jo) {
String content = jo.toString();
String fileName = UUID.randomUUID() + ErrorInfoUploader.SUFFIX;
File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), ErrorInfoUploader.FOLDER_NAME, fileName));
String fileName = UUID.randomUUID() + SUFFIX;
File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FOLDER_NAME, fileName));
FileOutputStream out = null;
try (InputStream in = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))) {
StableUtils.makesureFileExist(file);

3
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/StartErrorMessageCollector.java → designer-base/src/main/java/com/fr/design/mainframe/messagecollect/StartErrorMessageCollector.java

@ -1,8 +1,8 @@
package com.fr.design.mainframe.messagecollect;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.errorinfo.ErrorInfo;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
/**
@ -30,6 +30,7 @@ public class StartErrorMessageCollector {
}
public void record(String id, String msg, String detail) {
FineLoggerFactory.getLogger().error(id + ": " + msg + ", detail: " + detail);
ErrorInfo errorInfo = new ErrorInfo(StringUtils.EMPTY, uuid, activeKey);
errorInfo.setLogid(id);
errorInfo.setLog(msg);

0
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/DesignerErrorMessage.java → designer-base/src/main/java/com/fr/design/mainframe/messagecollect/entity/DesignerErrorMessage.java

43
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java

@ -1,11 +1,14 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.MobileTemplateStyleProvider;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.mobile.ui.TemplateStyleDefinePaneFactory;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.MobileTemplateStyleType;
import com.fr.invoke.Reflect;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JList;
@ -18,9 +21,12 @@ import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTemplateStyle> {
private static final List<MobileTemplateStyleType> STYLE_LIST = new ArrayList<MobileTemplateStyleType>();
@ -36,6 +42,7 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
private Map<String, BasicBeanPane<MobileTemplateStyle>> map = new HashMap<>();
private JPanel right;
private CardLayout card;
private Set<Class<? extends MobileTemplateStyle>> extraStyle = new HashSet<>();
public MobileTemplateStylePane(WCardTagLayout tagLayout){
init(tagLayout);
}
@ -52,6 +59,7 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
map.put(style.getDisplayName(), styleBasicBeanPane);
right.add(style.getDisplayName(), styleBasicBeanPane);
}
initExtra();
styleList = new JList(listModel);
styleList.setCellRenderer(render);
@ -74,6 +82,20 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
this.add(westPane, BorderLayout.WEST);
this.add(centerPane, BorderLayout.CENTER);
}
private void initExtra() {
List<MobileTemplateStyleProvider> list = getMobileTemplateStyleProvider();
for (MobileTemplateStyleProvider provider : list) {
String displayName = provider.displayName();
Class<? extends BasicBeanPane<MobileTemplateStyle>> clazz = provider.classFroMobileTemplateStyleAppearance();
BasicBeanPane<MobileTemplateStyle> styleBasicBeanPane = Reflect.on(clazz).create().get();
listModel.addElement(displayName);
map.put(displayName, styleBasicBeanPane);
right.add(displayName, styleBasicBeanPane);
extraStyle.add(provider.classFroMobileTemplateStyle());
}
}
public static ListCellRenderer render = new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
@ -97,16 +119,31 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
String style = templateStyle.getStyle();
MobileTemplateStyleType templateStyleType = MobileTemplateStyleType.parse(style);
if((listModel.getElementAt(i)).equals(templateStyleType.getDisplayName())){
styleList.setSelectedIndex(i);
map.get(templateStyle.toString()).populateBean(templateStyle);
card.show(right, templateStyle.toString());
populateStyle(templateStyle, i);
return;
}
if (extraStyle.contains(templateStyle.getClass())) {
populateStyle(templateStyle, i);
return;
}
}
styleList.setSelectedIndex(0);
}
private void populateStyle(MobileTemplateStyle templateStyle, int index) {
styleList.setSelectedIndex(index);
map.get(templateStyle.toString()).populateBean(templateStyle);
card.show(right, templateStyle.toString());
}
public MobileTemplateStyle update() {
return map.get(styleList.getSelectedValue()).updateBean();
}
private List<MobileTemplateStyleProvider> getMobileTemplateStyleProvider() {
List<MobileTemplateStyleProvider> list = new ArrayList<>();
Set<MobileTemplateStyleProvider> sets = ExtraDesignClassManager.getInstance().getArray(MobileTemplateStyleProvider.XML_TAG);
list.addAll(sets);
return Collections.unmodifiableList(list);
}
}

21
designer-base/src/main/java/com/fr/design/style/AbstractPopBox.java

@ -5,15 +5,22 @@ import com.fr.design.style.background.BackgroundJComponent;
import com.fr.design.style.background.gradient.GradientBackgroundPane;
import com.fr.general.Background;
import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.awt.AWTEvent;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.AWTEventListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
/**
* @author kunsnat E-mail:kunsnat@gmail.com
@ -50,7 +57,7 @@ public abstract class AbstractPopBox extends JPanel {
}
};
private void showPopupMenu() {
protected void showPopupMenu() {
if (selectPopupWindow != null && selectPopupWindow.isVisible()) {
hidePopupMenu();
return;
@ -98,6 +105,7 @@ public abstract class AbstractPopBox extends JPanel {
private void mouseClick(MouseEvent evt) {
Point point = new Point((int) (evt.getLocationOnScreen().getX()), (int) evt.getLocationOnScreen().getY());
Dimension popBoxD = AbstractPopBox.this.getSize();
try {
Point popBoxP = AbstractPopBox.this.getLocationOnScreen();
Dimension popMenuD = this.getControlWindow().getSize();
Point popMenuP = this.getControlWindow().getLocation();
@ -106,6 +114,9 @@ public abstract class AbstractPopBox extends JPanel {
if (!popBoxRect.contains(point) && !popMenuRect.contains(point)) {
this.hidePopupMenu();
}
} catch (Exception ignore){
this.hidePopupMenu();
}
}
protected void hidePopupMenu() {

4
designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBar.java

@ -1,6 +1,6 @@
package com.fr.design.style.background.gradient;
import com.fr.design.style.background.gradient.GradientBar;
import java.awt.Color;
/**
* 这个bar不能拖拽滑动
@ -8,6 +8,8 @@ import com.fr.design.style.background.gradient.GradientBar;
public class FixedGradientBar extends GradientBar {
private static final long serialVersionUID = 2787525421995954889L;
public static final Color NEW_CHARACTER = new Color(99, 178, 238);
public FixedGradientBar(int minvalue, int maxvalue) {
super(minvalue, maxvalue);
}

61
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java

@ -1,36 +1,34 @@
package com.fr.design.style.background.gradient;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LinearGradientPaint;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.design.DesignerEnvManager;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.style.color.ColorSelectDetailPane;
import com.fr.design.style.color.ColorSelectDialog;
import com.fr.design.style.color.ColorSelectable;
import com.fr.stable.AssistUtils;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LinearGradientPaint;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
/**
* TODO:面板缩放的功能没有考虑就是尾值过大导致超过界面显示的情况原来的那个实现完全是个BUG要缩放的情况也比较少就干脆以后弄吧
*/
@ -54,7 +52,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
private UINumberField endLabel;
private ChangeListener changeListener = null;
private UIObserverListener uiObserverListener;
private List<UIObserverListener> uiObserverListener;
private static final int MOUSE_OFFSET = 4;
@ -89,6 +87,11 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
iniListener();
}
public void updateColor(Color begin, Color end) {
p1.setColorInner(begin);
p2.setColorInner(end);
}
protected void addMouseClickListener() {
this.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
@ -142,14 +145,14 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
}
private void iniListener() {
uiObserverListener = new ArrayList<>();
if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (uiObserverListener == null) {
return;
for (UIObserverListener observerListener : uiObserverListener) {
observerListener.doChange();
}
uiObserverListener.doChange();
}
});
}
@ -215,6 +218,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
/**
* 如果左右两个按钮还在初始位置就为true
*
* @return 同上
*/
public boolean isOriginalPlace() {
@ -222,7 +226,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
}
/**
*
* @return
*/
public double getStartValue() {
@ -230,7 +233,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
}
/**
*
* @return
*/
public double getEndValue() {
@ -238,7 +240,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
}
/**
*
* @param startValue
*/
public void setStartValue(double startValue) {
@ -246,7 +247,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
}
/**
*
* @param endValue
*/
public void setEndValue(double endValue) {
@ -254,7 +254,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
}
/**
*
* @return
*/
public SelectColorPointBtn getSelectColorPointBtnP1() {
@ -262,7 +261,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
}
/**
*
* @return
*/
public SelectColorPointBtn getSelectColorPointBtnP2() {
@ -276,7 +274,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
*
*/
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener;
uiObserverListener.add(listener);
}
@Override
@ -300,6 +298,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
/**
* 选中颜色
*
* @param ColorCell 颜色单元格
*/
@Override

10
designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java

@ -16,6 +16,7 @@ import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -46,6 +47,8 @@ public abstract class ColorControlWindowWithAuto extends ColorControlWindow {
class ColorSelectionPopupPaneWithAuto extends NewColorSelectPane {
private static final long serialVersionUID = 7822856562329146354L;
private final static int BUTTON_HEIGHT = 15;
public ColorSelectionPopupPaneWithAuto(boolean isSupportTransparent) {
super(isSupportTransparent);
@ -111,6 +114,13 @@ public abstract class ColorControlWindowWithAuto extends ColorControlWindow {
}
}
public Dimension getPreferredSize() {
if (isSupportTransparent()) {
return new Dimension(super.getPreferredSize().width, TRANSPARENT_WINDOW_HEIGHT + BUTTON_HEIGHT);
}
return new Dimension(super.getPreferredSize().width, WINDOW_HEIGHT + BUTTON_HEIGHT);
}
}
}

7
designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java

@ -6,6 +6,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.JPanel;
import java.io.Serializable;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dialog;
@ -13,7 +14,6 @@ import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
/**
@ -136,8 +136,13 @@ public class ColorSelectDialog extends MiddleChartDialog{
* void
*/
public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane){
showDialog(owner,pane,initialColor,selectePane,false);
}
public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane, boolean alwaysOnTop){
ColorTracker okListener = new ColorTracker(pane);
ColorSelectDialog dialog = new ColorSelectDialog(owner,pane,initialColor,okListener,selectePane);
dialog.setAlwaysOnTop(alwaysOnTop);
dialog.setModal(true);
dialog.show();
}

15
designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java

@ -11,16 +11,21 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.util.ArrayList;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
/**
* The pane used to select color
@ -196,6 +201,6 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable
@Override
public void customButtonPressed() {
pane = new ColorSelectDetailPane(Color.WHITE);
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this);
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this, true);
}
}

12
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

@ -40,8 +40,8 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
// 是否支持透明
private boolean isSupportTransparent;
private final static int TRANSPANENT_WINDOW_HEIGHT = 165;
private final static int WINDWO_HEIGHT = 150;
public final static int TRANSPARENT_WINDOW_HEIGHT = 165;
public final static int WINDOW_HEIGHT = 150;
// 最近使用颜色
private UsedColorPane usedColorPane;
@ -105,6 +105,10 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
centerPane.add(centerPane1);
}
public boolean isSupportTransparent() {
return isSupportTransparent;
}
public void setSupportTransparent(boolean supportTransparent) {
isSupportTransparent = supportTransparent;
}
@ -208,9 +212,9 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
@Override
public Dimension getPreferredSize() {
if (isSupportTransparent) {
return new Dimension(super.getPreferredSize().width, TRANSPANENT_WINDOW_HEIGHT);
return new Dimension(super.getPreferredSize().width, TRANSPARENT_WINDOW_HEIGHT);
}
return new Dimension(super.getPreferredSize().width, WINDWO_HEIGHT);
return new Dimension(super.getPreferredSize().width, WINDOW_HEIGHT);
}
/**

8
designer-base/src/main/java/com/fr/exit/DesignerExiter.java

@ -1,5 +1,6 @@
package com.fr.exit;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent;
import com.fr.stable.StableUtils;
@ -19,9 +20,14 @@ public class DesignerExiter {
}
public void execute() {
beforeExit();
if (FineProcessContext.getParentPipe() != null) {
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY);
FineProcessContext.getParentPipe().syncFire(FineProcessEngineEvent.DESTROY);
}
System.exit(0);
}
private void beforeExit() {
DesignerWorkspaceGenerator.stop();
}
}

1
designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java

@ -118,6 +118,7 @@ public class MapAreaMatchPane extends BasicBeanPane<MapMatchResult> {
matchAreaTable.setItems(treeNodeAndItems.getSecond());
matchResultTable = new MatchResultTable(new Object[0][3], HEADER_WITH_EMPTY);
matchResultTable.setItems(treeNodeAndItems.getSecond());
DefaultTableModel model = new DefaultTableModel(new Object[0][3], HEADER_WITH_EMPTY);
matchResultTable.setModel(model);

28
designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java

@ -1,6 +1,5 @@
package com.fr.design.chartx.component;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
@ -63,6 +62,16 @@ public class MatchAreaTable extends JTable {
this.areaNameIndex = areaNameIndex;
}
@Override
public boolean isCellEditable(int row, int column) {
//第一列不可编辑
int col = convertColumnIndexToModel(column);
if (col == 0) {
return false;
}
return true;
}
public void setModel(TableModel dataModel) {
super.setModel(dataModel);
@ -70,7 +79,6 @@ public class MatchAreaTable extends JTable {
items = new HashSet<>();
}
TableColumnModel columnModel = getColumnModel();
columnModel.getColumn(0).setCellEditor(new UILabelEditor());
columnModel.getColumn(1).setCellEditor(new UIComboBoxRenderAndEditor());
columnModel.getColumn(1).setCellRenderer(new UIComboBoxRenderAndEditor());
}
@ -131,20 +139,4 @@ public class MatchAreaTable extends JTable {
return comboBox.getSelectedItem();
}
}
public static class UILabelEditor extends AbstractCellEditor implements TableCellEditor {
UILabel uiLabel;
public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected,
int row, int column) {
uiLabel = new UILabel(GeneralUtils.objectToString(value));
return uiLabel;
}
public Object getCellEditorValue() {
return uiLabel.getText();
}
}
}

39
designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java

@ -3,8 +3,10 @@ package com.fr.design.chartx.component;
import com.fr.base.BaseUtils;
import com.fr.base.Utils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.map.data.MapMatchResult;
import com.fr.stable.StringUtils;
@ -18,7 +20,9 @@ import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -32,6 +36,8 @@ public class MatchResultTable extends JTable {
private MatchAreaTable matchAreaTable;
private Set<String> items;
public MatchResultTable(Object[][] data, Object[] header) {
super(data, header);
this.getTableHeader().setReorderingAllowed(false);
@ -41,12 +47,26 @@ public class MatchResultTable extends JTable {
this.matchAreaTable = matchAreaTable;
}
public void setItems(Set<String> items) {
this.items = items;
}
@Override
public boolean isCellEditable(int row, int column) {
//第一列和第二列不可编辑
int col = convertColumnIndexToModel(column);
if (col == 0 || col == 1) {
return false;
}
return true;
}
public void setModel(TableModel dataModel) {
super.setModel(dataModel);
TableColumnModel columnModel = getColumnModel();
columnModel.getColumn(0).setCellEditor(new MatchAreaTable.UILabelEditor());
columnModel.getColumn(1).setCellEditor(new MatchAreaTable.UILabelEditor());
columnModel.getColumn(1).setCellRenderer(new UILabelEditorAndRender());
columnModel.getColumn(2).setCellEditor(new UIButtonEditorAndRender());
columnModel.getColumn(2).setCellRenderer(new UIButtonEditorAndRender());
columnModel.getColumn(2).setMaxWidth(20);
@ -56,7 +76,6 @@ public class MatchResultTable extends JTable {
int rowCount = this.getRowCount();
for (int i = 0; i < rowCount; i++) {
if (ComparatorUtils.equals(this.getValueAt(i, 0), areaName)) {
getColumnModel().getColumn(1).getCellEditor().stopCellEditing();
this.setValueAt(result, i, 1);
return;
}
@ -143,4 +162,18 @@ public class MatchResultTable extends JTable {
}
}
public class UILabelEditorAndRender implements TableCellRenderer {
UILabel uiLabel;
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
uiLabel = new UILabel(GeneralUtils.objectToString(value));
if (!items.contains(value)) {
uiLabel.setForeground(Color.GRAY);
uiLabel.setText(value + Toolkit.i18nText("Fine-Design_Chart_Lost_Data"));
}
return uiLabel;
}
}
}

174
designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java

@ -0,0 +1,174 @@
package com.fr.design.chartx.component.button;
import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.style.AbstractSelectBox;
import com.fr.design.style.color.ColorSelectPane;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-03-06
*/
public class ColorButton extends AbstractSelectBox<Color> {
private static final double DEL_WIDTH = 7;
public static final int WIDTH = 18;
private BufferedImage closeIcon = BaseUtils.readImageWithCache("com/fr/design/images/toolbarbtn/chartChangeClose.png");
private Color color;
private boolean isMoveOn = false;
private ColorSelectPane colorPane;
private boolean lastButton;
private ChangeListener changeListener;
public ColorButton(Color color) {
this.color = color;
addMouseListener(getMouseListener());
}
public Dimension getPreferredSize() {
return new Dimension(WIDTH, WIDTH);
}
private void paintDeleteButton(Graphics g2d) {
Rectangle2D bounds = this.getBounds();
int x = (int) (bounds.getWidth() - DEL_WIDTH);
int y = 1;
g2d.drawImage(closeIcon, x, y, closeIcon.getWidth(), closeIcon.getHeight(), null);
}
public void setLastButton(boolean lastButton) {
this.lastButton = lastButton;
}
@Override
public void paint(Graphics g) {
this.setSize(WIDTH, WIDTH);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(color);
Rectangle2D rec = new Rectangle2D.Double(0, 0, WIDTH + 1, WIDTH + 1);
g2d.fill(rec);
if (isMoveOn && !lastButton) {
paintDeleteButton(g);
}
}
protected void deleteButton() {
}
private void checkMoveOn(boolean moveOn) {
this.isMoveOn = moveOn;
repaint();
}
protected MouseListener getMouseListener() {
return new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
mouseClick(e);
}
public void mouseEntered(MouseEvent e) {
checkMoveOn(true);
}
public void mouseExited(MouseEvent e) {
checkMoveOn(false);
}
};
}
public void mouseClick(MouseEvent e) {
if (!lastButton) {
Rectangle2D bounds = this.getBounds();
if (bounds == null) {
return;
}
if (e.getX() >= bounds.getWidth() - DEL_WIDTH && e.getY() <= DEL_WIDTH) {
deleteButton();
hidePopupMenu();
return;
}
}
//打开颜色选择面板
showPopupMenu();
}
public JPanel initWindowPane(double preferredWidth) {
// 下拉的时候重新生成面板,刷新最近使用颜色
colorPane = new ColorSelectPane(false) {
@Override
public void setVisible(boolean b) {
super.setVisible(b);
}
};
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
hidePopupMenu();
color = ((ColorSelectPane) e.getSource()).getColor();
fireDisplayComponent(ColorBackground.getInstance(color));
ColorButton.this.stateChanged();
}
});
return colorPane;
}
public void stateChanged() {
if (changeListener != null) {
changeListener.stateChanged(null);
}
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
/**
* 获取当前选中的颜色
*
* @return 当前选中的颜色
*/
public Color getSelectObject() {
return this.color;
}
/**
* 设置选中的颜色
*
* @param color 颜色
*/
public void setSelectObject(Color color) {
this.color = color;
colorPane.setColor(color);
fireDisplayComponent(ColorBackground.getInstance(color));
}
}

245
designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java

@ -0,0 +1,245 @@
package com.fr.design.chartx.component.combobox;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.i18n.Toolkit;
import com.fr.general.GeneralUtils;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel;
import javax.swing.JList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LinearGradientPaint;
import java.awt.geom.Rectangle2D;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-03-05
* 一个带颜色展示的配色选择下拉框
*/
public class ColorSchemeComboBox extends UIComboBox {
private Map<String, ColorInfo> colorSchemes;
public ColorSchemeComboBox() {
this(null);
}
public ColorSchemeComboBox(Map<String, ColorInfo> colorSchemes) {
//通过配色方案的集合初始化下拉控件,如果参数为null,从配置中读取配色方案。
if (colorSchemes == null) {
colorSchemes = getColorSchemesFromConfig();
}
this.colorSchemes = colorSchemes;
this.setModel(new DefaultComboBoxModel(colorSchemes.keySet().toArray()));
this.setRenderer(new ColorSchemeCellRenderer());
}
private Map<String, ColorInfo> getColorSchemesFromConfig() {
Map<String, ColorInfo> colorSchemes = new LinkedHashMap<>();
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
//所有的样式名称
Iterator names = config.names();
//添加默认的方案和第一个方案
String defaultName = config.getCurrentStyle();
ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName);
Object firstName = names.next();
ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName);
if (defaultStyle == null) {
defaultStyle = firstStyle;
}
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle));
colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle));
//添加其他的配色方案
while (names.hasNext()) {
Object key = names.next();
ChartColorMatching colorMatching = (ChartColorMatching) config.getPreStyle(key);
colorSchemes.put(colorMatching.getId(), colorMatchingToColorInfo(colorMatching));
}
//添加自定义组合色和自定义渐变色
colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Custom_Combination_Color"), null);
colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Custom_Gradient"), null);
return colorSchemes;
}
public ColorInfo getSelectColorInfo() {
String selectedItem = (String) getSelectedItem();
return colorSchemes.get(selectedItem);
}
private ColorInfo colorMatchingToColorInfo(ChartColorMatching colorMatching) {
ColorInfo colorInfo = new ColorInfo();
colorInfo.setGradient(colorMatching.getGradient());
colorInfo.setColors(colorMatching.getColorList());
return colorInfo;
}
public SelectType getSelectType() {
int selectedIndex = this.getSelectedIndex();
int itemCount = this.getItemCount();
if (selectedIndex == itemCount - 1) {
return SelectType.GRADATION_COLOR;
}
if (selectedIndex == itemCount - 2) {
return SelectType.COMBINATION_COLOR;
}
if (selectedIndex == 0) {
return SelectType.DEFAULT;
}
return SelectType.NORMAL;
}
public void setSelectType(SelectType selectType) {
int itemCount = this.getItemCount();
switch (selectType) {
case DEFAULT:
setSelectedIndex(0);
break;
case GRADATION_COLOR:
setSelectedIndex(itemCount - 1);
break;
case COMBINATION_COLOR:
setSelectedIndex(itemCount - 2);
break;
}
}
public enum SelectType {
DEFAULT,
COMBINATION_COLOR,
GRADATION_COLOR,
NORMAL
}
public class ColorInfo {
private List<Color> colors;
private boolean gradient;
public List<Color> getColors() {
return colors;
}
public void setColors(List<Color> colors) {
this.colors = colors;
}
public boolean isGradient() {
return gradient;
}
public void setGradient(boolean gradient) {
this.gradient = gradient;
}
}
/**
* CellRenderer.
*/
class ColorSchemeCellRenderer extends UIComboBoxRenderer {
private String schemeName = Toolkit.i18nText("Fine-Design_Report_Default");
//左边距
private static final double X = 4d;
//上边距
private static final double Y = 4d;
private static final String BLANK_SPACE = " ";
private static final int HEIGHT = 20;
private static final int MAX_COUNT = 5;
@Override
public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize();
preferredSize.setSize(super.getPreferredSize().getWidth(), HEIGHT);
return preferredSize;
}
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
}
public Component getListCellRendererComponent(
JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
this.schemeName = GeneralUtils.objectToString(value);
ColorInfo colorInfo = colorSchemes.get(schemeName);
if (colorInfo == null) {
comp.setText(BLANK_SPACE + schemeName);
} else {
FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont());
double width = (HEIGHT - 2 * Y) * MAX_COUNT;
String fill = BLANK_SPACE;
//图形和文字之间留的宽度大于3倍的X
while (fontMetrics.stringWidth(fill) < width + 3 * X) {
fill += BLANK_SPACE;
}
comp.setText(fill + schemeName);
}
comp.setToolTipText(schemeName);
return comp;
}
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
ColorInfo colorInfo = colorSchemes.get(schemeName);
if (colorInfo != null) {
if (colorInfo.isGradient()) {
drawGradient(g2d, colorInfo.getColors());
} else {
drawCombineColor(g2d, colorInfo.getColors());
}
}
}
private void drawGradient(Graphics2D g2d, List<Color> colors) {
//上下留4px,宽度等于5倍高
double height = HEIGHT - 2 * Y;
double width = height * MAX_COUNT;
LinearGradientPaint linearGradientPaint = new LinearGradientPaint((float) X, (float) Y, (float) (X + width), (float) Y, new float[]{0f, 1f}, colors.toArray(new Color[colors.size()]));
g2d.setPaint(linearGradientPaint);
Rectangle2D rec = new Rectangle2D.Double(X, Y, width, height);
g2d.fill(rec);
}
private void drawCombineColor(Graphics2D g2d, List<Color> colors) {
int size = Math.min(colors.size(), MAX_COUNT);
double height = HEIGHT - 2 * Y;
double width = height * MAX_COUNT / size;
for (int i = 0; i < size; i++) {
g2d.setPaint(colors.get(i));
Rectangle2D rec = new Rectangle2D.Double(X + width * i, Y, width, height);
g2d.fill(rec);
}
}
}
}

238
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java

@ -0,0 +1,238 @@
package com.fr.design.mainframe.chart.gui.style;
import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.chartx.component.button.ColorButton;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.style.AbstractSelectBox;
import com.fr.design.style.color.ColorSelectPane;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
/**
* 配色方案选择组合色之后可以调整颜色的组件
*
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-03-25
*/
public class ChartColorAdjustPane extends JPanel implements UIObserver {
public static final Color[] DEFAULT_COLORS = {
new Color(99, 178, 238),
new Color(118, 218, 145),
new Color(248, 203, 127),
new Color(248, 149, 136),
new Color(124, 214, 207),
new Color(145, 146, 171),
new Color(120, 152, 225),
new Color(239, 166, 102),
new Color(237, 221, 134),
new Color(153, 135, 206),
};
private static final int COUNT_OF_ROW = 8;
private static final int MAX_BUTTON = 40;
private List<ColorButton> colorButtons = new ArrayList<>();
private List<UIObserverListener> uiObserverListener;
private ChangeListener changeListener;
public ChartColorAdjustPane() {
this(DEFAULT_COLORS);
}
public ChartColorAdjustPane(Color[] colors) {
iniListener();
createColorButton(colors);
createContentPane();
}
public void updateColor() {
updateColor(DEFAULT_COLORS);
}
public void updateColor(Color[] colors) {
createColorButton(colors);
relayout();
}
public Color[] getColors() {
int size = colorButtons.size();
Color[] colors = new Color[size];
for (int i = 0; i < size; i++) {
colors[i] = colorButtons.get(i).getSelectObject();
}
return colors;
}
private void relayout() {
this.removeAll();
createContentPane();
this.validate();
this.repaint();
}
private void createContentPane() {
VerticalFlowLayout layout = new VerticalFlowLayout(0, 0, 0);
layout.setAlignLeft(true);
this.setLayout(layout);
for (int i = 0, size = colorButtons.size(); i < size; i += COUNT_OF_ROW) {
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
int count = i + COUNT_OF_ROW > colorButtons.size() ? colorButtons.size() : i + COUNT_OF_ROW;
for (int j = i; j < count; j++) {
colorButtons.get(j).setLastButton(false);
panel.add(colorButtons.get(j));
}
if (i + COUNT_OF_ROW > colorButtons.size()) {
panel.add(new AddColorButton());
this.add(panel);
} else if (i + COUNT_OF_ROW == colorButtons.size() && colorButtons.size() != MAX_BUTTON) {
this.add(panel);
this.add(new AddColorButton());
} else {
this.add(panel);
}
}
if (colorButtons.size() == 1) {
colorButtons.get(0).setLastButton(true);
}
}
private void createColorButton(Color[] colors) {
colorButtons.clear();
for (Color color : colors) {
colorButtons.add(createColorButton(color));
}
}
private ColorButton createColorButton(Color color) {
ColorButton colorButton = new ColorButton(color) {
@Override
protected void deleteButton() {
colorButtons.remove(this);
stateChanged();
relayout();
}
};
colorButton.addChangeListener(changeListener);
return colorButton;
}
private void iniListener() {
uiObserverListener = new ArrayList<>();
if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
for (UIObserverListener observerListener : uiObserverListener) {
observerListener.doChange();
}
}
});
}
}
public void stateChanged() {
if (changeListener != null) {
changeListener.stateChanged(null);
}
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener.add(listener);
}
public boolean shouldResponseChangeListener() {
return true;
}
private class AddColorButton extends AbstractSelectBox<Color> {
BufferedImage image = BaseUtils.readImageWithCache("/com/fr/design/images/buttonicon/add.png");
public AddColorButton() {
addMouseListener(getMouseListener());
}
@Override
public void paint(Graphics g) {
this.setSize(ColorButton.WIDTH, ColorButton.WIDTH);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(Color.WHITE);
Rectangle2D rec = new Rectangle2D.Double(0, 0, ColorButton.WIDTH + 1, ColorButton.WIDTH + 1);
g2d.fill(rec);
g2d.drawImage(image, 0, 0, ColorButton.WIDTH + 1, ColorButton.WIDTH + 1, null);
}
public Dimension getPreferredSize() {
return new Dimension(ColorButton.WIDTH, ColorButton.WIDTH);
}
protected MouseListener getMouseListener() {
return new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
showPopupMenu();
}
};
}
public JPanel initWindowPane(double preferredWidth) {
// 下拉的时候重新生成面板,刷新最近使用颜色
ColorSelectPane colorPane = new ColorSelectPane(false) {
public void setVisible(boolean b) {
super.setVisible(b);
}
};
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
hidePopupMenu();
Color color = ((ColorSelectPane) e.getSource()).getColor();
fireDisplayComponent(ColorBackground.getInstance(color));
colorButtons.add(createColorButton(color));
ChartColorAdjustPane.this.stateChanged();
relayout();
}
});
return colorPane;
}
public Color getSelectObject() {
return null;
}
public void setSelectObject(Color color) {
}
}
}

19
designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java

@ -7,11 +7,12 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartAccColorPane;
import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane;
import com.fr.design.style.background.gradient.FixedGradientBar;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
@ -20,8 +21,6 @@ import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
@ -37,7 +36,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
private UIButton accButton;
private UIButton gradientButton;
private ChartAccColorPane colorAcc;
private ChartColorAdjustPane colorAdjustPane;
private FixedGradientBar colorGradient;
public ChartPreFillStylePane() {
@ -53,13 +52,13 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT));
buttonPane.add(accButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Acc_Set")));
buttonPane.add(accButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Color")));
buttonPane.add(gradientButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradient_Color")));
customPane.add(buttonPane, BorderLayout.NORTH);
changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient");
changeColorSetPane.add(colorAcc = new ChartAccColorPane(), "acc");
changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc");
cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER);
@ -68,7 +67,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
customPane.setPreferredSize(new Dimension(200, 200));
colorGradient.setPreferredSize(new Dimension(120, 30));
colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE);
colorGradient.getSelectColorPointBtnP2().setColorInner(Color.black);
colorGradient.getSelectColorPointBtnP2().setColorInner(FixedGradientBar.NEW_CHARACTER);
double p = TableLayout.PREFERRED;
double[] columnSize = {p, p};
@ -131,7 +130,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
cardLayout.show(changeColorSetPane, "acc");
if (colorList.size() > 0) {
colorAcc.populateBean(colorList.toArray(new Color[colorList.size()]));
colorAdjustPane.updateColor(colorList.toArray(new Color[colorList.size()]));
}
}
}
@ -152,7 +151,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
} else {
chartColorMatching.setGradient(false);
Color[] colors = colorAcc.updateBean();
Color[] colors = colorAdjustPane.getColors();
for(Color color : colors) {
colorList.add(color);
}

7
designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java

@ -6,6 +6,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.van.chart.column.VanChartCustomStackAndAxisConditionPane;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.line.VanChartLineSeriesPane;
import javax.swing.JPanel;
@ -27,7 +28,6 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane {
double[] col = {f};
Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createLineTypePane()},
new Component[]{createMarkerPane()},
new Component[]{createAreaFillColorPane()},
@ -44,4 +44,9 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane {
protected Class<? extends BasicBeanPane> getStackAndAxisPaneClass() {
return VanChartCustomStackAndAxisConditionPane.class;
}
//风格
protected VanChartBeautyPane createStylePane() {
return new VanChartBeautyPane();
}
}

3
designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java

@ -37,14 +37,13 @@ public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] col = {f};
Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createBubblePane()},
new Component[]{createStackedAndAxisPane()},
new Component[]{null}
};
if (!((VanChartBubblePlot) plot).isForceBubble()) {
components[3] = new Component[]{createLargeDataModelPane()};
components[2] = new Component[]{createLargeDataModelPane()};
}
contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col);

1
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java

@ -53,7 +53,6 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] columnSize = {f};
double[] rowSize = {p,p,p,p,p,p,p,p,p,p};
Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createSeriesStylePane(new double[]{p,p}, new double[]{f,e})},
new Component[]{createBorderPane()},
new Component[]{createStackedAndAxisPane()},

5
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java

@ -4,7 +4,6 @@ import com.fr.chart.chartattr.Chart;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane;
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
@ -24,7 +23,7 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane {
private JPanel seriesPane;
protected VanChartCustomPlotSeriesTabPane plotSeriesPane;
private ChartFillStylePane fillStylePane;//配色
private VanChartFillStylePane fillStylePane;//配色
private VanChartBeautyPane stylePane;//风格
@ -81,7 +80,7 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane {
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col);
panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15));
panel.setBorder(BorderFactory.createEmptyBorder(5,5,0,5));
return panel;
}

16
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java

@ -29,7 +29,7 @@ public class VanChartBeautyPane extends BasicBeanPane<Integer> {
double[] columnSize = {f, e};
double[] rowSize = {p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gradient_Style")), styleBox},
} ;
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
@ -37,17 +37,17 @@ public class VanChartBeautyPane extends BasicBeanPane<Integer> {
}
protected String[] getNameArray(){
return new String[]{Toolkit.i18nText("Fine-Design_Chart_Default_Name"),
Toolkit.i18nText("Fine-Design_Chart_Style_TopDownShade")
return new String[]{Toolkit.i18nText("Fine-Design_Chart_On"),
Toolkit.i18nText("Fine-Design_Chart_Off")
};
}
@Override
public void populateBean(Integer ob) {
int finalIndex;
switch (ob){
case ChartConstants.STYLE_NONE: finalIndex = 0; break;
case ChartConstants.STYLE_SHADE: finalIndex = 1; break;
default: finalIndex = 0;
case ChartConstants.STYLE_NONE: finalIndex = 1; break;
case ChartConstants.STYLE_SHADE: finalIndex = 0; break;
default: finalIndex = 1;
}
styleBox.setSelectedIndex(finalIndex);
}
@ -57,8 +57,8 @@ public class VanChartBeautyPane extends BasicBeanPane<Integer> {
int index = styleBox.getSelectedIndex();
int style;
switch (index){
case 0: style = ChartConstants.STYLE_NONE; break;
case 1: style = ChartConstants.STYLE_SHADE; break;
case 0: style = ChartConstants.STYLE_SHADE; break;
case 1: style = ChartConstants.STYLE_NONE; break;
default: style = ChartConstants.STYLE_NONE;
}
return style;

212
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java

@ -1,22 +1,136 @@
package com.fr.van.chart.designer.component;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Utils;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.ChartUtils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.component.combobox.ColorSchemeComboBox;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane;
import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by mengao on 2017/8/17.
*/
public class VanChartFillStylePane extends ChartFillStylePane {
public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> {
protected ColorSchemeComboBox styleSelectBox;
protected JPanel customPane;
protected JPanel changeColorSetPane;
protected FixedGradientBar colorGradient;
protected CardLayout cardLayout;
protected ChartColorAdjustPane colorAdjustPane;
private Color[] gradientColors;
private Color[] accColors;
private boolean gradientSelect = false;
public VanChartFillStylePane() {
this.setLayout(new BorderLayout());
styleSelectBox = new ColorSchemeComboBox();
customPane = new JPanel(FRGUIPaneFactory.createBorderLayout());
changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient");
gradientColors = new Color[]{Color.WHITE, FixedGradientBar.NEW_CHARACTER};
changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc");
accColors = ChartColorAdjustPane.DEFAULT_COLORS;
cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER);
initListener();
initLayout();
}
private void initListener() {
colorAdjustPane.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
accColors = colorAdjustPane.getColors();
if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.COMBINATION_COLOR) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR);
}
VanChartFillStylePane.this.revalidate();
}
});
colorGradient.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
gradientColors[0] = colorGradient.getSelectColorPointBtnP1().getColorInner();
gradientColors[1] = colorGradient.getSelectColorPointBtnP2().getColorInner();
if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.GRADATION_COLOR) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR);
}
}
});
styleSelectBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
switch (styleSelectBox.getSelectType()) {
case COMBINATION_COLOR:
colorAdjustPane.updateColor(accColors);
cardLayout.show(changeColorSetPane, "acc");
gradientSelect = false;
break;
case GRADATION_COLOR:
colorGradient.updateColor(gradientColors[0], gradientColors[1]);
cardLayout.show(changeColorSetPane, "gradient");
gradientSelect = true;
break;
default:
ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo();
if (selectColorInfo.isGradient()) {
colorGradient.updateColor(selectColorInfo.getColors().get(0), selectColorInfo.getColors().get(1));
cardLayout.show(changeColorSetPane, "gradient");
gradientSelect = true;
} else {
colorAdjustPane.updateColor(selectColorInfo.getColors().toArray(new Color[]{}));
cardLayout.show(changeColorSetPane, "acc");
gradientSelect = false;
}
break;
}
VanChartFillStylePane.this.revalidate();
}
});
}
protected void initLayout() {
this.setLayout(new BorderLayout());
this.add(getContentPane(), BorderLayout.CENTER);
}
@Override
public Dimension getPreferredSize() {
if (gradientSelect) {
return new Dimension(225, 80);
}
return super.getPreferredSize();
}
protected JPanel getContentPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -24,19 +138,99 @@ public class VanChartFillStylePane extends ChartFillStylePane {
double[] columnSize = {f, e};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color_Match")),styleSelectBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), styleSelectBox},
new Component[]{null, customPane},
};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,0,0));
panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
return panel;
}
@Override
public Dimension getPreferredSize() {
if(styleSelectBox.getSelectedIndex() != styleSelectBox.getItemCount() - 1) {
return new Dimension(styleSelectBox.getPreferredSize().width, 30);
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color");
}
@Override
public void populateBean(AttrFillStyle condition) {
String fillStyleName = condition == null ? "" : condition.getFillStyleName();
if (StringUtils.isBlank(fillStyleName)) {//兼容处理
if (condition == null || condition.getColorStyle() == ChartConstants.COLOR_DEFAULT) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);//默认
} else {
int colorStyle = condition.getColorStyle();
if (colorStyle == ChartConstants.COLOR_GRADIENT) {
gradientColors[0] = condition.getColorIndex(0);
gradientColors[1] = condition.getColorIndex(1);
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR);
} else {
int colorSize = condition.getColorSize();
accColors = new Color[colorSize];
for (int i = 0; i < colorSize; i++) {
accColors[i] = condition.getColorIndex(i);
}
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR);
}
}
} else {
styleSelectBox.setSelectedItem(fillStyleName);
}
}
@Override
public AttrFillStyle updateBean() {
switch (styleSelectBox.getSelectType()) {
case COMBINATION_COLOR:
return updateCombinationColor();
case GRADATION_COLOR:
return updateGradationColor();
case DEFAULT:
return updateDefaultColor();
default:
return updateNormalColor();
}
}
private AttrFillStyle updateCombinationColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
condition.setColorStyle(ChartConstants.COLOR_ACC);
for (int i = 0, length = accColors.length; i < length; i++) {
condition.addFillColor(accColors[i]);
}
condition.setCustomFillStyle(true);
return condition;
}
private AttrFillStyle updateGradationColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
condition.setColorStyle(ChartConstants.COLOR_GRADIENT);
Color start = gradientColors[0];
Color end = gradientColors[1];
condition.addFillColor(start);
condition.addFillColor(end);
condition.setCustomFillStyle(true);
return condition;
}
private AttrFillStyle updateDefaultColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
condition.setColorStyle(ChartConstants.COLOR_DEFAULT);
return condition;
}
private AttrFillStyle updateNormalColor() {
ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance();
Object preStyle = manager.getPreStyle(styleSelectBox.getSelectedItem());
if (preStyle instanceof ChartColorMatching) {
AttrFillStyle def = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle);
def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem()));
return def;
} else {
return updateDefaultColor();
}
return super.getPreferredSize();
}
}

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeAxisPane.java

@ -24,6 +24,8 @@ public class VanChartGaugeAxisPane extends VanChartAxisPane {
this.setLayout(new BorderLayout());
gaugeAxisPane = new VanChartAxisScrollPaneWithGauge();
this.add(gaugeAxisPane, BorderLayout.CENTER);
gaugeAxisPane.setParentPane(parent);
}
@Override

3
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -30,6 +30,7 @@ import java.awt.Dimension;
*/
public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
private static final int TEXT_FONT_PANE_HEIGHT = 50;
private GaugeStyle gaugeStyle;
private UIButtonGroup<Integer> align;
private JPanel alignPane;
@ -198,7 +199,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
protected void checkStyleUse() {
textFontPane.setVisible(true);
textFontPane.setPreferredSize(new Dimension(0, 60));
textFontPane.setPreferredSize(new Dimension(0, TEXT_FONT_PANE_HEIGHT));
}
protected boolean hasLabelAlign(Plot plot) {

27
designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java

@ -10,8 +10,8 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane;
import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane;
import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
@ -23,7 +23,6 @@ import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.plugin.chart.base.VanChartAttrTrendLine;
import com.fr.van.chart.custom.style.VanChartCustomStylePane;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartAreaSeriesFillColorPane;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
@ -62,6 +61,8 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
private VanChartBorderPane borderPane;//边框
protected VanChartFillStylePane vanChartFillStylePane;//配色
private UINumberDragPane transparent;//不透明度
protected VanChartStackedAndAxisListControlPane stackAndAxisEditPane;//堆積和坐標軸
@ -86,18 +87,18 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
JPanel panel = new JPanel(new BorderLayout());
if (fillStylePane != null) {
panel.add(fillStylePane, BorderLayout.NORTH);
JPanel colorPane = getColorPane();
if(colorPane != null) {
panel.add(colorPane, BorderLayout.NORTH);
}
panel.add(getContentInPlotType(), BorderLayout.CENTER);
return panel;
}
@Override
/**
* 返回 填充界面.
*/
protected ChartFillStylePane getFillStylePane() {
protected VanChartFillStylePane getVanChartFillStylePane() {
//如果是自定義組合圖,則不創建填充界面
return parentPane instanceof VanChartCustomStylePane ? null : new VanChartFillStylePane();
}
@ -111,9 +112,13 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
protected JPanel getColorPane() {
JPanel panel = new JPanel(new BorderLayout());
stylePane = createStylePane();
vanChartFillStylePane = getVanChartFillStylePane();
if (vanChartFillStylePane != null) {
panel.add(vanChartFillStylePane, BorderLayout.NORTH);
}
setColorPaneContent(panel);
JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel);
panel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0));
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
return panel.getComponentCount() == 0 ? null : colorPane;
}
@ -266,7 +271,9 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
checkoutMapType(plot);
super.populateBean(plot);//配色
if(vanChartFillStylePane != null) { //配色
vanChartFillStylePane.populateBean(plot.getPlotFillStyle());
}
if (stylePane != null) {//风格
stylePane.populateBean(plot.getPlotStyle());
@ -323,7 +330,9 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
//更新之前先更新界面的map类型属性
checkoutMapType(plot);
super.updateBean(plot);//配色
if(vanChartFillStylePane != null) {//配色
plot.setPlotFillStyle(vanChartFillStylePane.updateBean());
}
if (stylePane != null) {//风格
plot.setPlotStyle(stylePane.updateBean());

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

@ -31,7 +31,6 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] columnSize = {f};
double[] rowSize = {p,p,p,p,p,p,p,p,p,p};
Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createFunnelStylePane()},
new Component[]{createBorderPane()},
};

6
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java

@ -13,6 +13,7 @@ import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.plugin.chart.gantt.VanChartGanttPlot;
import com.fr.stable.CoreConstants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.component.VanChartMarkerPane;
import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
@ -121,4 +122,9 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane {
}
}
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
}

22
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

@ -6,6 +6,7 @@ import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
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;
@ -13,8 +14,6 @@ import com.fr.design.mainframe.chart.gui.style.series.ColorPickerPaneWithFormula
import com.fr.design.mainframe.chart.gui.style.series.UIColorPickerPane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.ComparatorUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.attr.GaugeDetailStyle;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrLabelDetail;
@ -22,6 +21,7 @@ import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel;
@ -74,7 +74,18 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
private JPanel createGaugeLayoutPane() {
gaugeLayout = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")});
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Page_Setup_Orientation"),gaugeLayout);
String title = Toolkit.i18nText("Fine-Design_Report_Page_Setup_Orientation");
if (plot instanceof VanChartGaugePlot) {
VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot;
if (gaugePlot.getGaugeStyle() == GaugeStyle.THERMOMETER) {
title = Toolkit.i18nText("Fine-Design_Report_Page_Setup_Sort_Orientation");
}
}
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(title, gaugeLayout);
gaugeLayout.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
@ -295,4 +306,9 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
colorPickerPane.updateBean(detailStyle.getHotAreaColor());
}
}
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
}

5
designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java

@ -9,10 +9,9 @@ import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane;
import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartFillStylePane;
import com.fr.van.chart.map.VanChartMapSeriesPane;
import javax.swing.JPanel;
@ -41,7 +40,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane {
/**
* 返回 填充界面.
*/
protected ChartFillStylePane getFillStylePane() {
protected VanChartFillStylePane getVanChartFillStylePane() {
return null;
}

6
designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java

@ -4,6 +4,7 @@ import com.fr.chart.chartattr.Plot;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel;
@ -38,4 +39,9 @@ public class VanChartLineSeriesPane extends VanChartAbstractPlotSeriesPane {
return contentPane;
}
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
}

47
designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

@ -6,6 +6,7 @@ import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox;
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;
@ -36,6 +37,7 @@ import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane;
import com.fr.van.chart.map.line.VanChartCurvePane;
import com.fr.van.chart.map.line.VanChartLineMapEffectPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@ -157,6 +159,35 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane {
}
}
@Override
protected JPanel getContentPane(boolean custom) {
JPanel panel = new JPanel(new BorderLayout());
mapType = ((VanChartMapPlot) plot).getAllLayersMapType();
if(mapType == MapType.CUSTOM || mapType == MapType.DRILL_CUSTOM) {
vanChartFillStylePane = getVanChartFillStylePane();
panel.add(vanChartFillStylePane, BorderLayout.NORTH);
}
panel.add(getContentInPlotType(), BorderLayout.CENTER);
return panel;
}
//获取颜色面板
private JPanel getColorPane(MapType paneType) {
JPanel panel = new JPanel(new BorderLayout());
stylePane = createStylePane();
mapType = ((VanChartMapPlot) plot).getAllLayersMapType();
if(mapType != MapType.CUSTOM && mapType != MapType.DRILL_CUSTOM) {
vanChartFillStylePane = getVanChartFillStylePane();
if (vanChartFillStylePane != null) {
panel.add(vanChartFillStylePane, BorderLayout.NORTH);
}
}
setColorPaneContent(panel, paneType);
JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
return panel.getComponentCount() == 0 ? null : colorPane;
}
/**
* 在每个不同类型Plot, 得到不同类型的属性. 比如: 柱形的风格, 折线的线型曲线.
*/
@ -176,10 +207,17 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane {
}
//设置色彩面板内容
protected void setColorPaneContent(JPanel panel) {
protected void setColorPaneContent(JPanel panel, MapType paneType) {
switch (paneType) {
case AREA:
panel.add(createNullValueColorPane(), BorderLayout.CENTER);
panel.add(createAlphaPane(), BorderLayout.SOUTH);
break;
case POINT:
panel.add(createPointAlphaPane(), BorderLayout.CENTER);
default:
return;
}
}
@ -192,7 +230,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] col = {f};
Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{getColorPane(MapType.AREA)},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderWithAlphaPane)},
};
@ -213,7 +251,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] col = {f};
Component[][] components = new Component[][]{
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), createPointAlphaPane())},
new Component[]{getColorPane(MapType.POINT)},
new Component[]{createMarkerComPane()},
//大数据模式 恢复用注释。下面1行删除。
new Component[]{createLargeDataModelPane()},
@ -232,6 +270,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane {
curvePane = new VanChartCurvePane();
Component[][] components = new Component[][]{
new Component[]{getColorPane(MapType.LINE)},
new Component[]{createCurvePane()},
//大数据模式 恢复用注释。下面1行删除。
new Component[]{createLineMapLargeDataModelPane()},

7
designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java

@ -7,9 +7,9 @@ import com.fr.design.gui.ispinner.UISpinner;
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.multilayer.VanChartMultiPiePlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.pie.VanChartPieSeriesPane;
import javax.swing.JPanel;
@ -90,4 +90,9 @@ public class VanChartMultiPieSeriesPane extends VanChartPieSeriesPane {
multiPiePlot.setSupportRotation(supportRotation.getSelectedIndex() == 0);
}
}
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
}

1
designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java

@ -41,7 +41,6 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] columnSize = {f};
double[] rowSize = {p,p,p,p,p,p};
Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createSeriesStylePane(rowSize, new double[]{f, e})},
new Component[]{createBorderPane()},
};

3
designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java

@ -43,7 +43,6 @@ public class VanChartRadarSeriesPane extends VanChartAbstractPlotSeriesPane {
private Component[][] getPaneComponents() {
if(plot instanceof VanChartRadarPlot && ((VanChartRadarPlot)plot).isStackChart()) {
return new Component[][]{
new Component[]{getColorPane()},
new Component[]{createRadarTypePane()},
new Component[]{createBorderPane()},
};
@ -59,8 +58,10 @@ public class VanChartRadarSeriesPane extends VanChartAbstractPlotSeriesPane {
//设置色彩面板内容
protected void setColorPaneContent (JPanel panel) {
if(plot instanceof VanChartRadarPlot && ((VanChartRadarPlot)plot).isStackChart()) {
panel.add(createAlphaPane(), BorderLayout.CENTER);
}
}
private JPanel createRadarTypePane() {
radarType = new UIButtonGroup<String>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Circle"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Polygonal")},

1
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java

@ -35,7 +35,6 @@ public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] col = {f};
Component[][] components = new Component[][]{
new Component[]{getColorPane()},
new Component[]{createLineTypePane()},
new Component[]{createMarkerPane()},
new Component[]{createStackedAndAxisPane()},

7
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java

@ -10,10 +10,10 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.chart.base.AttrNode;
import com.fr.plugin.chart.structure.VanChartStructurePlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel;
@ -142,4 +142,9 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane
}
}
}
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
}

7
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java

@ -15,10 +15,10 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.IOUtils;
import com.fr.plugin.chart.wordcloud.CloudShapeType;
import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel;
@ -228,4 +228,9 @@ public class VanChartWordCloudSeriesPane extends VanChartAbstractPlotSeriesPane
}
}
}
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
}

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

@ -93,7 +93,7 @@ public class FormCreatorDropTarget extends DropTarget {
//SetSelection时要确保选中的是最顶层的布局
//tab布局添加的时候是初始化了XWCardLayout,实际上最顶层的布局是XWCardMainBorderLayout
XCreator addingXCreator = addingModel.getXCreator();
Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData();
Widget widget = (addingXCreator.getBackupParent() != null && addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData();
//图表埋点
dealChartBuryingPoint(widget);
if (addingXCreator.isShared()) {

2
designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java

@ -88,7 +88,7 @@ public class BiasTextPainterCellEditor extends AbstractCellEditor {
Window parentWindow = SwingUtilities.getWindowAncestor(grid);
this.biasTextPainterPane = new BiasTextPainterPane();
Dimension dimension = this.biasTextPainterPane.getPreferredSize();
Dimension wrapDimension = new Dimension((int) (dimension.width * MULTIPLE), (int) (dimension.height * MULTIPLE));
Dimension wrapDimension = new Dimension((int) (dimension.width * MULTIPLE), (int) (dimension.height * Math.pow(MULTIPLE, 2)));
this.biasTextPainterPane.populate(biasTextPainter);
return this.biasTextPainterPane.showWindowWithCustomSize(parentWindow, new DialogActionAdapter() {

7
designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java

@ -5,6 +5,7 @@ import com.fr.main.impl.WorkBook;
import com.fr.main.parameter.ReportParameterAttr;
import com.fr.report.cellcase.CellCase;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.report.Report;
import com.fr.report.worksheet.WorkSheet;
import java.util.Iterator;
@ -61,10 +62,14 @@ public class JWorkBookProcessInfo extends TemplateProcessInfo<WorkBook> {
int blockCount = 0;
if (!template.isElementCaseBook()) { // 如果是聚合报表
for (int i = 0; i < template.getReportCount(); i++) {
PolyWorkSheet r = (PolyWorkSheet) template.getReport(i);
Report report = template.getReport(i);
// 考虑多个sheet下 包含WorkSheet的情况 需要判断下
if (report instanceof PolyWorkSheet) {
PolyWorkSheet r = (PolyWorkSheet) report;
blockCount += r.getBlockCount();
}
}
}
return blockCount;
}
// 获取模板控件数

8
designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java

@ -9,7 +9,6 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;
@ -32,16 +31,15 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime {
private static final String BIN_HOME = StableUtils.pathJoin(StableUtils.getInstallHome(), "bin");
private static final String LOGO_PATH = StableUtils.pathJoin(BIN_HOME, "logo.png");
private static final String DOCK_OPTIONS = "-Xdock:icon=" + LOGO_PATH;
private static final String DOCK_NAME_OPTIONS = "-Xdock:name=" + FineDesigner.class.getSimpleName();
private static final String[] DEBUG_OPTIONS = new String[]{"-Dfile.encoding=UTF-8", "-Xmx2048m"};
static {
if (SupportOSImpl.DOCK_ICON.support()) {
try {
ImageIO.write(IOUtils.readImage("com/fr/design/icon/logo.png"), "png", new File(LOGO_PATH));
IOUtils.copy(DesignerJavaRuntime.class.getResourceAsStream("/com/fr/design/icon/logo.png"), "logo.png", new File(BIN_HOME));
} catch (IOException ignore) {
}
}
}
private static final DesignerJavaRuntime INSTANCE = new DesignerJavaRuntime();
@ -99,7 +97,7 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime {
if (isInstallVersion()) {
String[] options = super.getJvmOptions();
if (SupportOSImpl.DOCK_ICON.support()) {
options = ArrayUtils.add(options, DOCK_OPTIONS);
options = ArrayUtils.addAll(options, DOCK_OPTIONS, DOCK_NAME_OPTIONS);
}
return options;
} else {

30
designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java

@ -1,5 +1,6 @@
package com.fr.start;
import com.fr.common.report.ReportState;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.dialog.ErrorDialog;
import com.fr.design.i18n.Toolkit;
@ -9,12 +10,14 @@ import com.fr.design.utils.DesignUtils;
import com.fr.event.Event;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.general.ComparatorUtils;
import com.fr.process.FineProcess;
import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent;
import com.fr.stable.StringUtils;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
@ -33,10 +36,12 @@ public class DesignerSuperListener {
private static final int FIXED_FREQ = 2;
private final ScheduledExecutorService service = Executors.newScheduledThreadPool(2, new NamedThreadFactory("DesignerListener"));
private final ExecutorService helpService = Executors.newSingleThreadExecutor( new NamedThreadFactory("DesignerSuperListener-Help"));
private FineProcess process;
private ScheduledFuture fixedFuture;
private ScheduledFuture onceFuture;
private volatile boolean cancel = false;
private DesignerSuperListener() {
@ -49,6 +54,7 @@ public class DesignerSuperListener {
public void start() {
process = FineProcessContext.getProcess(DesignerProcessType.INSTANCE);
startExitListener();
startHelpLister();
startFrameListener();
startFallBackListener();
}
@ -62,10 +68,32 @@ public class DesignerSuperListener {
});
}
private void startHelpLister() {
helpService.submit(new Runnable() {
@Override
public void run() {
while (!cancel) {
ProcessEventPipe pipe = process.getPipe();
String msg = pipe.info();
if (ComparatorUtils.equals(ReportState.STOP.getValue(), msg)) {
onceFuture.cancel(false);
}
if (ComparatorUtils.equals(ReportState.ACTIVE.getValue(), msg)) {
startFrameListener();
}
if (ComparatorUtils.equals(DesignerProcessType.INSTANCE.obtain(), msg)) {
frameReport();
}
}
}
});
}
private void startFrameListener() {
onceFuture = service.schedule(new Runnable() {
@Override
public void run() {
cancel = true;
ProcessEventPipe pipe = process.getPipe();
pipe.fire(FineProcessEngineEvent.READY);
if (StringUtils.isNotEmpty(pipe.info())) {
@ -138,10 +166,12 @@ public class DesignerSuperListener {
public void stopTask() {
onceFuture.cancel(false);
fixedFuture.cancel(false);
cancel = true;
}
public void stop() {
stopTask();
service.shutdown();
helpService.shutdown();
}
}

Loading…
Cancel
Save