Browse Source

REPORT-92628 控件支持主题切换-部分控件未实现主题样式设置

newui
John.Ying-应志浩 2 years ago
parent
commit
cab83ef74b
  1. 16
      designer-base/src/main/java/com/fr/design/widget/btn/ButtonConstants.java
  2. 62
      designer-base/src/main/java/com/fr/design/widget/btn/ButtonDetailPane.java
  3. 151
      designer-form/src/main/java/com/fr/design/widget/btn/ButtonDetailPane.java
  4. 11
      designer-form/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java
  5. 15
      designer-form/src/main/java/com/fr/design/widget/ui/btn/FormSubmitButtonDetailPane.java
  6. 20
      designer-realize/src/main/java/com/fr/design/widget/ui/btn/AppendRowButtonDefinePane.java
  7. 17
      designer-realize/src/main/java/com/fr/design/widget/ui/btn/DefaultButtonDetailPane.java
  8. 17
      designer-realize/src/main/java/com/fr/design/widget/ui/btn/DeleteRowButtonDefinePane.java
  9. 19
      designer-realize/src/main/java/com/fr/design/widget/ui/btn/FreeButtonDetailPane.java

16
designer-base/src/main/java/com/fr/design/widget/btn/ButtonConstants.java

@ -44,4 +44,20 @@ public class ButtonConstants {
StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class),
StableFactory.getMarkedClass(BridgeMark.TREE_NODE_TOGGLE_BUTTON, Widget.class)
};
public static final String[] TYPES4BUTTON4STRONGEST_CONTROL = {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Common"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Insert_Row"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Delete_Row"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Type_Parameter_Submit"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_TreeNode")
};
public static final Class[] CLASSES4BUTTON4STRONGEST_CONTROL = {
Button.class,
StableFactory.getMarkedClass(BridgeMark.APPEND_ROW_BUTTON, Widget.class),
StableFactory.getMarkedClass(BridgeMark.DELETE_ROW_BUTTON, Widget.class),
StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class),
StableFactory.getMarkedClass(BridgeMark.TREE_NODE_TOGGLE_BUTTON, Widget.class)
};
}

62
designer-base/src/main/java/com/fr/design/widget/btn/ButtonDetailPane.java

@ -1,62 +0,0 @@
package com.fr.design.widget.btn;
import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.dialog.BasicPane;
import com.fr.design.widget.btn.ButtonConstants;
import com.fr.form.ui.Button;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-15
* Time : 下午6:21
*/
public abstract class ButtonDetailPane<T extends Button> extends BasicPane {
private List<ChangeListener> ls = new ArrayList<ChangeListener>();
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Button");
}
public void populate(T button) {
}
public abstract T createButton();
public abstract T update();
protected void typeChange(Object obj) {
for (int i = 0, len = ls.size(); i < len; i++) {
ls.get(i).stateChanged(new ChangeEvent(obj));
}
}
public void addTypeChangeListener(ChangeListener l) {
ls.add(l);
}
public abstract Class classType();
protected DictionaryComboBox createButtonTypeComboBox() {
final DictionaryComboBox dictionaryComboBox = new DictionaryComboBox(ButtonConstants.CLASSES4BUTTON, ButtonConstants.TYPES4BUTTON, false);
dictionaryComboBox.setSelectedItem(classType());
dictionaryComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
typeChange(dictionaryComboBox.getSelectedItem());
}
});
return dictionaryComboBox;
}
}

151
designer-form/src/main/java/com/fr/design/widget/btn/ButtonDetailPane.java

