use of com.github.jakz.romlib.data.game.GameClone in project rom-manager by Jakz.
the class ClonesEnumPanel method update.
public void update(final Game game) {
Runnable updater = () -> {
inner.removeAll();
// inner.setLayout(mode == Mode.COMPACT ? new FlowLayout() : new BoxLayout(inner, BoxLayout.PAGE_AXIS));
inner.setLayout(new WrapLayout());
this.game = game;
if (game != null) {
GameClone clones = game.getClone();
if (clones != null) {
this.clones = clones.stream().toArray(i -> new Game[i]);
// title.setText("Clones: "+this.clones.length);
inner.add(new JLabel("" + this.clones.length + " clones:"));
for (final Game clone : this.clones) {
JButton label = new JButton();
label.setFocusPainted(false);
label.setContentAreaFilled(false);
label.setOpaque(false);
Icon icon = clone.getLocation().getIcon();
label.setIcon(icon != null ? icon.getIcon() : null);
label.setText(mode == Mode.COMPACT ? clone.getVersion().toString() : clone.getCorrectName());
// if (game == clone)
// label.setFont(label.getFont().deriveFont(Font.BOLD));
label.setForeground(clone.getStatus().color);
if (game == clone)
label.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 2), BorderFactory.createEmptyBorder(4, 4, 4, 4)));
else
label.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.GRAY), BorderFactory.createEmptyBorder(5, 5, 5, 5)));
label.setToolTipText(clone.getCorrectName());
label.addActionListener(e -> {
if (game != clone)
mediator.selectGameIfVisible(clone);
});
inner.add(label);
}
revalidate();
repaint();
return;
}
}
title.setText("");
revalidate();
repaint();
return;
};
if (SwingUtilities.isEventDispatchThread())
updater.run();
else
SwingUtilities.invokeLater(updater);
}
use of com.github.jakz.romlib.data.game.GameClone in project rom-manager by Jakz.
the class GameTree method fireChanges.
public void fireChanges() {
if (data.getMode() == GameListData.Mode.CLONES)
root = new GameTreeNode.RootNode(data.stream().map(d -> (GameClone) d));
else
root = null;
this.addTreeSelectionListener(new Listener());
model.setRoot(root);
model.nodeStructureChanged(root);
}
Aggregations