Browse Source

Merge branch 'feature/10.0' of https://cloud.finedevelop.com/scm/~wim.zhai/Xdesign into feature/10.0

persist/11.0
Wim.Zhai 5 years ago
parent
commit
c34b063a3e
  1. 23
      designer-base/src/main/java/com/fr/design/fun/MultiStyleUIConfigProvider.java
  2. 39
      designer-base/src/main/java/com/fr/design/fun/StyleUIConfigProvider.java
  3. 26
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMultiStyleUIConfigProvider.java
  4. 41
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractStyleUIConfigProvider.java
  5. 33
      designer-realize/src/main/java/com/fr/design/style/StylePane.java

23
designer-base/src/main/java/com/fr/design/fun/MultiStyleUIConfigProvider.java

@ -0,0 +1,23 @@
package com.fr.design.fun;
import com.fr.common.annotations.Open;
import com.fr.stable.fun.mark.Mutable;
import java.util.List;
/**
* Created by kerry on 2019-11-11
*/
@Open
public interface MultiStyleUIConfigProvider extends Mutable {
String XML_TAG = "MultiStyleUIConfigProvider";
int CURRENT_LEVEL = 1;
/**
* 获取配置项list
*
* @return 配置项list
*/
List<StyleUIConfigProvider> getConfigList();
}

39
designer-base/src/main/java/com/fr/design/fun/StyleUIConfigProvider.java

@ -0,0 +1,39 @@
package com.fr.design.fun;
import com.fr.base.Style;
import com.fr.common.annotations.Open;
import com.fr.stable.fun.mark.Mutable;
import javax.swing.JComponent;
import javax.swing.event.ChangeListener;
/**
* Created by kerry on 2019-11-11
*/
@Open
public interface StyleUIConfigProvider extends Mutable {
String XML_TAG = "CustomStyleUIConfigProvider";
int CURRENT_LEVEL = 1;
/**
* @return 配置名
*/
String configName();
/**
* @param changeListener 需要添加的listener
* @return 对应的component
*/
JComponent uiComponent(ChangeListener changeListener);
/**
* @return 更新后的样式
*/
Style updateConfig();
/**
* @param style 待渲染的样式
*/
void populateConfig(Style style);
}

26
designer-base/src/main/java/com/fr/design/fun/impl/AbstractMultiStyleUIConfigProvider.java

@ -0,0 +1,26 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.StyleUIConfigProvider;
import com.fr.design.fun.MultiStyleUIConfigProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kerry on 2019-11-11
*/
@API(level = MultiStyleUIConfigProvider.CURRENT_LEVEL)
public abstract class AbstractMultiStyleUIConfigProvider extends AbstractProvider implements MultiStyleUIConfigProvider {
@Override
public List<StyleUIConfigProvider> getConfigList() {
return new ArrayList<StyleUIConfigProvider>();
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

41
designer-base/src/main/java/com/fr/design/fun/impl/AbstractStyleUIConfigProvider.java

@ -0,0 +1,41 @@
package com.fr.design.fun.impl;
import com.fr.base.Style;
import com.fr.design.fun.StyleUIConfigProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
import javax.swing.JComponent;
import javax.swing.event.ChangeListener;
/**
* Created by kerry on 2019-11-11
*/
@API(level = StyleUIConfigProvider.CURRENT_LEVEL)
public class AbstractStyleUIConfigProvider extends AbstractProvider implements StyleUIConfigProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String configName() {
return StringUtils.EMPTY;
}
@Override
public JComponent uiComponent(ChangeListener changeListener) {
return null;
}
@Override
public Style updateConfig() {
return null;
}
@Override
public void populateConfig(Style style) {
}
}

33
designer-realize/src/main/java/com/fr/design/style/StylePane.java

@ -8,7 +8,10 @@ import com.fr.base.NameStyle;
import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.base.core.StyleUtils;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.StyleUIConfigProvider;
import com.fr.design.fun.MultiStyleUIConfigProvider;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.ElementCasePane;
@ -18,6 +21,7 @@ import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.solution.sandbox.collection.PluginSandboxCollections;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.FloatElement;
@ -38,6 +42,8 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.List;
import java.util.Set;
/**
* Style Pane.
@ -48,6 +54,7 @@ public class StylePane extends BasicBeanPane<Style> implements ChangeListener {
private static final int FONT_INDEX = 2;
private static final int BORDER_INDEX = 3;
private static final int BACKGROUND_INDEX = 4;
private static final int NEXT_TAB_INDEX = 5;
private ElementCasePane reportPane;
protected Style editing;
private NameStyle globalStyle;
@ -56,9 +63,17 @@ public class StylePane extends BasicBeanPane<Style> implements ChangeListener {
private FRFontPane frFontPane = null;
private BorderPane borderPane = null;
private BackgroundPane backgroundPane = null;
private static List<StyleUIConfigProvider> configList = PluginSandboxCollections.newSandboxList();
private PreivewArea previewArea;
private JPanel previewPane;
static {
Set<MultiStyleUIConfigProvider> preferenceConfigProviders = ExtraDesignClassManager.getInstance().getArray(MultiStyleUIConfigProvider.XML_TAG);
for (MultiStyleUIConfigProvider provider : preferenceConfigProviders) {
configList.addAll(provider.getConfigList());
}
}
/**
* Constructor
*/
@ -84,6 +99,9 @@ public class StylePane extends BasicBeanPane<Style> implements ChangeListener {
mainTabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
mainTabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
for (StyleUIConfigProvider config : configList) {
mainTabbedPane.addTab(config.configName(), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
}
mainTabbedPane.addChangeListener(tabChangeActionListener);
this.setPreferredSize(new Dimension(450, 480));
}
@ -344,6 +362,9 @@ public class StylePane extends BasicBeanPane<Style> implements ChangeListener {
if (this.backgroundPane != null) {
this.backgroundPane.populate(editing.getBackground());
}
for(StyleUIConfigProvider tabConfig : configList){
tabConfig.populateConfig(this.editing);
}
updatePreviewArea();
}
@ -378,6 +399,9 @@ public class StylePane extends BasicBeanPane<Style> implements ChangeListener {
if (this.backgroundPane != null) {
style = style.deriveBackground(this.backgroundPane.update());
}
for(StyleUIConfigProvider tabConfig : configList){
style = tabConfig.updateConfig();
}
return style;
}
@ -401,6 +425,9 @@ public class StylePane extends BasicBeanPane<Style> implements ChangeListener {
tabbedPane.setComponentAt(selectedIndex, StylePane.this.getBorderPane());
} else if (selectedIndex == BACKGROUND_INDEX) {
tabbedPane.setComponentAt(selectedIndex, StylePane.this.getBackgroundPane());
} else if (configList.size() + NEXT_TAB_INDEX > selectedIndex && configList.get(selectedIndex - NEXT_TAB_INDEX) != null) {
tabbedPane.setComponentAt(selectedIndex, configList.get(selectedIndex - NEXT_TAB_INDEX).uiComponent(StylePane.this));
configList.get(selectedIndex - NEXT_TAB_INDEX).populateConfig(StylePane.this.editing);
}
}
updatePreviewArea();
@ -419,7 +446,7 @@ public class StylePane extends BasicBeanPane<Style> implements ChangeListener {
/**
* 预览Style的面板
*
*
* @author richer
*/
public static class PreivewArea extends JComponent {
@ -461,7 +488,7 @@ public class StylePane extends BasicBeanPane<Style> implements ChangeListener {
}
}

Loading…
Cancel
Save