Browse Source

REPORT-22869 19fdc接口——预定义样式支持更多配置

research/11.0
kerry 5 years ago
parent
commit
f0e1d1255f
  1. 39
      designer-base/src/main/java/com/fr/design/fun/CustomStyleUIConfigProvider.java
  2. 23
      designer-base/src/main/java/com/fr/design/fun/MultiStyleUIConfigProvider.java
  3. 45
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractCustomStyleUIConfigProvider.java
  4. 30
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMultiStyleUIConfigProvider.java
  5. 26
      designer-realize/src/main/java/com/fr/design/style/StylePane.java
  6. 22
      designer-realize/src/main/java/com/fr/design/style/preference/PreferenceConfigProvider.java
  7. 32
      designer-realize/src/main/java/com/fr/design/style/preference/PreferenceTabConfig.java
  8. 29
      designer-realize/src/main/java/com/fr/design/style/preference/impl/AbstractPreferenceConfigProvider.java
  9. 33
      designer-realize/src/main/java/com/fr/design/style/preference/impl/AbstractPreferenceTabConfig.java

39
designer-base/src/main/java/com/fr/design/fun/CustomStyleUIConfigProvider.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 CustomStyleUIConfigProvider 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);
}

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<CustomStyleUIConfigProvider> getConfigList();
}

45
designer-base/src/main/java/com/fr/design/fun/impl/AbstractCustomStyleUIConfigProvider.java

@ -0,0 +1,45 @@
package com.fr.design.fun.impl;
import com.fr.base.Style;
import com.fr.design.fun.CustomStyleUIConfigProvider;
import com.fr.stable.StringUtils;
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 = CustomStyleUIConfigProvider.CURRENT_LEVEL)
public class AbstractCustomStyleUIConfigProvider implements CustomStyleUIConfigProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
@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) {
}
}

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

