gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.util / org.gvsig.tools.util.impl / src / main / java / org / gvsig / webbrowser / impl / WebBrowserHistoryImpl.java @ 2886
History | View | Annotate | Download (988 Bytes)
1 |
/*
|
---|---|
2 |
* To change this license header, choose License Headers in Project Properties.
|
3 |
* To change this template file, choose Tools | Templates
|
4 |
* and open the template in the editor.
|
5 |
*/
|
6 |
package org.gvsig.webbrowser.impl; |
7 |
|
8 |
import java.net.URL; |
9 |
import java.util.ArrayList; |
10 |
import java.util.List; |
11 |
|
12 |
/**
|
13 |
*
|
14 |
* @author jjdelcerro
|
15 |
*/
|
16 |
public class WebBrowserHistoryImpl { |
17 |
|
18 |
private final List<URL> history; |
19 |
private int pos; |
20 |
private URL current; |
21 |
|
22 |
public WebBrowserHistoryImpl() {
|
23 |
this.history = new ArrayList<>(); |
24 |
this.pos = 0; |
25 |
} |
26 |
|
27 |
public void previous() { |
28 |
if (pos > 1) { |
29 |
pos--; |
30 |
current = history.get(pos - 1);
|
31 |
} |
32 |
} |
33 |
|
34 |
public void next() { |
35 |
} |
36 |
|
37 |
public void go(URL url) { |
38 |
while (pos < history.size()) {
|
39 |
history.remove(history.size() - 1);
|
40 |
} |
41 |
history.add(url); |
42 |
pos++; |
43 |
current = url; |
44 |
} |
45 |
|
46 |
public URL get() { |
47 |
return this.current; |
48 |
} |
49 |
|
50 |
} |