All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.pepsoft.worldpainter.selection.CopySelectionOperationOptionsPanel Maven / Gradle / Ivy

There is a newer version: 2.23.2
Show newest version
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.pepsoft.worldpainter.selection;

/**
 *
 * @author Pepijn
 */
public class CopySelectionOperationOptionsPanel extends javax.swing.JPanel {
    /**
     * Creates new form CopySelectionOperationOptionsPanel
     */
    public CopySelectionOperationOptionsPanel() {
        initComponents();
    }

    /**
     * Creates new form CopySelectionOperationOptionsPanel
     */
    public CopySelectionOperationOptionsPanel(CopySelectionOperationOptions options) {
        this();
        setOptions(options);
    }

    public CopySelectionOperationOptions getOptions() {
        return options;
    }

    public void setOptions(CopySelectionOperationOptions options) {
        this.options = options;
        checkBoxHeight.setSelected(options.isCopyHeights());
        checkBoxTerrain.setSelected(options.isCopyTerrain());
        checkBoxFluids.setSelected(options.isCopyFluids());
        checkBoxLayers.setSelected(options.isCopyLayers());
        checkBoxRemoveExistingLayers.setSelected(options.isRemoveExistingLayers());
        checkBoxBiomes.setSelected(options.isCopyBiomes());
        checkBoxAnnotations.setSelected(options.isCopyAnnotations());
        checkBoxFeather.setSelected(options.isDoBlending());
        checkBoxCreateNewTiles.setSelected(options.isCreateNewTiles());
        setControlStates();
    }

