+++ /dev/null
-/*
- * Copyright
- * 2008 axYus - www.axyus.com
- * 2008 L.Meckert - laurent.meckert.com
- *
- * This file is part of XEMELIOS.
- *
- * XEMELIOS 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 2 of the License, or
- * (at your option) any later version.
- *
- * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package fr.gouv.finances.cp.xemelios.plugin.generatorPesPjs;
-
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.SwingUtilities;
-
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author jean-philippe.tessier
- */
-public abstract class AbstractDlgPesPj implements KeyListener, MouseListener {
- private static final Logger logger = Logger.getLogger(AbstractDlgPesPj.class);
- protected javax.swing.JDialog dialog = null;
- protected JFrame parentWindow;
-
- /**
- * The busy state of the frame.
- */
- private boolean busy = false;
- /**
- * The glass pane used when busy.
- */
- private Component glassPane = null;
- /**
- * The original glass pane, which is reset when not busy.
- */
- private Component defaultGlassPane = null;
-
- /** Creates new form AbstractDlgSignerfichier
- * @param parent
- * @param modal
- */
- public AbstractDlgPesPj(java.awt.Frame parent, boolean modal) {
- //System.out.println("AbstractDlgPesPj !!!");
- dialog = new javax.swing.JDialog(parent, modal);
- initGlassPane();
- }
-
-
-/**
- *
- * @return
- */
- public boolean isBusy() {
- return this.busy;
- }
-
- void setBusy(boolean busy) {
- // only set if changing
- if (this.busy != busy) {
- this.busy = busy;
- // If busy, keep current glass pane to put back when not
- // busy. This is done in case the application is using
- // it's own glass pane for something special.
- if (busy) {
- defaultGlassPane = dialog.getGlassPane();
- dialog.setGlassPane(glassPane);
- } else {
- dialog.setGlassPane(defaultGlassPane);
- defaultGlassPane = null;
- }
- glassPane.setVisible(busy);
- glassPane.setCursor(busy ? Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) : Cursor.getDefaultCursor());
- dialog.setCursor(glassPane.getCursor());
- }
- }
-
- /**
- * Handle key typed events. Consumes the event for the glasspane
- * when the frame is busy.
- *
- * @param ke the key event
- */
- public void keyTyped(KeyEvent ke) {
- ke.consume();
- }
-
- /**
- * Handle key released events. Consumes the event for the glasspane
- * when the frame is busy.
- *
- * @param ke the key event
- */
- public void keyReleased(KeyEvent ke) {
-System.out.println("keyReleased !"+ke.getKeyCode());
- ke.consume();
- }
-
- /**
- * Handle key pressed events. Consumes the event for the glasspane
- * when the frame is busy.
- *
- * @param ke the key event
- */
- public void keyPressed(KeyEvent ke) {
- ke.consume();
- }
-
- /**
- * Handle mouse clicked events. Consumes the event for the glasspane
- * when the frame is busy.
- *
- * @param me the mouse event
- */
- public void mouseClicked(MouseEvent me) {
- me.consume();
- }
-
- /**
- * Handle mouse entered events. Consumes the event for the glasspane
- * when the frame is busy.
- *
- * @param me the mouse event
- */
- public void mouseEntered(MouseEvent me) {
- me.consume();
- }
-
- /**
- * Handle mouse exited events. Consumes the event for the glasspane
- * when the frame is busy.
- *
- * @param me the mouse event
- */
- public void mouseExited(MouseEvent me) {
- me.consume();
- }
-
- /**
- * Handle mouse pressed events. Consumes the event for the glasspane
- * when the frame is busy.
- *
- * @param me the mouse event
- */
- public void mousePressed(MouseEvent me) {
- System.out.println("mousePressed:"+me.getButton());
- me.consume();
- }
-
- /**
- * Handle mouse released events. Consumes the event for the glasspane
- * when the frame is busy.
- *
- * @param me the mouse event
- */
- public void mouseReleased(MouseEvent me) {
- me.consume();
- }
-
- protected void initGlassPane() {
- glassPane = new JPanel();
- ((JPanel) glassPane).setOpaque(false);
- glassPane.addKeyListener(this);
- glassPane.addMouseListener(this);
- }
-
- public Component getGlassPane() {
- return glassPane;
-}
-
-
-/**
- *
- */
- public void run() {
- dialog.setVisible(true);
- }
-
- /**
- *
- */
- public void close() {
- logger.debug("closing dialog (DlgPesPj)");
- SwingUtilities.getWindowAncestor(dialog).dispose();
- }
-
-
-}