diff options
Diffstat (limited to 'src/main/model/BrowserState.java')
-rw-r--r-- | src/main/model/BrowserState.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/main/model/BrowserState.java b/src/main/model/BrowserState.java new file mode 100644 index 0000000..7f948dc --- /dev/null +++ b/src/main/model/BrowserState.java @@ -0,0 +1,40 @@ +package model; + +import model.util.Event; +import model.util.EventLog; + +import java.util.ArrayDeque; + +public class BrowserState { + private ArrayDeque<String> tabs; + private String currentTab; + + public BrowserState(ArrayDeque<String> tabs, String currentTab) { + this.tabs = tabs; + this.currentTab = currentTab; + } + + public ArrayDeque<String> getTabs() { + return this.tabs; + } + + public String getCurrentTab() { + return this.currentTab; + } + + public void setCurrentTab(String tab) { + this.currentTab = tab; + } + + public void addTab(String added) { + if (!this.tabs.contains(added)) { + this.tabs.add(added); + } + EventLog.getInstance().logEvent(new Event("Added tab " + added)); + } + + public void removeTab(String removed) { + this.tabs.remove(removed); + EventLog.getInstance().logEvent(new Event("Removed tab " + removed)); + } +} |