Browse Source

REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义

new-design
Bruce.Deng 2 years ago
parent
commit
2be154b2ef
  1. 33
      designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java

33
designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java

@ -18,6 +18,7 @@ import com.fr.general.GeneralContext;
import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import org.jetbrains.annotations.NotNull;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -91,18 +92,21 @@ public abstract class ButtonDefinePane<T extends Button> extends AbstractDataMod
rowSize = new double[]{p, p, p, p, p}; rowSize = new double[]{p, p, p, p, p};
columnSize = new double[]{p, f}; columnSize = new double[]{p, f};
rowCount = new int[][]{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; rowCount = new int[][]{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
n_components = new Component[][]{ n_components = getExtraAdvancedComponents(panel);
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")), iconPane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField},
{panel, null}
};
} else { } else {
rowSize = new double[]{p, p, p, p, p, p, p, p}; rowSize = new double[]{p, p, p, p, p, p, p, p};
columnSize = new double[]{p, f}; columnSize = new double[]{p, f};
rowCount = new int[][]{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; rowCount = new int[][]{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
n_components = new Component[][]{ n_components = getAdvancedComponents(backgroundCompPane, frFont);
}
hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ","));
extraPane = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
extraPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
@NotNull
private Component[][] getAdvancedComponents(Component[] backgroundCompPane, Component[] frFont) {
return new Component[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField},
backgroundCompPane, backgroundCompPane,
@ -111,9 +115,16 @@ public abstract class ButtonDefinePane<T extends Button> extends AbstractDataMod
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField} {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField}
}; };
} }
hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ","));
extraPane = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); @NotNull
extraPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); private Component[][] getExtraAdvancedComponents(JPanel panel) {
return new Component[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")), iconPane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField},
{panel, null}
};
} }
protected void initPluginListener() { protected void initPluginListener() {

Loading…
Cancel
Save