001: /*
002: * Created on 16/10/2006
003: *
004: * Swing Components - visit http://sf.net/projects/gfd
005: *
006: * Copyright (C) 2004 Igor Regis da Silva Simões
007: *
008: * This program is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU General Public License
010: * as published by the Free Software Foundation; either version 2
011: * of the License, or (at your option) any later version.
012: *
013: * This program is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: * GNU General Public License for more details.
017: *
018: * You should have received a copy of the GNU General Public License
019: * along with this program; if not, write to the Free Software
020: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
021: *
022: */
023: package br.com.gfp.ols.actions;
024:
025: import java.awt.event.ActionEvent;
026: import java.awt.event.ActionListener;
027: import java.net.URL;
028: import java.util.Enumeration;
029: import java.util.Locale;
030:
031: import org.flexdock.docking.DockingConstants;
032: import org.flexdock.view.View;
033:
034: import br.com.gfp.dao.GFPController;
035: import br.com.gfp.dao.SupportRequestDAO;
036: import br.com.gfp.ols.componentes.OLSHttpClientFactory;
037: import br.com.gfp.ols.telas.TelaSupportRequest;
038: import br.com.gfp.windows.views.HelpView;
039: import br.com.gfpshare.plugin.core.DynamicClassLoader;
040:
041: /**
042: * @author f4353008
043: * @since 17/01/2005 11:19:10
044: *
045: * To change the template for this generated type comment go to
046: * Window - Preferences - Java - Code Generation - Code and Comments
047: */
048: public class AbrirTelaSupportRequestAction implements ActionListener {
049: private static AbrirTelaSupportRequestAction action = null;
050:
051: /**
052: *
053: */
054: private AbrirTelaSupportRequestAction() {
055: super ();
056: }
057:
058: /**
059: * @return Retorna uma instancia desta action
060: */
061: public static AbrirTelaSupportRequestAction getAction() {
062: return action;
063: }
064:
065: /**
066: *
067: */
068: public static void initializeAction() {
069: if (action == null)
070: action = new AbrirTelaSupportRequestAction();
071: }
072:
073: /**
074: * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
075: */
076: public void actionPerformed(ActionEvent e) {
077: //Fazemos essa chamada para forçar e pegar chave e senha de proxy caso necessario
078: OLSHttpClientFactory.getHttpClient();
079: new SupportRequestDAO().sincronizarRequests();
080:
081: GFPController.getGFPController().create(
082: TelaSupportRequest.class);
083:
084: String language = Locale.getDefault().getLanguage();
085: if (!language.equals("en") && !language.equals("pt"))
086: language = "en";
087: Enumeration<URL> files = DynamicClassLoader
088: .getSystemResourcesEndingWith("index_pt.html");
089: String helpFilePath = null;
090: while (files.hasMoreElements()) {
091: URL file = files.nextElement();
092: if (file.toString().indexOf("ols") != -1)
093: helpFilePath = file.toString();
094: }
095: HelpView helpView = new HelpView(helpFilePath);
096:
097: View rootWindow = (View) GFPController.getGFPController()
098: .getContexto().get(GFPController.ROOT_WINDOW);
099: rootWindow.dock(helpView, DockingConstants.EAST_REGION, .3f);
100: }
101: }
|