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