|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.jface.window.Window
org.eclipse.jface.window.ApplicationWindow
control.Controller
public class Controller
The Controller class is responsible for manipulating the underlying model. User interaction of the database is delegated to public methods of the Controller.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.eclipse.jface.window.Window |
|---|
org.eclipse.jface.window.Window.IExceptionHandler |
| Fields inherited from class org.eclipse.jface.window.ApplicationWindow |
|---|
seperator1 |
| Fields inherited from class org.eclipse.jface.window.Window |
|---|
CANCEL, OK |
| Constructor Summary | |
|---|---|
Controller(DBHandler dbh)
Constructs a new Controller with the specified DBHandler. |
|
| Method Summary | |
|---|---|
Folder |
addFolder(Folder parent,
Folder child)
Adds a new folder. |
void |
checkUser()
Checks to make sure that there is a valid user profile. |
boolean |
close()
Performs maintenance tasks and closes application. |
protected void |
configureShell(org.eclipse.swt.widgets.Shell shell)
Configures the shell of the Controller object. |
void |
createAndSwitchUser(java.lang.String username)
Tries to creates a new user profile based on the input username, and switches to that userprofile. |
protected org.eclipse.swt.widgets.Control |
createContents(org.eclipse.swt.widgets.Composite parent)
Creates the contents for the Controller, based on the active view. |
protected org.eclipse.jface.action.MenuManager |
createMenuManager()
Constructs the Menu for the Controller. |
protected org.eclipse.jface.action.StatusLineManager |
createStatusLineManager()
Constructs the StatusLineManager for the Controller. |
protected org.eclipse.jface.action.ToolBarManager |
createToolBarManager(int style)
Constructs the toolbar for the Controller. |
boolean |
deleteFolder(Folder f)
Deletes specifed folder and all of its contents. |
void |
deleteUser(java.lang.String username)
Tries to delete the specified user profile. |
void |
emptyTrash()
Permanently empties the trash bin. |
View |
getActiveView()
Returns the currently active View. |
java.util.List<Feed> |
getAllFeeds()
Gets all feeds. |
java.util.List<java.lang.String> |
getAllUsers()
Returns a list of all usernames |
static Controller |
getApp()
Returns the currently running Instance of Controller. |
Article |
getArticleRandom()
Gets a random, unread article. |
java.util.List<Article> |
getArticles(Feed f)
Gets the List of Articles associated with a feed. |
java.util.List<Feed> |
getChildrenFeeds(Folder f)
Gets the children feeds of a folder. |
java.util.List<Folder> |
getChildrenFolders(Folder f)
Gets the children folders of a folder. |
int |
getNumberOfArticles(java.lang.String constraint)
Gets the number of articles that are found by a search based on the passed in constraing |
int |
getNumberOfNewArticles(Feed feed)
Gets the number of new articles in the selected feed. |
Feed |
getOutbox()
Gets the Outbox Feed |
Feed |
getParent(Article a)
Gets the Parent Feed of an article. |
Folder |
getParent(Feed f)
Gets the Parent Folder of a Feed. |
Folder |
getParent(Folder f)
Gets the Parent Folder of a Folder. |
java.util.List<java.lang.Object> |
getRoot()
Returns a list of top-level Objects. |
org.eclipse.jface.action.StatusLineManager |
getStatusLine()
Returns the StatusLineManager of the Controller window. |
Folder |
getSubscribedFeeds()
Gets the Subscribed feeds folder |
Feed |
getTrash()
Gets the Trash Feed |
boolean |
isUser(java.lang.String username)
Checks to see if there is a user profile for the specified user name. |
static void |
main(java.lang.String[] args)
The Application Entry Point |
Article |
markRead(Article a)
Marks the specified article as read. |
Article |
markUnread(Article a)
Marks the specified article as new. |
boolean |
move(Feed source,
Folder destination)
Moves Feed into destination folder. |
boolean |
move(Folder source,
Folder destination)
Moves Folder into destination folder. |
void |
moveToOutbox(Article source)
Copies the specified article to the outbox. |
java.util.List<Article> |
orderedSearch(java.lang.String string)
Performs a search based on the specified string and returns a list of Articles ordered by their date. |
void |
renameFeed(Feed f,
java.lang.String newName)
Tries to rename the specified feed. |
void |
reset()
Resets the underlying database. |
void |
run()
Runs the Application |
java.util.List<Article> |
searchArticles(boolean byAuthor,
boolean byTitle,
boolean byContent,
Feed feed,
java.lang.String constraint)
Searches for the articles based on the specified input values. |
java.util.List<Article> |
searchArticles(boolean byAuthor,
boolean byTitle,
boolean byContent,
java.lang.String constraint)
Searches for the articles based on the specified input values. |
void |
setActiveView(View newView)
Sets the active view to the specified view. |
void |
setDelete(Article a)
Deletes the specified article. |
void |
setFeedUpdateInterval(Feed f,
int i)
Sets a feeds update interval. |
Article |
setTrash(Article a)
Puts the specified article in the trash bin. |
Article |
setUnTrash(Article a)
Takes the specified article in the trash bin and restores it to its original location. |
private void |
setupViews()
Sets up the views. |
Feed |
subscribe(java.lang.String url)
Subscribes to the feed at the specified url. |
Feed |
subscribe(java.lang.String url,
Folder destination)
Subscribes to a new feed, and places that feed into the specified directory. |
void |
switchUser(java.lang.String username)
Tries to switch to the specified user profile. |
boolean |
unSubscribe(Feed f)
Unsubscribes from specified feed. |
Feed |
updateFeed(Feed f)
Refreshes the specified feed by comparing to the current rss feed at the feed object's url. |
void |
updateFeeds()
Updates all feeds that are scheduled to be updated based on their update interval. |
| Methods inherited from class org.eclipse.jface.window.ApplicationWindow |
|---|
addCoolBar, addMenuBar, addStatusLine, addToolBar, canHandleShellCloseEvent, coolBarChildrenExist, createCoolBarControl, createCoolBarManager, createStatusLine, createToolBarControl, createTrimWidgets, getCoolBarControl, getCoolBarManager, getFont, getLayout, getMenuBarManager, getSeperator1, getStatusLineManager, getSymbolicFontName, getToolBarControl, getToolBarManager, run, setStatus, showTopSeperator, toolBarChildrenExist |
| Methods inherited from class org.eclipse.jface.window.Window |
|---|
constrainShellSize, create, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getInitialLocation, getInitialSize, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, initializeBounds, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static Controller APP
private DBHandler dbh
private View activeView
private java.util.List<View> allViews
private java.util.List<ChangeViewAction> changeViewActions
private org.eclipse.swt.widgets.Composite mostRecent
private SubscribeAction subscribeAction
private UnSubscribeFeedAction unSubscribeAction
private ExitAction exitAction
private UpdateFeedAction updateFeedAction
private UpdateAllFeeds updateAllFeeds
private AddToOutbox addToOutbox
private TrashAction trashAction
private DeleteFolderAction deleteFolderAction
private EmptyTrashAction emptyTrashAction
private ImportFromFileAction importFromFileAction
private ImportFromURLAction importFromURLAction
private NewFolderAction newFolderAction
private RefreshAction refreshAction
private ExportOutboxAction exportOutboxAction
private NewArticleAction newArticleAction
private NewUserAction newUserAction
private SwitchUserAction switchUserAction
private DeleteUserAction deleteUserAction
private AboutAction aboutAction
private ResetAction resetAction
private ExportFeedListAction exportFeedListAction
| Constructor Detail |
|---|
public Controller(DBHandler dbh)
dbh - DBHandler| Method Detail |
|---|
private void setupViews()
protected org.eclipse.jface.action.MenuManager createMenuManager()
createMenuManager in class org.eclipse.jface.window.ApplicationWindowprotected org.eclipse.jface.action.ToolBarManager createToolBarManager(int style)
createToolBarManager in class org.eclipse.jface.window.ApplicationWindowprotected org.eclipse.jface.action.StatusLineManager createStatusLineManager()
createStatusLineManager in class org.eclipse.jface.window.ApplicationWindowpublic void setActiveView(View newView)
newView - View to be displayedpublic View getActiveView()
public static Controller getApp()
protected org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite parent)
createContents in class org.eclipse.jface.window.Windowprotected void configureShell(org.eclipse.swt.widgets.Shell shell)
configureShell in class org.eclipse.jface.window.ApplicationWindowpublic void run()
public boolean close()
close in class org.eclipse.jface.window.ApplicationWindowpublic static void main(java.lang.String[] args)
args - Command Line Argumentspublic void updateFeeds()
public void setFeedUpdateInterval(Feed f,
int i)
throws ControlException
f - Feed who's interval is to be changedi - Integer representing the interval of minutes between updates
ControlException - If there is an internal error or if the interval passed in is invalid.
public Folder getParent(Folder f)
throws ControlException
f - Folder to get parent of.
ControlException - if the Feed has no parent.
public Folder getParent(Feed f)
throws ControlException
f - Feed to get parent of.
ControlException - if the Feed has no parent.
public Feed getParent(Article a)
throws ControlException
f - Feed to get parent of.
ControlException - if the Feed has no parent.
public java.util.List<java.lang.Object> getRoot()
throws ControlException
ControlException - if Internal database has been corrupted.
public java.util.List<Folder> getChildrenFolders(Folder f)
throws ControlException
f - Folder parent
ControlException - if there is a problem with the internal data structures
or if the argument folder is not represented in the internal data structures.
public java.util.List<Feed> getChildrenFeeds(Folder f)
throws ControlException
f - Folder parent
ControlException - if there is a problem with the internal data structures
or if the argument feed is not represented in the internal data structures.
public Article getArticleRandom()
throws ControlException
ControlException - If there is a problem getting an article from
the database.
public java.util.List<Article> getArticles(Feed f)
throws ControlException
f - Feed that contains articles
ControlException - If the feed is not already represented in the internal
data structures or if there a problem with the internal data structures.
public java.util.List<Feed> getAllFeeds()
throws ControlException
ControlException - if there is an internal error.
public Folder getSubscribedFeeds()
throws ControlException
ControlException - if there is a problem with the internal data structures.
public Feed getTrash()
throws ControlException
ControlException - if there is a problem with the internal data structures.
public Feed getOutbox()
throws ControlException
ControlException - if there is a problem with the internal data structures.
public void emptyTrash()
throws ControlException
ControlException - if there is a problem with the internal data structures.
public Article markRead(Article a)
throws ControlException
a - Article to be marked as read
ControlException - If the Article is not already represented in the internal
data structures or if there a problem with the internal data structures.
public Article markUnread(Article a)
throws ControlException
a - Article
ControlException - If the Article is not already represented in the internal
data structures or if there a problem with the internal data structures.
public Article setTrash(Article a)
throws ControlException
a - Article to be put in the trash
ControlException - If the Article is not already represented in the internal
data structures or if there a problem with the internal data structures.
public Article setUnTrash(Article a)
throws ControlException
a - Article to be restored from the trash
ControlException - If the Article is not already represented in the internal
data structures or if there a problem with the internal data structures.
public void setDelete(Article a)
throws ControlException
a - Article to be deleted
ControlException - if there is an internal error.
public Feed subscribe(java.lang.String url)
throws ControlException
url - of rss feed
ControlException - If url is malformed, there is a problem with the internet
connection, or if there is a problem with the internal data structures.
public Feed subscribe(java.lang.String url,
Folder destination)
throws ControlException
url - String url of rss feed.destination - Folder where feed should be placed
ControlException - If url is malformed, there is a problem with the internet
connection, or if there is a problem with the internal data structures.
public boolean unSubscribe(Feed f)
throws ControlException
f - Feed to be unsubscribed from.
ControlException - if Feed specified is not represented in the internal data
structures (i.e. it is not subscribed to), or if the feed cannot be unsubscribed from.
For instance, if the feed is the outbox feed or trash bin.
public boolean deleteFolder(Folder f)
throws ControlException
f - Folder to be deleted
ControlException - If folder is not represented in the internal data
structures, or if the folder is the subscribedFeeds folder.
public Feed updateFeed(Feed f)
throws ControlException
f - Feed to be updated
ControlException - If there is an error updating the feed, or if the
feed is not already represented in the internal data structures.
public Folder addFolder(Folder parent,
Folder child)
throws ControlException
parent - Folder that will contain the added folderchild - Folder that is to be added
ControlException - if the folder couldn't be added.
public int getNumberOfNewArticles(Feed feed)
throws ControlException
feed - Selected feed
ControlException - if there is an internal error or the feed is not currently
subscribed to.
public int getNumberOfArticles(java.lang.String constraint)
throws ControlException
constraint - String constraint
ControlException - If there is an internal error
public boolean move(Folder source,
Folder destination)
throws ControlException
source - Folder to be moveddestination - Folder that source folder will be moved into.
ControlException - If either folder argument is not represented in the
internal data structures.
public boolean move(Feed source,
Folder destination)
throws ControlException
source - Feed to be moveddestination - Folder that source Feed will be moved into.
ControlException - If either argument is not represented in the internal data
structures.
public void moveToOutbox(Article source)
throws ControlException
source - Article to be moved
ControlException - if there is an internal error, or if the article is not already
represented in the internal data structures.public org.eclipse.jface.action.StatusLineManager getStatusLine()
public java.util.List<Article> searchArticles(boolean byAuthor,
boolean byTitle,
boolean byContent,
java.lang.String constraint)
byAuthor - byTitle - byContent - constraint -
public java.util.List<Article> searchArticles(boolean byAuthor,
boolean byTitle,
boolean byContent,
Feed feed,
java.lang.String constraint)
byAuthor - byTitle - byContent - feed - constraint -
public void checkUser()
public void createAndSwitchUser(java.lang.String username)
username - String Usernamepublic boolean isUser(java.lang.String username)
username - String Username
public void switchUser(java.lang.String username)
username - String username
public void deleteUser(java.lang.String username)
throws ControlException
username - String username
ControlException - If username is the current userpublic java.util.List<java.lang.String> getAllUsers()
public java.util.List<Article> orderedSearch(java.lang.String string)
string - String constraint
public void renameFeed(Feed f,
java.lang.String newName)
f - Feed to be renamednewName - String new name
public void reset()
throws ControlException
ControlException - If there is a internal error. If that happens, there is a serious problem.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||