Search in sources :

Example 6 with ModpackModel

use of net.technicpack.launchercore.modpacks.ModpackModel 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

ModpackModel (net.technicpack.launchercore.modpacks.ModpackModel)6 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 File (java.io.File)2 Version (net.technicpack.launchercore.install.Version)2 BufferedImage (java.awt.image.BufferedImage)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 MalformedURLException (java.net.MalformedURLException)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 CacheDiscordApi (net.technicpack.discord.CacheDiscordApi)1 HttpDiscordApi (net.technicpack.discord.HttpDiscordApi)1 IDiscordApi (net.technicpack.discord.IDiscordApi)1 Installer (net.technicpack.launcher.launch.Installer)1 IMigrator (net.technicpack.launcher.settings.migration.IMigrator)1 InitialV3Migrator (net.technicpack.launcher.settings.migration.InitialV3Migrator)1 LauncherFrame (net.technicpack.launcher.ui.LauncherFrame)1 LoginFrame (net.technicpack.launcher.ui.LoginFrame)1