/*
* 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.panel;
import java.util.logging.Logger;
import org.geoforge.guillc.dialog.GfrDlgCmdCancelOkEdtUrlAbs;
import org.geoforge.guillc.dialog.GfrDlgCmdCancelOkEdtUrlPdf;
import org.geoforge.guillc.event.GfrEvtPanelChange;
import org.geoforge.guillc.handler.IGfrHandlerListenerPanelDialog;
import org.geoforge.guillc.optionpane.GfrOptionPaneAbs;
import org.geoforge.java.io.file.GfrJavIoFileExtension;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
/**
*
* @author bill
*/
public class GfrPnlSelEdtIoChooserFileReaderUrlPdf extends GfrPnlSelEdtIoChooserFileReaderUrlAbs
{
final private static Logger _LOGGER_ = Logger.getLogger(GfrPnlSelEdtIoChooserFileReaderUrlPdf.class.getName());
static
{
GfrPnlSelEdtIoChooserFileReaderUrlPdf._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
}
// ---
public GfrPnlSelEdtIoChooserFileReaderUrlPdf(IGfrHandlerListenerPanelDialog lst)
{
super(GfrJavIoFileExtension.STRS_EXTENSION_PDF, GfrJavIoFileExtension.STR_DESCRIPTION_PDF, lst);
}
@Override
public void somethingHasHappened(GfrEvtPanelChange e)
{
Object obj = e.getSource();
if (!obj.equals(super._pnlFile))
return;
try
{
GfrDlgCmdCancelOkEdtUrlAbs dlg = new GfrDlgCmdCancelOkEdtUrlPdf();
if (!dlg.init())
{
throw new Exception("! dlg.init()");
}
if (!dlg.init())
{
throw new Exception("! dlg.init()");
}
dlg.setVisible(true);
boolean blnCancelled = dlg.isCancelled();
String strValue = null;
if (!blnCancelled)
{
strValue = dlg.getValue();
}
dlg.destroy();
dlg = null;
if (blnCancelled)
return;
// beg handling current bug
if (strValue == null || strValue.length() < 1)
{
String str = "strUrl == null || strUrl.length()<1";
GfrPnlSelEdtIoChooserFileReaderUrlPdf._LOGGER_.severe(str);
GfrOptionPaneAbs.s_showDialogError(null, "Dev coding error: " + str);
return;
}
setValuePath(strValue);
}
catch (Exception exc)
{
exc.printStackTrace();
String str = exc.getMessage();
GfrPnlSelEdtIoChooserFileReaderUrlPdf._LOGGER_.severe(str);
GfrOptionPaneAbs.s_showDialogError(null, str);
}
}
}