1 23 24 package org.objectweb.fractal.gui.graph.control; 25 26 import org.objectweb.fractal.api.control.BindingController; 27 28 import org.objectweb.fractal.gui.graph.model.Display; 29 import org.objectweb.fractal.gui.graph.model.DisplayListener; 30 import org.objectweb.fractal.gui.graph.model.Rect; 31 import org.objectweb.fractal.swing.AbstractAction; 32 33 import java.awt.event.ActionEvent ; 34 import java.net.URL ; 35 36 import javax.swing.ImageIcon ; 37 import javax.swing.KeyStroke ; 38 39 45 46 public class AntiAliasAction extends AbstractAction implements 47 DisplayListener, 48 BindingController 49 { 50 51 56 57 public final static String DISPLAY_BINDING = "display"; 58 59 62 63 private Display display; 64 65 68 69 public AntiAliasAction () { 70 putValue(NAME, "Antialiasing"); 71 URL url = getClass().getResource( 72 "/org/objectweb/fractal/gui/resources/empty.gif"); 73 putValue(SMALL_ICON, new ImageIcon (url)); 74 putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("alt L")); 75 } 76 77 81 public String [] listFc () { 82 return new String [] { DISPLAY_BINDING }; 83 } 84 85 public Object lookupFc (final String clientItfName) { 86 if (DISPLAY_BINDING.equals(clientItfName)) { 87 return display; 88 } 89 return null; 90 } 91 92 public void bindFc ( 93 final String clientItfName, 94 final Object serverItf) 95 { 96 if (DISPLAY_BINDING.equals(clientItfName)) { 97 display = (Display)serverItf; 98 } 99 } 100 101 public void unbindFc (final String clientItfName) { 102 if (DISPLAY_BINDING.equals(clientItfName)) { 103 display = null; 104 } 105 } 106 107 111 public void displayedAreaChanged (final Rect oldValue) { 112 } 114 115 public void antialiasingChanged () { 116 if (display.isAntialiasing()) { 117 putValue(NAME, "Aliasing"); 118 } else { 119 putValue(NAME, "Antialiasing"); 120 } 121 } 122 123 public void maxDepthChanged () { 124 } 126 127 public void itfNameDisplayModeChanged () { 128 } 130 131 135 public void actionPerformed (final ActionEvent e) { 136 display.setIsAntialiasing(!display.isAntialiasing()); 137 } 138 } 139 | Popular Tags |