KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > swingclient > workflowadmin > actions > ZoomIn


1 package org.enhydra.shark.swingclient.workflowadmin.actions;
2
3 import java.awt.event.*;
4 import java.awt.Dimension JavaDoc;
5
6 import org.enhydra.shark.swingclient.*;
7 import org.enhydra.shark.swingclient.workflowadmin.*;
8
9 /**
10 * Zoom in (for 15%)
11 */

12 public class ZoomIn extends ActionBase {
13
14    public ZoomIn (ProcessViewer pv) {
15       super(pv);
16    }
17
18    public void actionPerformed(ActionEvent e) {
19       ProcessViewer pv=(ProcessViewer)actionPanel;
20       try {
21          pv.getCurrentGraph();
22          pv.setScale(pv.getCurrentGraph().getScale()/0.85);
23          Dimension JavaDoc prefSize=pv.getCurrentGraph().getSize();
24          prefSize.width=(int)(prefSize.width/0.85);
25          prefSize.height=(int)(prefSize.height/0.85);
26          pv.getCurrentGraph().setPreferredSize(prefSize);
27          // With JGraph3.4.1 this causes problems
28
/*if (pv.getCurrentGraph().getSelectionCell() != null) {
29             pv.getCurrentGraph().scrollCellToVisible(pv.getCurrentGraph().getSelectionCell());
30           }*/

31       } catch (Exception JavaDoc ex) {}
32    }
33 }
34
Popular Tags