/*
* Copyright (C) 2011-2014 GeoForge Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.geoforge.guillc.dialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import org.geoforge.guillc.event.GfrEvtValidityChanged;
import org.geoforge.lang.util.GfrResBundleLang;
/**
*
* @author Amadeus.Sowerby
*
* email: Amadeus.Sowerby_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*/
abstract public class GfrDlgAddFolderSpcWrkAbs extends GfrDlgAddFolderAbs
{
static private String _STR_ALREADY_EXISTS_WORKSPACE_ = null;
static
{
try
{
_STR_ALREADY_EXISTS_WORKSPACE_ = GfrResBundleLang.s_getInstance().getValue("sentence.workspaceAllreadyExists");
}
catch(Exception exc)
{
exc.printStackTrace();
String str = exc.getMessage();
System.err.println(str);
str += "\n Exiting";
JOptionPane.showMessageDialog(null, str, GfrResBundleLang.s_getInstance().getValue("word.error"), JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
}
//--
//--beg static fields
final private static int _INT_SIZE_LABEL_ = 146;
final private static int _INT_SIZE_CONTENT_ = 340;
final private static int _INT_SIZE_BUTTON_ = 105;
//--end static fields
//--
@Override
protected String _getMessageErrorFolderAlreadyExist()
{
return GfrResBundleLang.s_getInstance().getValue("sentence.workspaceFolderAlreadyExistingFolder");
}
protected GfrDlgAddFolderSpcWrkAbs(
JFrame frmOwner,
String[] strsExistingItems,
String strSentence)
{
super(frmOwner,
strsExistingItems,
strSentence);
super.setLengths(
_INT_SIZE_LABEL_, _INT_SIZE_CONTENT_, _INT_SIZE_BUTTON_);
super._pnlSelectFolderLocation.setLengths(
_INT_SIZE_LABEL_, _INT_SIZE_CONTENT_, _INT_SIZE_BUTTON_);
}
@Override
protected boolean _nameEnablesOk()
{
String strName = super._pnlSelectFolderLocation.getIoName();
if (strName == null || strName.length() < 1)
return false;
if (super._alreadyExists(super._pnlSelectFolderLocation.getValuePath()))
{
validityChanged(new GfrEvtValidityChanged(false, _STR_ALREADY_EXISTS_WORKSPACE_));
return false;
}
//-- !!! keep this order
if(!super._nameEnablesOk())
return false;
return true;
}
}