1. Micha Kops
  2. apache-pivot-tutorial

Commits

Micha Kops  committed 77557a1

Initial import.

  • Participants
  • Branches master

Comments (0)

Files changed (4)

File .gitignore

View file
+.project
+.settings
+target
+.classpath

File README.md

View file
+# Apache Pivot Quick Samples
+
+Short examples on creating an Apache Pivot Rich Client application using programmatical declaration or using BXML and WTK to create layouts.
+
+----
+
+**2013 Micha Kops / hasCode.com**

File pom.xml

View file
+<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>
+	<groupId>com.hascode.tutorial</groupId>
+	<artifactId>apache-pivot-tutorial</artifactId>
+	<version>1.0.0</version>
+
+	<prerequisites>
+		<maven>3.0.4</maven>
+	</prerequisites>
+
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<pivot.version>2.0.2</pivot.version>
+	</properties>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.pivot</groupId>
+			<artifactId>pivot-core</artifactId>
+			<version>${pivot.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.pivot</groupId>
+			<artifactId>pivot-wtk</artifactId>
+			<version>${pivot.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.pivot</groupId>
+			<artifactId>pivot-charts</artifactId>
+			<version>${pivot.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.pivot</groupId>
+			<artifactId>pivot-wtk-terra</artifactId>
+			<version>${pivot.version}</version>
+		</dependency>
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>3.1</version>
+				<configuration>
+					<source>1.7</source>
+					<target>1.7</target>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>

File src/main/java/com/hascode/tutorial/sample1/Main.java

View file
+package com.hascode.tutorial.sample1;
+
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.FileBrowserSheet;
+import org.apache.pivot.wtk.Form;
+import org.apache.pivot.wtk.Label;
+import org.apache.pivot.wtk.PushButton;
+import org.apache.pivot.wtk.Window;
+
+public class Main {
+	public static void main(final String[] args) {
+		DesktopApplicationContext.main(MyApp.class, new String[] {});
+	}
+
+	public static class MyApp extends Window implements Application {
+		private final Form form = new Form();
+		private final Form.Section section = new Form.Section();
+		private final Label label = new Label("Select file to upload...");
+		private final PushButton btOpenFileDialog = new PushButton();
+		private final FileBrowserSheet fileBrowser = new FileBrowserSheet();
+
+		public MyApp() {
+			compose();
+		}
+
+		private void compose() {
+			this.setTitle("hasCode.com - Apache Pivot Example 1 - Programmatic construction");
+			this.setMaximized(true);
+			section.add(label);
+			btOpenFileDialog.setButtonData("Select File..");
+			section.add(btOpenFileDialog);
+			form.getSections().add(section);
+			this.add(form);
+		}
+
+		public void startup(final Display display,
+				final Map<String, String> properties) throws Exception {
+			this.open(display);
+		}
+
+		public boolean shutdown(final boolean optional) throws Exception {
+			this.close();
+			return false;
+		}
+
+		public void suspend() throws Exception {
+		}
+
+		public void resume() throws Exception {
+		}
+
+	}
+}