/* 
 * JFwknop is developed primarily by the people listed in the file 'AUTHORS'.
 * Copyright (C) 2016 JFwknop developers and contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package com.cipherdyne.gui.components;

/**
 *
 * @author franck
 */
public class JFwknopArgs extends JFwknopTextField {
    
    private boolean verbosityEnabled;
    private boolean testEnabled;
    private String args;

    public JFwknopArgs(String val) {
        super(val);
        this.setEditable(false);
        this.args = val;
    }
    
    public void setVerbose(boolean enable) {
        this.verbosityEnabled = enable;
        buildArgs();
    }
    
    public void setTest(boolean enable) {
        this.testEnabled = enable;
        buildArgs();
    }
    
    public void setArgs(String args) {
        this.args = args;
        buildArgs();
    }
    
    private void buildArgs() {
        StringBuilder sb = new StringBuilder();
        
        sb.append(this.args);
        if (this.verbosityEnabled) {
            sb.append(" --verbose");
        }        
        if (this.testEnabled) {
            sb.append(" --test");
        }      
        
        this.setText(sb.toString().trim());
    }
}
