source: other-projects/FileTransfer-WebSocketPair/testGXTWithGreenstone/src/org/greenstone/gatherer/cdm/DesignChangeListener.java@ 33053

Last change on this file since 33053 was 33053, checked in by ak19, 5 years ago

I still had some stuff of Nathan Kelly's (FileTransfer-WebSocketPair) sitting on my USB. Had already commited the Themes folder at the time, 2 years back. Not sure if he wanted this additional folder commited. But I didn't want to delete it and decided it will be better off on SVN. When we use his project, if we find we didn't need this test folder, we can remove it from svn then.

File size: 3.0 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * Author: Matthew Whyte, Greenstone Digital Library, University of Waikato
9 *
10 * Copyright (C) 1999 New Zealand Digital Library Project
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *########################################################################
26 */
27
28package org.greenstone.gatherer.cdm;
29
30import org.greenstone.gatherer.Gatherer;
31import org.greenstone.gatherer.DebugStream;
32import javax.swing.event.*;
33import java.awt.event.*;
34
35/**
36 * This handles events generated by changing design options.
37 * The rebuildTypeRequired is updated if the rebuild type associated with this
38 * listener requires more 'work' than what is currently set in the {@link CollectionDesignManager}.
39 * @author Matthew Whyte
40 */
41public class DesignChangeListener implements ActionListener, DocumentListener {
42
43 /** The rebuild type required associated with this listener */
44 private final int rebuildType;
45
46 /** Constructor. Sets the build type required. */
47 public DesignChangeListener(int type) {
48 rebuildType = type;
49 }
50
51 public void maybeSetRebuildRequired() {
52 if (rebuildType > CollectionDesignManager.getRebuildTypeRequired()) {
53 CollectionDesignManager.setRebuildTypeRequired(rebuildType);
54 }
55 }
56
57 /** Gives notification that an event has happened */
58 public void actionPerformed(ActionEvent event) {
59 //DebugStream.println("ActionEvent in Design from: " + event.getSource());
60 maybeSetRebuildRequired();
61 }
62
63 /** Gives notification that an attribute or set of attributes changed. */
64 public void changedUpdate(DocumentEvent e) {
65 maybeSetRebuildRequired();
66 //DebugStream.println("changedUpdate in Design.");
67 }
68
69 /** Gives notification that there was an insert into the document. */
70 public void insertUpdate(DocumentEvent e) {
71 maybeSetRebuildRequired();
72 //DebugStream.println("insertUpdate in Design."); //debug
73 }
74
75 /** Gives notification that a portion of the document has been removed. */
76 public void removeUpdate(DocumentEvent e) {
77 maybeSetRebuildRequired();
78 //DebugStream.println("removeUpdate in Design."); //debug
79 }
80
81}
Note: See TracBrowser for help on using the repository browser.