@ -4,35 +4,33 @@
package com.fr.design.mainframe.widget.accessibles ;
package com.fr.design.mainframe.widget.accessibles ;
import com.fr.design.Exception.ValidationException ;
import com.fr.design.designer.properties.Decoder ;
import com.fr.design.designer.properties.Encoder ;
import com.fr.design.gui.xpane.PredefinedComponentStyleSettingPane ;
import com.fr.design.mainframe.widget.editors.ITextComponent ;
import com.fr.design.mainframe.widget.editors.ITextComponent ;
import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer ;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer ;
import com.fr.design.mainframe.widget.wrappers.LayoutBorderStyleWrapper ;
import com.fr.design.dialog.BasicDialog ;
import com.fr.design.dialog.BasicDialog ;
import com.fr.design.dialog.DialogActionAdapter ;
import com.fr.design.dialog.DialogActionAdapter ;
import com.fr.design.widget.ui.designer.layout.ComponentStyle ;
import com.fr.design.gui.xpane.LayoutBorderPane ;
import com.fr.form.ui.LayoutBorderStyle ;
import javax.swing.SwingUtilities ;
import javax.swing.* ;
import java.awt.Dimension ;
import java.awt.* ;
public class AccessibleWLayoutBorderStyleEditor extends UneditableAccessibleEditor {
public class AccessibleWLayoutBorderStyleEditor extends UneditableAccessibleEditor {
private PredefinedComponentStyleSetting Pane borderPane ;
private LayoutBorder Pane borderPane ;
public AccessibleWLayoutBorderStyleEditor ( ) {
public AccessibleWLayoutBorderStyleEditor ( ) {
super ( new Component StyleWrapper( ) ) ;
super ( new LayoutBorder StyleWrapper( ) ) ;
}
}
@Override
@Override
protected ITextComponent createTextField ( ) {
protected ITextComponent createTextField ( ) {
return new RendererField ( new Component StyleRenderer( ) ) ;
return new RendererField ( new LayoutBorder StyleRenderer( ) ) ;
}
}
@Override
@Override
protected void showEditorPane ( ) {
protected void showEditorPane ( ) {
if ( borderPane = = null ) {
if ( borderPane = = null ) {
borderPane = new PredefinedComponentStyleSetting Pane( ) ;
borderPane = new LayoutBorder Pane( ) ;
borderPane . setPreferredSize ( new Dimension ( 600 , 400 ) ) ;
borderPane . setPreferredSize ( new Dimension ( 600 , 400 ) ) ;
}
}
BasicDialog dlg = borderPane . showWindow ( SwingUtilities . getWindowAncestor ( this ) ) ;
BasicDialog dlg = borderPane . showWindow ( SwingUtilities . getWindowAncestor ( this ) ) ;
@ -40,62 +38,11 @@ public class AccessibleWLayoutBorderStyleEditor extends UneditableAccessibleEdit
@Override
@Override
public void doOk ( ) {
public void doOk ( ) {
setValue ( borderPane . updateBean ( ) ) ;
setValue ( borderPane . update ( ) ) ;
fireStateChanged ( ) ;
fireStateChanged ( ) ;
}
}
} ) ;
} ) ;
borderPane . populateBean ( ( ComponentStyle ) getValue ( ) ) ;
borderPane . populate ( ( LayoutBorderStyle ) getValue ( ) ) ;
dlg . setVisible ( true ) ;
dlg . setVisible ( true ) ;
}
}
private static class ComponentStyleWrapper implements Encoder , Decoder {
public ComponentStyleWrapper ( ) {
}
/ * *
* 将属性转化成字符串
*
* @param v 属性对象
* @return 字符串
* /
public String encode ( Object v ) {
if ( v = = null ) {
return null ;
}
ComponentStyle style = ( ComponentStyle ) v ;
//todo
return "标准" ;
}
/ * *
* 将字符串转化成属性
*
* @param txt 字符串
* @return 属性对象
* /
public Object decode ( String txt ) {
return null ;
}
/ * *
* 符合规则
*
* @param txt 字符串
* @throws ValidationException 抛错
* /
public void validate ( String txt ) throws ValidationException {
}
}
private static class ComponentStyleRenderer extends EncoderCellRenderer {
public ComponentStyleRenderer ( ) {
super ( new ComponentStyleWrapper ( ) ) ;
}
}
}
}