1 23 24 package org.objectweb.fractal.gui.history.control; 25 26 import org.objectweb.fractal.api.control.BindingController; 27 28 import org.objectweb.fractal.gui.history.model.HistoryListener; 29 import org.objectweb.fractal.gui.history.model.HistoryManager; 30 import org.objectweb.fractal.swing.AbstractAction; 31 32 import java.awt.event.ActionEvent ; 33 import java.net.URL ; 34 35 import javax.swing.ImageIcon ; 36 import javax.swing.KeyStroke ; 37 38 44 45 public class GoNextAction extends AbstractAction implements 46 HistoryListener, 47 BindingController 48 { 49 50 54 55 public final static String HISTORY_MANAGER_BINDING = "history-manager"; 56 57 60 61 private HistoryManager historyManager; 62 63 66 67 public GoNextAction () { 68 putValue(NAME, "Next"); 69 putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("F4")); 70 putValue(SHORT_DESCRIPTION, "Next"); 71 URL url = getClass().getResource( 72 "/org/objectweb/fractal/gui/resources/1rightarrow.gif"); 73 putValue(SMALL_ICON, new ImageIcon (url)); 74 } 75 76 80 public String [] listFc () { 81 return new String [] { HISTORY_MANAGER_BINDING }; 82 } 83 84 public Object lookupFc (final String clientItfName) { 85 if (HISTORY_MANAGER_BINDING.equals(clientItfName)) { 86 return historyManager; 87 } 88 return null; 89 } 90 91 public void bindFc ( 92 final String clientItfName, 93 final Object serverItf) 94 { 95 if (HISTORY_MANAGER_BINDING.equals(clientItfName)) { 96 historyManager = (HistoryManager)serverItf; 97 } 98 } 99 100 public void unbindFc (final String clientItfName) { 101 if (HISTORY_MANAGER_BINDING.equals(clientItfName)) { 102 historyManager = null; 103 } 104 } 105 106 110 public void historyStateChanged () { 111 setEnabled(historyManager.canGoNext()); 112 } 113 114 118 public void actionPerformed (final ActionEvent e) { 119 historyManager.goNext(); 120 } 121 } 122 | Popular Tags |