| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| AcaoToolbar | 
 | 
 | 3.0;3 | 
| 1 |  /** | |
| 2 |   * Copyright 2008 WebPhotos | |
| 3 |   * | |
| 4 |   * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 |   * you may not use this file except in compliance with the License. | |
| 6 |   * You may obtain a copy of the License at | |
| 7 |   * | |
| 8 |   *      http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 |   * | |
| 10 |   * Unless required by applicable law or agreed to in writing, software | |
| 11 |   * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 |   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 |   * See the License for the specific language governing permissions and | |
| 14 |   * limitations under the License. | |
| 15 |   */ | |
| 16 |  package net.sf.webphotos.action; | |
| 17 | ||
| 18 |  import java.awt.event.ActionEvent; | |
| 19 |  import javax.swing.AbstractAction; | |
| 20 |  import net.sf.webphotos.gui.PainelWebFotos; | |
| 21 |  import net.sf.webphotos.gui.util.FtpClient; | |
| 22 |  import org.apache.log4j.Logger; | |
| 23 | ||
| 24 |  /** | |
| 25 |   * Identifica uma ação obtida ao clique de um dos botões da barra de ferramentas | |
| 26 |   * localizada no canto inferior direito do painel principal. Na classe | |
| 27 |   * {@link net.sf.webphotos.gui.BotaoIcone BotaoIcone}, onde será realizada uma | |
| 28 |   * instância de AcaoToolbar, será transmitido o evento para posteriormente | |
| 29 |   * implementar a ação do botão nesta classe. | |
| 30 |   */ | |
| 31 | public class AcaoToolbar extends AbstractAction { | |
| 32 | ||
| 33 | private static final long serialVersionUID = 5232557211589840659L; | |
| 34 | 3 | private Logger log = Logger.getLogger(this.getClass()); | 
| 35 | ||
| 36 |      /** | |
| 37 |       * Construtor da classe. Inicialmente vazio, pois a classe não possui | |
| 38 |       * atributos. | |
| 39 |       */ | |
| 40 | 3 |      public AcaoToolbar() { | 
| 41 | 3 | } | 
| 42 | ||
| 43 |      /** | |
| 44 |       * Recupera o nome setado em ActionCommand numa String. Executa testes para | |
| 45 |       * checar qual o comando desejado. Caso clique no primeiro botão, inicia uma | |
| 46 |       * thread de FtpClient. Se for um dos botões do meio, executa o método | |
| 47 |       * {@link net.sf.webphotos.gui.PainelWebFotos#marcaAlbunsFTP(int) marcaAlbunsFTP(int comando)} | |
| 48 |       * e marca para download ou upload. E caso seja o último botão, adiciona | |
| 49 |       * fotos. | |
| 50 |       * | |
| 51 |       * @param e Evento da ação | |
| 52 |       */ | |
| 53 | @Override | |
| 54 | public void actionPerformed(ActionEvent e) { | |
| 55 | 9 | String comando = e.getActionCommand(); | 
| 56 | ||
| 57 | 9 |          if (comando.equals("ftp")) { | 
| 58 | 0 |              Thread t = new Thread(new FtpClient()); | 
| 59 | 0 |              t.start(); | 
| 60 | 0 |          } else if (comando.equals("down")) { | 
| 61 | 0 |              PainelWebFotos.marcaAlbunsFTP(2); | 
| 62 | 9 |          } else if (comando.equals("up")) { | 
| 63 | 0 |              PainelWebFotos.marcaAlbunsFTP(1); | 
| 64 | 9 | } else if (comando.equals("camera")) { | 
| 65 | 3 |              log.debug("adicionar fotos"); | 
| 66 | } | |
| 67 | 9 | } | 
| 68 | } |