Revision 33420 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/layout/fframes/FFrameText.java
FFrameText.java | ||
---|---|---|
48 | 48 |
import java.awt.Color; |
49 | 49 |
import java.awt.Font; |
50 | 50 |
import java.awt.Graphics2D; |
51 |
import java.awt.Rectangle; |
|
51 | 52 |
import java.awt.font.FontRenderContext; |
52 | 53 |
import java.awt.font.TextLayout; |
53 | 54 |
import java.awt.geom.AffineTransform; |
... | ... | |
63 | 64 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
64 | 65 |
import org.gvsig.compat.print.PrintAttributes; |
65 | 66 |
import org.gvsig.fmap.geom.Geometry; |
67 |
import org.gvsig.tools.ToolsLocator; |
|
68 |
import org.gvsig.tools.dynobject.DynStruct; |
|
69 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
70 |
import org.gvsig.tools.persistence.PersistentState; |
|
71 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
66 | 72 |
import org.gvsig.utils.StringUtilities; |
67 | 73 |
import org.gvsig.utils.XMLEntity; |
68 | 74 |
|
... | ... | |
74 | 80 |
* @author Vicente Caballero Navarro |
75 | 81 |
*/ |
76 | 82 |
public class FFrameText extends FFrame { |
77 |
/** Localizaci?n del texto. */ |
|
83 |
public static final String PERSISTENCE_DEFINITION_NAME = "FFrameText"; |
|
84 |
|
|
85 |
private static final String S_FIELD = "s"; |
|
86 |
private static final String ISFIXED_FIELD = "isFixed"; |
|
87 |
private static final String FONT_FIELD = "font"; |
|
88 |
private static final String POS_FIELD = "pos"; |
|
89 |
private static final String TEXTCOLOR_FIELD = "textColor"; |
|
90 |
private static final String TRANSITIONPIXELSMILIMETERS_FIELD = "transicionPixelsMilimetros"; |
|
91 |
private static final String CELLPADDING_FIELD = "cellPadding"; |
|
92 |
private static final String FONTSIZE_FIELD = "fontSize"; |
|
93 |
private static final String FIXEDFONTSIZE_FIELD = "fixedFontSize"; |
|
94 |
private static final String SURROUNDED_FIELD = "surrounded"; |
|
95 |
private static final String HASTITLE_FIELD = "hasTitle"; |
|
96 |
private static final String TITLE_FIELD = "title"; |
|
97 |
private static final String TITLESIZE_FIELD = "titleSize"; |
|
98 |
private static final String FRAMEBORDERSIZE_FIELD = "frameBorderSize"; |
|
99 |
private static final String FRAMECOLOR_FIELD = "frameColor"; |
|
100 |
private static final String TITLECOLOR_FIELD = "titleColor"; |
|
101 |
|
|
102 |
/** Localizaci?n del texto. */ |
|
78 | 103 |
public static final int LEFT = 0; |
79 | 104 |
public static final int CENTER = 1; |
80 | 105 |
public static final int RIGTH = 2; |
... | ... | |
800 | 825 |
public IFFrameDialog getPropertyDialog() { |
801 | 826 |
return new FFrameTextDialog(getLayout(),this); |
802 | 827 |
} |
828 |
|
|
829 |
public static void registerPersistent() { |
|
830 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
831 |
if( manager.getDefinition(PERSISTENCE_DEFINITION_NAME)==null ) { |
|
832 |
DynStruct definition = manager.addDefinition( |
|
833 |
FFrameText.class, |
|
834 |
PERSISTENCE_DEFINITION_NAME, |
|
835 |
"FFrameText persistence definition", |
|
836 |
null, |
|
837 |
null |
|
838 |
); |
|
839 |
|
|
840 |
definition.extend(manager.getDefinition(FFrame.PERSISTENCE_DEFINITION_NAME)); |
|
841 |
|
|
842 |
definition.addDynField(S_FIELD).setClassOfValue(Rectangle.class).setMandatory(true); |
|
843 |
definition.addDynFieldBoolean(ISFIXED_FIELD).setMandatory(true); |
|
844 |
definition.addDynField(FONT_FIELD).setClassOfValue(Font.class).setMandatory(true); |
|
845 |
definition.addDynFieldInt(POS_FIELD).setMandatory(true); |
|
846 |
definition.addDynField(TEXTCOLOR_FIELD).setClassOfValue(Color.class).setMandatory(true); |
|
847 |
definition.addDynFieldBoolean(TRANSITIONPIXELSMILIMETERS_FIELD).setMandatory(true); |
|
848 |
definition.addDynFieldDouble(CELLPADDING_FIELD).setMandatory(true); |
|
849 |
definition.addDynFieldInt(FONTSIZE_FIELD).setMandatory(true); |
|
850 |
definition.addDynFieldBoolean(FIXEDFONTSIZE_FIELD).setMandatory(true); |
|
851 |
definition.addDynFieldBoolean(SURROUNDED_FIELD).setMandatory(true); |
|
852 |
definition.addDynFieldBoolean(HASTITLE_FIELD).setMandatory(true); |
|
853 |
definition.addDynFieldString(TITLE_FIELD).setMandatory(true); |
|
854 |
definition.addDynFieldInt(TITLESIZE_FIELD).setMandatory(true); |
|
855 |
definition.addDynFieldDouble(FRAMEBORDERSIZE_FIELD).setMandatory(true); |
|
856 |
definition.addDynField(FRAMECOLOR_FIELD).setClassOfValue(Color.class).setClassOfValue(Font.class).setMandatory(true); |
|
857 |
definition.addDynField(TITLECOLOR_FIELD).setClassOfValue(Color.class).setMandatory(true); |
|
858 |
} |
|
859 |
} |
|
860 |
|
|
861 |
@Override |
|
862 |
public void loadFromState(PersistentState state) |
|
863 |
throws PersistenceException { |
|
864 |
super.loadFromState(state); |
|
865 |
s = (Rectangle)state.get(S_FIELD); |
|
866 |
m_isFixed = state.getBoolean(ISFIXED_FIELD); |
|
867 |
m_f = (Font)state.get(FONT_FIELD); |
|
868 |
m_pos = state.getInt(POS_FIELD); |
|
869 |
textColor = (Color)state.get(TEXTCOLOR_FIELD); |
|
870 |
transicionPixelsMilimetros = state.getBoolean(TRANSITIONPIXELSMILIMETERS_FIELD); |
|
871 |
cellPadding = state.getDouble(CELLPADDING_FIELD); |
|
872 |
fontSize = state.getInt(FONTSIZE_FIELD); |
|
873 |
fixedFontSize = state.getBoolean(FIXEDFONTSIZE_FIELD); |
|
874 |
surrounded = state.getBoolean(SURROUNDED_FIELD); |
|
875 |
hasTitle = state.getBoolean(HASTITLE_FIELD); |
|
876 |
title = state.getString(TITLE_FIELD); |
|
877 |
titleSize = state.getInt(TITLESIZE_FIELD); |
|
878 |
frameBorderSize = state.getDouble(FRAMEBORDERSIZE_FIELD); |
|
879 |
frameColor = (Color)state.get(FRAMECOLOR_FIELD); |
|
880 |
titleColor =(Color) state.get(TITLECOLOR_FIELD); |
|
881 |
} |
|
882 |
|
|
883 |
@Override |
|
884 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
885 |
super.saveToState(state); |
|
886 |
state.set(S_FIELD, s); |
|
887 |
state.set(ISFIXED_FIELD, m_isFixed); |
|
888 |
state.set(FONT_FIELD, m_f); |
|
889 |
state.set(POS_FIELD, m_pos); |
|
890 |
state.set(TEXTCOLOR_FIELD, textColor); |
|
891 |
state.set(TRANSITIONPIXELSMILIMETERS_FIELD, transicionPixelsMilimetros); |
|
892 |
state.set(CELLPADDING_FIELD, cellPadding); |
|
893 |
state.set(FONTSIZE_FIELD, fontSize); |
|
894 |
state.set(FIXEDFONTSIZE_FIELD, fixedFontSize); |
|
895 |
state.set(SURROUNDED_FIELD, surrounded); |
|
896 |
state.set(HASTITLE_FIELD, hasTitle); |
|
897 |
state.set(TITLE_FIELD, title); |
|
898 |
state.set(TITLESIZE_FIELD, titleSize); |
|
899 |
state.set(FRAMEBORDERSIZE_FIELD, frameBorderSize); |
|
900 |
state.set(FRAMECOLOR_FIELD, frameColor); |
|
901 |
state.set(TITLECOLOR_FIELD, titleColor); |
|
902 |
} |
|
803 | 903 |
} |
Also available in: Unified diff