Search in sources :

Example 6 with TerrainListCellRenderer

use of org.pepsoft.worldpainter.themes.TerrainListCellRenderer in project WorldPainter by Captain-Chaos.

the class CombinedLayerEditor method setContext.

@Override
public void setContext(LayerEditorContext context) {
    super.setContext(context);
    CustomBiomeManager customBiomeManager = context.getCustomBiomeManager();
    ColourScheme colourScheme = context.getColourScheme();
    comboBoxTerrain.setRenderer(new TerrainListCellRenderer(colourScheme, "none"));
    comboBoxBiome.setRenderer(new BiomeListCellRenderer(colourScheme, customBiomeManager, "none"));
    List<Integer> allBiomes = new ArrayList<>();
    allBiomes.add(-1);
    for (int i = 0; i < Minecraft1_7Biomes.BIOME_NAMES.length; i++) {
        if (Minecraft1_7Biomes.BIOME_NAMES[i] != null) {
            allBiomes.add(i);
        }
    }
    List<CustomBiome> customBiomes = customBiomeManager.getCustomBiomes();
    if (customBiomes != null) {
        allBiomes.addAll(customBiomes.stream().map(CustomBiome::getId).collect(Collectors.toList()));
    }
    comboBoxBiome.setModel(new DefaultComboBoxModel(allBiomes.toArray()));
    allLayers = context.getAllLayers();
}
Also used : ColourScheme(org.pepsoft.worldpainter.ColourScheme) CustomBiome(org.pepsoft.worldpainter.biomeschemes.CustomBiome) ArrayList(java.util.ArrayList) CustomBiomeManager(org.pepsoft.worldpainter.biomeschemes.CustomBiomeManager) TerrainListCellRenderer(org.pepsoft.worldpainter.themes.TerrainListCellRenderer) BiomeListCellRenderer(org.pepsoft.worldpainter.BiomeListCellRenderer)

Aggregations

TerrainListCellRenderer (org.pepsoft.worldpainter.themes.TerrainListCellRenderer)6 javax.swing (javax.swing)2 ArrayList (java.util.ArrayList)1 DefaultCellEditor (javax.swing.DefaultCellEditor)1 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)1 JComboBox (javax.swing.JComboBox)1 SpinnerNumberModel (javax.swing.SpinnerNumberModel)1 DefaultTableCellRenderer (javax.swing.table.DefaultTableCellRenderer)1 BiomeListCellRenderer (org.pepsoft.worldpainter.BiomeListCellRenderer)1 ColourScheme (org.pepsoft.worldpainter.ColourScheme)1 CustomBiome (org.pepsoft.worldpainter.biomeschemes.CustomBiome)1 CustomBiomeManager (org.pepsoft.worldpainter.biomeschemes.CustomBiomeManager)1 LayerTableCellRenderer (org.pepsoft.worldpainter.layers.LayerTableCellRenderer)1 JButtonTableCellEditor (org.pepsoft.worldpainter.themes.JButtonTableCellEditor)1 JButtonTableCellRenderer (org.pepsoft.worldpainter.themes.JButtonTableCellRenderer)1 JSpinnerTableCellEditor (org.pepsoft.worldpainter.themes.JSpinnerTableCellEditor)1 TerrainTableCellRenderer (org.pepsoft.worldpainter.themes.TerrainTableCellRenderer)1