@ -0,0 +1,30 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.CustomStyleUIConfigProvider;
import com.fr.design.fun.MultiStyleUIConfigProvider;
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 implements MultiStyleUIConfigProvider {
@Override
public List<CustomStyleUIConfigProvider> getConfigList() {
return new ArrayList<CustomStyleUIConfigProvider>();
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

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

@ -10,12 +10,12 @@ 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.CustomStyleUIConfigProvider;
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;
import com.fr.design.style.background.BackgroundPane;
import com.fr.design.style.preference.PreferenceConfigProvider;
import com.fr.design.style.preference.PreferenceTabConfig;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
@ -63,13 +63,13 @@ public class StylePane extends BasicBeanPane<Style> implements ChangeListener {
private FRFontPane frFontPane = null;
private BorderPane borderPane = null;
private BackgroundPane backgroundPane = null;
private static List<PreferenceTabConfig> configList = PluginSandboxCollections.newSandboxList();
private static List<CustomStyleUIConfigProvider> configList = PluginSandboxCollections.newSandboxList();
private PreivewArea previewArea;
private JPanel previewPane;
static {
Set<PreferenceConfigProvider> preferenceConfigProviders = ExtraDesignClassManager.getInstance().getArray(PreferenceConfigProvider.XML_TAG);
for (PreferenceConfigProvider provider : preferenceConfigProviders) {
Set<MultiStyleUIConfigProvider> preferenceConfigProviders = ExtraDesignClassManager.getInstance().getArray(MultiStyleUIConfigProvider.XML_TAG);
for (MultiStyleUIConfigProvider provider : preferenceConfigProviders) {
configList.addAll(provider.getConfigList());
}
}
@ -99,8 +99,8 @@ 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 (PreferenceTabConfig config : configList) {
mainTabbedPane.addTab(config.tabName(), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
for (CustomStyleUIConfigProvider config : configList) {
mainTabbedPane.addTab(config.configName(), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane());
}
mainTabbedPane.addChangeListener(tabChangeActionListener);
this.setPreferredSize(new Dimension(450, 480));
@ -362,8 +362,8 @@ public class StylePane extends BasicBeanPane<Style> implements ChangeListener {
if (this.backgroundPane != null) {
this.backgroundPane.populate(editing.getBackground());
}
for(PreferenceTabConfig tabConfig : configList){
tabConfig.populateTabConfig(this.editing);
for(CustomStyleUIConfigProvider tabConfig : configList){
tabConfig.populateConfig(this.editing);
}
updatePreviewArea();
}
@ -399,8 +399,8 @@ public class StylePane extends BasicBeanPane<Style> implements ChangeListener {
if (this.backgroundPane != null) {
style = style.deriveBackground(this.backgroundPane.update());
}
for(PreferenceTabConfig tabConfig : configList){
style = tabConfig.updateTabConfig();
for(CustomStyleUIConfigProvider tabConfig : configList){
style = tabConfig.updateConfig();
}
return style;
@ -426,8 +426,8 @@ public class StylePane extends BasicBeanPane<Style> implements ChangeListener {
} 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).tabComponent(StylePane.this));
configList.get(selectedIndex - NEXT_TAB_INDEX).populateTabConfig(StylePane.this.editing);
tabbedPane.setComponentAt(selectedIndex, configList.get(selectedIndex - NEXT_TAB_INDEX).uiComponent(StylePane.this));
configList.get(selectedIndex - NEXT_TAB_INDEX).populateConfig(StylePane.this.editing);
}
}
updatePreviewArea();

22
designer-realize/src/main/java/com/fr/design/style/preference/PreferenceConfigProvider.java

@ -1,22 +0,0 @@
package com.fr.design.style.preference;
import com.fr.stable.fun.mark.Mutable;
import java.util.List;
/**
* Created by kerry on 2019-11-04
*/
public interface PreferenceConfigProvider extends Mutable {
String XML_TAG = "PreferenceConfigProvider";
int CURRENT_LEVEL = 1;
/**
* 获取tab配置项
* @return tab配置项
*/
List<PreferenceTabConfig> getConfigList();
}

32
designer-realize/src/main/java/com/fr/design/style/preference/PreferenceTabConfig.java

@ -1,32 +0,0 @@
package com.fr.design.style.preference;
import com.fr.base.Style;
import javax.swing.JComponent;
import javax.swing.event.ChangeListener;
/**
* Created by kerry on 2019-11-04
*/
public interface PreferenceTabConfig {
/**
* @return tab的标题
*/
String tabName();
/**
* @param changeListener 需要添加的listener
* @return tab对应的component
*/
JComponent tabComponent(ChangeListener changeListener);
/**
* @return 更新后的样式
*/
Style updateTabConfig();
/**
* @param style 待渲染的样式
*/
void populateTabConfig(Style style);
}

29
designer-realize/src/main/java/com/fr/design/style/preference/impl/AbstractPreferenceConfigProvider.java

@ -1,29 +0,0 @@
package com.fr.design.style.preference.impl;
import com.fr.design.style.preference.PreferenceConfigProvider;
import com.fr.design.style.preference.PreferenceTabConfig;
import com.fr.stable.fun.mark.API;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kerry on 2019-11-04
*/
@API(level = PreferenceConfigProvider.CURRENT_LEVEL)
public abstract class AbstractPreferenceConfigProvider implements PreferenceConfigProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public List<PreferenceTabConfig> getConfigList() {
return new ArrayList<PreferenceTabConfig>();
}
}

33
designer-realize/src/main/java/com/fr/design/style/preference/impl/AbstractPreferenceTabConfig.java

@ -1,33 +0,0 @@
package com.fr.design.style.preference.impl;
import com.fr.base.Style;
import com.fr.design.style.preference.PreferenceTabConfig;
import com.fr.stable.StringUtils;
import javax.swing.JComponent;
import javax.swing.event.ChangeListener;
/**
* Created by kerry on 2019-11-04
*/
public abstract class AbstractPreferenceTabConfig implements PreferenceTabConfig {
@Override
public String tabName() {
return StringUtils.EMPTY;
}
@Override
public JComponent tabComponent(ChangeListener changeListener) {
return null;
}
@Override
public Style updateTabConfig() {
return null;
}
@Override
public void populateTabConfig(Style style) {
}
}
Loading…
Cancel
Save