Revision 147 branches/usability_v2/org.gvsig.app.document.layout.app/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/fframes/FFrame.java
FFrame.java | ||
---|---|---|
34 | 34 |
import java.awt.image.BufferedImage; |
35 | 35 |
|
36 | 36 |
import org.gvsig.andami.PluginServices; |
37 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
37 | 38 |
import org.gvsig.app.project.ProjectManager; |
39 |
import org.gvsig.app.project.documents.Document; |
|
38 | 40 |
import org.gvsig.app.project.documents.layout.Attributes; |
39 | 41 |
import org.gvsig.app.project.documents.layout.DefaultLayoutManager; |
40 | 42 |
import org.gvsig.app.project.documents.layout.FLayoutUtilities; |
41 |
import org.gvsig.app.project.documents.layout.FrameChangedNotification; |
|
43 |
import org.gvsig.app.project.documents.layout.FrameChangedNotificationImpl;
|
|
42 | 44 |
import org.gvsig.app.project.documents.layout.LayoutContext; |
43 | 45 |
import org.gvsig.app.project.documents.layout.LayoutControl; |
46 |
import org.gvsig.app.project.documents.layout.LayoutDocument; |
|
44 | 47 |
import org.gvsig.app.project.documents.layout.LayoutManager; |
45 | 48 |
import org.gvsig.app.project.documents.layout.LayoutNotification; |
46 | 49 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
... | ... | |
72 | 75 |
private static final String ROTATION_FIELD = "rotation"; |
73 | 76 |
private static final String LEVEL_FIELD = "level"; |
74 | 77 |
private static final String NUM_FIELD = "num"; |
75 |
private static final String LAYOUTPANEL_FIELD = "layoutPanel"; |
|
78 |
private static final String DOCUMENT_FIELD = "layoutDocument"; |
|
79 |
private static final String LAYOUT_CONTEXT_FIELD = "layoutContext"; |
|
76 | 80 |
|
77 | 81 |
protected static final Logger LOG = LoggerFactory.getLogger(FFrame.class); |
78 | 82 |
|
... | ... | |
105 | 109 |
|
106 | 110 |
protected LayoutManager layoutManager = null; |
107 | 111 |
private LayoutContext layoutContext = null; |
108 |
private LayoutControl layoutControl = null; |
|
109 |
private LayoutPanel layoutPanel = null; |
|
110 |
|
|
112 |
private Document document = null; |
|
113 |
|
|
111 | 114 |
protected ObservableHelper observers; |
112 | 115 |
|
113 | 116 |
public FFrame() { |
... | ... | |
759 | 762 |
definition.addDynFieldDouble(ROTATION_FIELD).setMandatory(true); |
760 | 763 |
definition.addDynFieldInt(LEVEL_FIELD).setMandatory(true); |
761 | 764 |
definition.addDynFieldInt(NUM_FIELD).setMandatory(true); |
762 |
definition.addDynFieldObject(LAYOUTPANEL_FIELD).setClassOfValue(LayoutPanel.class).setMandatory(false); |
|
765 |
definition.addDynFieldObject(DOCUMENT_FIELD).setClassOfValue(LayoutDocument.class).setMandatory(false); |
|
766 |
definition.addDynFieldObject(LAYOUT_CONTEXT_FIELD).setClassOfValue(LayoutContext.class).setMandatory(false); |
|
763 | 767 |
} |
764 | 768 |
|
765 | 769 |
Attributes.registerPersistent(); |
... | ... | |
787 | 791 |
m_rotation = state.getDouble(ROTATION_FIELD); |
788 | 792 |
level = state.getInt(LEVEL_FIELD); |
789 | 793 |
num = state.getInt(NUM_FIELD); |
790 |
if (state.hasValue(LAYOUTPANEL_FIELD)) {
|
|
791 |
setLayoutPanel((LayoutPanel)state.get(LAYOUTPANEL_FIELD ));
|
|
794 |
if (state.hasValue(DOCUMENT_FIELD)) {
|
|
795 |
setDocument((LayoutDocument)state.get(DOCUMENT_FIELD ));
|
|
792 | 796 |
} |
797 |
if (state.hasValue(LAYOUT_CONTEXT_FIELD)) { |
|
798 |
setLayoutContext((LayoutContext) state.get(LAYOUT_CONTEXT_FIELD)); |
|
799 |
} |
|
793 | 800 |
} |
794 | 801 |
|
795 | 802 |
public void saveToState(PersistentState state) throws PersistenceException { |
... | ... | |
799 | 806 |
state.set(ROTATION_FIELD, getRotation()); |
800 | 807 |
state.set(LEVEL_FIELD, getLevel()); |
801 | 808 |
state.set(NUM_FIELD, num); |
802 |
state.set(LAYOUTPANEL_FIELD, getLayoutPanel()); |
|
809 |
state.set(DOCUMENT_FIELD, getDocument()); |
|
810 |
state.set(LAYOUT_CONTEXT_FIELD, getLayoutContext()); |
|
803 | 811 |
} |
804 | 812 |
|
805 | 813 |
public void addObserver(Observer o) { |
... | ... | |
848 | 856 |
protected void afterRemoved() {} |
849 | 857 |
|
850 | 858 |
public void update(Observable observable, Object notification) { |
851 |
if ((notification != null) && (notification instanceof LayoutNotification)){
|
|
852 |
FrameChangedNotification layoutNotification = (FrameChangedNotification)notification;
|
|
853 |
if (this.equals(layoutNotification.getFrame()) && FrameChangedNotification.FRAME_ADDED.equals(layoutNotification.getType())){ |
|
859 |
if ((notification != null) && (notification instanceof FrameChangedNotificationImpl)){
|
|
860 |
FrameChangedNotificationImpl layoutNotification = (FrameChangedNotificationImpl)notification;
|
|
861 |
if (this.equals(layoutNotification.getFrame()) && FrameChangedNotificationImpl.FRAME_ADDED.equals(layoutNotification.getType())){
|
|
854 | 862 |
afterAdded(); |
855 |
}else if (this.equals(layoutNotification.getFrame()) && FrameChangedNotification.FRAME_ADDING.equals(layoutNotification.getType())){ |
|
863 |
}else if (this.equals(layoutNotification.getFrame()) && FrameChangedNotificationImpl.FRAME_ADDING.equals(layoutNotification.getType())){
|
|
856 | 864 |
beforeAdded(); |
857 |
}else if (this.equals(layoutNotification.getFrame()) && FrameChangedNotification.FRAME_REMOVING.equals(layoutNotification.getType())){ |
|
865 |
}else if (this.equals(layoutNotification.getFrame()) && FrameChangedNotificationImpl.FRAME_REMOVING.equals(layoutNotification.getType())){
|
|
858 | 866 |
beforeRemoved(); |
859 |
}else if (this.equals(layoutNotification.getFrame()) && FrameChangedNotification.FRAME_REMOVED.equals(layoutNotification.getType())){ |
|
867 |
}else if (this.equals(layoutNotification.getFrame()) && FrameChangedNotificationImpl.FRAME_REMOVED.equals(layoutNotification.getType())){
|
|
860 | 868 |
afterRemoved(); |
861 | 869 |
} |
862 | 870 |
} |
863 | 871 |
} |
864 | 872 |
|
865 |
public LayoutPanel getLayoutPanel() { |
|
866 |
return layoutPanel; |
|
867 |
} |
|
868 |
|
|
869 |
public void setLayoutPanel(LayoutPanel layoutPanel) { |
|
870 |
this.layoutPanel = layoutPanel; |
|
871 |
} |
|
872 |
|
|
873 | 873 |
public LayoutContext getLayoutContext() { |
874 | 874 |
return layoutContext; |
875 | 875 |
} |
... | ... | |
878 | 878 |
this.layoutContext = layoutContext; |
879 | 879 |
} |
880 | 880 |
|
881 |
public LayoutControl getLayoutControl() {
|
|
882 |
return layoutControl;
|
|
881 |
public Document getDocument() {
|
|
882 |
return document;
|
|
883 | 883 |
} |
884 | 884 |
|
885 |
public void setLayoutControl(LayoutControl layoutControl) {
|
|
886 |
this.layoutControl = layoutControl;
|
|
885 |
public void setDocument(Document document) {
|
|
886 |
this.document = document;
|
|
887 | 887 |
} |
888 | 888 |
} |
Also available in: Unified diff