|
|
|
@ -7,14 +7,10 @@ import com.fr.design.gui.ilable.UILabel;
|
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane; |
|
|
|
|
import com.fr.design.mainframe.predefined.ui.detail.component.ComponentFrameStylePane; |
|
|
|
|
import com.fr.design.mainframe.predefined.ui.detail.component.ComponentMarginStylePane; |
|
|
|
|
import com.fr.design.mainframe.predefined.ui.detail.component.ComponentTitleStylePane; |
|
|
|
|
import com.fr.design.mainframe.predefined.ui.preview.StyleSettingPreviewPane; |
|
|
|
|
import com.fr.design.widget.ui.designer.layout.ComponentStyle; |
|
|
|
|
import com.fr.form.ui.LayoutBorderStyle; |
|
|
|
|
import com.fr.form.ui.NameLayoutBorderStyle; |
|
|
|
|
import com.fr.form.ui.NamePaddingMargin; |
|
|
|
|
import com.fr.form.ui.PaddingMargin; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
@ -23,7 +19,7 @@ import java.awt.FlowLayout;
|
|
|
|
|
/** |
|
|
|
|
* Created by kerry on 2020-09-02 |
|
|
|
|
*/ |
|
|
|
|
public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingPane<ComponentStyle> { |
|
|
|
|
public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingPane<NameLayoutBorderStyle> { |
|
|
|
|
private StyleSettingPane styleSettingPane; |
|
|
|
|
private TinyFormulaPane formulaPane; |
|
|
|
|
|
|
|
|
@ -52,11 +48,10 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void populateBean(ComponentStyle ob) { |
|
|
|
|
public void populateBean(NameLayoutBorderStyle ob) { |
|
|
|
|
this.setPopulating(true); |
|
|
|
|
NameLayoutBorderStyle layoutBorderStyle = ob.getNameLayoutBorderStyle(); |
|
|
|
|
super.populate(layoutBorderStyle); |
|
|
|
|
this.formulaPane.populateBean(layoutBorderStyle.getTitleText().toString()); |
|
|
|
|
super.populate(ob); |
|
|
|
|
this.formulaPane.populateBean(ob.getTitleText().toString()); |
|
|
|
|
styleSettingPane.populateBean(ob); |
|
|
|
|
this.previewPane.refresh(); |
|
|
|
|
this.setPopulating(false); |
|
|
|
@ -64,12 +59,11 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public ComponentStyle updateBean() { |
|
|
|
|
public NameLayoutBorderStyle updateBean() { |
|
|
|
|
if (predefinedRadioBtn.isSelected()) { |
|
|
|
|
NameLayoutBorderStyle layoutBorderStyle = NameLayoutBorderStyle.createPredefinedStyle(getPredefinedStyleName()); |
|
|
|
|
layoutBorderStyle.setTitleText(formulaPane.updateBean()); |
|
|
|
|
return new ComponentStyle(layoutBorderStyle, |
|
|
|
|
NamePaddingMargin.createPredefinedStyle(getPredefinedStyleName())); |
|
|
|
|
return layoutBorderStyle; |
|
|
|
|
} |
|
|
|
|
return styleSettingPane.updateBean(); |
|
|
|
|
} |
|
|
|
@ -79,10 +73,9 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP
|
|
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Style"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class StyleSettingPane extends BasicBeanPane<ComponentStyle> { |
|
|
|
|
class StyleSettingPane extends BasicBeanPane<NameLayoutBorderStyle> { |
|
|
|
|
private ComponentFrameStylePane frameStylePane; |
|
|
|
|
private ComponentTitleStylePane titleStylePane; |
|
|
|
|
private ComponentMarginStylePane marginStylePane; |
|
|
|
|
|
|
|
|
|
public StyleSettingPane() { |
|
|
|
|
initPane(); |
|
|
|
@ -92,53 +85,37 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP
|
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
JPanel frame = FRGUIPaneFactory.createTitledBorderNoGapPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame")); |
|
|
|
|
frameStylePane = new ComponentFrameStylePane(); |
|
|
|
|
frameStylePane.setPreferredSize(new Dimension(233, 183)); |
|
|
|
|
frameStylePane.setPreferredSize(new Dimension(233, 225)); |
|
|
|
|
frame.add(frameStylePane); |
|
|
|
|
|
|
|
|
|
JPanel title = FRGUIPaneFactory.createTitledBorderNoGapPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title")); |
|
|
|
|
titleStylePane = ComponentTitleStylePane.createStyleSettingPane(); |
|
|
|
|
titleStylePane.setPreferredSize(new Dimension(233, 140)); |
|
|
|
|
titleStylePane.setPreferredSize(new Dimension(233, 220)); |
|
|
|
|
title.add(titleStylePane); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel margin = FRGUIPaneFactory.createTitledBorderNoGapPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Base_Margin")); |
|
|
|
|
marginStylePane = new ComponentMarginStylePane(); |
|
|
|
|
marginStylePane.setPreferredSize(new Dimension(233, 100)); |
|
|
|
|
margin.add(marginStylePane); |
|
|
|
|
|
|
|
|
|
this.add(frame, BorderLayout.NORTH); |
|
|
|
|
this.add(title, BorderLayout.CENTER); |
|
|
|
|
this.add(margin, BorderLayout.SOUTH); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void populateBean(ComponentStyle ob) { |
|
|
|
|
public void populateBean(NameLayoutBorderStyle ob) { |
|
|
|
|
PredefinedComponentStyle componentStyle = new PredefinedComponentStyle(); |
|
|
|
|
componentStyle.setBorderStyle(ob.getNameLayoutBorderStyle().createRealStyle()); |
|
|
|
|
PaddingMargin margin = ob.getNamePaddingMargin().createRealStyle(); |
|
|
|
|
componentStyle.setTop(margin.getTop()); |
|
|
|
|
componentStyle.setBottom(margin.getBottom()); |
|
|
|
|
componentStyle.setLeft(margin.getLeft()); |
|
|
|
|
componentStyle.setRight(margin.getRight()); |
|
|
|
|
componentStyle.setBorderStyle(ob.createRealStyle()); |
|
|
|
|
frameStylePane.populate(componentStyle); |
|
|
|
|
titleStylePane.populate(componentStyle); |
|
|
|
|
marginStylePane.populate(componentStyle); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public ComponentStyle updateBean() { |
|
|
|
|
public NameLayoutBorderStyle updateBean() { |
|
|
|
|
PredefinedComponentStyle componentStyle = update(); |
|
|
|
|
NameLayoutBorderStyle nameLayoutBorderStyle = NameLayoutBorderStyle.createCustomStyle(componentStyle.getBorderStyle()); |
|
|
|
|
NamePaddingMargin namePaddingMargin = NamePaddingMargin.createCustomStyle( |
|
|
|
|
new PaddingMargin(componentStyle.getTop(), componentStyle.getLeft(), componentStyle.getBottom(), componentStyle.getRight())); |
|
|
|
|
return new ComponentStyle(nameLayoutBorderStyle, namePaddingMargin); |
|
|
|
|
return nameLayoutBorderStyle; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public PredefinedComponentStyle update() { |
|
|
|
|
PredefinedComponentStyle componentStyle = new PredefinedComponentStyle(); |
|
|
|
|
frameStylePane.update(componentStyle); |
|
|
|
|
titleStylePane.update(componentStyle); |
|
|
|
|
marginStylePane.update(componentStyle); |
|
|
|
|
return componentStyle; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -159,9 +136,8 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void refresh() { |
|
|
|
|
ComponentStyle componentStyle = PredefinedComponentStyleSettingPane.this.updateBean(); |
|
|
|
|
NameLayoutBorderStyle borderStyle = componentStyle.getNameLayoutBorderStyle(); |
|
|
|
|
this.layoutBorderPreviewPane.repaint((LayoutBorderStyle) borderStyle.createRealStyle()); |
|
|
|
|
NameLayoutBorderStyle componentStyle = PredefinedComponentStyleSettingPane.this.updateBean(); |
|
|
|
|
this.layoutBorderPreviewPane.repaint((LayoutBorderStyle) componentStyle.createRealStyle()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|