new AlternateRowHighlighter(Color.white,new Color(0xF0, 0xF0, 0xE0), null) //
, new es.juanrak.svn.gui.swing.tabla.Highlighter() {
@Override
public Component highlight(Component component,
ComponentAdapter adapter) {
SVNLogRutaEntrada logRutaEntrada = ((SVNPathTableModel)table.getModel()).getRutaEntrada(adapter.row);
if( logRutaEntrada.getPath().equals(logRutaEntrada.getLogEntrada().getParaPath())) {
component.setBackground(Color.BLACK);
component.setForeground(Color.WHITE);
}
return component;
}
}
};
table.setHighlighters(highlighters);
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if( e.getClickCount() == 2 ) {
int row = table.rowAtPoint(e.getPoint());
row = table.convertRowIndexToModel( row );
SVNLogRutaEntrada logRutaEntrada = ((SVNPathTableModel)table.getModel()).getRutaEntrada(row);
try {
File fd = logRutaEntrada.getFicheroRemoto();
if( fd == null) {
fd = controlador.getFichero(logRutaEntrada.getPath(), logRutaEntrada.getRevision());
logRutaEntrada.setFicheroRemoto(fd);
}
controlador.getLogger().log("[view] Fichero " + logRutaEntrada.getPath() + " rev: " + logRutaEntrada.getRevision());
SVNVisorFicheroEdicion visor = new SVNVisorFicheroEdicion(logRutaEntrada);
visor.setVisible(true);
}
catch(Exception exception) {
JXErrorPane.showDialog(exception);
}
}
}
public void mouseReleased(MouseEvent e) {
Point pt = e.getPoint();
int row = table.rowAtPoint(e.getPoint());
row = table.convertRowIndexToModel( row );
if( row != -1 ) {
SVNLogRutaEntrada logRutaEntrada = ((SVNPathTableModel)table.getModel()).getRutaEntrada(row);
if (logRutaEntrada != null) {
if (e.getButton() == MouseEvent.BUTTON3) {
PopupMenuActionListener listener = new PopupMenuActionListener(controlador, logRutaEntrada);
JPopupMenu popup = SVNMenuPopupConstructor.getPopupMenu(logRutaEntrada, controlador, listener);
popup.show(table, pt.x, pt.y);