nl.cloudfarming.client.fleet.machine.wizard.MachineVisualOverviewPanel 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.fleet.machine.wizard;
import java.beans.PropertyEditor;
import javax.swing.JLabel;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;
import org.openide.explorer.propertysheet.PropertyPanel;
import org.openide.nodes.Node.Property;
import org.openide.util.NbBundle;
/**
* The visual overview for the machine wizard. The values to show on this panel
* can be dynamically added.
*
* @author Wytse Visser
*/
@NbBundle.Messages({"overviewStepName=Overview"})
class MachineVisualOverviewPanel extends JPanel {
/**
* Creates new form MachineVisualOverviewPanel
*/
public MachineVisualOverviewPanel() {
setLayout(new MigLayout("wrap 2"));
}
public void addProperty(String name, Object value) {
add(new JLabel(name));
if (value != null) {
add(new JLabel(value.toString()));
} else{
add(new JLabel());
}
}
void addProperty(Property property) {
PropertyPanel propertyPanel = new PropertyPanel(property);
PropertyEditor propertyEditor = propertyPanel.getPropertyEditor(); // FIXME: Calling a deprecated method. Is there another way?
addProperty(property.getDisplayName(), propertyEditor.getAsText());
}
@Override
public String getName() {
return Bundle.overviewStepName();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy