Search in sources :

Example 51 with VersionData

use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.

the class ReadPanelConfig method decodeVersionData.

/**
 * Decode version data.
 *
 * @param xmlVendorOption the xml vendor option
 * @return the version data
 */
public static VersionData decodeVersionData(XMLVendorOption xmlVendorOption) {
    VersionData versionData = VendorOptionManager.getInstance().getDefaultVendorOptionVersionData();
    if (xmlVendorOption != null) {
        try {
            String vendorOptionClassName = xmlVendorOption.getClassType().trim();
            Class<?> vendorOptionClass = Class.forName(vendorOptionClassName);
            versionData = VersionData.decode(vendorOptionClass, xmlVendorOption.getVersion());
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
    return versionData;
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) XMLFieldConfigString(com.sldeditor.common.xml.ui.XMLFieldConfigString)

Example 52 with VersionData

use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.

the class VendorOptionPresentModel method getMinimum.

/**
 * Gets the minimum vendor option version.
 *
 * @return the minimum vendor option version
 */
public List<VersionData> getMinimum() {
    List<VersionData> minimum = new ArrayList<VersionData>();
    VendorOptionPresent voPresent = vendorOptionsPresentList.get(vendorOptionsPresentList.size() - 1);
    VersionData data = voPresent.getVendorOptionInfo().getVersionData().getEarliest();
    minimum.add(data);
    return minimum;
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) ArrayList(java.util.ArrayList)

Example 53 with VersionData

use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.

the class VendorOptionTableModel method setValueAt.

/*
     * (non-Javadoc)
     * 
     * @see javax.swing.table.AbstractTableModel#setValueAt(java.lang.Object, int, int)
     */
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
    if ((columnIndex == 1) && (rowIndex >= 0) && (rowIndex < selectedVersionList.size())) {
        VersionData value = (VersionData) aValue;
        selectedVersionList.remove(rowIndex);
        selectedVersionList.add(value);
        fireTableCellUpdated(rowIndex, columnIndex);
    }
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData)

Example 54 with VersionData

use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.

the class VendorOptionTableModel method setSelectedVendorOptionVersions.

/**
 * Sets the selected vendor option versions.
 *
 * @param selectedVersionList the new selected vendor option versions
 */
public void setSelectedVendorOptionVersions(List<VersionData> selectedVersionList) {
    if (selectedVersionList != null) {
        this.selectedVersionList = new ArrayList<VersionData>();
        for (VendorOptionTypeInterface key : nameOrder) {
            boolean found = false;
            for (VersionData versionData : selectedVersionList) {
                if (versionData.getVendorOptionType() == key.getClass()) {
                    found = true;
                    this.selectedVersionList.clear();
                    this.selectedVersionList.add(versionData);
                    VendorOptionInfoManager.getInstance().setSelectedVersion(instance, versionData);
                }
            }
            if (!found) {
                VersionData notSetVersion = VersionData.getNotSetVersion(key.getClass());
                this.selectedVersionList.add(notSetVersion);
                VendorOptionInfoManager.getInstance().setSelectedVersion(instance, notSetVersion);
            }
        }
        VersionData defaultVendorOption = VendorOptionManager.getInstance().getDefaultVendorOptionVersionData();
        this.selectedVersionList.remove(defaultVendorOption);
        this.fireTableDataChanged();
    }
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) VendorOptionTypeInterface(com.sldeditor.common.vendoroption.VendorOptionTypeInterface)

Example 55 with VersionData

use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.

the class VersionCellEditor method getTableCellEditorComponent.

/*
     * (non-Javadoc)
     * 
     * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable,
     * java.lang.Object, boolean, int, int)
     */
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
    selectedRowIndex = row;
    if (value instanceof VersionData) {
        this.versionData = (VersionData) value;
    }
    listVersionData = model.getVendorOption(row);
    MenuComboBox comboVersionData = new MenuComboBox(this);
    List<ValueComboBoxDataGroup> dataSelectionList = VendorOptionMenuUtils.createMenu(listVersionData);
    comboVersionData.vendorOptionsUpdated(listVersionData);
    comboVersionData.initialiseMenu(dataSelectionList);
    VendorOptionMenuUtils.setSelected(comboVersionData, this.versionData);
    if (isSelected) {
        comboVersionData.setBackground(table.getSelectionBackground());
    } else {
        comboVersionData.setBackground(table.getSelectionForeground());
    }
    return comboVersionData;
}
Also used : ValueComboBoxDataGroup(com.sldeditor.ui.widgets.ValueComboBoxDataGroup) MenuComboBox(com.sldeditor.ui.menucombobox.MenuComboBox) VersionData(com.sldeditor.common.vendoroption.VersionData)

Aggregations

VersionData (com.sldeditor.common.vendoroption.VersionData)56 Test (org.junit.Test)36 ArrayList (java.util.ArrayList)26 VendorOptionVersion (com.sldeditor.common.vendoroption.VendorOptionVersion)13 GeoServerVendorOption (com.sldeditor.common.vendoroption.GeoServerVendorOption)9 PrefData (com.sldeditor.common.preferences.PrefData)7 VendorOptionInfo (com.sldeditor.common.vendoroption.info.VendorOptionInfo)5 Color (java.awt.Color)5 SLDData (com.sldeditor.common.data.SLDData)4 VendorOptionTypeInterface (com.sldeditor.common.vendoroption.VendorOptionTypeInterface)4 File (java.io.File)4 VendorOptionTableModel (com.sldeditor.common.vendoroption.selection.VendorOptionTableModel)3 ValueComboBoxDataGroup (com.sldeditor.ui.widgets.ValueComboBoxDataGroup)3 IOException (java.io.IOException)3 LinkedHashMap (java.util.LinkedHashMap)3 DataSourcePropertiesInterface (com.sldeditor.common.DataSourcePropertiesInterface)2 StyleWrapper (com.sldeditor.common.data.StyleWrapper)2 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1