    private void setControlStates() {
        checkBoxRemoveExistingLayers.setEnabled(checkBoxLayers.isSelected());
    }
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // //GEN-BEGIN:initComponents
    private void initComponents() {

        checkBoxHeight = new javax.swing.JCheckBox();
        jLabel1 = new javax.swing.JLabel();
        checkBoxTerrain = new javax.swing.JCheckBox();
        checkBoxFluids = new javax.swing.JCheckBox();
        checkBoxLayers = new javax.swing.JCheckBox();
        checkBoxBiomes = new javax.swing.JCheckBox();
        checkBoxAnnotations = new javax.swing.JCheckBox();
        jLabel2 = new javax.swing.JLabel();
        checkBoxFeather = new javax.swing.JCheckBox();
        checkBoxCreateNewTiles = new javax.swing.JCheckBox();
        jLabel3 = new javax.swing.JLabel();
        checkBoxRemoveExistingLayers = new javax.swing.JCheckBox();

        checkBoxHeight.setText("terrain height");
        checkBoxHeight.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkBoxHeightActionPerformed(evt);
            }
        });

        jLabel1.setText("Copy:");

        checkBoxTerrain.setText("terrain type");
        checkBoxTerrain.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkBoxTerrainActionPerformed(evt);
            }
        });

        checkBoxFluids.setText("fluid height and type");
        checkBoxFluids.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkBoxFluidsActionPerformed(evt);
            }
        });

        checkBoxLayers.setText("layers");
        checkBoxLayers.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkBoxLayersActionPerformed(evt);
            }
        });

        checkBoxBiomes.setText("biomes");
        checkBoxBiomes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkBoxBiomesActionPerformed(evt);
            }
        });

        checkBoxAnnotations.setText("annotations");
        checkBoxAnnotations.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkBoxAnnotationsActionPerformed(evt);
            }
        });

        jLabel2.setText("Options:");

        checkBoxFeather.setText("blend edges (slow!)");
        checkBoxFeather.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkBoxFeatherActionPerformed(evt);
            }
        });

        checkBoxCreateNewTiles.setText("create new tiles");
        checkBoxCreateNewTiles.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkBoxCreateNewTilesActionPerformed(evt);
            }
        });

        jLabel3.setText("(no undo!)");

        checkBoxRemoveExistingLayers.setText("remove existing");
        checkBoxRemoveExistingLayers.setEnabled(false);
        checkBoxRemoveExistingLayers.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkBoxRemoveExistingLayersActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1)
            .addComponent(checkBoxHeight)
            .addComponent(checkBoxTerrain)
            .addComponent(checkBoxFluids)
            .addComponent(checkBoxLayers)
            .addComponent(checkBoxBiomes)
            .addComponent(checkBoxAnnotations)
            .addComponent(jLabel2)
            .addComponent(checkBoxFeather)
            .addComponent(checkBoxCreateNewTiles)
            .addGroup(layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(checkBoxRemoveExistingLayers)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkBoxHeight)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkBoxTerrain)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkBoxFluids)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkBoxLayers)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkBoxRemoveExistingLayers)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkBoxBiomes)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkBoxAnnotations)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkBoxFeather)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkBoxCreateNewTiles)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addGap(0, 0, 0))
        );
    }// //GEN-END:initComponents

    private void checkBoxHeightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxHeightActionPerformed
        options.setCopyHeights(checkBoxHeight.isSelected());
        firePropertyChange("options", null, options);
    }//GEN-LAST:event_checkBoxHeightActionPerformed

    private void checkBoxTerrainActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxTerrainActionPerformed
        options.setCopyTerrain(checkBoxTerrain.isSelected());
        firePropertyChange("options", null, options);
    }//GEN-LAST:event_checkBoxTerrainActionPerformed

    private void checkBoxFluidsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxFluidsActionPerformed
        options.setCopyFluids(checkBoxFluids.isSelected());
        firePropertyChange("options", null, options);
    }//GEN-LAST:event_checkBoxFluidsActionPerformed

    private void checkBoxLayersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxLayersActionPerformed
        options.setCopyLayers(checkBoxLayers.isSelected());
        setControlStates();
        firePropertyChange("options", null, options);
    }//GEN-LAST:event_checkBoxLayersActionPerformed

    private void checkBoxBiomesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxBiomesActionPerformed
        options.setCopyBiomes(checkBoxBiomes.isSelected());
        firePropertyChange("options", null, options);
    }//GEN-LAST:event_checkBoxBiomesActionPerformed

    private void checkBoxAnnotationsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxAnnotationsActionPerformed
        options.setCopyAnnotations(checkBoxAnnotations.isSelected());
        firePropertyChange("options", null, options);
    }//GEN-LAST:event_checkBoxAnnotationsActionPerformed

    private void checkBoxFeatherActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxFeatherActionPerformed
        options.setDoBlending(checkBoxFeather.isSelected());
        firePropertyChange("options", null, options);
    }//GEN-LAST:event_checkBoxFeatherActionPerformed

    private void checkBoxCreateNewTilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxCreateNewTilesActionPerformed
        options.setCreateNewTiles(checkBoxCreateNewTiles.isSelected());
        firePropertyChange("options", null, options);
    }//GEN-LAST:event_checkBoxCreateNewTilesActionPerformed

    private void checkBoxRemoveExistingLayersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxRemoveExistingLayersActionPerformed
        options.setRemoveExistingLayers(checkBoxRemoveExistingLayers.isSelected());
        firePropertyChange("options", null, options);
    }//GEN-LAST:event_checkBoxRemoveExistingLayersActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox checkBoxAnnotations;
    private javax.swing.JCheckBox checkBoxBiomes;
    private javax.swing.JCheckBox checkBoxCreateNewTiles;
    private javax.swing.JCheckBox checkBoxFeather;
    private javax.swing.JCheckBox checkBoxFluids;
    private javax.swing.JCheckBox checkBoxHeight;
    private javax.swing.JCheckBox checkBoxLayers;
    private javax.swing.JCheckBox checkBoxRemoveExistingLayers;
    private javax.swing.JCheckBox checkBoxTerrain;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    // End of variables declaration//GEN-END:variables

    private CopySelectionOperationOptions options = new CopySelectionOperationOptions();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy