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

nl.cloudfarming.client.spray.VehicleSelectButton Maven / Gradle / Ivy

/**
 * Copyright (C) 2008-2012 AgroSense Foundation.
 *
 * AgroSense 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 3 of the License, or
 * (at your option) any later version.
 *
 * There are special exceptions to the terms and conditions of the GPLv3 as it is applied to
 * this software, see the FLOSS License Exception
 * .
 *
 * AgroSense 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 AgroSense.  If not, see .
 */
package nl.cloudfarming.client.spray;

import nl.cloudfarming.client.fleet.model.Vehicle;
import nl.cloudfarming.client.task.Task;
import nl.cloudfarming.client.task.button.ItemSelectButton;
import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle;

/**
 *
 * @author Maciek Dulkiewicz
 */
@NbBundle.Messages({
    "VehicleSelectButton_text=Vehicle",
    "VehicleSelectButton_toolTipText=Click to add a vehicle",
    "VehicleSelectButton_wizard_panel_title=Select vehicle source",
    "VehicleSelectButton_wizard_panel_text=Select the source for a vehicle.",})
public class VehicleSelectButton extends ItemSelectButton {

    private static final String PANEL_TITLE = Bundle.VehicleSelectButton_wizard_panel_title();
    private static final String PANEL_TEXT = Bundle.VehicleSelectButton_wizard_panel_text();
    private static final String BUTTON_ICON = "nl/cloudfarming/client/fleet/vehicle/steering_wheel_332.png";
    private static final String BUTTON_TEXT = Bundle.VehicleSelectButton_text();
    private static final String BUTTON_TOOLTIP = Bundle.VehicleSelectButton_toolTipText();
    private static final Class TO_SELECT = Vehicle.class;
    //this is a vallue corresponding to a field in ListSelectionModel
    private int selectionMode;

    public VehicleSelectButton(Task task, int selectionMode) {
        super(task, TO_SELECT);
        this.selectionMode = selectionMode;

        setIcon(ImageUtilities.loadImageIcon(BUTTON_ICON, false));
        setText(BUTTON_TEXT); // Standard = showButtonText, disable by calling showButtonText(false);
        setToolTipText(BUTTON_TOOLTIP);
    }

    @Override
    public String getPanelTitle() {
        return PANEL_TITLE;
    }

    @Override
    public String getPanelText() {
        return PANEL_TEXT;
    }

    @Override
    public String getButtonText() {
        return BUTTON_TEXT;
    }

    @Override
    public int getSelectionMode() {
        return selectionMode;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy