Revision 43610 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.swing/org.gvsig.timesupport.swing.impl/src/main/java/org/gvsig/timesupport/swing/impl/panel/DefaultTimeSliderPanel.java
DefaultTimeSliderPanel.java | ||
---|---|---|
59 | 59 |
|
60 | 60 |
/** |
61 | 61 |
* Creates a panel with slider and time control calendars |
62 |
* |
|
63 |
* @author <a href="mailto:Pablo.Viciano@uji.es">Pablo Viciano Negre</a> |
|
64 |
* |
|
65 | 62 |
*/ |
66 | 63 |
public class DefaultTimeSliderPanel extends TimeSelectorPanel implements |
67 | 64 |
TimeAdjustmentListener { |
... | ... | |
79 | 76 |
|
80 | 77 |
public DefaultTimeSliderPanel() { |
81 | 78 |
super(); |
82 |
observers = new ArrayList<Observer>();
|
|
79 |
observers = new ArrayList<>(); |
|
83 | 80 |
} |
84 | 81 |
|
85 | 82 |
@Override |
... | ... | |
101 | 98 |
revalidate(); |
102 | 99 |
repaint(); |
103 | 100 |
createUI(); |
104 |
if(start.isAbsolute()) |
|
105 |
timePanel.setTimeMode(TIME_MODE.ABSOLUTE, start, end); |
|
106 |
else |
|
107 |
timePanel.setTimeMode(TIME_MODE.RELATIVE, start, end); |
|
101 |
if(start.isAbsolute()) { |
|
102 |
timePanel.setTimeMode(TIME_MODE.ABSOLUTE, start, end); |
|
103 |
} else { |
|
104 |
timePanel.setTimeMode(TIME_MODE.RELATIVE, start, end); |
|
105 |
} |
|
108 | 106 |
} |
109 | 107 |
|
108 |
@Override |
|
110 | 109 |
public void timeChanged(TimeEvent event) { |
111 | 110 |
if (getInstantRadioButton().isSelected()) { |
112 | 111 |
Instant instante = timePanel.getInstant(); |
113 |
if (this.observers.size() != 0) |
|
114 |
for (Observer o : this.observers) |
|
115 |
o.update(this, new UpdateTimeNotification(instante)); |
|
112 |
if (!this.observers.isEmpty()) { |
|
113 |
for (Observer o : this.observers) { |
|
114 |
o.update(this, new UpdateTimeNotification(instante)); |
|
115 |
} |
|
116 |
} |
|
116 | 117 |
} |
117 | 118 |
} |
118 | 119 |
|
120 |
@Override |
|
119 | 121 |
public void rangeChanged(TimeEvent event) { |
120 | 122 |
if (getIntervalRadioButton().isSelected()) { |
121 |
if (this.observers.size() != 0) |
|
122 |
for (Observer o : this.observers) |
|
123 |
o.update(this, new UpdateTimeNotification(timePanel.getInterval())); |
|
123 |
if (!this.observers.isEmpty()) { |
|
124 |
for (Observer o : this.observers) { |
|
125 |
o.update(this, new UpdateTimeNotification(timePanel.getInterval())); |
|
126 |
} |
|
127 |
} |
|
124 | 128 |
} |
125 | 129 |
} |
126 | 130 |
|
131 |
@Override |
|
127 | 132 |
public void boundsChanged(TimeEvent event) { |
128 | 133 |
|
129 | 134 |
} |
... | ... | |
135 | 140 |
|
136 | 141 |
|
137 | 142 |
public boolean isInterval() { |
138 |
// TODO Auto-generated method stub |
|
139 | 143 |
return getIntervalRadioButton().isSelected(); |
140 | 144 |
} |
141 | 145 |
|
142 | 146 |
public boolean isInstant() { |
143 |
// TODO Auto-generated method stub |
|
144 | 147 |
return getInstantRadioButton().isSelected(); |
145 | 148 |
} |
146 | 149 |
|
147 | 150 |
public boolean isNone() { |
148 |
// TODO Auto-generated method stub |
|
149 | 151 |
return getNoneRadioButton().isSelected(); |
150 | 152 |
} |
151 | 153 |
|
154 |
@Override |
|
152 | 155 |
public void addObserver(Observer o) { |
153 | 156 |
// TODO Auto-generated method stub |
154 | 157 |
observers.add(o); |
155 | 158 |
} |
156 | 159 |
|
160 |
@Override |
|
157 | 161 |
public void deleteObserver(Observer o) { |
158 | 162 |
// TODO Auto-generated method stub |
159 | 163 |
observers.remove(o); |
160 | 164 |
} |
161 | 165 |
|
166 |
@Override |
|
162 | 167 |
public void deleteObservers() { |
163 | 168 |
// TODO Auto-generated method stub |
164 | 169 |
observers.clear(); |
... | ... | |
323 | 328 |
|
324 | 329 |
@Override |
325 | 330 |
public void setInstants(List<Instant> instants) { |
326 |
// TODO Auto-generated method stub |
|
327 | 331 |
java.util.Collections.sort(instants, new InstantComparator()); |
328 | 332 |
//Delete duplicates |
329 | 333 |
Iterator<Instant> iterador = instants.iterator(); |
330 |
List<Instant> sortedList = new ArrayList<Instant>();
|
|
334 |
List<Instant> sortedList = new ArrayList<>(); |
|
331 | 335 |
Instant obj; |
332 | 336 |
while(iterador.hasNext()){ |
333 | 337 |
obj = iterador.next(); |
Also available in: Unified diff