| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| AcaoDocumentListener |
|
| 1.0;1 |
| 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 javax.swing.event.DocumentEvent; | |
| 19 | import javax.swing.event.DocumentListener; | |
| 20 | import net.sf.webphotos.gui.PainelWebFotos; | |
| 21 | ||
| 22 | /** | |
| 23 | * Notifica alterações no documento. Checa se ocorreram modificações e através | |
| 24 | * do método da classe chamado altera, alcança outro método da classe | |
| 25 | * PainelWebFotos chamado | |
| 26 | * {@link net.sf.webphotos.gui.PainelWebFotos#alteracaoDetectada(DocumentEvent) alteracaoDetectada}(DocumentEvent | |
| 27 | * e) que tem funcionalidade de uma flag. | |
| 28 | */ | |
| 29 | public class AcaoDocumentListener implements DocumentListener { | |
| 30 | ||
| 31 | /** | |
| 32 | * Construtor da classe. Inicialmente vazio pois a classe não possui dados | |
| 33 | * atributos. | |
| 34 | */ | |
| 35 | 3 | public AcaoDocumentListener() { |
| 36 | 3 | } |
| 37 | ||
| 38 | /** | |
| 39 | * Implementa o método insertUptade da interface | |
| 40 | * {@link javax.swing.event.DocumentListener DocumentListener}. Faz uso da | |
| 41 | * função | |
| 42 | * {@link net.sf.webphotos.acao.AcaoDocumentListener#altera(DocumentEvent) altera}(DocumentEvent | |
| 43 | * e) da própria classe. Não possui utilizações. | |
| 44 | * | |
| 45 | * @param e Notifica mudanças no documento. | |
| 46 | */ | |
| 47 | @Override | |
| 48 | public void insertUpdate(DocumentEvent e) { | |
| 49 | 33 | altera(e); |
| 50 | 33 | } |
| 51 | ||
| 52 | /** | |
| 53 | * Implementa o método removeUptade da interface | |
| 54 | * {@link javax.swing.event.DocumentListener DocumentListener}. Faz uso da | |
| 55 | * função | |
| 56 | * {@link net.sf.webphotos.acao.AcaoDocumentListener#altera(DocumentEvent) altera}(DocumentEvent | |
| 57 | * e) da própria classe. Não possui utilizações. | |
| 58 | * | |
| 59 | * @param e Notifica mudanças no documento. | |
| 60 | */ | |
| 61 | @Override | |
| 62 | public void removeUpdate(DocumentEvent e) { | |
| 63 | 30 | altera(e); |
| 64 | 30 | } |
| 65 | ||
| 66 | /** | |
| 67 | * Implementa o método changeUptade da interface | |
| 68 | * {@link javax.swing.event.DocumentListener DocumentListener}. Faz uso da | |
| 69 | * função | |
| 70 | * {@link net.sf.webphotos.acao.AcaoDocumentListener#altera(DocumentEvent) altera}(DocumentEvent | |
| 71 | * e) da própria classe. Não possui utilizações. | |
| 72 | * | |
| 73 | * @param e Notifica mudanças no documento. | |
| 74 | */ | |
| 75 | @Override | |
| 76 | public void changedUpdate(DocumentEvent e) { | |
| 77 | 0 | altera(e); |
| 78 | 0 | } |
| 79 | ||
| 80 | /** | |
| 81 | * Faz uso da função | |
| 82 | * {@link net.sf.webphotos.gui.PainelWebFotos#alteracaoDetectada() alteracaoDetectada}() | |
| 83 | * da classe PainelWebFotos, para checar se ocorreu alguma alteração. Uma | |
| 84 | * espécie de flag. | |
| 85 | * | |
| 86 | * @param e Notifica mudanças no documento. | |
| 87 | */ | |
| 88 | public void altera(DocumentEvent e) { | |
| 89 | 63 | PainelWebFotos.alteracaoDetectada(); |
| 90 | 63 | } |
| 91 | } |