r346 - in misctestproject/trunk: . src src/main src/main/java src/main/java/org src/main/java/org/nuiton src/main/java/org/nuiton/test src/main/java/org/nuiton/test/layer
Author: echatellier Date: 2010-01-05 15:01:10 +0100 (Tue, 05 Jan 2010) New Revision: 346 Added: misctestproject/trunk/pom.xml misctestproject/trunk/src/ misctestproject/trunk/src/main/ misctestproject/trunk/src/main/java/ misctestproject/trunk/src/main/java/org/ misctestproject/trunk/src/main/java/org/nuiton/ misctestproject/trunk/src/main/java/org/nuiton/test/ misctestproject/trunk/src/main/java/org/nuiton/test/layer/ misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestBlockingLayer.java misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestLayer.java misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestModel.java Modified: misctestproject/trunk/ Log: Initial commit. Property changes on: misctestproject/trunk ___________________________________________________________________ Added: svn:ignore + .settings target .classpath .project Added: misctestproject/trunk/pom.xml =================================================================== --- misctestproject/trunk/pom.xml (rev 0) +++ misctestproject/trunk/pom.xml 2010-01-05 14:01:10 UTC (rev 346) @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <!--The version of maven's project object model--> + <modelVersion>4.0.0</modelVersion> + + <!--A unique name for this project--> + <groupId>test</groupId> + <artifactId>test</artifactId> + <name>test</name> + + <!--ejb, jar, war...--> + <packaging>jar</packaging> + + <!--Version--> + <version>1</version> + + <!--Description--> + <description>test</description> + <inceptionYear>2009</inceptionYear> + + <build> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.6</source> + <target>1.6</target> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <!-- Dependencies --> + <dependencies> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>1.1.1</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.4</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>commons-configuration</groupId> + <artifactId>commons-configuration</artifactId> + <version>1.6</version> + </dependency> + + <dependency> + <groupId>commons-cli</groupId> + <artifactId>commons-cli</artifactId> + <version>1.2</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-utils</artifactId> + <version>1.1.0</version> + </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.14</version> + <scope>compile</scope> + </dependency> + + <!-- SwingLabs Swing Component Extensions --> + <dependency> + <groupId>org.swinglabs</groupId> + <artifactId>swingx</artifactId> + <version>1.6</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.swinglabs</groupId> + <artifactId>jxlayer</artifactId> + <version>3.0.4</version> + </dependency> + </dependencies> +</project> \ No newline at end of file Added: misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestBlockingLayer.java =================================================================== --- misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestBlockingLayer.java (rev 0) +++ misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestBlockingLayer.java 2010-01-05 14:01:10 UTC (rev 346) @@ -0,0 +1,66 @@ +/* *##% + * Copyright (C) 2010 Code Lutin, Chatellier Eric + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +package org.nuiton.test.layer; + +import java.awt.event.MouseEvent; + +import javax.swing.JComponent; +import javax.swing.JScrollBar; +import javax.swing.JTable; + +import org.jdesktop.jxlayer.JXLayer; +import org.jdesktop.jxlayer.plaf.AbstractLayerUI; + +/** + * TODO add comment here. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class TestBlockingLayer extends AbstractLayerUI<JComponent> { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1877010363682882308L; + + /* + * @see org.jdesktop.jxlayer.plaf.AbstractLayerUI#processMouseEvent(java.awt.event.MouseEvent, org.jdesktop.jxlayer.JXLayer) + */ + @Override + protected void processMouseEvent(MouseEvent event, + JXLayer<? extends JComponent> layer) { + + if (!(event.getSource() instanceof JScrollBar)) { + System.out.println("blocked on " + event.getSource()); + event.consume(); + } + + if (event.getSource() instanceof JTable) { + JTable tableSource = (JTable)event.getSource(); + TestModel model = (TestModel)tableSource.getModel(); + + int rowIndex = tableSource.rowAtPoint(event.getPoint()); + int columnIndex = tableSource.columnAtPoint(event.getPoint()); + Object value = model.getValueAt(rowIndex, columnIndex); + System.out.println("Try to click on + " + value); + } + } +} Property changes on: misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestBlockingLayer.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestLayer.java =================================================================== --- misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestLayer.java (rev 0) +++ misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestLayer.java 2010-01-05 14:01:10 UTC (rev 346) @@ -0,0 +1,66 @@ +/* *##% + * Copyright (C) 2010 Code Lutin, Chatellier Eric + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +package org.nuiton.test.layer; + +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; + +import org.jdesktop.jxlayer.JXLayer; + +/** + * Test jxlayer. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class TestLayer extends JFrame { + + /** serialVersionUID. */ + private static final long serialVersionUID = 8735374368691145269L; + + public static void main(String[] args) { + new TestLayer().setVisible(true); + } + + public TestLayer() { + + JPanel rootPanel = new JPanel(); + + JTable table = new JTable(); + table.setModel(new TestModel()); + + JScrollPane pane = new JScrollPane(table); + rootPanel.add(pane); + + TestBlockingLayer layerUI = new TestBlockingLayer(); + // wrap the panel with JXLayer and the lockableUI + JXLayer<JComponent> l = new JXLayer<JComponent>(rootPanel, layerUI); + + this.add(l); + this.pack(); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } + +} Property changes on: misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestLayer.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestModel.java =================================================================== --- misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestModel.java (rev 0) +++ misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestModel.java 2010-01-05 14:01:10 UTC (rev 346) @@ -0,0 +1,76 @@ +/* *##% + * Copyright (C) 2010 Code Lutin, Chatellier Eric + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +package org.nuiton.test.layer; + +import javax.swing.event.TableModelListener; +import javax.swing.table.TableModel; + +/** + * TODO add comment here. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class TestModel implements TableModel { + + @Override + public void setValueAt(Object aValue, int rowIndex, int columnIndex) { + } + + @Override + public void removeTableModelListener(TableModelListener l) { + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + return true; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + return rowIndex + "," + columnIndex; + } + + @Override + public int getRowCount() { + return 50; + } + + @Override + public String getColumnName(int columnIndex) { + return "column " + columnIndex; + } + + @Override + public int getColumnCount() { + return 5; + } + + @Override + public Class<?> getColumnClass(int columnIndex) { + return String.class; + } + + @Override + public void addTableModelListener(TableModelListener l) { + } +} Property changes on: misctestproject/trunk/src/main/java/org/nuiton/test/layer/TestModel.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL"
participants (1)
-
echatellier@users.nuiton.org