Examples of GlobalController


Examples of com.salas.bb.core.GlobalController

     *
     * @param feed feed to watch and change.
     */
    private void showQueryFeedProperties(QueryFeed feed)
    {
        GlobalController controller = GlobalController.SINGLETON;
        QueryFeedPropertiesDialog dialog =
            new QueryFeedPropertiesDialog(feed, controller.getMainFrame());

        // Read-in the properties
        String title = feed.getBaseTitle();
        QueryType queryType = feed.getQueryType();
        int purgeLimit = feed.getPurgeLimit();
        String parameter = feed.getParameter();

        boolean dedupEnabled = feed.isDedupEnabled();
        int dedupFrom = feed.getDedupFrom();
        int dedupTo = feed.getDedupTo();

        // Show dialog and check if something has been changed and accepted
        if (queryType == null)
        {
            JOptionPane.showMessageDialog(controller.getMainFrame(),
                Strings.message("show.feed.properties.dialog.text.unsupported.type"),
                Strings.message("show.feed.properties.dialog.title"),
                JOptionPane.INFORMATION_MESSAGE);
        } else if (dialog.open(title, queryType, purgeLimit, parameter, dedupEnabled, dedupFrom, dedupTo))
        {
            // Accepted
            feed.setBaseTitle(dialog.getFeedTitle());
            feed.setPurgeLimit(dialog.getFeedArticlesLimit());
            boolean dedupChanged = feed.setDedupProperties(dialog.isDedupEnabled(),
                dialog.getDedupFrom(), dialog.getDedupTo());
            boolean paramChanged = feed.changeParameter(dialog.getFeedParameter());

            if (paramChanged) controller.getPoller().update(feed, true, true); else
            if (dedupChanged) feed.reviewArticles();
        }
    }
View Full Code Here

Examples of com.salas.bb.core.GlobalController

     *
     * @param event original event object.
     */
    protected void doAction(ActionEvent event)
    {
        GlobalController controller = GlobalController.SINGLETON;
        final MainFrame mainFrame = controller.getMainFrame();
        final GlobalModel model = controller.getModel();
        new BlogStarzDialog(mainFrame, model).open();
    }
View Full Code Here

Examples of com.salas.bb.core.GlobalController

     *
     * @param aFeed feed object to change.
     */
    private void showDirectFeedProperties(final DirectFeed aFeed)
    {
        GlobalController controller = GlobalController.SINGLETON;

        boolean badFeed = aFeed.isInvalid() && !aFeed.isInitialized();

        // Record current XML URL
        URL xmlURL = badFeed ? aFeed.getXmlURL() : null;

        // Show dialog
        DirectFeedPropertiesDialog dialog =
            new DirectFeedPropertiesDialog(controller.getMainFrame(), aFeed);

        dialog.open();

        // Compare new XML URL to that
        URL newXmlURL = aFeed.getXmlURL();
        boolean xmlUrlChanged = (xmlURL == null
            ? newXmlURL != null
            : !xmlURL.toString().equals(newXmlURL.toString()));

        // If the feed is bad (is not initialized even once) and URL changed
        // then we remove it and add new feed with the given XML URL
        if (badFeed && xmlUrlChanged)
        {
            aFeed.setXmlURL(null);
            GuidesSet set = controller.getModel().getGuidesSet();
            DirectFeed existingFeed = set.findDirectFeed(newXmlURL);

            if (existingFeed != null)
            {
                GuidesSet.replaceFeed(aFeed, existingFeed);
            } else
            {
                aFeed.setXmlURL(newXmlURL);

                FeedMetaDataHolder holder = aFeed.getMetaDataHolder();

                // XML URL has changed -- suggest XML URL if it's not local
                if (xmlURL != null && !MDDiscoveryRequest.isLocalURL(newXmlURL))
                {
                    ServerService.metaSuggestFeedUrl(xmlURL.toString(), newXmlURL.toString());
                }

                // set newly discovered URL and mark the data as no longer invalid
                holder.setXmlURL(newXmlURL);
                holder.setInvalid(false);

                controller.updateIfDiscovered(aFeed);
            }
        }
    }
View Full Code Here

