You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by sk...@apache.org on 2016/11/11 18:52:41 UTC

[3/6] cayenne git commit: Windows Look And Feel

Windows Look And Feel


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/5bb62a05
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/5bb62a05
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/5bb62a05

Branch: refs/heads/master
Commit: 5bb62a05a7bb29b3fe042338e83598182b2f71b6
Parents: f3fb4c2
Author: stariy <st...@gmail.com>
Authored: Thu Nov 10 21:53:31 2016 +0300
Committer: stariy <st...@gmail.com>
Committed: Thu Nov 10 21:53:31 2016 +0300

----------------------------------------------------------------------
 modeler/cayenne-modeler-win-ext/pom.xml         | 93 ++++++++++++++++++++
 .../modeler/win/WinCayenneModelerModule.java    | 30 +++++++
 .../org/apache/cayenne/modeler/win/WinMain.java | 50 +++++++++++
 .../modeler/win/WinPlatformInitializer.java     | 43 +++++++++
 modeler/cayenne-modeler-win/pom.xml             |  7 +-
 modeler/pom.xml                                 |  3 +-
 6 files changed, 224 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/5bb62a05/modeler/cayenne-modeler-win-ext/pom.xml
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler-win-ext/pom.xml b/modeler/cayenne-modeler-win-ext/pom.xml
new file mode 100644
index 0000000..93e837d
--- /dev/null
+++ b/modeler/cayenne-modeler-win-ext/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	Licensed to the Apache Software Foundation (ASF) under one
+	or more contributor license agreements.  See the NOTICE file
+	distributed with this work for additional information
+	regarding copyright ownership.  The ASF licenses this file
+	to you under the Apache License, Version 2.0 (the
+	"License"); you may not use this file except in compliance
+	with the License.  You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+	Unless required by applicable law or agreed to in writing,
+	software distributed under the License is distributed on an
+	"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+	KIND, either express or implied.  See the License for the
+	specific language governing permissions and limitations
+	under the License.
+-->
+<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/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>cayenne-modeler-parent</artifactId>
+        <groupId>org.apache.cayenne.modeler</groupId>
+        <version>4.0.M4-SNAPSHOT</version>
+    </parent>
+
+    <name>Cayenne Modeler Win Extensions</name>
+    <packaging>jar</packaging>
+    <artifactId>cayenne-modeler-win-ext</artifactId>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.cayenne.modeler</groupId>
+            <artifactId>cayenne-modeler</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cayenne</groupId>
+            <artifactId>cayenne-di</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cayenne</groupId>
+            <artifactId>cayenne-server</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cayenne</groupId>
+            <artifactId>cayenne-project</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.jgoodies</groupId>
+            <artifactId>jgoodies-looks</artifactId>
+        </dependency>
+    </dependencies>
+
+    <profiles>
+        <profile>
+            <id>code-quality</id>
+
+            <activation>
+                <property>
+                    <name>!fast-and-dirty</name>
+                </property>
+            </activation>
+
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-checkstyle-plugin</artifactId>
+                        <!--<configuration>
+                            <suppressionsLocation>${project.basedir}/cayenne-checkstyle-suppression.xml</suppressionsLocation>
+                        </configuration>-->
+                    </plugin>
+                    <plugin>
+                        <artifactId>maven-pmd-plugin</artifactId>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/5bb62a05/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinCayenneModelerModule.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinCayenneModelerModule.java b/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinCayenneModelerModule.java
new file mode 100644
index 0000000..6c0257e
--- /dev/null
+++ b/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinCayenneModelerModule.java
@@ -0,0 +1,30 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.win;
+
+import org.apache.cayenne.di.Binder;
+import org.apache.cayenne.di.Module;
+import org.apache.cayenne.modeler.init.platform.PlatformInitializer;
+
+public class WinCayenneModelerModule implements Module {
+
+    public void configure(Binder binder) {
+        binder.bind(PlatformInitializer.class).to(WinPlatformInitializer.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/5bb62a05/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinMain.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinMain.java b/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinMain.java
new file mode 100644
index 0000000..baf66f5
--- /dev/null
+++ b/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinMain.java
@@ -0,0 +1,50 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.win;
+
+import org.apache.cayenne.di.Module;
+import org.apache.cayenne.modeler.Main;
+
+import java.util.Collection;
+
+public class WinMain extends Main {
+
+    /**
+     * Main method that starts the CayenneModeler.
+     */
+    public static void main(String[] args) {
+        try {
+            new WinMain(args).launch();
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+    }
+
+    protected WinMain(String[] args) {
+        super(args);
+    }
+
+    @Override
+    protected Collection<Module> appendModules(Collection<Module> modules) {
+        modules = super.appendModules(modules);
+        modules.add(new WinCayenneModelerModule());
+        return modules;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/5bb62a05/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinPlatformInitializer.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinPlatformInitializer.java b/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinPlatformInitializer.java
new file mode 100644
index 0000000..3f7871d
--- /dev/null
+++ b/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinPlatformInitializer.java
@@ -0,0 +1,43 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.win;
+
+import com.jgoodies.looks.windows.WindowsLookAndFeel;
+import org.apache.cayenne.modeler.init.platform.PlatformInitializer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JFrame;
+import javax.swing.UIManager;
+
+public class WinPlatformInitializer implements PlatformInitializer {
+
+    private static Log logger = LogFactory.getLog(WinPlatformInitializer.class);
+
+    public void setupMenus(JFrame frame) {
+    }
+
+    public void initLookAndFeel() {
+        try {
+            UIManager.setLookAndFeel(WindowsLookAndFeel.class.getName());
+        } catch (Exception e) {
+            logger.warn("Error installing L&F: " + WindowsLookAndFeel.class.getName(), e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/5bb62a05/modeler/cayenne-modeler-win/pom.xml
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler-win/pom.xml b/modeler/cayenne-modeler-win/pom.xml
index c5e355a..99a3e7d 100644
--- a/modeler/cayenne-modeler-win/pom.xml
+++ b/modeler/cayenne-modeler-win/pom.xml
@@ -39,6 +39,11 @@
 			<version>${project.version}</version>
 		</dependency>
 
+		<dependency>
+			<groupId>org.apache.cayenne.modeler</groupId>
+			<artifactId>cayenne-modeler-win-ext</artifactId>
+			<version>${project.version}</version>
+		</dependency>
 		<!-- 
 			adding cayenne runtime dependencies explicitly, 
 			as they are marked as "provided" in the modeler pom
@@ -87,7 +92,7 @@
 							<name>CayenneModeler</name>
 							<longName>${project.version}</longName>
 							<destDir>${project.build.outputDirectory}</destDir>
-							<mainClass>org.apache.cayenne.modeler.generic.GenericMain</mainClass>
+							<mainClass>org.apache.cayenne.modeler.win.WinMain</mainClass>
 							<icon>src/japplication/resources/CayenneModeler.ico</icon>
 							<os>windows</os>
 							<jvm>1.5+</jvm>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/5bb62a05/modeler/pom.xml
----------------------------------------------------------------------
diff --git a/modeler/pom.xml b/modeler/pom.xml
index 64a42a5..fbe9a28 100644
--- a/modeler/pom.xml
+++ b/modeler/pom.xml
@@ -40,7 +40,8 @@
 		<module>cayenne-modeler-mac-ext</module>
 		<module>cayenne-modeler-mac</module>
 		<module>cayenne-modeler-win</module>
-	</modules>
+        <module>cayenne-modeler-win-ext</module>
+    </modules>
 
 	<build>
 		<plugins>