Search in sources :

Example 1 with FeedItemView

use of net.technicpack.launcher.ui.controls.feeds.FeedItemView in project LauncherV3 by TechnicPack.

the class ModpackInfoPanel method setModpack.

public void setModpack(ModpackModel modpack) {
    for (ActionListener listener : playButton.getActionListeners()) {
        listener.actionPerformed(new ActionEvent(modpack, 0, ""));
    }
    modpackRefreshListener.actionPerformed(new ActionEvent(modpack, 0, ""));
    this.modpack = modpack;
    banner.setModpack(modpack);
    dataDisplay.setModpack(modpack);
    deleteButton.setVisible(modpack.getInstalledPack() != null);
    ImageJob<ModpackModel> job = backgroundRepo.startImageJob(modpack);
    job.addJobListener(this);
    background.setImage(job.getImage());
    feedGallery.removeAll();
    ArrayList<FeedItem> feed = modpack.getFeed();
    if (feed != null) {
        for (int i = 0; i < feed.size(); i++) {
            FeedItem item = feed.get(i);
            FeedItemView itemView = new FeedItemView(resources, item, avatarRepo.startImageJob(item.getAuthorship()));
            itemView.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    clickFeedItem((FeedItemView) e.getSource(), e.getActionCommand());
                }
            });
            feedGallery.add(itemView);
        }
    }
    EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            repaint();
        }
    });
}
Also used : ActionListener(java.awt.event.ActionListener) FeedItem(net.technicpack.platform.io.FeedItem) ModpackModel(net.technicpack.launchercore.modpacks.ModpackModel) ActionEvent(java.awt.event.ActionEvent) FeedItemView(net.technicpack.launcher.ui.controls.feeds.FeedItemView)

Aggregations

ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 FeedItemView (net.technicpack.launcher.ui.controls.feeds.FeedItemView)1 ModpackModel (net.technicpack.launchercore.modpacks.ModpackModel)1 FeedItem (net.technicpack.platform.io.FeedItem)1