Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~lucian.chen/design into release/10.0

feature/big-screen
lucian 5 years ago
parent
commit
9a9f48eadc
  1. 2
      build.gradle
  2. 21
      designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java
  3. 18
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  4. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java
  5. 12
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  6. 62
      designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java

2
build.gradle

@ -68,7 +68,7 @@ allprojects {
implementation 'org.apache.tomcat:tomcat-catalina:8.5.32' implementation 'org.apache.tomcat:tomcat-catalina:8.5.32'
implementation 'io.socket:socket.io-client:0.7.0' implementation 'io.socket:socket.io-client:0.7.0'
implementation 'com.fr.third:fine-third:' + frVersion implementation 'com.fr.third:fine-third:' + frVersion
implementation 'com.fr.core:fine-core:' + frVersion implementation 'com.fr.core:fine-core:' + frDevVersion
implementation 'com.fr.activator:fine-activator:' + frVersion implementation 'com.fr.activator:fine-activator:' + frVersion
implementation 'com.fr.datasource:fine-datasource:' + frVersion implementation 'com.fr.datasource:fine-datasource:' + frVersion
implementation 'com.fr.decision:fine-decision:' + frVersion implementation 'com.fr.decision:fine-decision:' + frVersion

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

@ -2,6 +2,8 @@ package com.fr.design.chartx.component.combobox;
import com.fr.base.ChartColorMatching; import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig; import com.fr.base.ChartPreStyleConfig;
import com.fr.cert.token.lang.Collections;
import com.fr.chart.base.ChartConstants;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -60,13 +62,20 @@ public class ColorSchemeComboBox extends UIComboBox {
//添加默认的方案和第一个方案 //添加默认的方案和第一个方案
String defaultName = config.getCurrentStyle(); String defaultName = config.getCurrentStyle();
ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName); ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName);
Object firstName = names.next(); if (names.hasNext()) {
ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName); Object firstName = names.next();
if (defaultStyle == null) { ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName);
defaultStyle = firstStyle; if (defaultStyle == null) {
defaultStyle = firstStyle;
}
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle));
colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle));
} else {
ColorInfo colorInfo = new ColorInfo();
colorInfo.setGradient(false);
colorInfo.setColors(Collections.arrayToList(ChartConstants.CHART_COLOR_ARRAY));
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorInfo);
} }
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle));
colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle));
//添加其他的配色方案 //添加其他的配色方案
while (names.hasNext()) { while (names.hasNext()) {

18
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java

@ -253,23 +253,15 @@ public class VanChartPlotLegendPane extends BasicPane {
}); });
customFloatPositionButton.addMouseListener(new MouseAdapter() { customFloatPositionButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if(!customFloatPositionButton.isSelected()){
customFloatPositionButton.setSelected(true);
checkLayoutPaneVisible();
checkDisplayStrategyUse();
}
}
@Override
public void mousePressed(MouseEvent e) {
location.setSelectedIndex(-1);
}
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
super.mouseReleased(e); super.mouseReleased(e);
location.setSelectedIndex(-1);
customFloatPositionButton.setSelected(true);
checkLayoutPaneVisible();
checkDisplayStrategyUse();
if(customFloatPositionPane == null) { if(customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
} }

17
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java

@ -214,23 +214,14 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
}); });
customFloatPositionButton.addMouseListener(new MouseAdapter() { customFloatPositionButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (!customFloatPositionButton.isSelected()) {
customFloatPositionButton.setSelected(true);
checkDisplayStrategyUse();
}
}
@Override
public void mousePressed(MouseEvent e) {
alignmentPane.setSelectedIndex(-1);
}
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
super.mouseReleased(e); super.mouseReleased(e);
alignmentPane.setSelectedIndex(-1);
customFloatPositionButton.setSelected(true);
checkDisplayStrategyUse();
if (customFloatPositionPane == null) { if (customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
} }

12
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -429,10 +429,14 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
xCreators.add(this); xCreators.add(this);
int componentCount = getComponentCount(); int componentCount = getComponentCount();
for (int i = 0; i < componentCount; i++) { for (int i = 0; i < componentCount; i++) {
XCreator xCreator = (XCreator) getComponent(i);
//获取真实的 creator Component component = getComponent(i);
XCreator realCreator = xCreator.getXCreator(); if (component instanceof XCreator) {
realCreator.traversalNameRelatedXCreators(xCreators); XCreator xCreator = (XCreator) component;
//获取真实的 creator
XCreator realCreator = xCreator.getXCreator();
realCreator.traversalNameRelatedXCreators(xCreators);
}
} }
} }

