class ZNavigatorTreeLinksNode(ZNavigatorTreeSubNode): def __init__(self): ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_LINKS) self.filter = ZLinkSearchFilter() self.linksCount = -1 # end __init__() def getSearchFilter(self): return self.filter # end getSearchFilter() def getLinksCount(self): if self.linksCount == -1: self._configureFilter() self.linksCount = self._getLinksCount() return self.linksCount # end getLinksCount() def _configureFilter(self): if self.parentBlog: self.filter.setBlogIdCriteria(self.parentBlog.getId()) # end _configureFilter() def _getLinksCount(self): docIndex = getApplicationModel().getEngine().getService( IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID) return docIndex.getLinkCount(self.filter) # end _getLinksCount() def getLabel(self): label = ZNavigatorTreeSubNode.getLabel(self) return u"%s (%d)" % (label, self.getLinksCount()) #$NON-NLS-1$ # end getLabel() def addLinkIDO(self, linkIDO): if self.linksCount != -1 and self.filter.matches(linkIDO): self.linksCount = self.linksCount + 1 return True return False # end addLinkIDO() def removeLinkIDO(self, linkIDO): if self.linksCount != -1 and self.filter.matches(linkIDO): self.linksCount = self.linksCount - 1 return True return False
class ZNavigatorTreeLinksNode(ZNavigatorTreeSubNode): def __init__(self): ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_LINKS) self.filter = ZLinkSearchFilter() self.linksCount = -1 # end __init__() def getSearchFilter(self): return self.filter # end getSearchFilter() def getLinksCount(self): if self.linksCount == -1: self._configureFilter() self.linksCount = self._getLinksCount() return self.linksCount # end getLinksCount() def _configureFilter(self): if self.parentBlog: self.filter.setBlogIdCriteria(self.parentBlog.getId()) # end _configureFilter() def _getLinksCount(self): docIndex = getApplicationModel().getEngine().getService(IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID) return docIndex.getLinkCount(self.filter) # end _getLinksCount() def getLabel(self): label = ZNavigatorTreeSubNode.getLabel(self) return u"%s (%d)" % (label, self.getLinksCount()) #$NON-NLS-1$ # end getLabel() def addLinkIDO(self, linkIDO): if self.linksCount != -1 and self.filter.matches(linkIDO): self.linksCount = self.linksCount + 1 return True return False # end addLinkIDO() def removeLinkIDO(self, linkIDO): if self.linksCount != -1 and self.filter.matches(linkIDO): self.linksCount = self.linksCount - 1 return True return False
def refreshContent(self, selection): (accountId, blogId) = selection.getData() filter = ZLinkSearchFilter() if blogId is not None: account = self.accountStore.getAccountById(accountId) self.blog = account.getBlogById(blogId) filter.setAccountIdCriteria(accountId) filter.setBlogIdCriteria(blogId) else: self.blog = None filter.setAccountIdCriteria( IZLinkSearchFilter.UNPUBLISHED_ACCOUNT_ID) filter.setBlogIdCriteria(IZLinkSearchFilter.UNPUBLISHED_BLOG_ID) self.model = ZContextInfoLinksModel(filter) self.linksTreeView.setContentProvider( ZLinkTreeContentProvider(self.model)) self.linksTreeView.refresh() self.linksTreeView.deselectAll() self.onInvalidSelection() fireViewUnselectionEvent()
def refreshContent(self, selection): (accountId, blogId) = selection.getData() filter = ZLinkSearchFilter() if blogId is not None: account = self.accountStore.getAccountById(accountId) self.blog = account.getBlogById(blogId) filter.setAccountIdCriteria(accountId) filter.setBlogIdCriteria(blogId) else: self.blog = None filter.setAccountIdCriteria(IZLinkSearchFilter.UNPUBLISHED_ACCOUNT_ID) filter.setBlogIdCriteria(IZLinkSearchFilter.UNPUBLISHED_BLOG_ID) self.model = ZContextInfoLinksModel(filter) self.linksTreeView.setContentProvider(ZLinkTreeContentProvider(self.model)) self.linksTreeView.refresh() self.linksTreeView.deselectAll() self.onInvalidSelection() fireViewUnselectionEvent()
def __init__(self, parent): self.link = None self.blog = None self.indexService = getApplicationModel().getService( IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID) self.accountStore = getApplicationModel().getService( IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID) self.model = ZContextInfoLinksModel(ZLinkSearchFilter()) self.openLinkAction = getApplicationModel().getActionRegistry( ).findAction(IZAppActionIDs.OPEN_LINK_ACTION) ZBoxedView.__init__(self, parent) self._registerAsIndexListener() self.validSelection = False
def __init__(self): ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_LINKS) self.filter = ZLinkSearchFilter() self.linksCount = -1