@ -0,0 +1,151 @@
package com.fr.design.widget.btn;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.dialog.BasicPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.form.ui.Button;
import com.fr.general.GeneralContext;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-15
* Time : 下午6:21
*/
public abstract class ButtonDetailPane<T extends Button> extends BasicPane {
private List<ChangeListener> ls = new ArrayList<ChangeListener>();
protected final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
protected JPanel extraPane;
protected boolean containsExtraPane;
protected static double F = TableLayout.FILL;
protected static double P = TableLayout.PREFERRED;
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Button");
}
public void populate(T button) {
}
public abstract T createButton();
public abstract T update();
protected void typeChange(Object obj) {
for (int i = 0, len = ls.size(); i < len; i++) {
ls.get(i).stateChanged(new ChangeEvent(obj));
}
}
public void addTypeChangeListener(ChangeListener l) {
ls.add(l);
}
public abstract Class classType();
protected DictionaryComboBox createButtonTypeComboBox() {
// final DictionaryComboBox dictionaryComboBox = new DictionaryComboBox(ButtonConstants.CLASSES4BUTTON, ButtonConstants.TYPES4BUTTON, false);
// dictionaryComboBox.setSelectedItem(classType());
// dictionaryComboBox.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// typeChange(dictionaryComboBox.getSelectedItem());
// }
// });
// return dictionaryComboBox;
return createButtonTypeComboBox(false);
}
private DictionaryComboBox initDictionaryComboBox(DictionaryComboBox dictionaryComboBox) {
dictionaryComboBox.setSelectedItem(classType());
dictionaryComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
typeChange(dictionaryComboBox.getSelectedItem());
}
});
return dictionaryComboBox;
// return createButtonTypeComboBox();
}
protected DictionaryComboBox createButtonTypeComboBox(Boolean containsExtraPane) {
final DictionaryComboBox dictionaryComboBox;
if (!containsExtraPane) {
dictionaryComboBox = new DictionaryComboBox(ButtonConstants.CLASSES4BUTTON, ButtonConstants.TYPES4BUTTON, false);
} else {
dictionaryComboBox = new DictionaryComboBox(ButtonConstants.CLASSES4BUTTON4STRONGEST_CONTROL, ButtonConstants.TYPES4BUTTON4STRONGEST_CONTROL, false);
}
return initDictionaryComboBox(dictionaryComboBox);
}
protected void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane();
}
protected void refreshExtraAdvancedPane() {
// do nothing
}
protected void refreshExtraAdvancedPane(Class cls) {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<T>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<T> provider : providers) {
if (!provider.accept(cls)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<T> pane : extraPaneList) {
extraPane.add(pane);
}
}
this.containsExtraPane = containsExtraPane;
}
protected void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
protected void insertShortCut(int index, BasicBeanPane<T> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
}

11
designer-base/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java → designer-form/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java

@ -4,6 +4,7 @@ import java.awt.*;
import javax.swing.*;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
@ -42,8 +43,9 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
iconPane = new AccessibleIconEditor();
labelPane.add(iconPane);
Component comp = createCenterPane();
Component[][] n_components = {
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Button_Type")), createButtonTypeComboBox()},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Button_Type")), createButtonTypeComboBox(containsExtraPane)},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField = new UITextField()},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Icon")), iconPane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField = new UITextField()},
@ -52,7 +54,6 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
advancePane.add(panel, BorderLayout.NORTH);
Component comp = createCenterPane();
if(comp != null ) {
advancePane.add(comp,BorderLayout.CENTER);
}
@ -71,6 +72,9 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
iconPane.setValue(button.getIconName());
buttonNameTextField.setText(button.getText());
hotkeysTextField.setText(button.getHotkeys());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(button);
}
}
@Override
@ -79,6 +83,9 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
button.setIconName((String)iconPane.getValue());
button.setText(buttonNameTextField.getText());
button.setHotkeys(hotkeysTextField.getText());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(button);
}
return button;
}
}

15
designer-form/src/main/java/com/fr/design/widget/ui/btn/FormSubmitButtonDetailPane.java

@ -1,5 +1,6 @@
package com.fr.design.widget.ui.btn;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.parameter.FormSubmitButton;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
@ -16,7 +17,14 @@ public class FormSubmitButtonDetailPane extends ButtonWithHotkeysDetailPane<Form
@Override
protected Component createCenterPane() {
return null;
initExtraPane();
Component[][] components = new Component[][]{
new Component[]{extraPane, null}
};
double[] rowSize = {P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
}
@Override
@ -37,4 +45,9 @@ public class FormSubmitButtonDetailPane extends ButtonWithHotkeysDetailPane<Form
public Class classType() {
return FormSubmitButton.class;
}
@Override
protected void refreshExtraAdvancedPane() {
super.refreshExtraAdvancedPane(FormSubmitButton.class);
}
}

20
designer-realize/src/main/java/com/fr/design/widget/ui/btn/AppendRowButtonDefinePane.java

@ -2,11 +2,15 @@ package com.fr.design.widget.ui.btn;
import com.fr.base.IconManager;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.report.web.button.write.AppendRowButton;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
import java.awt.*;
/**
* Created by IntelliJ IDEA.
* Author : Richer
@ -26,7 +30,16 @@ public class AppendRowButtonDefinePane<T extends AppendRowButton> extends Button
@Override
protected Component createCenterPane() {
return defineColumnRowPane = new DefineAppendColumnRowPane();
initExtraPane();
defineColumnRowPane = new DefineAppendColumnRowPane();
Component[][] components = new Component[][]{
new Component[]{defineColumnRowPane, null},
new Component[]{extraPane, null}
};
double[] rowSize = {P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1},{1, 1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
}
@Override
@ -55,4 +68,9 @@ public class AppendRowButtonDefinePane<T extends AppendRowButton> extends Button
public Class classType() {
return AppendRowButton.class;
}
@Override
protected void refreshExtraAdvancedPane() {
super.refreshExtraAdvancedPane(AppendRowButton.class);
}
}

17
designer-realize/src/main/java/com/fr/design/widget/ui/btn/DefaultButtonDetailPane.java

@ -1,5 +1,6 @@
package com.fr.design.widget.ui.btn;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.Button;
import com.fr.form.ui.FreeButton;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
@ -14,6 +15,16 @@ public class DefaultButtonDetailPane extends ButtonWithHotkeysDetailPane<Button>
@Override
protected Component createCenterPane() {
initExtraPane();
if (containsExtraPane) {
Component[][] components = new Component[][]{
new Component[]{extraPane, null}
};
double[] rowSize = {P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
}
return null;
}
@ -27,4 +38,10 @@ public class DefaultButtonDetailPane extends ButtonWithHotkeysDetailPane<Button>
public Class classType() {
return Button.class;
}
@Override
protected void refreshExtraAdvancedPane() {
super.refreshExtraAdvancedPane(Button.class);
}
}

17
designer-realize/src/main/java/com/fr/design/widget/ui/btn/DeleteRowButtonDefinePane.java

@ -2,6 +2,7 @@ package com.fr.design.widget.ui.btn;
import com.fr.base.IconManager;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.report.web.button.write.DeleteRowButton;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
@ -19,7 +20,16 @@ public class DeleteRowButtonDefinePane<T extends DeleteRowButton> extends Button
@Override
protected Component createCenterPane() {
return ddcp = new DefineDeleteColumnRowPane();
initExtraPane();
ddcp = new DefineDeleteColumnRowPane();
Component[][] components = new Component[][]{
new Component[]{ddcp, null},
new Component[]{extraPane, null}
};
double[] rowSize = {P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1},{1, 1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
}
@Override
@ -48,4 +58,9 @@ public class DeleteRowButtonDefinePane<T extends DeleteRowButton> extends Button
ddcp.update(btn);
return btn;
}
@Override
protected void refreshExtraAdvancedPane() {
super.refreshExtraAdvancedPane(DeleteRowButton.class);
}
}

19
designer-realize/src/main/java/com/fr/design/widget/ui/btn/FreeButtonDetailPane.java

@ -1,6 +1,8 @@
package com.fr.design.widget.ui.btn;
import java.awt.Component;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.FreeButton;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
@ -11,9 +13,17 @@ public class FreeButtonDetailPane extends ButtonWithHotkeysDetailPane<FreeButton
@Override
protected Component createCenterPane() {
buttonSytleDefinedPane = new ButtonSytleDefinedPane();
return buttonSytleDefinedPane;
initExtraPane();
Component[][] components = new Component[][]{
new Component[]{buttonSytleDefinedPane, null},
new Component[]{extraPane, null}
};
double[] rowSize = {P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1},{1, 1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
}
@Override
public FreeButton createButton() {
return new FreeButton();
@ -35,4 +45,9 @@ public class FreeButtonDetailPane extends ButtonWithHotkeysDetailPane<FreeButton
public Class classType() {
return FreeButton.class;
}
@Override
protected void refreshExtraAdvancedPane() {
super.refreshExtraAdvancedPane(FreeButton.class);
}
}
Loading…
Cancel
Save