Examples of com.salas.bb.core.GlobalController

     *
     * @return <code>TRUE</code> if action of this type is available.
     */
    public boolean isAvailable()
    {
        GlobalController controller = GlobalController.SINGLETON;
        GlobalModel model = controller.getModel();
        FeatureManager fm = controller.getFeatureManager();

        boolean ptbEnabled = fm.isPtbEnabled();
        boolean articleSelected = model.getSelectedArticle() != null;
        boolean manyArticlesSelected = articleSelected && model.getSelectedArticles().length > 1;
        boolean blogRecordsPresent = model.getUserPreferences().getBloggingPreferences().getBlogsCount() > 0;
View Full Code Here

Examples of com.salas.bb.core.GlobalController

     */
    public void actionPerformed(ActionEvent e)
    {
        if (GlobalController.SINGLETON.checkForNewSubscription()) return;

        GlobalController controller = GlobalController.SINGLETON;

        // Check the clippoard for URL if it's not specified
        String url = takeURLFromClipboardIfPresent();

        IFeed feed = controller.createDirectFeed(url, true);
        if (feed != null)
        {
            IGuide selectedGuide = controller.getModel().getSelectedGuide();
            if (!feed.belongsTo(selectedGuide))
            {
                IGuide[] guides = feed.getParentGuides();
                IGuide guide = guides.length > 0 ? guides[0] : null;
                if (guide != null) controller.selectGuide(guide, false);
            }
            controller.selectFeed(feed, true);
        }
    }
View Full Code Here

Examples of com.salas.bb.core.GlobalController

            HotResultItem item = (HotResultItem)o;
            String link = item.getHotlink();
            IArticle article = item.getArticle();

            GlobalController controller = GlobalController.SINGLETON;
            controller.selectArticle(article, link);
        }
View Full Code Here

Examples of com.salas.bb.core.GlobalController

     *
     * @param aLink link.
     */
    public static void setLink(URL aLink)
    {
        GlobalController controller = GlobalController.SINGLETON;
        GuidesSet set = controller.getModel().getGuidesSet();

        getInstance().link = aLink;
        getInstance().setEnabled(set.findDirectFeed(aLink) == null);
    }
View Full Code Here

Examples of com.salas.bb.core.GlobalController

     *
     * @param e action event details object.
     */
    public void actionPerformed(ActionEvent e)
    {
        final GlobalController controller = GlobalController.SINGLETON;

        if (hoveredFeed != null)
        {
            // EDT !!!
            IGuide[] guides = hoveredFeed.getParentGuides();
            if (guides.length != 0)
            {
                controller.selectGuide(GlobalController.chooseBestGuide(guides), false);
                controller.selectFeed(hoveredFeed, true);
            }
        }
    }
View Full Code Here

Examples of com.salas.bb.core.GlobalController

     */
    public void actionPerformed(ActionEvent e)
    {
        if (GlobalController.SINGLETON.checkForNewSubscription()) return;

        GlobalController controller = GlobalController.SINGLETON;
        MainFrame mainFrame = controller.getMainFrame();
        AddSmartFeedDialog dialog = new AddSmartFeedDialog(mainFrame);

        dialog.open(DataFeed.getGlobalPurgeLimit());

        if (!dialog.hasBeenCanceled())
        {
            IFeed feed;
            String title = dialog.getFeedTitle();
            int purgeLimit = dialog.getFeedArticlesLimit();

            int from = dialog.getDedupFrom();
            int to = dialog.getDedupTo();
            boolean isDedup = dialog.isDedupEnabled();

            if (dialog.isQueryFeed())
            {
                int queryType = dialog.getFeedQueryType();
                String parameter = dialog.getFeedParameter();

                QueryFeed qfeed = controller.createQueryFeed(null, title, queryType, parameter, purgeLimit);
                if (qfeed != null) qfeed.setDedupProperties(isDedup, from, to);
                feed = qfeed;
            } else
            {
                Query searchQuery = dialog.getFeedSearchQuery();
                SearchFeed sfeed = controller.createSearchFeed(null, title, searchQuery, purgeLimit);
                if (sfeed != null) sfeed.setDedupProperties(isDedup, from, to, false);
                controller.updateSearchFeed(sfeed);
               
                feed = sfeed;
            }

            if (feed != null)
            {
                feed.setType(dialog.getFeedType());
                feed.setCustomViewModeEnabled(dialog.isCustomViewModeEnabled());
                feed.setCustomViewMode(dialog.getViewMode());

                dialog.commitAutoSaveProperties(feed);
               
                controller.selectFeed(feed, true);
            }
        }
    }
View Full Code Here

Examples of com.salas.bb.core.GlobalController

     *
     * @param e action event details object.
     */
    public void actionPerformed(ActionEvent e)
    {
        GlobalController controller = GlobalController.SINGLETON;
        IFeedDisplay feedDisplay = controller.getMainFrame().getArticlesListPanel().getFeedView();

        GlobalModel model = GlobalModel.SINGLETON;
        final IArticle selectedArticle = model.getSelectedArticle();

        boolean articleWasSelected = feedDisplay.selectPreviousArticle(INavigationModes.MODE_UNREAD);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.