Revision 33420 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/layout/fframes/FFrame.java
FFrame.java | ||
---|---|---|
58 | 58 |
|
59 | 59 |
import org.gvsig.andami.PluginServices; |
60 | 60 |
import org.gvsig.andami.messages.NotificationManager; |
61 |
import org.gvsig.app.extension.ProjectExtension; |
|
62 | 61 |
import org.gvsig.app.project.Project; |
63 |
import org.gvsig.app.project.Project; |
|
64 | 62 |
import org.gvsig.app.project.ProjectManager; |
65 | 63 |
import org.gvsig.app.project.documents.exceptions.OpenException; |
66 | 64 |
import org.gvsig.app.project.documents.exceptions.SaveException; |
65 |
import org.gvsig.app.project.documents.layout.Attributes; |
|
67 | 66 |
import org.gvsig.app.project.documents.layout.FLayoutUtilities; |
68 | 67 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
69 | 68 |
import org.gvsig.app.project.documents.layout.gui.dialogs.Tag; |
70 | 69 |
import org.gvsig.tools.ToolsLocator; |
70 |
import org.gvsig.tools.dynobject.DynStruct; |
|
71 | 71 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
72 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
73 |
import org.gvsig.tools.persistence.PersistentState; |
|
74 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
72 | 75 |
import org.gvsig.utils.XMLEntity; |
73 | 76 |
|
74 | 77 |
|
... | ... | |
82 | 85 |
* @author Vicente Caballero Navarro |
83 | 86 |
*/ |
84 | 87 |
public abstract class FFrame implements IFFrame { |
88 |
public static final String PERSISTENCE_DEFINITION_NAME = "FFrame"; |
|
89 |
|
|
90 |
private static final String NAME_FIELD = "name"; |
|
91 |
private static final String X_FIELD = "x"; |
|
92 |
private static final String Y_FIELD = "y"; |
|
93 |
private static final String WIDTH_FIELD = "width"; |
|
94 |
private static final String HEIGHT_FIELD = "height"; |
|
95 |
private static final String SELECTED_FIELD = "selected"; |
|
96 |
private static final String TAG_FIELD = "tag"; |
|
97 |
private static final String ROTATION_FIELD = "rotation"; |
|
98 |
private static final String LEVEL_FIELD = "level"; |
|
99 |
private static final String NUM_FIELD = "num"; |
|
100 |
|
|
85 | 101 |
protected String m_name = "FFrame"; |
86 | 102 |
protected Rectangle2D.Double m_BoundBox = new Rectangle2D.Double(); |
87 | 103 |
private Rectangle2D.Double m_BoundingBox = new Rectangle2D.Double(); |
... | ... | |
892 | 908 |
public FrameFactory getFrameLayoutFactory() { |
893 | 909 |
return factory; |
894 | 910 |
} |
911 |
|
|
912 |
public static void registerPersistent() { |
|
913 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
914 |
if( manager.getDefinition(PERSISTENCE_DEFINITION_NAME)==null ) { |
|
915 |
DynStruct definition = manager.addDefinition( |
|
916 |
FFrame.class, |
|
917 |
PERSISTENCE_DEFINITION_NAME, |
|
918 |
"FFrame persistence definition", |
|
919 |
null, |
|
920 |
null |
|
921 |
); |
|
922 |
|
|
923 |
definition.addDynFieldString(NAME_FIELD).setMandatory(true); |
|
924 |
definition.addDynFieldDouble(X_FIELD).setMandatory(true); |
|
925 |
definition.addDynFieldDouble(Y_FIELD).setMandatory(true); |
|
926 |
definition.addDynFieldDouble(WIDTH_FIELD).setMandatory(true); |
|
927 |
definition.addDynFieldDouble(HEIGHT_FIELD).setMandatory(true); |
|
928 |
|
|
929 |
definition.addDynFieldBoolean(SELECTED_FIELD).setMandatory(true); |
|
930 |
definition.addDynFieldString(TAG_FIELD).setMandatory(true); |
|
931 |
definition.addDynFieldDouble(ROTATION_FIELD).setMandatory(true); |
|
932 |
definition.addDynFieldInt(LEVEL_FIELD).setMandatory(true); |
|
933 |
definition.addDynFieldInt(NUM_FIELD).setMandatory(true); |
|
934 |
} |
|
935 |
|
|
936 |
Attributes.registerPersistent(); |
|
937 |
FFrameBasic.registerPersistent(); |
|
938 |
FFrameGraphics.registerPersistent(); |
|
939 |
FFrameSymbol.registerPersistent(); |
|
940 |
FFrameGrid.registerPersistent(); |
|
941 |
FFrameGroup.registerPersistent(); |
|
942 |
FFrameTable.registerPersistent(); |
|
943 |
FFrameLegend.registerPersistent(); |
|
944 |
FFramePicture.registerPersistent(); |
|
945 |
FFrameNorth.registerPersistent(); |
|
946 |
FFrameScaleBar.registerPersistent(); |
|
947 |
FFrameText.registerPersistent(); |
|
948 |
FFrameView.registerPersistent(); |
|
949 |
FFrameOverView.registerPersistent(); |
|
950 |
} |
|
895 | 951 |
|
952 |
public void loadFromState(PersistentState state) |
|
953 |
throws PersistenceException { |
|
954 |
m_name = state.getString(NAME_FIELD); |
|
955 |
m_BoundBox = new Rectangle2D.Double(state.getDouble(X_FIELD), state.getDouble(Y_FIELD), |
|
956 |
state.getDouble(WIDTH_FIELD), state.getDouble(HEIGHT_FIELD)); |
|
957 |
m_Selected = state.getInt(SELECTED_FIELD); |
|
958 |
tag = state.getString(TAG_FIELD); |
|
959 |
m_rotation = state.getDouble(ROTATION_FIELD); |
|
960 |
level = state.getInt(LEVEL_FIELD); |
|
961 |
num = state.getInt(NUM_FIELD); |
|
962 |
} |
|
963 |
|
|
964 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
965 |
state.set(NAME_FIELD, m_name); |
|
966 |
state.set(X_FIELD, getBoundBox().x); |
|
967 |
state.set(Y_FIELD, getBoundBox().y); |
|
968 |
state.set(WIDTH_FIELD, getBoundBox().y); |
|
969 |
state.set(HEIGHT_FIELD, getBoundBox().y); |
|
970 |
state.set(SELECTED_FIELD, m_Selected); |
|
971 |
state.set(TAG_FIELD, getTag()); |
|
972 |
state.set(ROTATION_FIELD, getRotation()); |
|
973 |
state.set(LEVEL_FIELD, getLevel()); |
|
974 |
state.set(NUM_FIELD, num); |
|
975 |
} |
|
976 |
|
|
896 | 977 |
// public void setPrintingProperties(PrintRequestAttributeSet properties) { |
897 | 978 |
// printingProperties=properties; |
898 | 979 |
// } |
980 |
|
|
981 |
|
|
899 | 982 |
} |
Also available in: Unified diff