|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfable.gui.FableManager
public class FableManager
FableManager is the overall Manager class that takes requests from the GUI.
For operations that change the ADT, the FableManager will delegate changes to the ADT
For operations that do not change the ADT e.g. Sort, Search etc. the FableManager will return results directly.
FableManager also deals with SWT threading and censorship issues.
censor
Censorship settings
censorshipStatus
Whether censorship is on or off
activationStatus
Whether account is activated
root
Root FableComponent of the entire tree
Field Summary | |
---|---|
static int |
searchArticle
|
static int |
searchKeywords
|
Constructor Summary | |
---|---|
FableManager(java.lang.String fbmlFile,
Display display)
Creates a FableManager from an fbmlFile and the given GUI display. |
Method Summary | |
---|---|
boolean |
accountVerified()
Checks if the master password was authenticated and not revoked (logged out) at most 10 minutes ago |
void |
accountVerify(boolean value)
Sets account verification (meaning that master password was entered) |
void |
activateCensor()
Activates the censor |
Feed |
addCustomFeed(FableComponent root,
java.lang.String title)
Adds a new custom feed |
Feed |
addCustomFeed(FableComponent root,
java.lang.String title,
PseudoFeed articles)
Creates a custom feed with some articles inside |
void |
addFeed(FableComponent parent,
java.net.URL url,
java.lang.String title,
int refreshTime,
int cacheTime)
Adds a feed given a URL and a title |
boolean |
addToCustomFeed(Feed feed,
PseudoFeed articles)
Adds articles to a custom feed |
void |
changeCacheTime(FableComponent f,
int newCacheTime)
Change the cache time of a feed or folder, as well as all of its children |
void |
changeCustomArticleProperties(Article oldArticle,
Article newArticle)
Edit the properties of a custom article |
boolean |
changeParent(FableComponent feedOrFolder,
FableComponent newParent)
Change parent of a feed or a folder |
void |
changeRefreshRate(FableComponent f,
int newInterval)
Change the Refresh Rate of a feed or folder, as well as all of its children. |
void |
checkRefreshStatus()
Checks the refresh status of all feeds, and if needs to refresh, queues up a refresh operation on the refresh thread |
void |
close()
Closes the FableManager. |
void |
createFolder(FableComponent parentFolder,
java.lang.String name)
Creates a new folder with a particular name |
void |
deactivateCensor()
De-activates the censor |
boolean |
deleteArticleFromCustomFeed(Article a)
Removes an article from custom feed |
boolean |
exportDocument(PseudoFeed feed,
java.lang.String title,
java.lang.String fileName,
java.lang.String fileType)
Exports a document describing some articles |
void |
exportFBML(java.lang.String fileName)
Export everything into an FBML file. |
java.util.List<FeedsterSearchData> |
feedsterSearch(java.lang.String keyString)
Returns Feedster search data |
PseudoFeed |
filterFeed(PseudoFeed feed,
FilterStrategy f)
Filters a feed according to a given strategy |
PseudoFeed |
getAllArticles(FableComponent f)
Gets all articles rooted at a particular Folder/Feed |
FableCensor |
getCensor()
Returns the censor |
Display |
getDisplay()
Returns the GUI display |
java.lang.String |
getEmailBody(PseudoFeed x)
Produces an email body from a pseudofeed |
FableComponent |
getFableComponent(java.lang.String ID)
Returns the FableComponent given an ID. |
java.lang.String |
getHTML(FableComponent article)
Returns the HTML content of an article |
java.lang.String |
getID(FableComponent f)
Returns the ID of a particular component. |
java.lang.String |
getManual()
Returns the manual's url address |
FableComponent |
getParent(FableComponent fc)
Gets the parent of a fableComponent |
int |
getPosition(FableComponent fc)
Gets the position of a fableComponent with respect to its parent (is it the 0th, 1st, 2nd, etc. |
FableComponent |
getRoot()
Returns the root folder of the Fable hierachy |
java.lang.String |
getTutorial()
Returns the quick start in html form |
int |
getUnReadCount(FableComponent f)
Returns the number of unread articles rooted at this particular fableComponent |
void |
importFBML(java.lang.String fileName)
Imports everything from an FBML file WARNING: This OVERWRITES the existing settings, INCLUDING CENSORSHIP |
void |
importFeed(Feed feed,
FableComponent parent)
Imports a feed and slowly loads its articles if possible |
boolean |
isCensorActivated()
Checks if the censor is activated |
boolean |
isCustomArticle(Article a)
Check if an article is a custom article |
boolean |
isMarkedAs(Article a,
Mark m)
Checks if an article is marked with a particular mark |
boolean |
isThreadRunning()
Checks if any thread is running |
void |
markReadAs(FableComponent fc,
boolean mark)
Mark all children (directly or indirectly) articles as read or unread |
void |
markStarredAs(FableComponent fc,
boolean mark)
Mark all articles rooted at a particular Component to be mark as starred |
void |
moveDown(FableComponent feedOrFolder)
Move a feed or folder downwards in the hierachy |
void |
moveUp(FableComponent feedOrFolder)
Move a feed or folder upwards in the hierachy |
java.util.List<Feed> |
readOPML(java.lang.String fileName)
Returns a list of feeds in a particular OPML file |
boolean |
refreshArticle(FableComponent article)
Refreshes an article |
void |
refreshFeedOrFolder(FableComponent f)
Refreshes feeds/folders rooted at that particular feed/folder |
void |
removeFeedOrFolder(FableComponent f)
Removes folders / feeds completely. |
void |
renameFableComponent(FableComponent f,
java.lang.String newName)
Renames a particular fableComponent |
PseudoFeed |
searchFeed(PseudoFeed articles,
java.lang.String keyString,
boolean sameSearch,
int searchType)
Searches a list of articles |
boolean |
sendMail(java.lang.String from,
java.lang.String mailAddr,
java.lang.String title,
java.lang.String body,
boolean sendAsText,
java.lang.String attachment)
Sends mail |
void |
setCensor(FableCensor censor)
Sets the censor |
void |
setName(FableComponent feedOrFolder,
java.lang.String newName)
Change the name of a fableComponent |
boolean |
setPosition(FableComponent fc,
int newPosition)
Sets the position of a fableComponent with relation to its parent |
void |
writeFBML()
Call this method just before closing the GUI to write data to the FBMLfile |
void |
writeOPML(java.util.List<Feed> f,
java.lang.String fileName)
Write a list of feeds to OPML |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int searchKeywords
public static int searchArticle
Constructor Detail |
---|
public FableManager(java.lang.String fbmlFile, Display display)
Method Detail |
---|
public void writeFBML()
public void close()
public FableComponent getRoot()
public Display getDisplay()
public boolean isThreadRunning()
public FableCensor getCensor()
public void setCensor(FableCensor censor)
censor
- New censorpublic void activateCensor()
public void deactivateCensor()
public boolean isCensorActivated()
public boolean accountVerified()
public void accountVerify(boolean value)
value
- true if the master password was entered, false if we should disable a previous verificationpublic void addFeed(FableComponent parent, java.net.URL url, java.lang.String title, int refreshTime, int cacheTime)
parent
- Parent componenturl
- URL address of the new feedtitle
- The name of this feedrefreshTime
- refresh rate of this feedcacheTime
- cache rate of this feedpublic void createFolder(FableComponent parentFolder, java.lang.String name)
parentFolder
- The parent folder of this foldername
- The name of this folderpublic void removeFeedOrFolder(FableComponent f)
f
- The feed or folder to removepublic int getUnReadCount(FableComponent f)
f
- The FableComponent to check from
public PseudoFeed getAllArticles(FableComponent f)
f
- Folder or Feed which is root of all the articles to obtain
public void refreshFeedOrFolder(FableComponent f)
f
- feed/folder to refreshpublic void checkRefreshStatus()
public void changeRefreshRate(FableComponent f, int newInterval)
f
- Feed or folder for which all children are to be changednewInterval
- The new refresh ratepublic void changeCacheTime(FableComponent f, int newCacheTime)
f
- Feed or folder for which all children are to be changednewCacheTime
- The new cache timepublic void renameFableComponent(FableComponent f, java.lang.String newName)
f
- FableComponent to renamenewName
- New Namepublic void setName(FableComponent feedOrFolder, java.lang.String newName)
feedOrFolder
- The fableComponent to be changednewName
- The new namepublic FableComponent getParent(FableComponent fc)
fc
- Returns the parent of a FableComponent
public boolean changeParent(FableComponent feedOrFolder, FableComponent newParent)
feedOrFolder
- The feed or folder to changenewParent
- The new parent of the feed or folderpublic void moveUp(FableComponent feedOrFolder)
feedOrFolder
- feed or folder to move upwardspublic void moveDown(FableComponent feedOrFolder)
feedOrFolder
- feed or folder to move downwardspublic int getPosition(FableComponent fc)
fc
- FableComponent to check for
public boolean setPosition(FableComponent fc, int newPosition)
fc
- FableComponentnewPosition
- new Position with relation to its parent
public PseudoFeed filterFeed(PseudoFeed feed, FilterStrategy f)
feed
- PseudoFeed to filterf
- FilterStrategy
public PseudoFeed searchFeed(PseudoFeed articles, java.lang.String keyString, boolean sameSearch, int searchType)
articles
- A list of all feeds to search for, in the form of a PseudoFeedkeyString
- The string to search forsameSearch
- true if this is continuance of the last search (for incremental searching), false if this is a completely new searchsearchType
- To determine if we search keywords only, or the whole article. Searching the whole article ALSO searches keywords. This should either be FableManager.searchKeywords or FableManager.searchArticle
public void markReadAs(FableComponent fc, boolean mark)
fc
- component to mark as readtrue
- or false depending on whether to mark as read or unread (true == read)public void markStarredAs(FableComponent fc, boolean mark)
fc
- FableComponent to markmark
- true if article(s) are to be mark as starred, false if unstarredpublic boolean isMarkedAs(Article a, Mark m)
a
- Article to checkm
- Mark to check
public java.lang.String getHTML(FableComponent article)
article
- Article to check HTML content of
public boolean refreshArticle(FableComponent article)
article
- Article to refreshpublic java.lang.String getID(FableComponent f)
f
- Component to get ID from
public FableComponent getFableComponent(java.lang.String ID)
ID
- ID string obtained previously via getID
public java.util.List<Feed> readOPML(java.lang.String fileName)
fileName
- OPML file name
public void writeOPML(java.util.List<Feed> f, java.lang.String fileName)
f
- List of feedsfileName
- OPML filenamepublic void importFeed(Feed feed, FableComponent parent)
feed
- Feed to loadparent
- parent of the Feedpublic void exportFBML(java.lang.String fileName)
fileName
- file to export FBML topublic void importFBML(java.lang.String fileName)
fileName
- Filename to import frompublic boolean exportDocument(PseudoFeed feed, java.lang.String title, java.lang.String fileName, java.lang.String fileType)
feed
- PseudoFeed containing articles to exporttitle
- Title of documentfileName
- file name to export tofileType
- file type to export to. Currently only supports ExportDocumentManager.PDF_FORM
public Feed addCustomFeed(FableComponent root, java.lang.String title)
root
- Root of the custom feedtitle
- title of the custom feed
public Feed addCustomFeed(FableComponent root, java.lang.String title, PseudoFeed articles)
root
- parent of the new custom feedtitle
- Title of the new custom feedarticles
- Articles to put in the new Custom Feed
public boolean addToCustomFeed(Feed feed, PseudoFeed articles)
feed
- Feed to add articles toarticles
- PseudoFeed containing the articles to be added to feed
public boolean isCustomArticle(Article a)
a
- Article
public boolean deleteArticleFromCustomFeed(Article a)
a
- Article to delete
public void changeCustomArticleProperties(Article oldArticle, Article newArticle)
oldArticle
- The custom articlenewArticle
- A new article representing the fields that this article should be changed topublic java.util.List<FeedsterSearchData> feedsterSearch(java.lang.String keyString)
keyString
- String to search for
public java.lang.String getEmailBody(PseudoFeed x)
x
- PseudoFeed to produce body from
public boolean sendMail(java.lang.String from, java.lang.String mailAddr, java.lang.String title, java.lang.String body, boolean sendAsText, java.lang.String attachment)
from
- Name of person its sent frommailAddr
- Mail Address of person to send totitle
- Email subjectbody
- Email bodysendAsText
- Sends as text if true, as html if falseattachment
- null if there is no attachment, else attachment is a string representing the file name of the attachment
public java.lang.String getTutorial()
public java.lang.String getManual()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |