package vut.msa.gui.components;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.hyperic.sigar.FileSystem;
import org.primefaces.model.DualListModel;
import vut.msa.monitor.system.ServerInformation;

/**
 * PickList pripojenych diskov
 */
public class DisksPickList {

    private DualListModel<String> disks;

    public DisksPickList() {

        ServerInformation info = ServerInformation.getInstance();
        List<String>source = new ArrayList<String>();
        Iterator<FileSystem> iterator = info.getFsList().iterator();
        while (iterator.hasNext()) {
            FileSystem fs = iterator.next();
            if (fs.getOptions().equals("rw")) {
                source.add(fs.getDevName() + " - "
                            + fs.getTypeName()
                            + " disk("
                            + fs.getSysTypeName()
                            +")");
            }
        }

        List<String> target = new ArrayList<String>();

        disks = new DualListModel<String>(source, target);
    }

    public DualListModel<String> getDisks() { return disks; }
    public void setDisks(DualListModel<String> disks) { this.disks = disks; }
}
