You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
3.1 KiB
85 lines
3.1 KiB
1 year ago
|
package com.fr.widgettheme.theme.edit;
|
||
|
|
||
|
import com.fr.base.theme.TemplateTheme;
|
||
|
import com.fr.base.theme.settings.AbstractThemedParamContainerStyle;
|
||
|
import com.fr.base.theme.settings.DefaultThemedParamContainerStyle;
|
||
|
import com.fr.widgettheme.theme.widget.style.ThemedParamContainerStyle;
|
||
|
import com.fr.design.beans.BasicBeanPane;
|
||
|
import com.fr.design.designer.IntervalConstants;
|
||
|
import com.fr.design.gui.ilable.UILabel;
|
||
|
import com.fr.design.i18n.Toolkit;
|
||
|
import com.fr.design.layout.FRGUIPaneFactory;
|
||
|
import com.fr.design.layout.TableLayout;
|
||
|
import com.fr.design.layout.TableLayoutHelper;
|
||
|
|
||
|
import javax.swing.BorderFactory;
|
||
|
import javax.swing.JPanel;
|
||
|
import java.awt.BorderLayout;
|
||
|
import java.awt.Component;
|
||
|
|
||
|
/**
|
||
|
* 参数面板样式编辑pane
|
||
|
*
|
||
|
* @author Bruce.Deng
|
||
|
* @since 11.0
|
||
|
* Created on 2022/12/16
|
||
|
*/
|
||
|
public class ParamContainerStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<T> {
|
||
|
public static final int LABEL_WIDTH = 60;
|
||
|
public static final int SETTING_WIDTH = 193;
|
||
|
|
||
|
private final ParamContainerBackgroundPane backgroundPane;
|
||
|
|
||
|
public ParamContainerStyleEditPane() {
|
||
|
backgroundPane = new ParamContainerBackgroundPane();
|
||
|
|
||
|
double p = TableLayout.PREFERRED;
|
||
|
|
||
|
JPanel uiLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
|
||
|
uiLabelPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Background")), BorderLayout.NORTH);
|
||
|
uiLabelPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
|
||
|
JPanel backgroundLabeledPane = TableLayoutHelper.createCommonTableLayoutPane(
|
||
|
new Component[][]{ new Component[] { uiLabelPane, backgroundPane } },
|
||
|
new double[] { p }, new double[] { LABEL_WIDTH, SETTING_WIDTH}, IntervalConstants.INTERVAL_L1
|
||
|
);
|
||
|
backgroundLabeledPane.setBorder(BorderFactory.createEmptyBorder(
|
||
|
IntervalConstants.INTERVAL_L1,
|
||
|
IntervalConstants.INTERVAL_L1,
|
||
|
IntervalConstants.INTERVAL_L1,
|
||
|
IntervalConstants.INTERVAL_L1
|
||
|
));
|
||
|
this.add(backgroundLabeledPane);
|
||
|
setBorder(BorderFactory.createEmptyBorder());
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void populateBean(T t) {
|
||
|
AbstractThemedParamContainerStyle paramContainerStyle = t.getParamContainerStyle();
|
||
|
if (paramContainerStyle == null || paramContainerStyle instanceof DefaultThemedParamContainerStyle) {
|
||
|
paramContainerStyle = new ThemedParamContainerStyle();
|
||
|
t.setParamContainerStyle(paramContainerStyle);
|
||
|
}
|
||
|
backgroundPane.populateBean(paramContainerStyle.getBackground());
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public T updateBean() {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void updateBean(T t) {
|
||
|
ThemedParamContainerStyle style = (ThemedParamContainerStyle) t.getParamContainerStyle();
|
||
|
if (style == null) {
|
||
|
style = new ThemedParamContainerStyle();
|
||
|
t.setParamContainerStyle(style);
|
||
|
}
|
||
|
style.setBackground(backgroundPane.update());
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected String title4PopupWindow() {
|
||
|
return Toolkit.i18nText("Fine-Design_Widget_Theme_ParamContainer");
|
||
|
}
|
||
|
}
|