01: /*
02: * Project: AMODA - Abstract Modeled Application
03: * Class: de.gulden.framework.amoda.environment.gui.behaviour.CommandExportView
04: * Version: snapshot-beautyj-1.1
05: *
06: * Date: 2004-09-29
07: *
08: * This is a snapshot version of the AMODA 0.2 development branch,
09: * it is not released as a seperate version.
10: * For AMODA, see http://amoda.berlios.de/.
11: *
12: * This is licensed under the GNU Lesser General Public License (LGPL)
13: * and comes with NO WARRANTY.
14: *
15: * Author: Jens Gulden
16: * Email: amoda@jensgulden.de
17: */
18:
19: package de.gulden.framework.amoda.environment.gui.behaviour;
20:
21: import de.gulden.framework.amoda.generic.behaviour.GenericCommand;
22: import java.util.*;
23:
24: /**
25: * Class CommandExportView.
26: *
27: * @author Jens Gulden
28: * @version snapshot-beautyj-1.1
29: */
30: public class CommandExportView extends GenericCommand {
31:
32: // ------------------------------------------------------------------------
33: // --- method ---
34: // ------------------------------------------------------------------------
35:
36: public void perform() {
37: de.gulden.framework.amoda.model.document.DocumentView view = getApplication()
38: .getWorkspace().getActiveView();
39: if (view != null) {
40: getApplication().message("*** TO DO ***");
41: /*
42: FileDialogGraphicExport fileDialogGraphicExport=getWorkspace().getEditor().getFileDialogGraphicExport();
43: File file=fileDialogGraphicExport.ask();
44: String suffix=fileDialogGraphicExport.filterSuffix();
45: if (file!=null) {
46: if (suffix!=null) {
47: try {
48: FileOutputStream out=new FileOutputStream(file);
49: // create offline image buffer
50:
51: //changed by brieger
52: //Breite aller visible Actors bestimmen, um das zu exportierende Bild dementsprechend gross zu machen
53: int width = 0;
54: Vector actors = visibleWorkflowModel.getVisibleActors();
55: for (int i=0; i<actors.size(); i++) {
56: width = width + ((VisibleActor)actors.elementAt(i)).getWidth();
57: }
58:
59: Image image=panel.createImage(width, panel.getHeight());
60: // and paint model on it
61: getVisibleWorkflowModel().paintNoGrid(image.getGraphics());
62: ParameterBlock pb = new ParameterBlock();
63: pb.add(image);
64: PlanarImage img = (PlanarImage)JAI.create("awtImage", pb);
65: if ( "gif".equalsIgnoreCase(suffix) ) {
66: GifEncoder encoder = new GifEncoder(image, out);
67: encoder.encode();
68: }
69: else if ( "jpg".equalsIgnoreCase(suffix))
70: JAI.create("encode", img, out, "JPEG", null);
71: else if ( "bmp".equalsIgnoreCase(suffix))
72: JAI.create("encode", img, out, "BMP", null);
73: else if ( "tif".equalsIgnoreCase(suffix))
74: JAI.create("encode", img, out, "TIFF", null);
75: else if ( "png".equalsIgnoreCase(suffix))
76: JAI.create("encode", img, out, "PNG", null);
77: out.flush();
78: out.close();
79: }
80: catch (Exception e) {
81: getWorkspace().getEditor().error("Fehler beim Grafik-Export: "+e.getMessage());
82: }
83: } else {
84: getWorkspace().getEditor().error("Fehler beim Exportieren: Kein Dateityp gew?hlt.");
85: }
86: }
87: */
88:
89: } else {
90: getApplication()
91: .message(
92: "This requires a currently selected document view.");
93: }
94: }
95:
96: } // end CommandExportView
|