KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > actions > ActualSize


1 /*
2  * Authors:
3  * Stefanovic Nenad chupo@iis.ns.ac.yu
4  * Bojanic Sasa sasaboy@neobee.net
5  * Puskas Vladimir vpuskas@eunet.yu
6  * Pilipovic Goran zboniek@uns.ac.yu
7  *
8  */

9
10 package org.enhydra.jawe.actions;
11
12 import org.enhydra.jawe.*;
13 import org.enhydra.jawe.xml.*;
14 import org.enhydra.jawe.xml.elements.*;
15 import org.enhydra.jawe.xml.panels.*;
16 import java.awt.Dimension JavaDoc;
17
18 import java.awt.event.ActionEvent JavaDoc;
19
20 /**
21  * Set the graph scale to 100%.
22  */

23 public class ActualSize extends ActionBase {
24
25    public ActualSize (ProcessEditor pe) {
26       super(pe);
27    }
28
29    public void actionPerformed(ActionEvent JavaDoc e) {
30       double curScale=editor.getGraph().getScale();
31       try {
32          Dimension JavaDoc prefSize=editor.getGraph().getSize();
33          prefSize.width=(int)(prefSize.width/curScale);
34          prefSize.height=(int)(prefSize.height/curScale);
35          editor.getGraph().setPreferredSize(prefSize);
36          editor.getGraph().setPreferredSize(editor.getGraph().getWorkflowManager().getGraphsPreferredSize());
37          //setResizeAction(null);
38
} catch (Exception JavaDoc ex) {}
39       editor.setScale(1);
40       if (editor.getGraph().getSelectionCell() != null) {
41          editor.getGraph().scrollCellToVisible(editor.getGraph().getSelectionCell());
42       }
43
44    }
45 }
46
Popular Tags