/*
* Constellation - An open source and standard compliant SDI
* http://www.constellation-sdi.org
*
* Copyright 2014 Geomatys.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.constellation.swing;
import org.constellation.configuration.DataSourceType;
import org.constellation.generic.database.Automatic;
/**
*
* @author Guilhem Legal (Geomatys)
*/
public class JCswFsEditPane extends JServiceEditionPane {
/**
* Creates new form JCswFsEditPane
* @param configuration
*/
public JCswFsEditPane(final Automatic configuration) {
initComponents();
if (configuration != null) {
if (configuration.getDataDirectoryValue() != null) {
guiDataDir.setText(configuration.getDataDirectoryValue());
}
if (configuration.getProfileValue() != null) {
guiProfileCombo.setSelectedItem(configuration.getProfileValue());
}
}
}
@Override
public Automatic getConfiguration() {
final Automatic configuration = new Automatic("filesystem", guiDataDir.getText());
configuration.setProfile((String)guiProfileCombo.getSelectedItem());
return configuration;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
guiDataDir = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
guiProfileCombo = new javax.swing.JComboBox();
setMinimumSize(new java.awt.Dimension(450, 86));
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/constellation/swing/Bundle"); // NOI18N
jLabel1.setText(bundle.getString("dataDir")); // NOI18N
jLabel2.setText(bundle.getString("profil")); // NOI18N
guiProfileCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "discovery", "transactional" }));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(guiProfileCombo, 0, 309, Short.MAX_VALUE)
.addComponent(guiDataDir))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(guiDataDir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(guiProfileCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField guiDataDir;
private javax.swing.JComboBox guiProfileCombo;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
// End of variables declaration//GEN-END:variables
@Override
public DataSourceType getDatasourceType() {
return DataSourceType.FILESYSTEM;
}
}