|
From: <de...@us...> - 2003-12-19 12:06:45
|
Update of /cvsroot/fudaa/fudaa_devel/ebli/src/org/fudaa/ebli/tableau
In directory sc8-pr-cvs1:/tmp/cvs-serv28248/tableau
Modified Files:
EbliCellDialogEditor.java EbliPanelListEditor.java
Added Files:
EbliCellButtonEditor.java
Log Message:
Correction bogue bgraphe
Ajout support graphe ( suivi souris)
--- NEW FILE: EbliCellButtonEditor.java ---
/*
* @file TrCellDialogEditor.java
* @creation 13 mai 2003
* @modification $Date: 2003/12/19 12:06:42 $
* @license GNU General Public License 2
* @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
* @mail de...@fu...
*/
package org.fudaa.ebli.tableau;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.EventObject;
import javax.swing.DefaultCellEditor;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import com.memoire.bu.BuButton;
import org.fudaa.ebli.dialog.EbliSimpleDialogPanel;
/**
* @author deniger
* @version $Id: EbliCellButtonEditor.java,v 1.1 2003/12/19 12:06:42 deniger Exp $
*/
public abstract class EbliCellButtonEditor
extends JButton
implements TableCellEditor, ActionListener {
private transient ChangeEvent changeEvent= null;
private EbliCellDecorator decorator_;
protected Object value_;
private boolean doubleClick_;
public EbliCellButtonEditor(
EbliCellDecorator _deco) {
setOpaque(false);
setEnabled(true);
addActionListener(this);
decorator_= _deco;
setBorder(UIManager.getBorder("Label.border"));
setFont(UIManager.getFont("Table.font"));
setHorizontalAlignment(0);
}
/**
*
*/
public Component getTableCellEditorComponent(
JTable table,
Object value,
boolean isSelected,
int row,
int column) {
value_= value;
setValue(value);
if (decorator_ != null)
decorator_.decore(this, table, value, row, column);
return this;
}
public void setValue(Object _o) {
setText(_o.toString());
}
/**
*
*/
public Object getCellEditorValue() {
return value_;
}
/**
*
*/
public boolean isCellEditable(EventObject anEvent) {
if (!doubleClick_)
return true;
if (anEvent instanceof MouseEvent) {
return ((MouseEvent)anEvent).getClickCount() >= 2;
}
return true;
}
/**
*
*/
public boolean shouldSelectCell(EventObject anEvent) {
return true;
}
/**
*
*/
public void cancelCellEditing() {
Object[] listeners= listenerList.getListenerList();
for (int i= listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == CellEditorListener.class) {
if (changeEvent == null)
changeEvent= new ChangeEvent(this);
((CellEditorListener)listeners[i + 1]).editingCanceled(changeEvent);
}
}
}
/**
*
*/
public void addCellEditorListener(CellEditorListener l) {
listenerList.add(CellEditorListener.class, l);
}
/**
*
*/
public void removeCellEditorListener(CellEditorListener l) {
listenerList.remove(CellEditorListener.class, l);
}
public boolean stopCellEditing() {
Object[] listeners= listenerList.getListenerList();
for (int i= listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == CellEditorListener.class) {
if (changeEvent == null)
changeEvent= new ChangeEvent(this);
((CellEditorListener)listeners[i + 1]).editingStopped(changeEvent);
}
}
return false;
}
protected abstract void doAction();
public void actionPerformed(ActionEvent _ae) {
doAction();
stopCellEditing();
}
/**
*
*/
public EbliCellDecorator getDecorator() {
return decorator_;
}
/**
*
*/
public void setDecorator(EbliCellDecorator _decorator) {
decorator_= _decorator;
}
/**
*
*/
public boolean isDoubleClick() {
return doubleClick_;
}
/**
*
*/
public void setDoubleClick(boolean _b) {
doubleClick_= _b;
}
}
Index: EbliCellDialogEditor.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/ebli/src/org/fudaa/ebli/tableau/EbliCellDialogEditor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** EbliCellDialogEditor.java 12 Dec 2003 10:52:26 -0000 1.1
--- EbliCellDialogEditor.java 19 Dec 2003 12:06:42 -0000 1.2
***************
*** 31,41 ****
*/
public class EbliCellDialogEditor
! extends JButton
! implements TableCellEditor, ActionListener {
protected EbliSimpleDialogPanel dialog_;
- private transient ChangeEvent changeEvent= null;
- private EbliCellDecorator decorator_;
- private Object value_;
- private boolean doubleClick_;
public EbliCellDialogEditor(EbliSimpleDialogPanel _dialog) {
this(_dialog, null);
--- 31,36 ----
*/
public class EbliCellDialogEditor
! extends EbliCellButtonEditor{
protected EbliSimpleDialogPanel dialog_;
public EbliCellDialogEditor(EbliSimpleDialogPanel _dialog) {
this(_dialog, null);
***************
*** 44,134 ****
EbliSimpleDialogPanel _dialog,
EbliCellDecorator _deco) {
! setOpaque(false);
! setEnabled(true);
! addActionListener(this);
! decorator_= _deco;
! setBorder(UIManager.getBorder("Label.border"));
! setFont(UIManager.getFont("Table.font"));
! setHorizontalAlignment(0);
dialog_= _dialog;
}
! /**
! *
! */
! public Component getTableCellEditorComponent(
! JTable table,
! Object value,
! boolean isSelected,
! int row,
! int column) {
! value_= value;
! setValue(value);
! if (decorator_ != null)
! decorator_.decore(this, table, value, row, column);
! return this;
! }
! public void setValue(Object _o) {
! setText(_o.toString());
! }
! /**
! *
! */
! public Object getCellEditorValue() {
! return value_;
! }
! /**
! *
! */
! public boolean isCellEditable(EventObject anEvent) {
! if (!doubleClick_)
! return true;
! if (anEvent instanceof MouseEvent) {
! return ((MouseEvent)anEvent).getClickCount() >= 2;
! }
! return true;
! }
! /**
! *
! */
! public boolean shouldSelectCell(EventObject anEvent) {
! return true;
! }
! /**
! *
! */
! public void cancelCellEditing() {
! Object[] listeners= listenerList.getListenerList();
! for (int i= listeners.length - 2; i >= 0; i -= 2) {
! if (listeners[i] == CellEditorListener.class) {
! if (changeEvent == null)
! changeEvent= new ChangeEvent(this);
! ((CellEditorListener)listeners[i + 1]).editingCanceled(changeEvent);
! }
! }
! }
! /**
! *
! */
! public void addCellEditorListener(CellEditorListener l) {
! listenerList.add(CellEditorListener.class, l);
! }
! /**
! *
! */
! public void removeCellEditorListener(CellEditorListener l) {
! listenerList.remove(CellEditorListener.class, l);
! }
! public boolean stopCellEditing() {
! Object[] listeners= listenerList.getListenerList();
! for (int i= listeners.length - 2; i >= 0; i -= 2) {
! if (listeners[i] == CellEditorListener.class) {
! if (changeEvent == null)
! changeEvent= new ChangeEvent(this);
! ((CellEditorListener)listeners[i + 1]).editingStopped(changeEvent);
! }
! }
! return false;
! }
! private void go() {
dialog_.setValue(value_);
dialog_.doLayout();
--- 39,47 ----
EbliSimpleDialogPanel _dialog,
EbliCellDecorator _deco) {
! super(_deco);
dialog_= _dialog;
}
!
! protected void doAction() {
dialog_.setValue(value_);
dialog_.doLayout();
***************
*** 137,177 ****
value_= dialog_.getValue();
setValue(value_);
! stopCellEditing();
} else
cancelCellEditing();
if (getParent() != null) {
getParent().requestFocus();
}
- // }
- }
- /**
- *
- */
- public void actionPerformed(ActionEvent _ae) {
- go();
- }
- /**
- *
- */
- public EbliCellDecorator getDecorator() {
- return decorator_;
- }
- /**
- *
- */
- public void setDecorator(EbliCellDecorator _decorator) {
- decorator_= _decorator;
- }
- /**
- *
- */
- public boolean isDoubleClick() {
- return doubleClick_;
- }
- /**
- *
- */
- public void setDoubleClick(boolean _b) {
- doubleClick_= _b;
}
}
--- 50,61 ----
value_= dialog_.getValue();
setValue(value_);
!
} else
cancelCellEditing();
+ stopCellEditing();
if (getParent() != null) {
getParent().requestFocus();
}
}
+
}
Index: EbliPanelListEditor.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/ebli/src/org/fudaa/ebli/tableau/EbliPanelListEditor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** EbliPanelListEditor.java 12 Dec 2003 10:52:26 -0000 1.1
--- EbliPanelListEditor.java 19 Dec 2003 12:06:42 -0000 1.2
***************
*** 234,238 ****
btModifier_=
buildButton(
! BuResource.BU.getIcon("modifier"),
EbliResource.getS("Modifier"),
"MODIFIER",
--- 234,238 ----
btModifier_=
buildButton(
! BuResource.BU.getIcon("editer"),
EbliResource.getS("Modifier"),
"MODIFIER",
|