View Javadoc

1   package org.xmlhammer.gui.util;
2   
3   import java.awt.event.ItemEvent;
4   import java.awt.event.ItemListener;
5   
6   import javax.swing.JCheckBox;
7   
8   import org.xmlhammer.gui.Page;
9   
10  public class UndoableCheckBoxItemListener implements ItemListener {
11      private JCheckBox check = null;
12      private Page page = null;
13  
14      public UndoableCheckBoxItemListener(Page page, JCheckBox check) {
15          this.page = page;
16          this.check = check;
17      }
18  
19      public void itemStateChanged(ItemEvent event) {
20          if (page != null) {
21              page.getProjectView().getUndoManager().addEdit(new UndoableCheckBoxEdit(page, check, event.getStateChange() == ItemEvent.SELECTED));
22          }
23      }
24  
25  }