62
designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java

@ -1,32 +1,45 @@
package com.fr.design.designer.beans.models; package com.fr.design.designer.beans.models;
import com.fr.base.chart.BaseChartCollection;
import com.fr.config.dao.DaoContext; import com.fr.config.dao.DaoContext;
import com.fr.config.dao.impl.LocalClassHelperDao; import com.fr.config.dao.impl.LocalClassHelperDao;
import com.fr.config.dao.impl.LocalEntityDao; import com.fr.config.dao.impl.LocalEntityDao;
import com.fr.config.dao.impl.LocalXmlEntityDao; import com.fr.config.dao.impl.LocalXmlEntityDao;
import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XChartEditor;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.module.DesignModuleFactory;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.ui.ChartEditor; import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.container.WTitleLayout;
import com.fr.stable.core.PropertyChangeListener;
import org.easymock.EasyMock; import org.easymock.EasyMock;
import org.junit.After; import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import javax.swing.JComponent; import javax.swing.JComponent;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
@PrepareForTest({DesignModuleFactory.class})
@PowerMockIgnore({"com.sun.*", "javax.*", "com.fr.jvm.assist.*"})
@RunWith(PowerMockRunner.class)
public class AddingModelTest { public class AddingModelTest {
@Before @Before
@ -99,7 +112,7 @@ public class AddingModelTest {
FormDesigner mock = EasyMock.mock(FormDesigner.class); FormDesigner mock = EasyMock.mock(FormDesigner.class);
EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes(); EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes();
EasyMock.replay(mock); EasyMock.replay(mock);
WCardLayout wCardLayout = new WCardLayout(20, 20); WCardLayout wCardLayout = new WCardLayout(20, 20);
XWCardLayout xwCardLayout = new XWCardLayout(wCardLayout, new Dimension(40, 40)); XWCardLayout xwCardLayout = new XWCardLayout(wCardLayout, new Dimension(40, 40));
AddingModel addingModel = new AddingModel(mock, xwCardLayout); AddingModel addingModel = new AddingModel(mock, xwCardLayout);
@ -113,6 +126,53 @@ public class AddingModelTest {
} }
@Test
public void testInstantiateCreator_containsNotXCreator() throws Exception {
Form form = EasyMock.mock(Form.class);
EasyMock.expect(form.isNameExist("cardlayout")).andReturn(true).once();
EasyMock.expect(form.isNameExist("cardlayout0")).andReturn(true).once();
EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes();
EasyMock.replay(form);
FormDesigner mock = EasyMock.mock(FormDesigner.class);
EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes();
EasyMock.replay(mock);
PowerMock.mockStaticPartial(DesignModuleFactory.class, "getChartComponent");
EasyMock.expect(DesignModuleFactory.getChartComponent(EasyMock.anyObject(BaseChartCollection.class))).andReturn(new MiddleChartComponent() {
@Override
public void populate(BaseChartCollection cc) {
}
@Override
public BaseChartCollection update() {
return null;
}
@Override
public void reset() {
}
@Override
public void addStopEditingListener(PropertyChangeListener list) {
}
}).anyTimes();
PowerMock.replayAll();
Dimension dimension = new Dimension(20, 20);
ChartEditor chartEditor1 = new ChartEditor();
XCreator xCreator1 = new XChartEditor(chartEditor1, dimension);
AddingModel chartModel = new AddingModel(mock, xCreator1);
Assert.assertEquals("chart", xCreator1.toData().getWidgetName());
}
private static class DemoCreator extends XCreator { private static class DemoCreator extends XCreator {
private String widgetName; private String widgetName;

Loading…
Cancel
Save