1 package org.robsite.extension.rss;
2
3 import oracle.ide.config.ChangeEventSource;
4 import oracle.ide.util.Copyable;
5
6 import org.robsite.extension.rss.model.Channels;
7
8 /***
9 * Preferences for the news feed extension
10 *
11 * @author brian_duff@sourceforge.net
12 * @version $Revision: 1.1.1.1 $
13 */
14 public class NewsFeedPreferences
15 extends ChangeEventSource
16 implements Copyable
17 {
18 private int _checkDelaySeconds;
19 private String _directoryURL;
20 private Channels _channels = new Channels();
21 private boolean _checkAutomatically;
22 private boolean _checkOnStartup;
23 private boolean _syncChannels;
24 private int _httpTimeoutMillis;
25
26
27 private int _statusMessageDuration = 300;
28
29 /***
30 * The minimum check delay is 5 minutes.
31 */
32 public static final int MIN_CHECK_DELAY = 300;
33
34 public void setStatusMessageDuration( int seconds )
35 {
36 _statusMessageDuration = seconds;
37 }
38
39 public int getStatusMessageDuration()
40 {
41
42 if ( _statusMessageDuration == 0 )
43 {
44 return 300;
45 }
46 return _statusMessageDuration;
47 }
48
49 public void setHTTPTimeout( int httpTimeout )
50 {
51 _httpTimeoutMillis = httpTimeout;
52 }
53
54 public int getHTTPTimeout()
55 {
56 return _httpTimeoutMillis;
57 }
58
59 public boolean isSyncChannels()
60 {
61 return _syncChannels;
62 }
63
64 public void setSyncChannels( boolean sync )
65 {
66 _syncChannels = sync;
67 }
68
69 public boolean isCheckAutomatically()
70 {
71 return _checkAutomatically;
72 }
73
74 public void setCheckAutomatically( boolean checkAutomatically )
75 {
76 _checkAutomatically = checkAutomatically;
77 }
78
79 public boolean isCheckOnStartup()
80 {
81 return _checkOnStartup;
82 }
83
84 public void setCheckOnStartup( boolean checkOnStartup )
85 {
86 _checkOnStartup = checkOnStartup;
87 }
88
89 public Channels getChannels()
90 {
91 return _channels;
92 }
93
94 public void setChannels( Channels channels )
95 {
96 _channels = channels;
97 }
98
99 public int getCheckDelaySeconds()
100 {
101 return Math.max( MIN_CHECK_DELAY, _checkDelaySeconds );
102 }
103
104 public void setCheckDelaySeconds( int checkDelay )
105 {
106 _checkDelaySeconds = Math.max( MIN_CHECK_DELAY, checkDelay );
107 }
108
109 public String getDirectoryURL()
110 {
111 return _directoryURL;
112 }
113
114 public void setDirectoryURL( String url )
115 {
116 _directoryURL = url;
117 }
118
119
120
121
122
123 public Object copyTo(Object target)
124 {
125 final NewsFeedPreferences copy =
126 target != null ? (NewsFeedPreferences) target : new NewsFeedPreferences();
127
128 copy._checkDelaySeconds = _checkDelaySeconds;
129 copy._directoryURL = _directoryURL;
130 copy._channels = (Channels) _channels.copyTo( copy._channels );
131 copy._checkAutomatically = _checkAutomatically;
132 copy._checkOnStartup = _checkOnStartup;
133 copy._httpTimeoutMillis = _httpTimeoutMillis;
134 copy._statusMessageDuration = _statusMessageDuration;
135
136 copy.fireChangeEvent();
137
138 return copy;
139 }
140
141 }