KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > corbaclient > workflowadmin > actions > ActualSize


1 package org.enhydra.shark.corbaclient.workflowadmin.actions;
2
3 import java.awt.event.*;
4 import java.awt.Dimension JavaDoc;
5
6 import org.enhydra.shark.corbaclient.*;
7 import org.enhydra.shark.corbaclient.workflowadmin.*;
8
9 /**
10 * Set the graph scale to 100%.
11 */

12 public class ActualSize extends ActionBase {
13
14    public ActualSize (ProcessViewer pv) {
15       super(pv);
16    }
17
18    public void actionPerformed(ActionEvent e) {
19       ProcessViewer pv=(ProcessViewer)actionPanel;
20       try {
21          double curScale=pv.getCurrentGraph().getScale();
22          Dimension JavaDoc prefSize=pv.getCurrentGraph().getSize();
23          prefSize.width=(int)(prefSize.width/curScale);
24          prefSize.height=(int)(prefSize.height/curScale);
25          pv.getCurrentGraph().setPreferredSize(prefSize);
26          pv.getCurrentGraph().setPreferredSize(pv.getCurrentGraph().getWorkflowManager().getGraphsPreferredSize());
27          //setResizeAction(null);
28
pv.setScale(1);
29          if (pv.getCurrentGraph().getSelectionCell() != null) {
30             pv.getCurrentGraph().scrollCellToVisible(pv.getCurrentGraph().getSelectionCell());
31          }
32       } catch (Exception JavaDoc ex) {}
33    }
34 }
35
Popular Tags