├── .gitignore
├── README.md
├── build
├── com.eclipsesource.tabris.demos.build
│ ├── .project
│ ├── Tabris Demos build.launch
│ └── pom.xml
├── com.eclipsesource.tabris.demos.feature
│ ├── .project
│ ├── build.properties
│ ├── feature.xml
│ ├── pom.xml
│ └── rootfiles
│ │ ├── launch.ini
│ │ └── web.xml
└── com.eclipsesource.tabris.demos.product
│ ├── .project
│ ├── assembly.xml
│ ├── com.eclipsesource.tabris.demos.product
│ └── pom.xml
└── com.eclipsesource.tabris.demos
├── .classpath
├── .project
├── .settings
├── org.eclipse.core.resources.prefs
├── org.eclipse.jdt.core.prefs
├── org.eclipse.jdt.ui.prefs
├── org.eclipse.pde.core.prefs
└── org.eclipse.pde.prefs
├── META-INF
└── MANIFEST.MF
├── Tabris Demos.launch
├── build.properties
├── epl-v10.html
├── gallery
├── IRS46_nasa.jpg
├── IRS46_nasa_thumb.jpg
├── catseye.jpg
├── catseye_thumb.jpg
├── heic0305a.jpg
├── heic0305a_thumb.jpg
├── heic0401a.jpg
├── heic0401a_thumb.jpg
├── heic0405a.jpg
├── heic0405a_thumb.jpg
├── heic0407a.jpg
├── heic0407a_thumb.jpg
├── heic0407b.jpg
├── heic0407b_thumb.jpg
├── heic0409a.jpg
├── heic0409a_thumb.jpg
├── heic0414a.jpg
├── heic0414a_thumb.jpg
├── heic0502a.jpg
├── heic0502a_thumb.jpg
├── heic0514a.jpg
├── heic0514a_thumb.jpg
├── heic0515a.jpg
├── heic0515a_thumb.jpg
├── heic0604a.jpg
├── heic0604a_thumb.jpg
├── heic0910e.jpg
├── heic0910e_thumb.jpg
├── ngc4414.jpg
├── ngc4414_thumb.jpg
├── opo0110a.jpg
├── opo0110a_thumb.jpg
├── opo0505a.jpg
├── opo0505a_thumb.jpg
├── opo9901a.jpg
├── opo9901a_thumb.jpg
├── orion-nebula.jpg
└── orion-nebula_thumb.jpg
├── images
├── action.png
├── action_search.png
├── action_settings.png
├── action_share.png
├── action_theme.png
├── add_page.png
├── add_root_page.png
├── book_a_history.jpg
├── book_after_visiting.jpg
├── book_autobiografy.jpg
├── book_how_literature.jpg
├── book_schroder.jpg
├── book_store_ui.png
├── book_the_dinner.jpg
├── book_vampires.jpg
├── browser.png
├── dontPanic.png
├── envelope.png
├── ernie.png
├── global_action.png
├── hal.png
├── hal_160.png
├── hal_240.png
├── hal_360.png
├── hal_480.png
├── inbox.png
├── line-width-medium.png
├── line-width-thick.png
├── line-width-thin.png
├── mail.png
├── maps.png
├── openurl.png
├── page_all_books.png
├── page_favorite_books.png
├── page_popular_books.png
├── phone.png
├── redo.png
├── remove_root_page.png
├── rubber_grip.png
├── sms.png
├── star-bg.jpg
└── undo.png
├── pom.xml
├── src
└── com
│ └── eclipsesource
│ └── tabris
│ └── demos
│ ├── Activator.java
│ ├── Configuration.java
│ ├── button
│ └── Questions.java
│ ├── enron
│ ├── EnronDataset.java
│ ├── EnronDatasetIndexer.java
│ ├── EnronExample.java
│ └── ExampleUtil.java
│ ├── entrypoints
│ ├── AppEventsDemo.java
│ ├── AppLauncherDemo.java
│ ├── ButtonControlsDemo.java
│ ├── CameraDemo.java
│ ├── ClientDeviceDemo.java
│ ├── DrawDemo.java
│ ├── GalleryDemo.java
│ ├── GeolocationDemo.java
│ ├── InputControlsDemo.java
│ ├── KeyboardDemo.java
│ ├── PdfDemo.java
│ ├── ScrollDemo.java
│ ├── SimpleTreeDemo.java
│ ├── SwipeDemo.java
│ ├── UiDemo.java
│ ├── VideoDemo.java
│ ├── VirtualTreeDemo.java
│ └── VisualGuideDemo.java
│ ├── hal
│ └── Hal9000.java
│ ├── swipe
│ ├── DictionarySwipeItem.java
│ └── DictionarySwipeItemProvider.java
│ └── ui
│ ├── AllBooksPage.java
│ ├── Book.java
│ ├── BookDetailsPage.java
│ ├── BookFilter.java
│ ├── BookProvider.java
│ ├── BookSearchAction.java
│ ├── BooksContentProvider.java
│ ├── BooksLabelProvider.java
│ ├── BooksListPage.java
│ ├── ChangeThemeAction.java
│ ├── Constants.java
│ ├── FavoriteBooksPage.java
│ ├── PopularBooksPage.java
│ ├── ReadBookPage.java
│ ├── SearchResultsPage.java
│ ├── SettingsAction.java
│ ├── SettingsPage.java
│ ├── ShareAction.java
│ └── dynamic
│ ├── DynamicAction.java
│ ├── DynamicPage.java
│ └── DynamicUIDemo.java
└── tabris.target
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | bin
3 | target
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Tabris Demos
2 | ============
3 |
4 | This repository contains a single Eclipse project with sources for all demos shown in the [Tabris Screencasts](http://developer.eclipsesource.com/tabris/demos/). The steps to get this running are described [here](http://developer.eclipsesource.com/tabris/docs/1.4/getting-started/samples/). After running this project the following Entrypoints are available:
5 |
6 | * http://SERVER:9090/input
7 | * http://SERVER:9090/buttons
8 | * http://SERVER:9090/simple-tree
9 | * http://SERVER:9090/location
10 | * http://SERVER:9090/draw
11 | * http://SERVER:9090/launcher
12 | * http://SERVER:9090/camera
13 | * http://SERVER:9090/gallery
14 | * http://SERVER:9090/video
15 | * http://SERVER:9090/keyboard
16 | * http://SERVER:9090/virtual-tree (Read the note below!)
17 | * http://SERVER:9090/swipe
18 | * http://SERVER:9090/appevents
19 | * http://SERVER:9090/ui
20 | * http://SERVER:9090/dynamic-ui
21 | * http://SERVER:9090/device
22 |
23 | To list all available Entrypoints: http://SERVER:9090/index.json
24 |
25 | Please replace SERVER with your ip address.
26 |
27 | IMPORTANT: Virtual Tree
28 | -----------------------
29 | To run the virtual tree example you need to download the [Enron Email Dataset](http://www.cs.cmu.edu/~enron/)
30 | to your local machine. After this is done you need to change the constant DEFAULT_DATASET_DIR within the
31 | com.eclipsesource.tabris.demos.enron.EnronExample class to point to your maildir destination.
32 | After this please point your web browser to http://SERVER:9090/virtual-tree. It may take som eminutes before
33 | the ui will be displayed because the example needs to create some .index files. Don't worry, this happens only once.
34 |
35 | Build
36 | -----
37 | There are some build projects located in the build directory. The build compiles the demo project into a war file that can be deployed
38 | on a servlet container. The build uses [Maven Tycho](http://eclipse.org/tycho/) and can be launched when Maven 3 is installed. Simply step to the build/com.eclipsesource.tabris.demos.build folder and run "mvn clean verify". After the build has succeeded you will find the .war file within the build/com.eclipsesource.tabris.demos.product/target folder.
39 |
40 | Alternatively you can use the [Eclipse m2e Tooling](http://eclipse.org/m2e/) and run the launch configuration located in build/com.eclipsesource.tabris.demos.build.
41 |
42 | License
43 | -------
44 | The code is published under the terms of the [Eclipse Public License, version 1.0](http://www.eclipse.org/legal/epl-v10.html).
45 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.build/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.eclipsesource.tabris.demos.build
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.build/Tabris Demos build.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.build/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | 4.0.0
7 |
8 | 3.0.0
9 |
10 |
11 | com.eclipsesource
12 | tabris-demos-parent
13 | 3.17.0-SNAPSHOT
14 | pom
15 |
16 | Tabris Demos
17 |
18 |
19 |
20 | 2.1.0
21 | org.eclipse.tycho
22 | true
23 |
24 | 2.4
25 | 1.4.1
26 |
27 | demos
28 | ${basedir}
29 | UTF-8
30 |
31 |
32 |
33 | ../../com.eclipsesource.tabris.demos
34 | ../com.eclipsesource.tabris.demos.feature
35 | ../com.eclipsesource.tabris.demos.product
36 |
37 |
38 |
39 |
40 | tabris-repo
41 | p2
42 | http://download.eclipsesource.com/technology/tabris/downloads/releases/3.17.0
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | ${tycho-groupid}
51 | tycho-maven-plugin
52 | ${tycho-version}
53 | true
54 |
55 |
56 |
57 |
58 | ${tycho-groupid}
59 | tycho-compiler-plugin
60 | ${tycho-version}
61 |
62 | ${project.build.sourceEncoding}
63 |
64 |
65 |
66 |
67 |
68 | org.eclipse.tycho
69 | target-platform-configuration
70 | ${tycho-version}
71 |
72 | p2
73 |
74 |
75 | linux
76 | gtk
77 | x86_64
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | ${tycho-groupid}
86 | tycho-packaging-plugin
87 | ${tycho-version}
88 |
89 | yyyyMMdd-HHmm
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.feature/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.eclipsesource.tabris.demos.feature
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.pde.FeatureBuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.pde.FeatureNature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.feature/build.properties:
--------------------------------------------------------------------------------
1 | bin.includes = feature.xml,\
2 | rootfiles/
3 |
4 | root=rootfiles
5 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.feature/feature.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 | Official Tabris Demos
10 |
11 |
12 |
13 | Copyright (c) 2012, 2021 EclipseSource and others.
14 | All rights reserved. This program and the accompanying materials
15 | are made available under the terms of the Eclipse Public License v1.0
16 | which accompanies this distribution, and is available at
17 | http://www.eclipse.org/legal/epl-v10.html
18 |
19 | Contributors:
20 | EclipseSource - initial API and implementation
21 |
22 |
23 |
24 | EPL v1.0
25 |
26 |
27 |
33 |
34 |
40 |
41 |
47 |
48 |
54 |
55 |
61 |
62 |
68 |
69 |
75 |
76 |
82 |
83 |
89 |
90 |
96 |
97 |
103 |
104 |
110 |
111 |
117 |
118 |
124 |
125 |
131 |
132 |
138 |
139 |
145 |
146 |
152 |
153 |
159 |
160 |
166 |
167 |
173 |
174 |
180 |
181 |
187 |
188 |
194 |
195 |
201 |
202 |
203 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.feature/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | 4.0.0
8 |
9 |
10 | tabris-demos-parent
11 | com.eclipsesource
12 | 3.17.0-SNAPSHOT
13 | ../com.eclipsesource.tabris.demos.build/
14 |
15 |
16 | com.eclipsesource
17 | com.eclipsesource.tabris.demos.feature
18 | 3.17.0-SNAPSHOT
19 | eclipse-feature
20 |
21 |
22 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.feature/rootfiles/launch.ini:
--------------------------------------------------------------------------------
1 | # Eclipse Runtime Configuration Overrides
2 | # These properties are loaded prior to starting the framework and can also be used to override System Properties
3 | # @null is a special value used to override and clear the framework's copy of a System Property prior to starting the framework
4 | # "*" can be used together with @null to clear System Properties that match a prefix name.
5 |
6 | osgi.*=@null
7 | org.osgi.*=@null
8 | eclipse.*=@null
9 | org.eclipse.*=@null
10 |
11 | osgi.parentClassloader=app
12 | osgi.contextClassLoaderParent=app
13 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.feature/rootfiles/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | equinoxbridgeservlet
6 | Equinox Bridge Servlet
7 | Equinox Bridge Servlet
8 | org.eclipse.equinox.servletbridge.BridgeServlet
9 |
10 |
11 | commandline
12 | -registryMultiLanguage
13 |
14 |
15 |
16 | enableFrameworkControls
17 | true
18 |
19 |
20 |
35 |
36 | 1
37 |
38 |
39 |
40 | equinoxbridgeservlet
41 | /*
42 |
43 |
44 |
45 |
46 | 20
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.product/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.eclipsesource.tabris.demos.product
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.product/assembly.xml:
--------------------------------------------------------------------------------
1 |
2 | com.eclipsesource.rap.mobile.demos.war
3 |
4 | war
5 |
6 | false
7 |
8 |
9 | ${basedir}/target/products/${artifactId}/linux/gtk/x86_64
10 | /WEB-INF
11 |
12 | plugins/javax.servlet*.jar
13 |
14 |
15 |
16 | ${basedir}/rootfiles
17 | /
18 |
19 |
20 | ${basedir}/target/products/${artifactId}/linux/gtk/x86_64/plugins
21 | /WEB-INF/lib
22 |
23 | org.eclipse.equinox.servletbridge_*.jar
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.product/com.eclipsesource.tabris.demos.product:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/build/com.eclipsesource.tabris.demos.product/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | 4.0.0
8 |
9 |
10 | tabris-demos-parent
11 | com.eclipsesource
12 | 3.17.0-SNAPSHOT
13 | ../com.eclipsesource.tabris.demos.build/
14 |
15 |
16 | com.eclipsesource
17 | com.eclipsesource.tabris.demos.product
18 | 3.17.0-SNAPSHOT
19 | eclipse-repository
20 |
21 |
22 |
23 |
24 |
25 | ${tycho-groupid}
26 | tycho-p2-director-plugin
27 | ${tycho-version}
28 |
29 |
30 | materialize-products
31 |
32 | materialize-products
33 |
34 |
35 |
36 | archive-products
37 |
38 | archive-products
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | com.google.code.maven-replacer-plugin
47 | maven-replacer-plugin
48 | ${replacer-version}
49 |
50 |
51 | verify
52 |
53 | replace
54 |
55 |
56 |
57 |
58 | target/products/${project.artifactId}/linux/gtk/x86_64/configuration/config.ini
59 |
60 |
61 | osgi.bundles=
62 | osgi.bundles=org.eclipse.equinox.servletbridge.extensionbundle,
63 |
64 |
65 | reference\\:file\\:javax.servlet.*?jar@4,
66 |
67 |
68 |
69 |
70 | CASE_INSENSITIVE
71 | UNIX_LINES
72 |
73 |
74 |
75 |
76 |
77 |
78 | org.apache.maven.plugins
79 | maven-assembly-plugin
80 | ${assembly-version}
81 |
82 |
83 | assembly.xml
84 |
85 |
86 | ${war-filename}
87 | false
88 |
89 |
90 |
91 | make-assembly
92 | verify
93 |
94 | single
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.eclipsesource.tabris.demos
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.pde.PluginNature
26 | org.eclipse.jdt.core.javanature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/.settings/org.eclipse.jdt.ui.prefs:
--------------------------------------------------------------------------------
1 | #Mon Sep 19 22:12:05 CEST 2011
2 | eclipse.preferences.version=1
3 | formatter_profile=_RAP
4 | formatter_settings_version=12
5 | org.eclipse.jdt.ui.ignorelowercasenames=true
6 | org.eclipse.jdt.ui.importorder=java;javax;org;com;
7 | org.eclipse.jdt.ui.javadoc=false
8 | org.eclipse.jdt.ui.ondemandthreshold=99
9 | org.eclipse.jdt.ui.staticondemandthreshold=99
10 | org.eclipse.jdt.ui.text.custom_code_templates=/**\n * \n *//**\n * @author ${user} *//**\n * ${tags}\n * ${see_to_target}\n *//*******************************************************************************\n * Copyright (c) ${year} EclipseSource and others.\n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * EclipseSource - initial API and implementation\n ******************************************************************************/\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n\n\n\n// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();${body_statement}${body_statement}return ${field};${field} \= ${param};
11 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/.settings/org.eclipse.pde.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | pluginProject.equinox=false
3 | pluginProject.extensions=false
4 | resolve.requirebundle=false
5 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/.settings/org.eclipse.pde.prefs:
--------------------------------------------------------------------------------
1 | compilers.f.unresolved-features=1
2 | compilers.f.unresolved-plugins=1
3 | compilers.incompatible-environment=1
4 | compilers.p.build=1
5 | compilers.p.build.bin.includes=1
6 | compilers.p.build.encodings=2
7 | compilers.p.build.java.compiler=2
8 | compilers.p.build.java.compliance=1
9 | compilers.p.build.missing.output=2
10 | compilers.p.build.output.library=1
11 | compilers.p.build.source.library=1
12 | compilers.p.build.src.includes=1
13 | compilers.p.deprecated=1
14 | compilers.p.discouraged-class=1
15 | compilers.p.internal=1
16 | compilers.p.missing-packages=2
17 | compilers.p.missing-version-export-package=2
18 | compilers.p.missing-version-import-package=2
19 | compilers.p.missing-version-require-bundle=1
20 | compilers.p.no-required-att=0
21 | compilers.p.not-externalized-att=2
22 | compilers.p.unknown-attribute=1
23 | compilers.p.unknown-class=1
24 | compilers.p.unknown-element=1
25 | compilers.p.unknown-identifier=1
26 | compilers.p.unknown-resource=1
27 | compilers.p.unresolved-ex-points=0
28 | compilers.p.unresolved-import=0
29 | compilers.s.create-docs=false
30 | compilers.s.doc-folder=doc
31 | compilers.s.open-tags=1
32 | eclipse.preferences.version=1
33 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: Tabris Demos
4 | Bundle-SymbolicName: com.eclipsesource.tabris.demos
5 | Bundle-Version: 3.17.0.qualifier
6 | Bundle-Activator: com.eclipsesource.tabris.demos.Activator
7 | Bundle-Vendor: EclipseSource
8 | Bundle-RequiredExecutionEnvironment: JavaSE-11
9 | Import-Package: org.osgi.framework;version="[1.3.0,2.0.0)"
10 | Require-Bundle: org.eclipse.rap.rwt;bundle-version="[3.17.0,4.0.0)",
11 | org.eclipse.rap.jface;bundle-version="[3.17.0,4.0.0)",
12 | com.eclipsesource.tabris;bundle-version="[3.17.0,4.0.0)"
13 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/Tabris Demos.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/, images/
2 | output.. = bin/
3 | bin.includes = META-INF/,\
4 | .,\
5 | gallery/,\
6 | epl-v10.html
7 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/IRS46_nasa.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/IRS46_nasa.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/IRS46_nasa_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/IRS46_nasa_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/catseye.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/catseye.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/catseye_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/catseye_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0305a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0305a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0305a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0305a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0401a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0401a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0401a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0401a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0405a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0405a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0405a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0405a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0407a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0407a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0407a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0407a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0407b.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0407b.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0407b_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0407b_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0409a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0409a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0409a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0409a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0414a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0414a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0414a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0414a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0502a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0502a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0502a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0502a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0514a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0514a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0514a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0514a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0515a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0515a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0515a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0515a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0604a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0604a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0604a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0604a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0910e.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0910e.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/heic0910e_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/heic0910e_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/ngc4414.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/ngc4414.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/ngc4414_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/ngc4414_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/opo0110a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/opo0110a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/opo0110a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/opo0110a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/opo0505a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/opo0505a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/opo0505a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/opo0505a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/opo9901a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/opo9901a.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/opo9901a_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/opo9901a_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/orion-nebula.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/orion-nebula.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/gallery/orion-nebula_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/gallery/orion-nebula_thumb.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/action.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/action.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/action_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/action_search.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/action_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/action_settings.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/action_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/action_share.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/action_theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/action_theme.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/add_page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/add_page.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/add_root_page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/add_root_page.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/book_a_history.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/book_a_history.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/book_after_visiting.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/book_after_visiting.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/book_autobiografy.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/book_autobiografy.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/book_how_literature.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/book_how_literature.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/book_schroder.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/book_schroder.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/book_store_ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/book_store_ui.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/book_the_dinner.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/book_the_dinner.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/book_vampires.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/book_vampires.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/browser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/browser.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/dontPanic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/dontPanic.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/envelope.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/envelope.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/ernie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/ernie.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/global_action.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/global_action.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/hal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/hal.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/hal_160.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/hal_160.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/hal_240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/hal_240.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/hal_360.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/hal_360.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/hal_480.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/hal_480.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/inbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/inbox.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/line-width-medium.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/line-width-medium.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/line-width-thick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/line-width-thick.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/line-width-thin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/line-width-thin.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/mail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/mail.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/maps.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/maps.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/openurl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/openurl.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/page_all_books.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/page_all_books.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/page_favorite_books.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/page_favorite_books.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/page_popular_books.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/page_popular_books.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/phone.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/redo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/redo.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/remove_root_page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/remove_root_page.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/rubber_grip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/rubber_grip.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/sms.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/sms.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/star-bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/star-bg.jpg
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/images/undo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eclipsesource/tabris-demos/d395770b2a87fb973ce9d1aaad5b7d62dacc5d82/com.eclipsesource.tabris.demos/images/undo.png
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | 4.0.0
8 |
9 |
10 | tabris-demos-parent
11 | com.eclipsesource
12 | 3.17.0-SNAPSHOT
13 | ../build/com.eclipsesource.tabris.demos.build/
14 |
15 |
16 | com.eclipsesource
17 | com.eclipsesource.tabris.demos
18 | 3.17.0-SNAPSHOT
19 | eclipse-plugin
20 |
21 |
22 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/Activator.java:
--------------------------------------------------------------------------------
1 | package com.eclipsesource.tabris.demos;
2 |
3 | import org.eclipse.rap.rwt.application.ApplicationConfiguration;
4 | import org.osgi.framework.BundleActivator;
5 | import org.osgi.framework.BundleContext;
6 | import org.osgi.framework.ServiceRegistration;
7 |
8 | public class Activator implements BundleActivator {
9 |
10 | private ServiceRegistration> registration;
11 |
12 | public void start(BundleContext bundleContext) throws Exception {
13 | Configuration configuration = new Configuration();
14 | registration = bundleContext.registerService( ApplicationConfiguration.class.getName(),
15 | configuration,
16 | null );
17 | }
18 |
19 | public void stop(BundleContext bundleContext) throws Exception {
20 | registration.unregister();
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/Configuration.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2012, 2021 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos;
12 |
13 | import org.eclipse.rap.rwt.application.Application;
14 | import org.eclipse.rap.rwt.application.ApplicationConfiguration;
15 |
16 | import com.eclipsesource.tabris.TabrisClientInstaller;
17 | import com.eclipsesource.tabris.demos.entrypoints.AppEventsDemo;
18 | import com.eclipsesource.tabris.demos.entrypoints.AppLauncherDemo;
19 | import com.eclipsesource.tabris.demos.entrypoints.ButtonControlsDemo;
20 | import com.eclipsesource.tabris.demos.entrypoints.CameraDemo;
21 | import com.eclipsesource.tabris.demos.entrypoints.ClientDeviceDemo;
22 | import com.eclipsesource.tabris.demos.entrypoints.DrawDemo;
23 | import com.eclipsesource.tabris.demos.entrypoints.GalleryDemo;
24 | import com.eclipsesource.tabris.demos.entrypoints.GeolocationDemo;
25 | import com.eclipsesource.tabris.demos.entrypoints.InputControlsDemo;
26 | import com.eclipsesource.tabris.demos.entrypoints.KeyboardDemo;
27 | import com.eclipsesource.tabris.demos.entrypoints.PdfDemo;
28 | import com.eclipsesource.tabris.demos.entrypoints.ScrollDemo;
29 | import com.eclipsesource.tabris.demos.entrypoints.SimpleTreeDemo;
30 | import com.eclipsesource.tabris.demos.entrypoints.SwipeDemo;
31 | import com.eclipsesource.tabris.demos.entrypoints.UiDemo;
32 | import com.eclipsesource.tabris.demos.entrypoints.VideoDemo;
33 | import com.eclipsesource.tabris.demos.entrypoints.VisualGuideDemo;
34 | import com.eclipsesource.tabris.demos.ui.dynamic.DynamicUIDemo;
35 |
36 | public class Configuration implements ApplicationConfiguration {
37 |
38 | @Override
39 | public void configure( Application application ) {
40 | bootstrapTabris( application );
41 | application.addEntryPoint( "/input", InputControlsDemo.class, null );
42 | application.addEntryPoint( "/buttons", ButtonControlsDemo.class, null );
43 | // application.addEntryPoint( "/virtual-tree", VirtualTreeDemo.class, null );
44 | application.addEntryPoint( "/simple-tree", SimpleTreeDemo.class, null );
45 | application.addEntryPoint( "/gallery", GalleryDemo.class, null );
46 | application.addEntryPoint( "/location", GeolocationDemo.class, null );
47 | application.addEntryPoint( "/draw", DrawDemo.class, null );
48 | application.addEntryPoint( "/camera", CameraDemo.class, null );
49 | application.addEntryPoint( "/keyboard", KeyboardDemo.class, null );
50 | application.addEntryPoint( "/video", VideoDemo.class, null );
51 | application.addEntryPoint( "/pdf", PdfDemo.class, null );
52 | application.addEntryPoint( "/launcher", AppLauncherDemo.class, null );
53 | application.addEntryPoint( "/appevents", AppEventsDemo.class, null );
54 | application.addEntryPoint( "/swipe", SwipeDemo.class, null );
55 | application.addEntryPoint( "/ui", new UiDemo(), null );
56 | application.addEntryPoint( "/dynamic-ui", new DynamicUIDemo(), null );
57 | application.addEntryPoint( "/device", ClientDeviceDemo.class, null );
58 | application.addEntryPoint( "/scroll", ScrollDemo.class, null );
59 | application.addEntryPoint( "/guide", VisualGuideDemo.class, null );
60 | }
61 |
62 | private void bootstrapTabris( Application application ) {
63 | TabrisClientInstaller.install( application );
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/button/Questions.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.button;
12 |
13 | import java.util.ArrayList;
14 | import java.util.Arrays;
15 | import java.util.Collections;
16 | import java.util.HashMap;
17 | import java.util.List;
18 | import java.util.Map;
19 |
20 | public class Questions {
21 |
22 | private static Map database;
23 | private List questions;
24 | private int currentQuestionIndex = 0;
25 |
26 | static {
27 | database = new HashMap();
28 | database.put( "What TV cartoon character wrote on his school chalkboard. \"I will not aim at the head\" and \"My name is not Dr. Death\"?",
29 | new String[]{"Bart Simpson","Butthead","Dennis the menace"} );
30 | database.put( "How many friends are there in Friends?",
31 | new String[]{"Six","Five","Four"} );
32 | database.put( "What's Fran's last name on The Nanny?",
33 | new String[]{"Fine","Cline","Zine"} );
34 | database.put( "How many fingers does Homer Simpson have?",
35 | new String[]{"Eight","Nine","Ten"} );
36 | database.put( "In what year did Star Trek's voyages begin on screen?",
37 | new String[]{"1966","1978","1952"} );
38 | database.put( "Who led The A Team?",
39 | new String[]{"Hannibal Smith","Templeton Peck","Bosco Albert Baracus"} );
40 | database.put( "In Sledge Hammer, what did the Inspector have on his car sticker?",
41 | new String[]{"I Love Violence","Trust me. I know what I’m doing.","I love Susi"} );
42 | database.put( "Which cult series asked, \"Who killed Laura Palmer?\"",
43 | new String[]{"Twin Peaks","Hart to Hart","Desperate Housewives"} );
44 | database.put( "What was the name of the physician in The Incredible Hulk?",
45 | new String[]{"Dr. David Banner","Professor Charles Xavier","Dr. Henry 'Hank' McCoy"} );
46 | database.put( "Who was the captain of the Enterprise on the pilot episode of Star Trek?",
47 | new String[]{"Christopher Pike","James Tiberius Kirk","Khan Noonien Singh"} );
48 | database.put( "Which series was based on the novel 'Cyborg' by Martin Caidin?",
49 | new String[]{"The Six Million Dollar Man","Robocop","Battlestar Galactica"} );
50 | database.put( "What kid's show's interracial cast needed riot police protection during a 1969 trip to Mississippi?",
51 | new String[]{"Sesame Street","Muppet Show","The Addams Family"} );
52 | database.put( "What sitcom was among the top 20 most watched shows every season during its entire run, form 1984 to 1992?",
53 | new String[]{"The Cosby Show","Roseanne","Star Trek TNG"} );
54 | database.put( "Who appeared in Return of the Killer Tomatoes before he landed a role on ER?",
55 | new String[]{"George Clooney","Noah Wyle","Eriq La Salle"} );
56 | database.put( "What reformed con artist shared a detective agency with Laura Holt?",
57 | new String[]{"Remington Steele","Ethan Hunt","Agent Maxwell Smart"} );
58 | database.put( "What two cartoon rodents attempt every night to take over the world from their cages in Acme Labs?",
59 | new String[]{"Pinky and the Brain", "Chip 'n' Dale","Benjy and Frankie"} );
60 | database.put( "What TV star did 500,000 people show up to watch sing at the Berlin Wall?",
61 | new String[]{"David Hasselhoff","Michael Jackson","William Shatner"} );
62 | database.put( "What does Mr. Spock of Star Trek have to have every seven years?",
63 | new String[]{"Sex","A new body","A vulcan mind melt"} );
64 | }
65 |
66 | public Questions() {
67 | List keys = new ArrayList(database.keySet());
68 | Collections.shuffle(keys);
69 | questions = keys;
70 | }
71 |
72 | public static Map getQuestions() {
73 | if( database == null) {
74 | }
75 | return database;
76 | }
77 |
78 | public boolean hasNextQuestion() {
79 | return currentQuestionIndex+1 < database.size();
80 | }
81 |
82 | public String getNextQuestion() {
83 | if( hasNextQuestion() ) {
84 | currentQuestionIndex++;
85 | }
86 | return questions.get( currentQuestionIndex );
87 | }
88 |
89 | public boolean hasPreviousQuestion() {
90 | return currentQuestionIndex > 0;
91 | }
92 |
93 | public String getPreviousQuestion() {
94 | if( hasPreviousQuestion() ) {
95 | currentQuestionIndex--;
96 | }
97 | return questions.get( currentQuestionIndex );
98 | }
99 |
100 | public boolean isCorrect(String question, String answer ) {
101 | boolean result = false;
102 | if( getQuestions().containsKey( question ) ) {
103 | String[] strings = getQuestions().get( question );
104 | result = strings[ 0 ].equals( answer );
105 | }
106 | return result;
107 | }
108 |
109 | public String getCurrentQuestion() {
110 | return questions.get( currentQuestionIndex );
111 | }
112 |
113 | public String[] getAnswers( String currentQuestion ) {
114 | List answers = new ArrayList(Arrays.asList( database.get( currentQuestion ) ));
115 | Collections.shuffle(answers);
116 | return answers.toArray( new String[answers.size()] );
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/enron/EnronDataset.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.enron;
12 |
13 | import java.io.File;
14 | import java.io.FileNotFoundException;
15 | import java.io.FileReader;
16 | import java.io.IOException;
17 | import java.util.ArrayList;
18 | import java.util.List;
19 |
20 |
21 | final class EnronDataset {
22 |
23 | private final File root;
24 |
25 | public EnronDataset( File root ) {
26 | this.root = root;
27 | }
28 |
29 | public Node getRootNode() throws IOException {
30 | new EnronDatasetIndexer( root ).index();
31 | return new Folder( root );
32 | }
33 |
34 | static class Node {
35 |
36 | private final Folder parent;
37 | private final String name;
38 | private final String subject;
39 | private final String from;
40 |
41 | private Node( Folder parent, String name, String subject, String from ) {
42 | this.parent = parent;
43 | this.name = name;
44 | this.subject = subject;
45 | this.from = from;
46 | }
47 |
48 | public boolean hasChildren() {
49 | return false;
50 | }
51 |
52 | public int getChildCount() {
53 | return 0;
54 | }
55 |
56 | public File getFile() {
57 | return new File( parent.file, name );
58 | }
59 |
60 | public String getTitle() {
61 | return subject;
62 | }
63 |
64 | public String getFrom() {
65 | return from;
66 | }
67 |
68 | public Folder getParent() {
69 | return parent;
70 | }
71 |
72 | public String readContents() throws IOException {
73 | return readFromFile( getFile() );
74 | }
75 |
76 | protected String readFromFile( File file ) throws FileNotFoundException, IOException {
77 | StringBuilder resultBuffer = new StringBuilder();
78 | FileReader reader = new FileReader( file );
79 | try {
80 | char[] charBuffer = new char[ 8196 ];
81 | int charsRead = 0;
82 | while( ( charsRead = reader.read( charBuffer ) ) != -1 ) {
83 | resultBuffer.append( charBuffer, 0, charsRead );
84 | }
85 | } finally {
86 | reader.close();
87 | }
88 | return resultBuffer.toString();
89 | }
90 |
91 | @Override
92 | public int hashCode() {
93 | final int prime = 31;
94 | int result = 1;
95 | result = prime * result + ( ( from == null )
96 | ? 0
97 | : from.hashCode() );
98 | result = prime * result + ( ( name == null )
99 | ? 0
100 | : name.hashCode() );
101 | result = prime * result + ( ( parent == null )
102 | ? 0
103 | : parent.hashCode() );
104 | result = prime * result + ( ( subject == null )
105 | ? 0
106 | : subject.hashCode() );
107 | return result;
108 | }
109 |
110 | @Override
111 | public boolean equals( Object obj ) {
112 | if( this == obj )
113 | return true;
114 | if( obj == null )
115 | return false;
116 | if( getClass() != obj.getClass() )
117 | return false;
118 | Node other = ( Node )obj;
119 | if( from == null ) {
120 | if( other.from != null )
121 | return false;
122 | } else if( !from.equals( other.from ) )
123 | return false;
124 | if( name == null ) {
125 | if( other.name != null )
126 | return false;
127 | } else if( !name.equals( other.name ) )
128 | return false;
129 | if( parent == null ) {
130 | if( other.parent != null )
131 | return false;
132 | } else if( !parent.equals( other.parent ) )
133 | return false;
134 | if( subject == null ) {
135 | if( other.subject != null )
136 | return false;
137 | } else if( !subject.equals( other.subject ) )
138 | return false;
139 | return true;
140 | }
141 | }
142 |
143 | static class Folder extends Node {
144 |
145 | private final File file;
146 | private final int childCount;
147 | private Node[] children;
148 |
149 | private Folder( File file ) {
150 | super( null, null, null, null );
151 | this.file = file;
152 | readChildrenFromIndex();
153 | this.childCount = children.length;
154 | }
155 |
156 | private Folder( Folder parent, String name, int count ) {
157 | super( parent, name , name, name );
158 | this.file = new File( parent.file, name );
159 | this.childCount = count;
160 | }
161 |
162 | @Override
163 | public boolean hasChildren() {
164 | return childCount > 0;
165 | }
166 |
167 | @Override
168 | public int getChildCount() {
169 | return childCount;
170 | }
171 |
172 | @Override
173 | public String readContents() throws IOException {
174 | return "";
175 | }
176 |
177 | public Node getChild( int index ) {
178 | readChildrenFromIndex();
179 | return children[ index ];
180 | }
181 |
182 | public Node[] getChildren() {
183 | readChildrenFromIndex();
184 | return children;
185 | }
186 |
187 | private void readChildrenFromIndex() {
188 | if( children == null ) {
189 | try {
190 | children = readIndex();
191 | // if( childCount != 0 && children.length != childCount ) {
192 | // throw new RuntimeException( "Children count in index ("
193 | // + children.length
194 | // + ") does not match default ("
195 | // + childCount
196 | // + "): "
197 | // + file.getAbsolutePath()
198 | // + " " );
199 | // }
200 | } catch( IOException e ) {
201 | throw new RuntimeException( "Failed to read index for " + file.getAbsolutePath() );
202 | }
203 | }
204 | }
205 |
206 | private Node[] readIndex() throws IOException {
207 | File indexFile = new File( file, ".index" );
208 | String indexString = readFromFile( indexFile );
209 | String[] lines = indexString.split( "\n" );
210 | List nodes = new ArrayList();
211 | for( int i = 0; i < lines.length; i++ ) {
212 | String line = lines[ i ];
213 | String[] parts = line.split( "\t" );
214 | if( parts.length == 5 ) {
215 | if( "d".equals( parts[ 0 ] ) ) {
216 | nodes.add( new Folder( this, parts[ 1 ], Integer.parseInt( parts[ 4 ] ) ) );
217 | } else if( "f".equals( parts[ 0 ] ) ) {
218 | nodes.add( new Node( this, parts[ 1 ], parts[ 2 ], parts[ 3 ] ) );
219 | }
220 | }
221 | }
222 | Node[] result = new Node[ nodes.size() ];
223 | nodes.toArray( result );
224 | return result;
225 | }
226 | }
227 |
228 | }
229 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/enron/EnronDatasetIndexer.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.enron;
12 |
13 | import java.io.BufferedReader;
14 | import java.io.BufferedWriter;
15 | import java.io.File;
16 | import java.io.FileReader;
17 | import java.io.FileWriter;
18 | import java.io.IOException;
19 | import java.util.ArrayList;
20 | import java.util.Collections;
21 | import java.util.Comparator;
22 | import java.util.List;
23 |
24 |
25 | class EnronDatasetIndexer {
26 |
27 | private final File root;
28 | private int fileCount;
29 | private int dirCount;
30 |
31 | public static void main( String[] args ) {
32 | if( args.length == 0 ) {
33 | System.err.println( "Missing root directory" );
34 | System.exit( 42 );
35 | }
36 | File root = new File( args[ 0 ] );
37 | System.out.println( "Indexing " + root.getAbsolutePath() + " ..." );
38 | EnronDatasetIndexer indexer = new EnronDatasetIndexer( root );
39 | try {
40 | indexer.index();
41 | } catch( IOException exception ) {
42 | throw new RuntimeException( exception );
43 | }
44 | System.out.println( "Done." );
45 | System.out.println( "Processed directories: " + indexer.dirCount );
46 | System.out.println( "Processed files: " + indexer.fileCount );
47 | System.out.println( "Total: " + ( indexer.dirCount + indexer.fileCount ) );
48 | }
49 |
50 | public EnronDatasetIndexer( File root ) {
51 | this.root = root;
52 | fileCount = 0;
53 | dirCount = 0;
54 | }
55 |
56 | public void index() throws IOException {
57 | index( root );
58 | }
59 |
60 | private int index( File file ) throws IOException {
61 | int count = 0;
62 | File indexFile = getIndexFile( file );
63 | if( indexFile.exists() ) {
64 | count = readChildCountFromIndexFile( indexFile );
65 | } else {
66 | File[] children = file.listFiles();
67 | if( children == null ) {
68 | throw new RuntimeException( "no child count available for " + file.getAbsolutePath() );
69 | }
70 | List list = new ArrayList();
71 | for( File child : children ) {
72 | if( !".index".equals( child.getName() ) ) {
73 | count++;
74 | count( child );
75 | if( child.isDirectory() ) {
76 | int childCount = index( child );
77 | list.add( new FileEntry( child.getName(), child.getName(), child.getName(), 'd', childCount ) );
78 | } else {
79 | String[] displayTexts = getDisplayTexts( child );
80 | list.add( new FileEntry( child.getName(), displayTexts[ 0 ], displayTexts[ 1 ], 'f', 0 ) );
81 | }
82 | }
83 | }
84 | createIndexFile( indexFile, list );
85 | }
86 | return count;
87 | }
88 |
89 | private String[] getDisplayTexts( File child ) {
90 | String[] result = new String[] { "[No Subject]", "[Unknown]" };
91 | BufferedReader bufferedReader = null;
92 | try {
93 | FileReader reader = new FileReader( child );
94 | bufferedReader = new BufferedReader( reader );
95 | String line;
96 | String subject = "Subject: ";
97 | String from = "From: ";
98 | boolean fromFound = false;
99 | boolean subjectFound = false;
100 | while( ( line = bufferedReader.readLine() ) != null && ( !fromFound || !subjectFound ) ) {
101 | int indexOfSubject = line.indexOf( subject );
102 | if( indexOfSubject != -1 ) {
103 | subjectFound = true;
104 | String subjectText = line.substring( indexOfSubject + subject.length(), line.length() );
105 | if( !"".equals( subjectText ) ) {
106 | result[ 0 ] = subjectText;
107 | }
108 | }
109 | int indexOfFrom = line.indexOf( from );
110 | if( indexOfFrom != -1 ) {
111 | fromFound = true;
112 | String fromText = line.substring( indexOfFrom + from.length(), line.length() );
113 | if( !"".equals( fromText ) ) {
114 | result[ 1 ] = fromText;
115 | }
116 | }
117 | }
118 | } catch ( IOException e ) {
119 | // do nothing
120 | } finally {
121 | if( bufferedReader != null ) {
122 | try {
123 | bufferedReader.close();
124 | } catch( IOException e ) {
125 | throw new IllegalStateException( e );
126 | }
127 | }
128 | }
129 | return result;
130 | }
131 |
132 | private void count( File file ) {
133 | if( file.isDirectory() ) {
134 | dirCount++;
135 | } else {
136 | fileCount++;
137 | }
138 | }
139 |
140 | private static void createIndexFile( File indexFile, List list ) throws IOException {
141 | sortFileList( list );
142 | String string = createString( list );
143 | writeToFile( indexFile, string );
144 | }
145 |
146 | private static File getIndexFile( File file ) {
147 | File indexFile = new File( file, ".index" );
148 | return indexFile;
149 | }
150 |
151 | private static void sortFileList( List list ) {
152 | Collections.sort( list, new Comparator() {
153 |
154 | public int compare( FileEntry file1, FileEntry file2 ) {
155 | int result = 0;
156 | if( file1.type < file2.type ) {
157 | result = -1;
158 | } else if( file1.type > file2.type ) {
159 | result = 1;
160 | } else if( file1.name.endsWith( "." ) && file2.name.endsWith( "." ) ) {
161 | int number1 = Integer.parseInt( file1.name.substring( 0, file1.name.length() - 1 ) );
162 | int number2 = Integer.parseInt( file2.name.substring( 0, file2.name.length() - 1 ) );
163 | if( number1 < number2 ) {
164 | result = -1;
165 | } else if( number1 > number2 ) {
166 | result = 1;
167 | }
168 | } else {
169 | result = file1.name.compareTo( file2.name );
170 | }
171 | return result;
172 | }
173 | } );
174 | }
175 |
176 | private static String createString( List list ) {
177 | StringBuffer buffer = new StringBuffer();
178 | for( FileEntry file : list ) {
179 | buffer.append( file.type );
180 | buffer.append( "\t" );
181 | buffer.append( file.name );
182 | buffer.append( "\t" );
183 | buffer.append( file.subject );
184 | buffer.append( "\t" );
185 | buffer.append( file.from );
186 | buffer.append( "\t" );
187 | buffer.append( file.count );
188 | buffer.append( "\n" );
189 | }
190 | return buffer.toString();
191 | }
192 |
193 | private static void writeToFile( File file, String string ) throws IOException {
194 | BufferedWriter writer = new BufferedWriter( new FileWriter( file ) );
195 | try {
196 | writer.write( string );
197 | } finally {
198 | writer.close();
199 | }
200 | }
201 |
202 | private static int readChildCountFromIndexFile( File indexFile ) throws IOException {
203 | int count = 0;
204 | BufferedReader reader = new BufferedReader( new FileReader( indexFile ) );
205 | try {
206 | boolean done = false;
207 | while( !done ) {
208 | String line = reader.readLine();
209 | if( line == null ) {
210 | done = true;
211 | } else if( line.trim().length() > 0 ) {
212 | count++;
213 | }
214 | }
215 | } finally {
216 | reader.close();
217 | }
218 | return count;
219 | }
220 |
221 | private static class FileEntry {
222 | final String name;
223 | final int count;
224 | final char type;
225 | final String subject;
226 | final String from;
227 |
228 | FileEntry( String name, String subject, String from, char type, int count ) {
229 | this.name = name;
230 | this.subject = subject;
231 | this.from = from;
232 | this.count = count;
233 | this.type = type;
234 | }
235 | }
236 | }
237 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/enron/ExampleUtil.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.enron;
12 |
13 | import org.eclipse.swt.SWT;
14 | import org.eclipse.swt.layout.GridData;
15 | import org.eclipse.swt.layout.GridLayout;
16 |
17 |
18 | public final class ExampleUtil {
19 |
20 | public static GridLayout createMainLayout( int numColumns ) {
21 | GridLayout result = createGridLayout();
22 | result.makeColumnsEqualWidth = true;
23 | result.numColumns = numColumns;
24 | result.marginTop = 10;
25 | result.marginBottom = 10;
26 | result.verticalSpacing = 20;
27 | result.horizontalSpacing = 20;
28 | return result;
29 | }
30 |
31 | public static GridLayout createColumnLayout() {
32 | GridLayout result = createGridLayout();
33 | result.verticalSpacing = 20;
34 | return result;
35 | }
36 |
37 | public static GridLayout createGridLayout( int numColumns, boolean makeColumnsEqual ) {
38 | return createGridLayout( numColumns, makeColumnsEqual, 0, 0 );
39 | }
40 |
41 | public static GridLayout createGridLayout( int numColumns,
42 | boolean makeColumnsEqual,
43 | int margin,
44 | int spacing )
45 | {
46 | GridLayout result = new GridLayout( numColumns, makeColumnsEqual );
47 | result.horizontalSpacing = spacing;
48 | result.verticalSpacing = spacing;
49 | result.marginWidth = margin;
50 | result.marginHeight = margin;
51 | return result;
52 | }
53 |
54 | public static GridLayout createGridLayout() {
55 | GridLayout result = new GridLayout();
56 | result.horizontalSpacing = 0;
57 | result.verticalSpacing = 0;
58 | result.marginWidth = 0;
59 | result.marginHeight = 0;
60 | return result;
61 | }
62 |
63 | public static GridData createHorzFillData() {
64 | return new GridData( SWT.FILL, SWT.TOP, true, false );
65 | }
66 |
67 | public static GridData createFillData() {
68 | return new GridData( SWT.FILL, SWT.FILL, true, true );
69 | }
70 |
71 | private ExampleUtil() {
72 | // prevent instantiation
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/AppEventsDemo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.entrypoints;
12 |
13 | import org.eclipse.rap.rwt.RWT;
14 | import org.eclipse.rap.rwt.application.EntryPoint;
15 | import org.eclipse.swt.SWT;
16 | import org.eclipse.swt.layout.FillLayout;
17 | import org.eclipse.swt.widgets.Display;
18 | import org.eclipse.swt.widgets.Label;
19 | import org.eclipse.swt.widgets.Shell;
20 |
21 | import com.eclipsesource.tabris.app.App;
22 | import com.eclipsesource.tabris.app.AppEvent;
23 | import com.eclipsesource.tabris.app.AppListener;
24 | import com.eclipsesource.tabris.app.EventType;
25 | import com.eclipsesource.tabris.demos.hal.Hal9000;
26 |
27 | public class AppEventsDemo implements EntryPoint {
28 |
29 | private Hal9000 hal;
30 | private long sleepMillis;
31 |
32 | public int createUI() {
33 | Display display = new Display();
34 | Shell shell = new Shell( display, SWT.NO_TRIM );
35 | shell.setMaximized( true );
36 | shell.setLayout( new FillLayout() );
37 | shell.setBackground( display.getSystemColor( SWT.COLOR_BLACK ) );
38 | hal = new Hal9000( shell );
39 | registerAppStateListener();
40 | shell.open();
41 | return 0;
42 | }
43 |
44 | private void registerAppStateListener() {
45 | final App app = RWT.getClient().getService( App.class );
46 | if( app != null ) {
47 | app.addEventListener( EventType.PAUSE, new AppListener() {
48 |
49 | public void handleEvent( AppEvent event ) {
50 | System.out.println("Paused");
51 | Label output = hal.getText();
52 | output.setText( "I am going to sleep now.\n" );
53 | output.getParent().layout( true, true );
54 | sleepMillis = System.currentTimeMillis();
55 | }
56 | } );
57 | app.addEventListener( EventType.RESUME, new AppListener() {
58 |
59 | public void handleEvent( AppEvent event ) {
60 | System.out.println("Resumed");
61 | long slept = ( System.currentTimeMillis() - sleepMillis ) / 1000;
62 | Label output = hal.getText();
63 | output.setText( "Good morning Dave!\n\nThank for waking me up again. I was sleeping for "
64 | + slept
65 | + " seconds.\n" );
66 | output.getParent().layout( true, true );
67 | }
68 | } );
69 | app.addEventListener( EventType.INACTIVE, new AppListener() {
70 |
71 | public void handleEvent( AppEvent event ) {
72 | System.out.println("Inactive");
73 | Label output = hal.getText();
74 | output.setText( "Dave, did you fall asleep?\nYou haven't touched the screen for over 10 seconds.\n" );
75 | output.getParent().layout( true, true );
76 | }
77 | } );
78 | app.startInactivityTimer( 10000 );
79 | app.setScreenProtection( true );
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/ButtonControlsDemo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2012 EclipseSource and others. All rights reserved. This
3 | * program and the accompanying materials are made available under the terms of
4 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
5 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
6 | * EclipseSource - initial API and implementation
7 | ******************************************************************************/
8 | package com.eclipsesource.tabris.demos.entrypoints;
9 |
10 | import org.eclipse.jface.layout.GridDataFactory;
11 | import org.eclipse.jface.layout.GridLayoutFactory;
12 | import org.eclipse.jface.resource.FontDescriptor;
13 | import org.eclipse.rap.rwt.application.EntryPoint;
14 | import org.eclipse.swt.SWT;
15 | import org.eclipse.swt.events.SelectionAdapter;
16 | import org.eclipse.swt.events.SelectionEvent;
17 | import org.eclipse.swt.graphics.Color;
18 | import org.eclipse.swt.graphics.RGB;
19 | import org.eclipse.swt.widgets.Button;
20 | import org.eclipse.swt.widgets.Composite;
21 | import org.eclipse.swt.widgets.Display;
22 | import org.eclipse.swt.widgets.Label;
23 | import org.eclipse.swt.widgets.Shell;
24 | import org.eclipse.swt.widgets.ToolBar;
25 | import org.eclipse.swt.widgets.ToolItem;
26 |
27 | import com.eclipsesource.tabris.demos.button.Questions;
28 | import com.eclipsesource.tabris.widgets.enhancement.Widgets;
29 |
30 | public class ButtonControlsDemo implements EntryPoint {
31 |
32 | private Questions questions;
33 | private Button buttonA;
34 | private Button buttonB;
35 | private Button buttonC;
36 | private Button buttonNext;
37 | private Button buttonPrevious;
38 | private Label labelQuestion;
39 |
40 | @Override
41 | public int createUI() {
42 | Display display = new Display();
43 | Shell shell = new Shell( display, SWT.NO_TRIM );
44 | shell.setMaximized( true );
45 | shell.setBackground( display.getSystemColor( SWT.COLOR_WHITE ) );
46 | GridLayoutFactory.fillDefaults().applyTo( shell );
47 | createToolbar( shell );
48 | createContent( shell );
49 | createNavigation( shell );
50 | shell.open();
51 | reset();
52 | return 0;
53 | }
54 |
55 | private void createToolbar( Composite parent ) {
56 | ToolBar toolBar = new ToolBar( parent, SWT.NONE );
57 | GridDataFactory.fillDefaults().grab( true, false ).align( SWT.FILL, SWT.TOP ).applyTo( toolBar );
58 |
59 | ToolItem titleItem = new ToolItem( toolBar, SWT.NONE );
60 | Widgets.onToolItem( titleItem ).useAsTitle();
61 | titleItem.setText( "You don't know that?" );
62 |
63 | ToolItem resetItem = new ToolItem( toolBar, SWT.PUSH );
64 | resetItem.setText( "Restart" );
65 | resetItem.addSelectionListener( new SelectionAdapter() {
66 | @Override
67 | public void widgetSelected( SelectionEvent e ) {
68 | reset();
69 | updateUI();
70 | }
71 | } );
72 | }
73 |
74 | private void createContent( Composite parent ) {
75 | Composite content = new Composite( parent, SWT.NONE );
76 | GridDataFactory.fillDefaults().grab( true, true ).align( SWT.FILL, SWT.FILL ).applyTo( content );
77 | GridLayoutFactory.fillDefaults().margins( 16, 16 ).applyTo( content );
78 | createQuestion( content );
79 | createAnswers( content );
80 | }
81 |
82 | public void createQuestion( Composite parent ) {
83 | labelQuestion = new Label( parent, SWT.WRAP | SWT.CENTER );
84 | GridDataFactory.fillDefaults().align( SWT.FILL, SWT.FILL ).grab( true, true ).applyTo( labelQuestion );
85 | FontDescriptor labelFontDescriptor = FontDescriptor.createFrom( labelQuestion.getFont() );
86 | FontDescriptor bigFontDescriptor = labelFontDescriptor.setStyle( SWT.BOLD ).increaseHeight( 7 );
87 | labelQuestion.setFont( bigFontDescriptor.createFont( parent.getDisplay() ) );
88 | labelQuestion.setForeground( parent.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
89 | }
90 |
91 | private void createAnswers( Composite parent ) {
92 | Composite result = new Composite( parent, SWT.NONE );
93 | GridDataFactory.fillDefaults().grab( true, true ).align( SWT.FILL, SWT.FILL ).applyTo( result );
94 | GridLayoutFactory.fillDefaults().applyTo( result );
95 | buttonA = createAnswerButton( result, new RGB(43, 232, 105) );
96 | buttonB = createAnswerButton( result, new RGB(182, 107, 153) );
97 | buttonC = createAnswerButton( result, new RGB(225, 134, 87) );
98 | }
99 |
100 | private Button createAnswerButton( Composite result, RGB color ) {
101 | final Button button = new Button( result, SWT.RADIO | SWT.WRAP );
102 | button.setForeground( new Color( button.getDisplay(), color ) );
103 | button.addSelectionListener( new SelectionAdapter() {
104 | @Override
105 | public void widgetSelected( SelectionEvent e ) {
106 | if( button.getSelection() ) {
107 | answerSelected( button.getText() );
108 | }
109 | }
110 | } );
111 | return button;
112 | }
113 |
114 | private void createNavigation( Composite parent ) {
115 | Composite navigation = new Composite( parent, SWT.NONE );
116 | GridDataFactory.fillDefaults().grab( true, false ).align( SWT.FILL, SWT.FILL ).applyTo( navigation );
117 | GridLayoutFactory.fillDefaults().numColumns( 2 ).margins( 8, 8 ).equalWidth( true ).applyTo( navigation );
118 |
119 | createNavigationPrevious( navigation );
120 | createNavigationNext( navigation );
121 | }
122 |
123 | public void createNavigationNext( Composite parent ) {
124 | buttonNext = new Button( parent, SWT.PUSH | SWT.BORDER );
125 | buttonNext.setText( "Next Question" );
126 | GridDataFactory.fillDefaults().grab( true, true ).align( SWT.END, SWT.END ).applyTo( buttonNext);
127 | buttonNext.addSelectionListener( new SelectionAdapter() {
128 | @Override
129 | public void widgetSelected( SelectionEvent e ) {
130 | next();
131 | }
132 | } );
133 | }
134 |
135 | public void createNavigationPrevious( Composite parent ) {
136 | buttonPrevious = new Button( parent, SWT.PUSH );
137 | buttonPrevious.setText( "Last Question" );
138 | GridDataFactory.fillDefaults().grab( true, true ).align( SWT.BEGINNING, SWT.END ).applyTo( buttonPrevious );
139 | buttonPrevious.addSelectionListener( new SelectionAdapter() {
140 | @Override
141 | public void widgetSelected( SelectionEvent e ) {
142 | previous();
143 | }
144 | } );
145 | }
146 |
147 | /**
148 | * Update UI state
149 | */
150 | protected void answerSelected( String answer ) {
151 | String currentQuestion = questions.getCurrentQuestion();
152 | boolean correct = questions.isCorrect( currentQuestion, answer );
153 | if( correct ) {
154 | buttonNext.setForeground( buttonNext.getDisplay().getSystemColor( SWT.COLOR_DARK_GREEN ) );
155 | } else {
156 | buttonNext.setForeground( buttonNext.getDisplay().getSystemColor( SWT.COLOR_DARK_RED ) );
157 | }
158 | buttonNext.setEnabled( correct && questions.hasNextQuestion() );
159 | }
160 |
161 | private void updateUI() {
162 | String currentQuestion = questions.getCurrentQuestion();
163 | labelQuestion.setText( currentQuestion );
164 | labelQuestion.getParent().layout();
165 | String[] answers = questions.getAnswers( currentQuestion );
166 | buttonA.setText( answers[0] );
167 | buttonB.setText( answers[1] );
168 | buttonC.setText( answers[2] );
169 | buttonA.getParent().layout();
170 | buttonPrevious.setEnabled( questions.hasPreviousQuestion() );
171 | buttonNext.setEnabled( false );
172 | }
173 |
174 | /**
175 | * Navigate the Questions
176 | */
177 |
178 | private void previous() {
179 | questions.getPreviousQuestion();
180 | resetButtons();
181 | updateUI();
182 | }
183 |
184 | protected void next() {
185 | questions.getNextQuestion();
186 | resetButtons();
187 | updateUI();
188 | }
189 |
190 | private void resetButtons() {
191 | buttonA.setSelection( false );
192 | buttonB.setSelection( false );
193 | buttonC.setSelection( false );
194 | }
195 |
196 | private void reset() {
197 | questions = new Questions();
198 | updateUI();
199 | resetButtons();
200 | }
201 |
202 | }
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/ClientDeviceDemo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others. All rights reserved. This
3 | * program and the accompanying materials are made available under the terms of
4 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
5 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
6 | * EclipseSource - initial API and implementation
7 | ******************************************************************************/
8 | package com.eclipsesource.tabris.demos.entrypoints;
9 |
10 | import static com.eclipsesource.tabris.device.ClientDevice.Capability.CAMERA;
11 | import static com.eclipsesource.tabris.device.ClientDevice.Capability.LOCATION;
12 | import static com.eclipsesource.tabris.device.ClientDevice.Capability.MAPS;
13 | import static com.eclipsesource.tabris.device.ClientDevice.Capability.MESSAGE;
14 | import static com.eclipsesource.tabris.device.ClientDevice.Capability.PHONE;
15 |
16 | import java.text.SimpleDateFormat;
17 | import java.util.Date;
18 | import java.util.TimeZone;
19 |
20 | import org.eclipse.jface.layout.GridDataFactory;
21 | import org.eclipse.jface.layout.GridLayoutFactory;
22 | import org.eclipse.jface.resource.FontDescriptor;
23 | import org.eclipse.rap.rwt.RWT;
24 | import org.eclipse.rap.rwt.application.EntryPoint;
25 | import org.eclipse.swt.SWT;
26 | import org.eclipse.swt.graphics.Font;
27 | import org.eclipse.swt.layout.FillLayout;
28 | import org.eclipse.swt.widgets.Composite;
29 | import org.eclipse.swt.widgets.Display;
30 | import org.eclipse.swt.widgets.Group;
31 | import org.eclipse.swt.widgets.Label;
32 | import org.eclipse.swt.widgets.Shell;
33 |
34 | import com.eclipsesource.tabris.app.App;
35 | import com.eclipsesource.tabris.device.ClientDevice;
36 | import com.eclipsesource.tabris.device.ClientDevice.Capability;
37 | import com.eclipsesource.tabris.device.ClientDevice.ConnectionType;
38 | import com.eclipsesource.tabris.device.ClientDevice.Orientation;
39 | import com.eclipsesource.tabris.device.ClientDeviceAdapter;
40 | import com.eclipsesource.tabris.widgets.ScrollingComposite;
41 |
42 | public class ClientDeviceDemo implements EntryPoint {
43 |
44 | private static final String CHECK_MARK = "\u2713";
45 |
46 | @Override
47 | public int createUI() {
48 | Display display = new Display();
49 | Shell shell = new Shell( display, SWT.NO_TRIM );
50 | shell.setMaximized( true );
51 | shell.setLayout( new FillLayout() );
52 | ClientDevice clientDevice = RWT.getClient().getService( ClientDevice.class );
53 | App app = RWT.getClient().getService( App.class );
54 | ScrollingComposite scrollingComposite = new ScrollingComposite( shell, SWT.V_SCROLL );
55 | scrollingComposite.setLayout( new FillLayout() );
56 | createContent( clientDevice, app, scrollingComposite );
57 | shell.open();
58 | return 0;
59 | }
60 |
61 | private void createContent( ClientDevice clientDevice, App app, Composite parent ) {
62 | Composite content = new Composite( parent, SWT.NONE );
63 | GridLayoutFactory.fillDefaults().spacing( 0, 0 ).applyTo( content );
64 | createAppGroup( content, app );
65 | createDeviceGroup( content, clientDevice );
66 | createDisplayGroup( content, clientDevice );
67 | createCapabilityGroup( content, clientDevice );
68 | createConnectionGroup( content, clientDevice );
69 | createTimeGroup( content, clientDevice );
70 | }
71 |
72 | private void createAppGroup( Composite parent, App app ) {
73 | Group group = createGroup( parent, "App" );
74 | if( app != null ) {
75 | createLabel( group, "Id" ).setText( stringForText( app.getId() ) );
76 | createLabel( group, "Version" ).setText( stringForText( app.getVersion() ) );
77 | createLabel( group, "Tabris Version" ).setText( stringForText( app.getTabrisVersion() ) );
78 | }
79 | }
80 |
81 | private void createDeviceGroup( Composite parent, ClientDevice clientDevice ) {
82 | Group group = createGroup( parent, "Device" );
83 | if( clientDevice != null ) {
84 | createLabel( group, "Model" ).setText( stringForText( clientDevice.getModel() ) );
85 | createLabel( group, "Vendor" ).setText( stringForText( clientDevice.getVendor() ) );
86 | createLabel( group, "OS Version" ).setText( stringForText( clientDevice.getOSVersion() ) );
87 | createLabel( group, "Locale" ).setText( stringForText( clientDevice.getLocale().toString() ) );
88 | }
89 | }
90 |
91 | private void createDisplayGroup( Composite parent, ClientDevice clientDevice ) {
92 | Group group = createGroup( parent, "Display" );
93 | final Label label = createLabel( group, "Orientation" );
94 | if( clientDevice != null ) {
95 | label.setText( clientDevice.getOrientation().toString() );
96 | clientDevice.addClientDeviceListener( new ClientDeviceAdapter() {
97 |
98 | @Override
99 | public void orientationChange( Orientation newOrientation ) {
100 | label.setText( newOrientation.toString() );
101 | label.pack();
102 | }
103 | } );
104 | String scaleFactor = Float.toString( clientDevice.getScaleFactor() );
105 | createLabel( group, "Scale Factor" ).setText( scaleFactor );
106 | }
107 | }
108 |
109 | private void createCapabilityGroup( Composite parent, ClientDevice clientDevice ) {
110 | Group group = createGroup( parent, "Capabilities" );
111 | createLabel( group, "Phone" ).setText( getHasCapabilityString( clientDevice, PHONE ) );
112 | createLabel( group, "Message" ).setText( getHasCapabilityString( clientDevice, MESSAGE ) );
113 | createLabel( group, "Location" ).setText( getHasCapabilityString( clientDevice, LOCATION ) );
114 | createLabel( group, "Camera" ).setText( getHasCapabilityString( clientDevice, CAMERA ) );
115 | createLabel( group, "Maps" ).setText( getHasCapabilityString( clientDevice, MAPS ) );
116 | }
117 |
118 | private void createConnectionGroup( Composite parent, ClientDevice clientDevice ) {
119 | Group group = createGroup( parent, "Connection" );
120 | final Label label = createLabel( group, "Type" );
121 | if( clientDevice != null ) {
122 | label.setText( clientDevice.getConnectionType().toString() );
123 | clientDevice.addClientDeviceListener( new ClientDeviceAdapter() {
124 |
125 | @Override
126 | public void connectionTypeChanged( ConnectionType newConnectionType ) {
127 | label.setText( newConnectionType.toString() );
128 | label.pack();
129 | }
130 | } );
131 | }
132 | }
133 |
134 | private void createTimeGroup( Composite parent, ClientDevice clientDevice ) {
135 | Group group = createGroup( parent, "Time" );
136 | int offset = 0;
137 | if( clientDevice != null ) {
138 | offset = clientDevice.getTimezoneOffset() * -1;
139 | }
140 | SimpleDateFormat formatter = new SimpleDateFormat();
141 | createLabel( group, "Server Time" ).setText( formatter.format( new Date() ) );
142 | formatter.setTimeZone( TimeZone.getTimeZone( TimeZone.getAvailableIDs( offset * 1000 * 60 )[ 0 ] ) );
143 | createLabel( group, "Client Time" ).setText( formatter.format( new Date() ) );
144 | createLabel( group, "Client UTC Offset" ).setText( offset + " Minutes" );
145 | }
146 |
147 | private String stringForText( String value ) {
148 | return ( value == null ) ? "" : value;
149 | }
150 |
151 | private String getHasCapabilityString( ClientDevice clientDevice, Capability capability ) {
152 | String result = "-";
153 | if( clientDevice != null && clientDevice.hasCapability( capability ) ) {
154 | result = CHECK_MARK;
155 | }
156 | return result;
157 | }
158 |
159 | private Group createGroup( Composite parent, String title ) {
160 | Group group = new Group( parent, SWT.NONE );
161 | GridLayoutFactory.fillDefaults().numColumns( 2 ).spacing( 12, 4 ).applyTo( group );
162 | GridDataFactory.fillDefaults().align( SWT.FILL, SWT.TOP ).grab( true, false ).applyTo( group );
163 | group.setText( title );
164 | return group;
165 | }
166 | private Label createLabel( Composite parent, final String text ) {
167 | Label label = new Label( parent, SWT.NONE );
168 | label.setText( text );
169 | GridDataFactory.fillDefaults().align( SWT.LEFT, SWT.CENTER ).grab( false, true ).applyTo( label );
170 | Label resultLabel = new Label( parent, SWT.NONE );
171 | GridDataFactory.fillDefaults().align( SWT.FILL, SWT.TOP ).grab( true, false ).applyTo( resultLabel );
172 | makeBold( resultLabel );
173 | return resultLabel;
174 | }
175 |
176 | private void makeBold( Label resultLabel ) {
177 | FontDescriptor fontDescriptor = FontDescriptor.createFrom( resultLabel.getFont() );
178 | Font font = fontDescriptor.setStyle( SWT.BOLD ).createFont( resultLabel.getDisplay() );
179 | resultLabel.setFont( font );
180 | }
181 |
182 | }
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/GeolocationDemo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2012 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.entrypoints;
12 |
13 | import static com.eclipsesource.tabris.widgets.enhancement.Widgets.onToolItem;
14 |
15 | import org.eclipse.jface.layout.GridDataFactory;
16 | import org.eclipse.jface.layout.GridLayoutFactory;
17 | import org.eclipse.rap.rwt.RWT;
18 | import org.eclipse.rap.rwt.application.EntryPoint;
19 | import org.eclipse.rap.rwt.widgets.DialogUtil;
20 | import org.eclipse.swt.SWT;
21 | import org.eclipse.swt.events.SelectionAdapter;
22 | import org.eclipse.swt.events.SelectionEvent;
23 | import org.eclipse.swt.graphics.Color;
24 | import org.eclipse.swt.layout.GridData;
25 | import org.eclipse.swt.widgets.Button;
26 | import org.eclipse.swt.widgets.Composite;
27 | import org.eclipse.swt.widgets.Display;
28 | import org.eclipse.swt.widgets.MessageBox;
29 | import org.eclipse.swt.widgets.Shell;
30 | import org.eclipse.swt.widgets.ToolBar;
31 | import org.eclipse.swt.widgets.ToolItem;
32 |
33 | import com.eclipsesource.tabris.geolocation.Geolocation;
34 | import com.eclipsesource.tabris.geolocation.GeolocationAdapter;
35 | import com.eclipsesource.tabris.geolocation.GeolocationListener;
36 | import com.eclipsesource.tabris.geolocation.GeolocationOptions;
37 | import com.eclipsesource.tabris.geolocation.Position;
38 | import com.eclipsesource.tabris.geolocation.PositionError;
39 | import com.eclipsesource.tabris.interaction.AppLauncher;
40 | import com.eclipsesource.tabris.interaction.MapsOptions;
41 |
42 |
43 | public class GeolocationDemo implements EntryPoint {
44 |
45 | private static final double SPRINGFIELD_LAT = 44.050953;
46 | private static final double SPRINGFIELD_LON = -123.016663;
47 |
48 | private Shell shell;
49 | private Geolocation geolocation;
50 |
51 | @Override
52 | public int createUI() {
53 | createShell();
54 | createTitle();
55 | geolocation = RWT.getClient().getService( Geolocation.class );
56 | createContent();
57 | shell.open();
58 | return 0;
59 | }
60 |
61 | private void createContent() {
62 | Composite container = new Composite( shell, SWT.NONE );
63 | container.setLayoutData( GridDataFactory.fillDefaults() .align( SWT.FILL, SWT.FILL ) .grab( true, false ) .create() );
64 | container.setLayout( GridLayoutFactory.fillDefaults().margins( 5, 5 ).create() );
65 | createGetLocationButton( container );
66 | createSpringfieldButton( container );
67 | }
68 |
69 | private void createShell() {
70 | Display display = new Display();
71 | shell = new Shell( display, SWT.NO_TRIM );
72 | shell.setLayout( GridLayoutFactory.fillDefaults().margins( 0, 0 ).spacing( 0, 0 ).create() );
73 | shell.setMaximized( true );
74 | }
75 |
76 | private void createTitle() {
77 | ToolBar toolBar = new ToolBar( shell, SWT.NONE);
78 | toolBar.setLayoutData( new GridData( SWT.FILL, SWT.TOP, true, false ) );
79 | ToolItem title = new ToolItem( toolBar, SWT.NONE );
80 | onToolItem( title ).useAsTitle();
81 | title.setText( "D'oh! Where am I?" );
82 | }
83 |
84 | private Button createGetLocationButton( final Composite container ) {
85 | Button getLocationButton = new Button( container, SWT.PUSH );
86 | getLocationButton.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
87 | getLocationButton.setText( "Open my position in maps" );
88 | getLocationButton.setBackground( new Color( getLocationButton.getDisplay(), 60, 60, 60 ) );
89 | getLocationButton.setForeground( new Color( getLocationButton.getDisplay(), 225, 255, 255 ) );
90 | final GeolocationListener listener = new GeolocationListener() {
91 |
92 | @Override
93 | public void positionReceived( Position position ) {
94 | openLocation( position.getCoords().getLatitude(), position.getCoords().getLongitude() );
95 | geolocation.removeGeolocationListener( this );
96 | }
97 |
98 | @Override
99 | public void errorReceived( PositionError error ) {
100 | openErrorDialog( "Error " + error.getCode(), error.getMessage() );
101 | geolocation.removeGeolocationListener( this );
102 | }
103 | };
104 |
105 | getLocationButton.addSelectionListener( new SelectionAdapter() {
106 |
107 | @Override
108 | public void widgetSelected( SelectionEvent e ) {
109 | geolocation.addGeolocationListener( listener );
110 | geolocation.determineCurrentPosition( new GeolocationOptions().enableHighAccuracy() );
111 | }
112 | } );
113 | return getLocationButton;
114 | }
115 |
116 | private Button createSpringfieldButton( final Composite container ) {
117 | Button button = new Button( container, SWT.PUSH );
118 | button.setLayoutData( GridDataFactory.fillDefaults().align( SWT.FILL, SWT.CENTER ).grab( true, false ).create() );
119 | button.setText( "Head me to Springfield" );
120 | button.setBackground( new Color( button.getDisplay(), 225, 151, 7 ) );
121 | button.setForeground( new Color( button.getDisplay(), 225, 255, 255 ) );
122 | final GeolocationAdapter listener = new GeolocationAdapter() {
123 |
124 | @Override
125 | public void positionReceived( Position position ) {
126 | geolocation.removeGeolocationListener( this );
127 | openLocation( SPRINGFIELD_LAT, SPRINGFIELD_LON );
128 | }
129 |
130 | };
131 | button.addSelectionListener( new SelectionAdapter() {
132 |
133 | @Override
134 | public void widgetSelected( SelectionEvent e ) {
135 | geolocation.addGeolocationListener( listener );
136 | geolocation.determineCurrentPosition( new GeolocationOptions().enableHighAccuracy() );
137 | }
138 | } );
139 | return button;
140 | }
141 |
142 | protected void openLocation( double latitude, double longitude ) {
143 | AppLauncher appLauncher = RWT.getClient().getService( AppLauncher.class );
144 | if( appLauncher != null ) {
145 | MapsOptions mapsOptions = new MapsOptions( latitude, longitude );
146 | appLauncher.open( mapsOptions );
147 | }
148 | }
149 |
150 | private void openErrorDialog( String title, String message ) {
151 | MessageBox box = new MessageBox( shell, SWT.ICON_ERROR );
152 | box.setText( title );
153 | box.setMessage( message );
154 | DialogUtil.open( box, null );
155 | }
156 |
157 | }
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/KeyboardDemo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013, 2018 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.entrypoints;
12 |
13 | import static com.eclipsesource.tabris.widgets.enhancement.Widgets.onToolItem;
14 |
15 | import org.eclipse.jface.layout.GridDataFactory;
16 | import org.eclipse.rap.rwt.application.EntryPoint;
17 | import org.eclipse.swt.SWT;
18 | import org.eclipse.swt.layout.GridData;
19 | import org.eclipse.swt.layout.GridLayout;
20 | import org.eclipse.swt.widgets.Composite;
21 | import org.eclipse.swt.widgets.Display;
22 | import org.eclipse.swt.widgets.Label;
23 | import org.eclipse.swt.widgets.Shell;
24 | import org.eclipse.swt.widgets.Text;
25 | import org.eclipse.swt.widgets.ToolBar;
26 | import org.eclipse.swt.widgets.ToolItem;
27 |
28 | import com.eclipsesource.tabris.widgets.ScrollingComposite;
29 | import com.eclipsesource.tabris.widgets.enhancement.TextDecorator;
30 | import com.eclipsesource.tabris.widgets.enhancement.TextReplacementData;
31 | import com.eclipsesource.tabris.widgets.enhancement.Widgets;
32 |
33 | public class KeyboardDemo implements EntryPoint {
34 |
35 | Display display;
36 |
37 | @Override
38 | public int createUI() {
39 | display = new Display();
40 | final Shell shell = createShell();
41 | createToolBar( shell );
42 | Composite comp = createParentComposite( shell );
43 | createTextFields( comp );
44 | createNoteLabel( comp );
45 | shell.open();
46 | return 0;
47 | }
48 |
49 | private Shell createShell() {
50 | final Shell shell = new Shell( display, SWT.NONE );
51 | shell.setMaximized( true );
52 | GridLayout shellLayout = new GridLayout( 1, false );
53 | shellLayout.marginHeight = 0;
54 | shellLayout.marginWidth = 0;
55 | shell.setLayout( shellLayout );
56 | return shell;
57 | }
58 |
59 | private void createToolBar( final Composite parent ) {
60 | ToolBar toolBar = new ToolBar( parent, SWT.NONE );
61 | toolBar.setLayoutData( GridDataFactory.fillDefaults().align( SWT.FILL, SWT.TOP ).grab( true, false ).create() );
62 | ToolItem toolItem = new ToolItem( toolBar, SWT.NONE );
63 | toolItem.setText( "Keyboard Types" );
64 | onToolItem( toolItem ).useAsTitle();
65 | }
66 |
67 | private Composite createParentComposite( final Shell shell ) {
68 | ScrollingComposite comp = new ScrollingComposite( shell, SWT.VERTICAL );
69 | GridLayout compLayout = new GridLayout( 2, false );
70 | compLayout.marginWidth = 16;
71 | compLayout.horizontalSpacing = 16;
72 | comp.setLayout( compLayout );
73 | comp.setLayoutData( GridDataFactory.fillDefaults().align( SWT.FILL, SWT.FILL ).grab( true, true ).create() );
74 | return comp;
75 | }
76 |
77 | private void createTextFields( Composite comp ) {
78 | createLabelText( comp, "Captialize On" ).setAutoCapitalization( TextDecorator.AutoCapitalization.ALL );
79 | createLabelText( comp, "Captialize Off" ).setAutoCapitalization( TextDecorator.AutoCapitalization.NONE );
80 | createLabelText( comp, "AutoCorrect On" ).setAutoCorrectionEnabled( true );
81 | createLabelText( comp, "AutoCorrect Off" ).setAutoCorrectionEnabled( false );
82 | createLabelText( comp, "ASCII" ).useAsciiKeyboard();
83 | createLabelText( comp, "Decimal" ).useDecimalKeyboard();
84 | createLabelText( comp, "E-Mail" ).useEmailKeyboard();
85 | createLabelText( comp, "Numbers" ).useNumberKeyboard();
86 | createLabelText( comp, "Numbers &\nPunctuation" ).useNumbersAndPunctuationKeyboard();
87 | createLabelText( comp, "Phone" ).usePhoneKeyboard();
88 | createLabelText( comp, "URL" ).useUrlKeyboard();
89 | createLabelTextReplacement( comp, "Replace" );
90 | }
91 |
92 | private TextDecorator createLabelText( Composite parent, String title ) {
93 | Label titleLabel = new Label( parent, SWT.NONE );
94 | titleLabel.setText( title );
95 | Text text = new Text( parent, SWT.BORDER );
96 | text.setLayoutData( GridDataFactory.fillDefaults().align( SWT.FILL, SWT.TOP ).grab( true, false ).create() );
97 | return Widgets.onText( text );
98 | }
99 |
100 | private void createLabelTextReplacement( Composite parent, String title ) {
101 | Label titleLabel = new Label( parent, SWT.NONE );
102 | titleLabel.setText( title );
103 | Text text = new Text( parent, SWT.BORDER | SWT.MULTI );
104 | text.setLayoutData( GridDataFactory.fillDefaults().align( SWT.FILL, SWT.TOP ).hint( SWT.DEFAULT, 200 ).grab( true, false ).create() );
105 | TextReplacementData data = new TextReplacementData();
106 | data.put( "yolo", "You only live once" );
107 | data.put( "hodor", "hodor hodor hodor hodor" );
108 | data.put( "rap", "Remote Application Platform" );
109 | data.put( "tabris", "Tabris Rocks!" );
110 | Widgets.onText( text ).setTextReplacement( data );
111 | }
112 |
113 | private void createNoteLabel( Composite comp ) {
114 | Label labelNote = new Label( comp, SWT.CENTER | SWT.WRAP );
115 | labelNote.setText( "Tab on the text input fields to show different keyboards." );
116 | GridData gridData = new GridData( SWT.CENTER, SWT.CENTER, true, false );
117 | gridData.verticalIndent = 24;
118 | gridData.horizontalSpan = 2;
119 | labelNote.setLayoutData( gridData );
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/PdfDemo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2021 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.entrypoints;
12 |
13 | import org.eclipse.rap.rwt.application.EntryPoint;
14 | import org.eclipse.swt.SWT;
15 | import org.eclipse.swt.graphics.Color;
16 | import org.eclipse.swt.layout.FillLayout;
17 | import org.eclipse.swt.widgets.Display;
18 | import org.eclipse.swt.widgets.Shell;
19 |
20 | import com.eclipsesource.tabris.widgets.LoadListener;
21 | import com.eclipsesource.tabris.widgets.PdfView;
22 |
23 | public class PdfDemo implements EntryPoint {
24 |
25 | private static final String PDF_URL = "https://tabrisjs.com/downloads/ebook/tabrisjs-3.5.0.pdf";
26 |
27 | @Override
28 | public int createUI() {
29 | Display display = new Display();
30 | Shell shell = new Shell( display, SWT.NO_TRIM );
31 | shell.setMaximized( true );
32 | shell.setLayout( new FillLayout() );
33 | PdfView pdf = new PdfView( shell );
34 | pdf.setBackground( new Color( display, 239, 239, 239 ) );
35 | pdf.setZoomEnabled( true );
36 | pdf.setPageElevation( 4 );
37 | pdf.setSpacing( 16 );
38 | pdf.setViewPadding( 24, 16, 24, 16 );
39 | pdf.addLoadListener( new LoadListener() {
40 | @Override
41 | public void loadSucceeded() {
42 | System.out.println( "PDF loaded successfully" );
43 | }
44 | @Override
45 | public void loadFailed() {
46 | System.out.println( "Failed to load PDF Document" );
47 | }
48 | } );
49 | pdf.setUrl( PDF_URL );
50 | shell.open();
51 | return 0;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/SimpleTreeDemo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2012 EclipseSource and others. All rights reserved. This
3 | * program and the accompanying materials are made available under the terms of
4 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
5 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
6 | * EclipseSource - initial API and implementation
7 | ******************************************************************************/
8 | package com.eclipsesource.tabris.demos.entrypoints;
9 |
10 | import static com.eclipsesource.tabris.widgets.enhancement.Widgets.onTree;
11 |
12 | import org.eclipse.rap.rwt.application.EntryPoint;
13 | import org.eclipse.swt.SWT;
14 | import org.eclipse.swt.layout.FillLayout;
15 | import org.eclipse.swt.widgets.Display;
16 | import org.eclipse.swt.widgets.Event;
17 | import org.eclipse.swt.widgets.Listener;
18 | import org.eclipse.swt.widgets.Shell;
19 | import org.eclipse.swt.widgets.Tree;
20 | import org.eclipse.swt.widgets.TreeItem;
21 |
22 | import com.eclipsesource.tabris.widgets.RefreshListener;
23 | import com.eclipsesource.tabris.widgets.enhancement.RefreshHandler;
24 |
25 | public class SimpleTreeDemo implements EntryPoint {
26 |
27 | @Override
28 | public int createUI() {
29 | Display display = new Display();
30 | Shell shell = new Shell( display, SWT.NO_TRIM );
31 | shell.setMaximized( true );
32 | shell.setLayout( new FillLayout() );
33 | createContent( display, shell );
34 | shell.open();
35 | shell.setVisible( true );
36 | return 0;
37 | }
38 |
39 | private void createContent( Display display, Shell shell ) {
40 | Tree tree = new Tree( shell, SWT.BORDER );
41 | tree.setToolTipText( "Winchester Evangelium" );
42 | tree.setLinesVisible( true );
43 | onTree( tree ).enableMarkup( true );
44 | onTree( tree ).setBackButtonNavigationEnabled( true );
45 | setupPullToRefresh( tree );
46 | addTreeItems( tree );
47 | tree.addListener( SWT.Expand, new Listener() {
48 |
49 | @Override
50 | public void handleEvent( Event event ) {
51 | TreeItem item = ( TreeItem )event.item;
52 | System.out.println( "Item selected: " + item.getText() );
53 | }
54 | } );
55 | }
56 |
57 | public void addTreeItems( Tree tree ) {
58 | for( int i = 0; i < 4; i++ ) {
59 | TreeItem iItem = new TreeItem( tree, 0 );
60 | iItem.setText( getMainCharacterName( i ) );
61 | for( int j = 0; j < 8; j++ ) {
62 | TreeItem jItem = new TreeItem( iItem, 0 );
63 | jItem.setText( getSideCharacterName( j ) );
64 | for( int k = 0; k < 30; k++ ) {
65 | TreeItem kItem = new TreeItem( jItem, 0 );
66 | kItem.setText( "Season 5, Episode " + k + "" );
67 | }
68 | }
69 | }
70 | }
71 |
72 | private void setupPullToRefresh( final Tree tree ) {
73 | final RefreshHandler handler = new RefreshHandler();
74 | handler.setMessage( "Spoiler Alert!" );
75 | handler.addRefreshListener( new RefreshListener() {
76 | @Override
77 | public void refresh() {
78 | markDead( tree.getItems() );
79 | tree.update();
80 | handler.done();
81 | }
82 | } );
83 | onTree( tree ).setRefreshHandler( handler );
84 | }
85 |
86 | private void markDead( TreeItem[] items ) {
87 | for( TreeItem item : items ) {
88 | markDead( item.getItems() );
89 | String name = item.getText();
90 | if( !survives( name ) && !name.contains( "Deceased" ) ) {
91 | item.setText( name + " [Deceased]" );
92 | }
93 | }
94 | }
95 |
96 | private String getSideCharacterName( int j ) {
97 | String result = "";
98 | switch( j ) {
99 | case 0:
100 | result = "Bobby Singer";
101 | break;
102 | case 1:
103 | result = "Ellen Harvelle";
104 | break;
105 | case 2:
106 | result = "Johanna Harvelle";
107 | break;
108 | case 3:
109 | result = "Gordon Walker";
110 | break;
111 | case 4:
112 | result = "Samuel Campbell";
113 | break;
114 | case 5:
115 | result = "Rufus Turner";
116 | break;
117 | case 6:
118 | result = "Gwen Campbell";
119 | break;
120 | case 7:
121 | result = "Castiel";
122 | break;
123 | }
124 | return result;
125 | }
126 |
127 | private String getMainCharacterName( int i ) {
128 | String result = "";
129 | switch( i ) {
130 | case 0:
131 | result = "John Winchester";
132 | break;
133 | case 1:
134 | result = "Mary Winchester";
135 | break;
136 | case 2:
137 | result = "Dean Winchester";
138 | break;
139 | case 3:
140 | result = "Sam Winchester";
141 | break;
142 | default:
143 | result = "Not known";
144 | break;
145 | }
146 | return result;
147 | }
148 |
149 | private boolean survives( String name ) {
150 | boolean survivor = false;
151 | if( (contains( name, "Castiel" ) || contains( name, "Sam" ) || contains( name, "Dean" )) && !contains( name, "Samuel" ) ) {
152 | survivor = true;
153 | }
154 | return survivor;
155 | }
156 |
157 | private boolean contains( String string, String substring ) {
158 | return string.indexOf( substring ) >= 0;
159 | }
160 |
161 | }
162 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/SwipeDemo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013, 2018 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.entrypoints;
12 |
13 | import static com.eclipsesource.tabris.widgets.enhancement.Widgets.onToolItem;
14 |
15 | import org.eclipse.jface.layout.GridDataFactory;
16 | import org.eclipse.jface.layout.GridLayoutFactory;
17 | import org.eclipse.rap.rwt.RWT;
18 | import org.eclipse.rap.rwt.application.EntryPoint;
19 | import org.eclipse.swt.SWT;
20 | import org.eclipse.swt.widgets.Composite;
21 | import org.eclipse.swt.widgets.Display;
22 | import org.eclipse.swt.widgets.MessageBox;
23 | import org.eclipse.swt.widgets.Shell;
24 | import org.eclipse.swt.widgets.ToolBar;
25 | import org.eclipse.swt.widgets.ToolItem;
26 |
27 | import com.eclipsesource.tabris.TabrisClient;
28 | import com.eclipsesource.tabris.demos.swipe.DictionarySwipeItemProvider;
29 | import com.eclipsesource.tabris.widgets.PagingIndicator;
30 | import com.eclipsesource.tabris.widgets.swipe.Swipe;
31 | import com.eclipsesource.tabris.widgets.swipe.SwipeAdapter;
32 | import com.eclipsesource.tabris.widgets.swipe.SwipeContext;
33 | import com.eclipsesource.tabris.widgets.swipe.SwipeItem;
34 |
35 | public class SwipeDemo implements EntryPoint {
36 |
37 | @Override
38 | public int createUI() {
39 | Display display = new Display();
40 | final Shell shell = createShell( display );
41 | if( RWT.getClient() instanceof TabrisClient ) {
42 | createToolBar( shell );
43 | Composite container = createParentComposite( shell );
44 | createSwipeWidget( container );
45 | } else {
46 | createWebClientContent( shell );
47 | }
48 | shell.open();
49 | return 0;
50 | }
51 |
52 | private Composite createParentComposite( final Shell shell ) {
53 | Composite comp = new Composite( shell, SWT.NONE );
54 | GridLayoutFactory.fillDefaults().margins( 0, 5 ).applyTo( comp );
55 | GridDataFactory.fillDefaults().align( SWT.FILL, SWT.FILL ).grab( true, true ).applyTo( comp );
56 | return comp;
57 | }
58 |
59 | private Shell createShell( Display display ) {
60 | final Shell shell = new Shell( display, SWT.NONE );
61 | shell.setMaximized( true );
62 | GridLayoutFactory.fillDefaults().applyTo( shell );
63 | return shell;
64 | }
65 |
66 | private void createToolBar( final Composite parent ) {
67 | ToolBar toolBar = new ToolBar( parent, SWT.NONE );
68 | GridDataFactory.fillDefaults().align( SWT.FILL, SWT.TOP ).grab( true, false ).applyTo( toolBar );
69 | ToolItem toolItem = new ToolItem( toolBar, SWT.NONE );
70 | toolItem.setText( "Klingon Lessons" );
71 | onToolItem( toolItem ).useAsTitle();
72 | }
73 |
74 | private void createSwipeWidget( Composite parent ) {
75 | DictionarySwipeItemProvider itemProvider = new DictionarySwipeItemProvider();
76 | Swipe result = new Swipe( parent, itemProvider );
77 | result.setCacheSize( 2 );
78 | GridDataFactory.fillDefaults()
79 | .grab( true, true )
80 | .align( SWT.FILL, SWT.FILL )
81 | .applyTo( result.getControl() );
82 | result.show( 0 );
83 | createPagingIndicator( parent, result, itemProvider.getItemCount() );
84 | }
85 |
86 | private void createPagingIndicator( Composite parent, Swipe swipe, int itemCount ) {
87 | final PagingIndicator pagingIndicator = new PagingIndicator( parent );
88 | pagingIndicator.setSpacing( 5 );
89 | pagingIndicator.setCount( itemCount );
90 | swipe.addSwipeListener( new SwipeAdapter() {
91 | @Override
92 | public void itemActivated(SwipeItem item, int index, SwipeContext context) {
93 | pagingIndicator.setActive( index );
94 | }
95 | } );
96 | GridDataFactory.fillDefaults()
97 | .grab( true, false )
98 | .align( SWT.FILL, SWT.FILL )
99 | .applyTo( pagingIndicator );
100 | }
101 |
102 | private void createWebClientContent( final Shell shell ) {
103 | MessageBox messageBox = new MessageBox( shell, SWT.ICON_WARNING );
104 | messageBox.setMessage( "This demo is availaible on mobile devices only." );
105 | messageBox.setText( "Tabris Demo" );
106 | shell.open();
107 | messageBox.open( null );
108 | }
109 |
110 | }
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/UiDemo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others. All rights reserved. This
3 | * program and the accompanying materials are made available under the terms of
4 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
5 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
6 | * EclipseSource - initial API and implementation
7 | ******************************************************************************/
8 | package com.eclipsesource.tabris.demos.entrypoints;
9 |
10 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_ACTION_SEARCH;
11 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_ACTION_SETTINGS;
12 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_ACTION_SHARE;
13 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_ACTION_THEME;
14 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_PAGE_ALL_BOOKS;
15 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_PAGE_FAVORITE_BOOKS;
16 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_PAGE_POPULAR_BOOKS;
17 |
18 | import java.io.InputStream;
19 |
20 | import org.eclipse.rap.rwt.application.EntryPoint;
21 | import org.eclipse.rap.rwt.application.EntryPointFactory;
22 |
23 | import com.eclipsesource.tabris.demos.ui.AllBooksPage;
24 | import com.eclipsesource.tabris.demos.ui.BookDetailsPage;
25 | import com.eclipsesource.tabris.demos.ui.BookSearchAction;
26 | import com.eclipsesource.tabris.demos.ui.ChangeThemeAction;
27 | import com.eclipsesource.tabris.demos.ui.FavoriteBooksPage;
28 | import com.eclipsesource.tabris.demos.ui.PopularBooksPage;
29 | import com.eclipsesource.tabris.demos.ui.ReadBookPage;
30 | import com.eclipsesource.tabris.demos.ui.SearchResultsPage;
31 | import com.eclipsesource.tabris.demos.ui.SettingsAction;
32 | import com.eclipsesource.tabris.demos.ui.SettingsPage;
33 | import com.eclipsesource.tabris.demos.ui.ShareAction;
34 | import com.eclipsesource.tabris.ui.ActionConfiguration;
35 | import com.eclipsesource.tabris.ui.PageConfiguration;
36 | import com.eclipsesource.tabris.ui.PlacementPriority;
37 | import com.eclipsesource.tabris.ui.TabrisUIEntryPoint;
38 | import com.eclipsesource.tabris.ui.UIConfiguration;
39 |
40 | public class UiDemo implements EntryPointFactory {
41 |
42 | @Override
43 | public EntryPoint create() {
44 | return new TabrisUIEntryPoint( createConfiguration() );
45 | }
46 |
47 | private UIConfiguration createConfiguration() {
48 | UIConfiguration configuration = new UIConfiguration();
49 | // configuration.setImage( getImage( IMAGE_BOOK_STORE_UI ) );
50 | createPages( configuration );
51 | createPageSettings( configuration );
52 | createGlobalActions( configuration );
53 | return configuration;
54 | }
55 |
56 | private void createPages( UIConfiguration configuration ) {
57 | createAllBooksPage( configuration );
58 | createPopularBooksPage( configuration );
59 | createFavoriteBooksPage( configuration );
60 | createBookDetailsPage( configuration );
61 | createReadBookPage( configuration );
62 | createSearchResultsPage( configuration );
63 | }
64 |
65 | private void createAllBooksPage( UIConfiguration configuration ) {
66 | PageConfiguration page = new PageConfiguration( AllBooksPage.class.getName(),
67 | AllBooksPage.class );
68 | page.setTitle( "All Books" );
69 | page.setImage( getImage( IMAGE_PAGE_ALL_BOOKS ) );
70 | page.setTopLevel( true );
71 | configuration.addPageConfiguration( page );
72 | }
73 |
74 | private void createPopularBooksPage( UIConfiguration configuration ) {
75 | PageConfiguration page = new PageConfiguration( PopularBooksPage.class.getName(),
76 | PopularBooksPage.class );
77 | page.setTitle( "Popular" );
78 | page.setImage( getImage( IMAGE_PAGE_POPULAR_BOOKS ) );
79 | page.setTopLevel( true );
80 | configuration.addPageConfiguration( page );
81 | }
82 |
83 | private void createFavoriteBooksPage( UIConfiguration configuration ) {
84 | PageConfiguration page = new PageConfiguration( FavoriteBooksPage.class.getName(),
85 | FavoriteBooksPage.class );
86 | page.setTitle( "Favorite" );
87 | page.setImage( getImage( IMAGE_PAGE_FAVORITE_BOOKS ) );
88 | page.setTopLevel( true );
89 | configuration.addPageConfiguration( page );
90 | }
91 |
92 | private void createBookDetailsPage( UIConfiguration configuration ) {
93 | PageConfiguration page = new PageConfiguration( BookDetailsPage.class.getName(),
94 | BookDetailsPage.class );
95 | page.setTitle( "Book" );
96 | ActionConfiguration action = new ActionConfiguration( ShareAction.class.getName(),
97 | ShareAction.class );
98 | action.setImage( getImage( IMAGE_ACTION_SHARE ) );
99 | action.setTitle( "Share" );
100 | page.addActionConfiguration( action );
101 | configuration.addPageConfiguration( page );
102 | }
103 |
104 | private void createReadBookPage( UIConfiguration configuration ) {
105 | PageConfiguration page = new PageConfiguration( ReadBookPage.class.getName(),
106 | ReadBookPage.class );
107 | page.setTitle( "Book" );
108 | ActionConfiguration action = new ActionConfiguration( ChangeThemeAction.class.getName(),
109 | ChangeThemeAction.class );
110 | action.setImage( getImage( IMAGE_ACTION_THEME ) );
111 | action.setTitle( "Change Theme" );
112 | page.addActionConfiguration( action );
113 | configuration.addPageConfiguration( page );
114 | }
115 |
116 | private void createPageSettings( UIConfiguration configuration ) {
117 | PageConfiguration page = new PageConfiguration( SettingsPage.class.getName(),
118 | SettingsPage.class );
119 | page.setTitle( "Settings" );
120 | configuration.addPageConfiguration( page );
121 | }
122 |
123 | private void createSearchResultsPage( UIConfiguration configuration ) {
124 | PageConfiguration page = new PageConfiguration( SearchResultsPage.class.getName(),
125 | SearchResultsPage.class );
126 | configuration.addPageConfiguration( page );
127 | }
128 |
129 | private void createGlobalActions( UIConfiguration configuration ) {
130 | ActionConfiguration action = new ActionConfiguration( BookSearchAction.class.getName(),
131 | BookSearchAction.class );
132 | action.setImage( getImage( IMAGE_ACTION_SEARCH ) );
133 | action.setTitle( "Search" );
134 | action.setPlacementPriority( PlacementPriority.HIGH );
135 | configuration.addActionConfiguration( action );
136 | action = new ActionConfiguration( SettingsAction.class.getName(), SettingsAction.class );
137 | action.setPlacementPriority( PlacementPriority.LOW );
138 | action.setImage( getImage( IMAGE_ACTION_SETTINGS ) );
139 | action.setTitle( "Settings" );
140 | configuration.addActionConfiguration( action );
141 | }
142 |
143 | private InputStream getImage( String path ) {
144 | return UiDemo.class.getResourceAsStream( path );
145 | }
146 | }
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/VideoDemo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * "****************************************************************************
3 | * * * Copyright (c) 2012 EclipseSource and others. All rights reserved. This
4 | * program and the accompanying materials are made available under the terms of
5 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
6 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
7 | * EclipseSource - initial API and implementation
8 | * ****************************************************************************
9 | */
10 | package com.eclipsesource.tabris.demos.entrypoints;
11 |
12 | import org.eclipse.rap.rwt.application.EntryPoint;
13 | import org.eclipse.swt.SWT;
14 | import org.eclipse.swt.events.SelectionAdapter;
15 | import org.eclipse.swt.events.SelectionEvent;
16 | import org.eclipse.swt.events.SelectionListener;
17 | import org.eclipse.swt.layout.GridData;
18 | import org.eclipse.swt.layout.GridLayout;
19 | import org.eclipse.swt.widgets.Button;
20 | import org.eclipse.swt.widgets.Composite;
21 | import org.eclipse.swt.widgets.Display;
22 | import org.eclipse.swt.widgets.Shell;
23 |
24 | import com.eclipsesource.tabris.widgets.PlaybackListener;
25 | import com.eclipsesource.tabris.widgets.Video;
26 | import com.eclipsesource.tabris.widgets.Video.PlayerState;
27 |
28 | public class VideoDemo implements EntryPoint {
29 |
30 | private static final String videoUrl = "http://peach.themazzone.com/durian/movies/sintel-1280-stereo.mp4";
31 |
32 | @Override
33 | public int createUI() {
34 | Display display = new Display();
35 | Shell shell = new Shell( display, SWT.NO_TRIM );
36 | shell.setMaximized( true );
37 | GridLayout layout = new GridLayout( 1, false );
38 | layout.marginHeight = 0;
39 | layout.marginWidth = 0;
40 | shell.setLayout( layout );
41 | final Video video = new Video( shell, videoUrl );
42 | video.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
43 | video.setSpeed( Video.PLAY_SPEED );
44 | video.addPlaybackListener( new PlaybackListener() {
45 |
46 | @Override
47 | public void playbackChanged( PlayerState state ) {
48 | System.out.println( "New playback state: " + state );
49 | System.out.println( "Playback speed: " + video.getSpeed() );
50 | }
51 | } );
52 | createButtons( shell, video );
53 | shell.open();
54 | return 0;
55 | }
56 |
57 | private void createButtons( Composite parent, final Video video ) {
58 | Composite composite = new Composite( parent, SWT.NONE );
59 | composite.setLayout( new GridLayout( 3, true ) );
60 | composite.setLayoutData( new GridData( SWT.FILL, SWT.BOTTOM, true, false ) );
61 | createButton( composite, "Play", new SelectionAdapter() {
62 |
63 | @Override
64 | public void widgetSelected( SelectionEvent e ) {
65 | video.setSpeed( 1f );
66 | }
67 | } );
68 | createButton( composite, "Pause", new SelectionAdapter() {
69 |
70 | @Override
71 | public void widgetSelected( SelectionEvent e ) {
72 | video.setSpeed( 0f );
73 | }
74 | } );
75 | createButton( composite, "Controls", new SelectionAdapter() {
76 |
77 | @Override
78 | public void widgetSelected( SelectionEvent e ) {
79 | video.setPlayerControlsVisible( !video.hasPlayerControlsVisible() );
80 | }
81 | } );
82 | createButton( composite, "Step to 3:00", new SelectionAdapter() {
83 |
84 | @Override
85 | public void widgetSelected( SelectionEvent e ) {
86 | video.stepToTime( 3 * 60 );
87 | }
88 | } );
89 | createButton( composite, "Skip -20 sec", new SelectionAdapter() {
90 |
91 | @Override
92 | public void widgetSelected( SelectionEvent e ) {
93 | video.skipFromCurrent( -20 );
94 | }
95 | } );
96 | createButton( composite, "Skip + 30 sec", new SelectionAdapter() {
97 |
98 | @Override
99 | public void widgetSelected( SelectionEvent e ) {
100 | video.skipFromCurrent( 30 );
101 | }
102 | } );
103 | }
104 |
105 | private Button createButton( Composite composite, String text, SelectionListener listener ) {
106 | Button button = new Button( composite, SWT.PUSH );
107 | button.setText( text );
108 | button.setLayoutData( new GridData( SWT.FILL, SWT.TOP, true, false ) );
109 | button.addSelectionListener( listener );
110 | return button;
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/VirtualTreeDemo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2012 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.entrypoints;
12 |
13 | import org.eclipse.rap.rwt.application.EntryPoint;
14 | import org.eclipse.swt.SWT;
15 | import org.eclipse.swt.layout.FillLayout;
16 | import org.eclipse.swt.widgets.Composite;
17 | import org.eclipse.swt.widgets.Display;
18 | import org.eclipse.swt.widgets.Shell;
19 |
20 | import com.eclipsesource.tabris.demos.enron.EnronExample;
21 |
22 |
23 | public class VirtualTreeDemo implements EntryPoint {
24 |
25 | public int createUI() {
26 | Display display = new Display();
27 | Shell shell = new Shell( display, SWT.NO_TRIM );
28 | shell.setMaximized(true);
29 | shell.setLayout( new FillLayout() );
30 | createContent( shell );
31 | shell.open();
32 | return 0;
33 | }
34 |
35 | private void createContent( Composite parent ) {
36 | Composite comp = new Composite( parent, SWT.NONE );
37 | comp.setLayout( new FillLayout() );
38 | EnronExample enronExample = new EnronExample();
39 | enronExample.createMainArea( comp );
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/hal/Hal9000.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.hal;
12 |
13 | import org.eclipse.jface.layout.GridLayoutFactory;
14 | import org.eclipse.swt.SWT;
15 | import org.eclipse.swt.graphics.Color;
16 | import org.eclipse.swt.graphics.Font;
17 | import org.eclipse.swt.graphics.FontData;
18 | import org.eclipse.swt.graphics.Image;
19 | import org.eclipse.swt.graphics.Rectangle;
20 | import org.eclipse.swt.layout.FormAttachment;
21 | import org.eclipse.swt.layout.FormData;
22 | import org.eclipse.swt.layout.FormLayout;
23 | import org.eclipse.swt.layout.GridData;
24 | import org.eclipse.swt.layout.GridLayout;
25 | import org.eclipse.swt.widgets.Composite;
26 | import org.eclipse.swt.widgets.Display;
27 | import org.eclipse.swt.widgets.Label;
28 |
29 | public class Hal9000 {
30 |
31 | private static final int PLATE_BORDER = 4;
32 | private static final int PLATE_FONT_SIZE = 28;
33 | private static final int BORDER = 6;
34 | private static final int TOP_HEIGHT_PERCENTAGE = 65;
35 | private Color borderColor;
36 | private Label output;
37 | private Image halEye;
38 | private int fontSize;
39 |
40 | public Hal9000( Composite parent ) {
41 | initSizeAgnosticParts( parent.getDisplay() );
42 | createContent( parent );
43 | }
44 |
45 | public Label getText() {
46 | return output;
47 | }
48 |
49 | private void createContent( Composite parent ) {
50 | Display display = parent.getDisplay();
51 | Composite content = new Composite( parent, SWT.NONE );
52 | borderColor = display.getSystemColor( SWT.COLOR_GRAY );
53 | content.setBackground( borderColor );
54 | content.setLayout( new FormLayout() );
55 | Composite top = createBlackComposite( content );
56 | top.setLayout( createGridLayout( 1, true, 40, 10, 0 ) );
57 | FormData formDataTop = createTopLayoutData();
58 | top.setLayoutData( formDataTop );
59 | Composite bottom = createBlackComposite( content );
60 | bottom.setLayout( createGridLayout( 1, true, 10, 10, 0 ) );
61 | bottom.setBackgroundImage( loadImage( display, "/rubber_grip.png" ) );
62 | FormData formDataBottom = createBottomLayoutData( top, formDataTop );
63 | bottom.setLayoutData( formDataBottom );
64 | createTypePlate( top );
65 | createEye( top );
66 | createGrille( bottom );
67 | }
68 |
69 | private Composite createBlackComposite( Composite parent ) {
70 | Composite blackComposite = new Composite( parent, SWT.NONE );
71 | blackComposite.setBackground( parent.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
72 | return blackComposite;
73 | }
74 |
75 | public GridLayout createGridLayout( int numColumns,
76 | boolean makeColumnsEqual,
77 | int marginWidth,
78 | int marginHeight,
79 | int spacing )
80 | {
81 | GridLayout result = new GridLayout( numColumns, makeColumnsEqual );
82 | result.horizontalSpacing = spacing;
83 | result.verticalSpacing = spacing;
84 | result.marginWidth = marginWidth;
85 | result.marginHeight = marginHeight;
86 | return result;
87 | }
88 |
89 | private FormData createTopLayoutData() {
90 | FormData formDataTop = new FormData();
91 | formDataTop.top = new FormAttachment( 0, BORDER );
92 | formDataTop.left = new FormAttachment( 0, BORDER );
93 | formDataTop.right = new FormAttachment( 100, -BORDER );
94 | formDataTop.bottom = new FormAttachment( TOP_HEIGHT_PERCENTAGE, 0 );
95 | return formDataTop;
96 | }
97 |
98 | private FormData createBottomLayoutData( Composite top, FormData formDataTop ) {
99 | FormData formDataBottom = new FormData();
100 | formDataBottom.top = new FormAttachment( top, BORDER );
101 | formDataBottom.left = formDataTop.left;
102 | formDataBottom.right = formDataTop.right;
103 | formDataBottom.bottom = new FormAttachment( 100, -BORDER );
104 | return formDataBottom;
105 | }
106 |
107 | private void createTypePlate( Composite parent ) {
108 | Composite container = new Composite( parent, SWT.NONE );
109 | container.setBackground( borderColor );
110 | GridData gridData = new GridData( SWT.CENTER, SWT.FILL, true, false );
111 | gridData.widthHint = 200;
112 | container.setLayoutData( gridData );
113 | GridLayout layout = GridLayoutFactory.fillDefaults().numColumns( 2 ).equalWidth( true )
114 | .margins( PLATE_BORDER, PLATE_BORDER ).spacing( 0, 0 ).create();
115 | container.setLayout( layout );
116 | Color blue = new Color( parent.getDisplay(), 1, 116, 255 );
117 | Color black = parent.getDisplay().getSystemColor( SWT.COLOR_BLACK );
118 | createPlateLabel( container, "HAL", SWT.RIGHT, blue );
119 | createPlateLabel( container, "9000", SWT.LEFT, black );
120 | }
121 |
122 | private void createPlateLabel( Composite parent,
123 | String text,
124 | int alignment,
125 | Color background )
126 | {
127 | GridData labelLayoutData = new GridData( SWT.FILL, SWT.FILL, true, true );
128 | Label hal = new Label( parent, alignment );
129 | hal.setBackground( background );
130 | hal.setForeground( parent.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
131 | hal.setText( text );
132 | hal.setLayoutData( labelLayoutData );
133 | hal.setFont( createBold( parent.getDisplay(), PLATE_FONT_SIZE ) );
134 | }
135 |
136 | private void createEye( Composite parent ) {
137 | Composite eyeContainer = new Composite( parent, SWT.NONE );
138 | GridData container2Data = new GridData( SWT.FILL, SWT.FILL, false, true );
139 | eyeContainer.setBackground( parent.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
140 | eyeContainer.setLayoutData( container2Data );
141 | eyeContainer.setLayout( new FormLayout() );
142 | final Label eyeLabel = new Label( eyeContainer, SWT.CENTER );
143 | eyeLabel.setBackground( parent.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
144 | eyeLabel.setImage( halEye );
145 | eyeLabel.setLayoutData( createFormDataEye() );
146 | }
147 |
148 | private void initSizeAgnosticParts( Display display ) {
149 | Rectangle bounds = display.getMonitors()[ 0 ].getBounds();
150 | int width = Math.min( bounds.width, bounds.height );
151 | if( width < 400 ) {
152 | halEye = loadImage( display, "/hal_160.png" );
153 | fontSize = 18;
154 | } else {
155 | halEye = loadImage( display, "/hal_240.png" );
156 | fontSize = 24;
157 | }
158 | }
159 |
160 | private FormData createFormDataEye() {
161 | FormData formDataEye = new FormData();
162 | formDataEye.left = new FormAttachment( 0, 0 );
163 | formDataEye.right = new FormAttachment( 100, 0 );
164 | formDataEye.bottom = new FormAttachment( 90, 0 );
165 | return formDataEye;
166 | }
167 |
168 | private Font createBold( Display display, int size ) {
169 | FontData fontData = new FontData();
170 | fontData.setStyle( SWT.BOLD );
171 | fontData.setHeight( size );
172 | return new Font( display, fontData );
173 | }
174 |
175 | private void createGrille( Composite parent ) {
176 | Composite textContainer = new Composite( parent, SWT.NONE );
177 | GridData grilleData = new GridData( SWT.FILL, SWT.FILL, true, true );
178 | textContainer.setLayoutData( grilleData );
179 | GridLayout layout = GridLayoutFactory.fillDefaults().equalWidth( true ).margins( 0, 0 ).spacing( 0, 0 ).create();
180 | textContainer.setLayout( layout );
181 | output = new Label( textContainer, SWT.WRAP );
182 | output.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
183 | output.setForeground( parent.getDisplay().getSystemColor( SWT.COLOR_GREEN ) );
184 | output.setFont( createBold( parent.getDisplay(), fontSize ) );
185 | output.setText( "Good morning Dave.\n\nYou can send me to sleep by changing to another app.\n" );
186 | }
187 |
188 | private Image loadImage( Display display, String path ) {
189 | return new Image( display, Hal9000.class.getResourceAsStream( path ) );
190 | }
191 | }
192 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/swipe/DictionarySwipeItem.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others. All rights reserved. This
3 | * program and the accompanying materials are made available under the terms of
4 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
5 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
6 | * EclipseSource - initial API and implementation
7 | ******************************************************************************/
8 | package com.eclipsesource.tabris.demos.swipe;
9 |
10 | import org.eclipse.jface.layout.GridDataFactory;
11 | import org.eclipse.jface.layout.GridLayoutFactory;
12 | import org.eclipse.swt.SWT;
13 | import org.eclipse.swt.graphics.Font;
14 | import org.eclipse.swt.graphics.FontData;
15 | import org.eclipse.swt.widgets.Composite;
16 | import org.eclipse.swt.widgets.Control;
17 | import org.eclipse.swt.widgets.Label;
18 |
19 | import com.eclipsesource.tabris.widgets.swipe.SwipeContext;
20 | import com.eclipsesource.tabris.widgets.swipe.SwipeItem;
21 |
22 | public class DictionarySwipeItem implements SwipeItem {
23 |
24 | private final String english;
25 | private final String klingon;
26 | private final int index;
27 |
28 | public DictionarySwipeItem( String english, String klingon, int index ) {
29 | this.english = english;
30 | this.klingon = klingon;
31 | this.index = index;
32 | }
33 |
34 | public boolean isPreloadable() {
35 | return true;
36 | }
37 |
38 | public Control load( Composite parent ) {
39 | Composite result = new Composite( parent, SWT.NONE );
40 | GridLayoutFactory.fillDefaults().margins( 5, 0 ).applyTo( result );
41 | Composite page = createPage( result );
42 | createTitleLabel( page );
43 | createEnglishLabel( page );
44 | createKlingonLabel( page );
45 | parent.layout( true, true );
46 | return result;
47 | }
48 |
49 | private Composite createPage( Composite parent ) {
50 | Composite page = new Composite( parent, SWT.NONE );
51 | GridDataFactory.fillDefaults().grab( true, true ).align( SWT.FILL, SWT.FILL ).applyTo( page );
52 | GridLayoutFactory.fillDefaults().margins( 16, 16 ).applyTo( page );
53 | page.setBackground( parent.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
54 | return page;
55 | }
56 |
57 | private void createTitleLabel( Composite parent ) {
58 | Label titleLabel = new Label( parent, SWT.WRAP );
59 | GridDataFactory.fillDefaults()
60 | .align( SWT.CENTER, SWT.TOP )
61 | .grab( true, true )
62 | .applyTo( titleLabel );
63 | titleLabel.setForeground( parent.getDisplay().getSystemColor( SWT.COLOR_DARK_GRAY ) );
64 | titleLabel.setText( "Lesson " + ( index + 1 ) );
65 | titleLabel.setFont( new Font( parent.getDisplay(), new FontData( "Arial", 30, SWT.BOLD ) ) );
66 | }
67 |
68 | private void createEnglishLabel( Composite parent ) {
69 | Label englishLabel = new Label( parent, SWT.WRAP );
70 | GridDataFactory.fillDefaults()
71 | .align( SWT.LEFT, SWT.CENTER )
72 | .grab( true, true )
73 | .applyTo( englishLabel );
74 | englishLabel.setForeground( parent.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
75 | englishLabel.setText( english );
76 | englishLabel.setFont( new Font( parent.getDisplay(), new FontData( "Arial", 25, SWT.BOLD ) ) );
77 | }
78 |
79 | private void createKlingonLabel( Composite parent ) {
80 | Label klingonLabel = new Label( parent, SWT.WRAP | SWT.RIGHT );
81 | GridDataFactory.fillDefaults()
82 | .align( SWT.END, SWT.CENTER )
83 | .grab( true, true )
84 | .applyTo( klingonLabel );
85 | klingonLabel.setForeground( parent.getDisplay().getSystemColor( SWT.COLOR_DARK_GRAY ) );
86 | klingonLabel.setText( klingon );
87 | klingonLabel.setFont( new Font( parent.getDisplay(), new FontData( "Arial", 25, SWT.BOLD ) ) );
88 | }
89 |
90 | public void activate( SwipeContext context ) {
91 | // do nothing
92 | }
93 |
94 | public void deactivate( SwipeContext context ) {
95 | // do nothing
96 | }
97 | }
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/swipe/DictionarySwipeItemProvider.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others. All rights reserved. This
3 | * program and the accompanying materials are made available under the terms of
4 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
5 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
6 | * EclipseSource - initial API and implementation
7 | ******************************************************************************/
8 | package com.eclipsesource.tabris.demos.swipe;
9 |
10 | import java.util.ArrayList;
11 | import java.util.HashMap;
12 | import java.util.List;
13 | import java.util.Map;
14 | import java.util.Map.Entry;
15 |
16 | import com.eclipsesource.tabris.widgets.swipe.SwipeItem;
17 | import com.eclipsesource.tabris.widgets.swipe.SwipeItemProvider;
18 |
19 | public class DictionarySwipeItemProvider implements SwipeItemProvider {
20 |
21 | private final List items;
22 |
23 | public DictionarySwipeItemProvider() {
24 | items = new ArrayList();
25 | Map dictionary = new HashMap();
26 | dictionary.put( "yes", "HISlaH" );
27 | dictionary.put( "no", "ghobe’" );
28 | dictionary.put( "No problem.", "qay’be’" );
29 | dictionary.put( "Success! (shout)", "Qapla’" );
30 | dictionary.put( "What do you want? (greeting)", "nuqneH" );
31 | dictionary.put( "I understand.", "jIyaj" );
32 | dictionary.put( "I do not understand.", "jIyajbe’" );
33 | dictionary.put( "Do you speak Klingon?", "tlhIngan Hol Dajatlh’a’" );
34 | dictionary.put( "I cannot speak Klingon.", "tlhIngan Hol vIjatlhaHbe’" );
35 | dictionary.put( "Where is a good restaurant?", "nuqDaq ’oH Qe’ QaQ’e’" );
36 | dictionary.put( "Beam me aboard!", "HIjol" );
37 | dictionary.put( "Come here!", "HIghoS" );
38 | dictionary.put( "Pay now!", "DaH yIDIl" );
39 | dictionary.put( "You lie.", "bInep" );
40 | dictionary.put( "I did not do it.", "vIta’pu’be’" );
41 | dictionary.put( "I am a Klingon.", "tlhIngan jIH" );
42 | dictionary.put( "I want to sleep.", "jIQong vIneH" );
43 | dictionary.put( "Fire the torpedoes!", "cha yIbaH qara’DI’" );
44 | dictionary.put( "Where is the bathroom?", "nuqDaq ’oH puchpa’’e’" );
45 | dictionary.put( "I have a headache.", "jIwuQ" );
46 | dictionary.put( "Hurry up!", "tugh" );
47 | dictionary.put( "Is this seat taken?", "quSDaQ ba’lu’’a’" );
48 | int index = 0;
49 | for( Entry entry : dictionary.entrySet() ) {
50 | items.add( new DictionarySwipeItem( entry.getKey(), entry.getValue(), index ) );
51 | index++;
52 | }
53 | }
54 |
55 | public SwipeItem getItem( int index ) {
56 | return items.get( index );
57 | }
58 |
59 | public int getItemCount() {
60 | return items.size();
61 | }
62 | }
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/AllBooksPage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others. All rights reserved. This
3 | * program and the accompanying materials are made available under the terms of
4 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
5 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
6 | * EclipseSource - initial API and implementation
7 | ******************************************************************************/
8 | package com.eclipsesource.tabris.demos.ui;
9 |
10 | import java.util.List;
11 |
12 | public class AllBooksPage extends BooksListPage {
13 |
14 | private static class AllBookFilter implements BookFilter {
15 |
16 | public List filter( List books ) {
17 | return books;
18 | }
19 | }
20 |
21 | public AllBooksPage() {
22 | setBookFilter( new AllBookFilter() );
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/Book.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui;
12 |
13 | import java.util.ArrayList;
14 | import java.util.List;
15 |
16 | import org.eclipse.swt.graphics.Image;
17 |
18 | public class Book {
19 |
20 | private final String title;
21 | private final String author;
22 | private final Image image;
23 | private final List related;
24 | private boolean favorite;
25 | private boolean popular;
26 |
27 | public Book( String title, String author, Image image ) {
28 | this.title = title;
29 | this.author = author;
30 | this.image = image;
31 | this.related = new ArrayList();
32 | }
33 |
34 | public boolean isFavorite() {
35 | return favorite;
36 | }
37 |
38 | public Book setFavorite( boolean favorite ) {
39 | this.favorite = favorite;
40 | return this;
41 | }
42 |
43 | public boolean isPopular() {
44 | return popular;
45 | }
46 |
47 | public Book setPopular( boolean popular ) {
48 | this.popular = popular;
49 | return this;
50 | }
51 |
52 | public String getTitle() {
53 | return title;
54 | }
55 |
56 | public String getAuthor() {
57 | return author;
58 | }
59 |
60 | public Image getImage() {
61 | return image;
62 | }
63 |
64 | public List getRelated() {
65 | return related;
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/BookDetailsPage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others. All rights reserved. This
3 | * program and the accompanying materials are made available under the terms of
4 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
5 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
6 | * EclipseSource - initial API and implementation
7 | ******************************************************************************/
8 | package com.eclipsesource.tabris.demos.ui;
9 |
10 | import static com.eclipsesource.tabris.demos.ui.Constants.RELATED_BOOKS_FONT;
11 | import static com.eclipsesource.tabris.demos.ui.Constants.TITLE_FONT;
12 | import static com.eclipsesource.tabris.widgets.enhancement.Widgets.onComposite;
13 | import static org.eclipse.jface.resource.JFaceResources.getFontRegistry;
14 |
15 | import org.eclipse.jface.layout.GridDataFactory;
16 | import org.eclipse.jface.layout.GridLayoutFactory;
17 | import org.eclipse.jface.viewers.TreeViewer;
18 | import org.eclipse.swt.SWT;
19 | import org.eclipse.swt.layout.GridData;
20 | import org.eclipse.swt.layout.GridLayout;
21 | import org.eclipse.swt.widgets.Composite;
22 | import org.eclipse.swt.widgets.Event;
23 | import org.eclipse.swt.widgets.Label;
24 | import org.eclipse.swt.widgets.Listener;
25 |
26 | import com.eclipsesource.tabris.ui.AbstractPage;
27 | import com.eclipsesource.tabris.ui.PageData;
28 |
29 | public class BookDetailsPage extends AbstractPage {
30 |
31 | public static final String BOOK_ITEM = "bookItem";
32 | private Label titleLabel;
33 | private Label authorLabel;
34 | private Label imageLabel;
35 | private TreeViewer relatedTreeViewer;
36 | private Composite bookDetailsComposite;
37 |
38 | @Override
39 | public void createContent( Composite parent, PageData data ) {
40 | Composite container = new Composite( parent, SWT.NONE );
41 | container.setBackground( parent.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
42 | GridLayoutFactory.fillDefaults().spacing( 0, 0 ).applyTo( container );
43 | createBookDetailsComposite( container );
44 | createRelatedBooks( container );
45 | createRelatedList( container );
46 | populatePage( data );
47 | }
48 |
49 | private void populatePage( PageData data ) {
50 | Book book = data.get( BOOK_ITEM, Book.class );
51 | setTitle( book.getTitle() );
52 | titleLabel.setText( book.getTitle() );
53 | authorLabel.setText( book.getAuthor() );
54 | imageLabel.setImage( book.getImage() );
55 | relatedTreeViewer.setInput( book.getRelated() );
56 | addGroupedEventsListener( book );
57 | }
58 |
59 | private void addGroupedEventsListener( final Book book ) {
60 | onComposite( bookDetailsComposite ).addGroupedListener( SWT.MouseDown, new Listener() {
61 |
62 | @Override
63 | public void handleEvent( Event event ) {
64 | PageData readData = new PageData();
65 | readData.set( ReadBookPage.BOOK_ITEM, book );
66 | openPage( ReadBookPage.class.getName(), readData );
67 | }
68 | } );
69 | }
70 |
71 | private void createBookDetailsComposite( Composite parent ) {
72 | createBookComposite( parent );
73 | createBookImage();
74 | createBookTitle();
75 | createBookAuthor();
76 | }
77 |
78 | private void createBookComposite( Composite parent ) {
79 | bookDetailsComposite = new Composite( parent, SWT.NONE );
80 | bookDetailsComposite.setBackground( parent.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
81 | GridData layoutData = GridDataFactory.fillDefaults()
82 | .align( SWT.FILL, SWT.TOP )
83 | .grab( true, false )
84 | .create();
85 | bookDetailsComposite.setLayoutData( layoutData );
86 | onComposite( bookDetailsComposite ).showLocalTouch( true );
87 | GridLayout layout = GridLayoutFactory.fillDefaults()
88 | .spacing( 12, 12 )
89 | .margins( 12, 12 )
90 | .numColumns( 2 )
91 | .create();
92 | bookDetailsComposite.setLayout( layout );
93 | }
94 |
95 | private void createBookImage() {
96 | imageLabel = new Label( bookDetailsComposite, SWT.WRAP );
97 | imageLabel.setForeground( bookDetailsComposite.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
98 | GridData gridData = new GridData( SWT.FILL, SWT.FILL, false, false );
99 | gridData.verticalSpan = 2;
100 | imageLabel.setLayoutData( gridData );
101 | }
102 |
103 | private void createBookTitle() {
104 | titleLabel = new Label( bookDetailsComposite, SWT.WRAP );
105 | titleLabel.setForeground( bookDetailsComposite.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
106 | titleLabel.setFont( getFontRegistry().get( TITLE_FONT ) );
107 | GridDataFactory.fillDefaults().align( SWT.FILL, SWT.TOP ).grab( true, false ).applyTo( titleLabel );
108 | }
109 |
110 | private void createBookAuthor() {
111 | authorLabel = new Label( bookDetailsComposite, SWT.WRAP );
112 | authorLabel.setForeground( bookDetailsComposite.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
113 | GridDataFactory.fillDefaults().align( SWT.FILL, SWT.TOP ).grab( true, false ).applyTo( authorLabel );
114 | }
115 |
116 | private void createRelatedBooks( Composite parent ) {
117 | Composite relatedBooksComposite = createRelatedTitleComposite( parent );
118 | createRelatedBooksTitle( relatedBooksComposite );
119 | createLine( relatedBooksComposite );
120 | }
121 |
122 | private Composite createRelatedTitleComposite( Composite parent ) {
123 | Composite composite = new Composite( parent, SWT.NONE );
124 | GridDataFactory.fillDefaults().align( SWT.FILL, SWT.TOP ).grab( true, false ).applyTo( composite );
125 | GridLayoutFactory.fillDefaults()
126 | .spacing( 0, 0 )
127 | .margins( 6, 0 )
128 | .extendedMargins( 0, 0, 12, 6 )
129 | .applyTo( composite );
130 | composite.setBackground( composite.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
131 | return composite;
132 | }
133 |
134 | private void createRelatedBooksTitle( Composite composite ) {
135 | Label relatedBooksLabel = new Label( composite, SWT.NONE );
136 | relatedBooksLabel.setText( "Related Books" );
137 | relatedBooksLabel.setFont( getFontRegistry().get( RELATED_BOOKS_FONT ) );
138 | relatedBooksLabel.setForeground( composite.getDisplay().getSystemColor( SWT.COLOR_DARK_GRAY ) );
139 | GridData layoutData = new GridData( SWT.FILL, SWT.TOP, true, false );
140 | layoutData.horizontalIndent = 6;
141 | relatedBooksLabel.setLayoutData( layoutData );
142 | }
143 |
144 | private void createLine( Composite composite ) {
145 | Label line = new Label( composite, SWT.NONE );
146 | line.setBackground( composite.getDisplay().getSystemColor( SWT.COLOR_GRAY ) );
147 | GridData layoutData = new GridData( SWT.FILL, SWT.TOP, true, false );
148 | layoutData.heightHint = 1;
149 | line.setLayoutData( layoutData );
150 | }
151 |
152 | private void createRelatedList( Composite parent ) {
153 | relatedTreeViewer = BooksListPage.createTreeViewer( this, parent );
154 | }
155 |
156 | @Override
157 | public void activate() {
158 | relatedTreeViewer.setSelection( null );
159 | }
160 |
161 | @Override
162 | public void deactivate() {
163 | // nothing to do here
164 | }
165 | }
166 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/BookFilter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui;
12 |
13 | import java.util.List;
14 |
15 | public interface BookFilter {
16 |
17 | List filter( List books );
18 | }
19 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/BookProvider.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others. All rights reserved. This
3 | * program and the accompanying materials are made available under the terms of
4 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
5 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
6 | * EclipseSource - initial API and implementation
7 | ******************************************************************************/
8 | package com.eclipsesource.tabris.demos.ui;
9 |
10 | import static com.eclipsesource.tabris.demos.ui.Constants.BOOK_BROOK;
11 | import static com.eclipsesource.tabris.demos.ui.Constants.BOOK_GAIGE;
12 | import static com.eclipsesource.tabris.demos.ui.Constants.BOOK_HAINY;
13 | import static com.eclipsesource.tabris.demos.ui.Constants.BOOK_KOCH;
14 | import static com.eclipsesource.tabris.demos.ui.Constants.BOOK_RUSSEL;
15 | import static com.eclipsesource.tabris.demos.ui.Constants.BOOK_SHIELDS;
16 | import static com.eclipsesource.tabris.demos.ui.Constants.BOOK_SLOSS;
17 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_AFTER_VISITING;
18 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_AUTOBIOGRAFY;
19 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_HISTORY;
20 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_HOW_LITERATUR;
21 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_SCHRODER;
22 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_THE_DINNER;
23 | import static com.eclipsesource.tabris.demos.ui.Constants.IMAGE_VAMPIRES;
24 | import static java.util.regex.Pattern.CASE_INSENSITIVE;
25 | import static java.util.regex.Pattern.compile;
26 | import static java.util.regex.Pattern.quote;
27 |
28 | import java.util.ArrayList;
29 | import java.util.HashMap;
30 | import java.util.List;
31 | import java.util.Map;
32 |
33 | import org.eclipse.swt.graphics.Image;
34 | import org.eclipse.swt.widgets.Display;
35 |
36 | import com.eclipsesource.tabris.ui.action.Proposal;
37 |
38 | public class BookProvider {
39 |
40 | private static class BookData {
41 |
42 | private final String title;
43 | private final String author;
44 | private final String imagePath;
45 |
46 | public BookData( String title, String author, String imagePath ) {
47 | this.title = title;
48 | this.author = author;
49 | this.imagePath = imagePath;
50 | }
51 | }
52 | private static Map bookData = createBookData();
53 |
54 | private static Map createBookData() {
55 | Map data = new HashMap();
56 | data.put( BOOK_GAIGE, new BookData( "Schroder: A Novel", "Amity Gaige", IMAGE_SCHRODER ) );
57 | data.put( BOOK_HAINY, new BookData( "After Visiting Friends: A Son's Story",
58 | "Michael Hainey",
59 | IMAGE_AFTER_VISITING ) );
60 | data.put( BOOK_RUSSEL, new BookData( "Vampires in the Lemon Grove: Stories",
61 | "Karen Russell",
62 | IMAGE_VAMPIRES ) );
63 | data.put( BOOK_BROOK,
64 | new BookData( "A History of Future Cities", "Daniel Brook", IMAGE_HISTORY ) );
65 | data.put( BOOK_SLOSS, new BookData( "Autobiography of Us: A Novel",
66 | "Aria Beth Sloss",
67 | IMAGE_AUTOBIOGRAFY ) );
68 | data.put( BOOK_SHIELDS, new BookData( "How Literature Saved My Life",
69 | "David Shields",
70 | IMAGE_HOW_LITERATUR ) );
71 | data.put( BOOK_KOCH, new BookData( "The Dinner", "Herman Koch", IMAGE_THE_DINNER ) );
72 | return data;
73 | }
74 |
75 | public static List getBooks( Display display ) {
76 | List books = new ArrayList();
77 | Book bookSchroder = createBook( display, bookData.get( BOOK_GAIGE ) );
78 | Book bookAfterVisiting = createBook( display, bookData.get( BOOK_HAINY ) ).setFavorite( true );
79 | Book bookVampires = createBook( display, bookData.get( BOOK_RUSSEL ) ).setFavorite( true );
80 | Book bookHistory = createBook( display, bookData.get( BOOK_BROOK ) ).setFavorite( true )
81 | .setPopular( true );
82 | Book bookAutobiography = createBook( display, bookData.get( BOOK_SLOSS ) ).setPopular( true );
83 | Book bookLiteratur = createBook( display, bookData.get( BOOK_SHIELDS ) ).setPopular( true );
84 | Book bookDinner = createBook( display, bookData.get( BOOK_KOCH ) ).setPopular( true );
85 | relate( bookVampires, bookAfterVisiting );
86 | relate( bookVampires, bookAutobiography );
87 | relate( bookSchroder, bookAfterVisiting );
88 | relate( bookHistory, bookLiteratur );
89 | relate( bookHistory, bookAutobiography );
90 | relate( bookHistory, bookAfterVisiting );
91 | books.add( bookSchroder );
92 | books.add( bookAfterVisiting );
93 | books.add( bookVampires );
94 | books.add( bookHistory );
95 | books.add( bookAutobiography );
96 | books.add( bookLiteratur );
97 | books.add( bookDinner );
98 | return books;
99 | }
100 |
101 | private static Book createBook( Display display, BookData data ) {
102 | Image image = new Image( display, BookProvider.class.getResourceAsStream( data.imagePath ) );
103 | return new Book( data.title, data.author, image );
104 | }
105 |
106 | private static void relate( Book book1, Book book2 ) {
107 | book1.getRelated().add( book2 );
108 | book2.getRelated().add( book1 );
109 | }
110 |
111 | public static List findBookTitles( Display display, final String query ) {
112 | List books = BookProvider.getBooks( display );
113 | final List matches = new ArrayList();
114 | for( Book book : books ) {
115 | if( contains( book.getTitle(), query ) ) {
116 | matches.add( new Proposal( book.getTitle() ) );
117 | }
118 | }
119 | return matches;
120 | }
121 |
122 | public static List findBooks( Display display, final String query ) {
123 | List books = BookProvider.getBooks( display );
124 | final List matches = new ArrayList();
125 | for( Book book : books ) {
126 | if( contains( book.getTitle(), query ) ) {
127 | matches.add( book );
128 | }
129 | }
130 | return matches;
131 | }
132 |
133 | private static boolean contains( String title, String query ) {
134 | return compile( quote( query ), CASE_INSENSITIVE ).matcher( title ).find();
135 | }
136 |
137 | private BookProvider() {
138 | // prevent instantiation
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/BookSearchAction.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others. All rights reserved. This
3 | * program and the accompanying materials are made available under the terms of
4 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
5 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
6 | * EclipseSource - initial API and implementation
7 | ******************************************************************************/
8 | package com.eclipsesource.tabris.demos.ui;
9 |
10 | import static com.eclipsesource.tabris.demos.ui.BookDetailsPage.BOOK_ITEM;
11 | import static com.eclipsesource.tabris.demos.ui.BookProvider.findBookTitles;
12 | import static com.eclipsesource.tabris.demos.ui.BookProvider.findBooks;
13 |
14 | import java.util.List;
15 |
16 | import com.eclipsesource.tabris.ui.PageData;
17 | import com.eclipsesource.tabris.ui.action.Proposal;
18 | import com.eclipsesource.tabris.ui.action.ProposalHandler;
19 | import com.eclipsesource.tabris.ui.action.SearchAction;
20 |
21 | public class BookSearchAction extends SearchAction {
22 |
23 | @Override
24 | public void search( String query ) {
25 | List books = findBooks( getUI().getDisplay(), query );
26 | if( books.size() == 1 ) {
27 | showBookDetailsPage( books.get( 0 ) );
28 | } else {
29 | showSearchResultsPage( query );
30 | }
31 | }
32 |
33 | private void showBookDetailsPage( Book book ) {
34 | PageData data = new PageData();
35 | data.set( BOOK_ITEM, book );
36 | openPage( BookDetailsPage.class.getName(), data );
37 | }
38 |
39 | private void showSearchResultsPage( String query ) {
40 | if( getCurrentPage() instanceof SearchResultsPage ) {
41 | closeCurrentPage();
42 | }
43 | PageData data = new PageData();
44 | data.set( SearchResultsPage.SEARCH_QUERY, query );
45 | openPage( SearchResultsPage.class.getName(), data );
46 | }
47 |
48 | @Override
49 | public void modified( final String query, final ProposalHandler proposalHandler ) {
50 | // start potentially long running proposal gathering thread
51 | new Thread( new Runnable() {
52 |
53 | @Override
54 | public void run() {
55 | getUI().getDisplay().asyncExec( new Runnable() {
56 |
57 | @Override
58 | public void run() {
59 | // should be performed in the thread not in the async display
60 | final List bookTitles = findBookTitles( getUI().getDisplay(), query );
61 | proposalHandler.setProposals( bookTitles );
62 | }
63 | } );
64 | }
65 | } ).start();
66 | }
67 | }
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/BooksContentProvider.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui;
12 |
13 | import java.util.List;
14 |
15 | import org.eclipse.jface.viewers.ITreeContentProvider;
16 | import org.eclipse.jface.viewers.Viewer;
17 |
18 | public class BooksContentProvider implements ITreeContentProvider {
19 |
20 | private List books;
21 |
22 | public void dispose() {
23 | }
24 |
25 | @SuppressWarnings("unchecked")
26 | public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) {
27 | books = ( List )newInput;
28 | }
29 |
30 | public Object[] getElements( Object inputElement ) {
31 | return books.toArray();
32 | }
33 |
34 | public Object[] getChildren( Object parentElement ) {
35 | return null;
36 | }
37 |
38 | public Object getParent( Object element ) {
39 | return null;
40 | }
41 |
42 | public boolean hasChildren( Object element ) {
43 | return false;
44 | }
45 |
46 | }
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/BooksLabelProvider.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui;
12 |
13 | import org.eclipse.jface.viewers.ILabelProviderListener;
14 | import org.eclipse.jface.viewers.ITableLabelProvider;
15 | import org.eclipse.swt.graphics.Image;
16 |
17 |
18 | public class BooksLabelProvider implements ITableLabelProvider {
19 |
20 | public Image getColumnImage( Object element, int columnIndex ) {
21 | if( element instanceof Book ) {
22 | return resizeImageToHeight( ( ( Book )element ).getImage(), 48 );
23 | }
24 | return null;
25 | }
26 |
27 | private static Image resizeImageToHeight( Image image, int height ) {
28 | float ratio = ( float )image.getBounds().height / ( float )image.getBounds().width;
29 | int width = Math.round( height / ratio );
30 | return new Image( image.getDevice(), image.getImageData().scaledTo( width, height ) );
31 | }
32 |
33 | public String getColumnText( Object element, int columnIndex ) {
34 | String result = null;
35 | if( columnIndex == 1 ) {
36 | if( element instanceof Book ) {
37 | result = ( ( Book )element ).getTitle();
38 | }
39 | } else if( columnIndex == 2 ) {
40 | if( element instanceof Book ) {
41 | result = ( ( Book )element ).getAuthor();
42 | }
43 | }
44 | return result;
45 | }
46 |
47 | public void addListener( ILabelProviderListener listener ) {
48 | // nothing to do here
49 | }
50 |
51 | public void dispose() {
52 | // nothing to do here
53 | }
54 |
55 | public boolean isLabelProperty( Object element, String property ) {
56 | return false;
57 | }
58 |
59 | public void removeListener( ILabelProviderListener listener ) {
60 | // nothing to do here
61 | }
62 | }
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/BooksListPage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui;
12 |
13 | import static com.eclipsesource.tabris.demos.ui.BookDetailsPage.BOOK_ITEM;
14 | import static com.eclipsesource.tabris.demos.ui.Constants.BOOKS;
15 | import static com.eclipsesource.tabris.demos.ui.Constants.RELATED_BOOKS_FONT;
16 | import static com.eclipsesource.tabris.demos.ui.Constants.TITLE_FONT;
17 | import static com.eclipsesource.tabris.widgets.enhancement.Widgets.onTree;
18 |
19 | import java.util.List;
20 |
21 | import org.eclipse.jface.layout.GridDataFactory;
22 | import org.eclipse.jface.layout.GridLayoutFactory;
23 | import org.eclipse.jface.resource.FontRegistry;
24 | import org.eclipse.jface.resource.JFaceResources;
25 | import org.eclipse.jface.viewers.ISelectionChangedListener;
26 | import org.eclipse.jface.viewers.IStructuredSelection;
27 | import org.eclipse.jface.viewers.SelectionChangedEvent;
28 | import org.eclipse.jface.viewers.TreeViewer;
29 | import org.eclipse.rap.rwt.RWT;
30 | import org.eclipse.rap.rwt.template.ImageCell;
31 | import org.eclipse.rap.rwt.template.Template;
32 | import org.eclipse.rap.rwt.template.TextCell;
33 | import org.eclipse.swt.SWT;
34 | import org.eclipse.swt.graphics.Color;
35 | import org.eclipse.swt.graphics.Font;
36 | import org.eclipse.swt.graphics.FontData;
37 | import org.eclipse.swt.graphics.RGB;
38 | import org.eclipse.swt.widgets.Composite;
39 | import org.eclipse.swt.widgets.Tree;
40 | import org.eclipse.swt.widgets.TreeColumn;
41 |
42 | import com.eclipsesource.tabris.ui.AbstractPage;
43 | import com.eclipsesource.tabris.ui.PageData;
44 | import com.eclipsesource.tabris.ui.UI;
45 |
46 | public class BooksListPage extends AbstractPage {
47 |
48 | private BookFilter bookFilter;
49 | private Composite container;
50 | private TreeViewer viewer;
51 | private static UI ui;
52 |
53 | public void setBookFilter( BookFilter bookFilter ) {
54 | this.bookFilter = bookFilter;
55 | }
56 |
57 | @Override
58 | public void createContent( Composite parent, PageData data ) {
59 | ui = getUI();
60 | registerResources();
61 | createBooks();
62 | container = new Composite( parent, SWT.NONE );
63 | GridLayoutFactory.fillDefaults().spacing( 0, 0 ).applyTo( container );
64 | viewer = createTreeViewer( this, container );
65 | createViewerInput( viewer );
66 | }
67 |
68 | private void registerResources() {
69 | FontRegistry fontRegistry = JFaceResources.getFontRegistry();
70 | fontRegistry.put( TITLE_FONT, createFontData( 16, SWT.BOLD ) );
71 | fontRegistry.put( RELATED_BOOKS_FONT, createFontData( 16, SWT.BOLD ) );
72 | }
73 |
74 | private FontData[] createFontData( int height, int style ) {
75 | return new FontData[]{ new FontData( "Verdana", height, style ) };
76 | }
77 |
78 | private void createBooks() {
79 | Object books = RWT.getUISession().getAttribute( BOOKS );
80 | if( books == null ) {
81 | books = BookProvider.getBooks( getUI().getDisplay() );
82 | RWT.getUISession().setAttribute( BOOKS, books );
83 | }
84 | }
85 |
86 | public Composite getContainer() {
87 | return container;
88 | }
89 |
90 | public static TreeViewer createTreeViewer( AbstractPage page, Composite container ) {
91 | TreeViewer viewer = new TreeViewer( container, SWT.V_SCROLL );
92 | viewer.setContentProvider( new BooksContentProvider() );
93 | addBookSelectionListener( page, viewer );
94 | Tree tree = viewer.getTree();
95 | tree.setLinesVisible( true );
96 | tree.setData( RWT.MARKUP_ENABLED, Boolean.TRUE );
97 | onTree( tree ).setTemplate( createRowTemplate() );
98 | onTree( tree ).setItemHeight( 68 );
99 | GridDataFactory.fillDefaults().align( SWT.FILL, SWT.FILL ).grab( true, true ).applyTo( tree );
100 | viewer.setLabelProvider( new BooksLabelProvider() );
101 | new TreeColumn( tree, SWT.LEFT );
102 | new TreeColumn( tree, SWT.LEFT );
103 | new TreeColumn( tree, SWT.LEFT );
104 | return viewer;
105 | }
106 |
107 | private static Template createRowTemplate() {
108 | Template template = new Template();
109 | addImageCell( template );
110 | addTitleCell( template );
111 | addAuthorCell( template );
112 | return template;
113 | }
114 |
115 | private static void addAuthorCell( Template template ) {
116 | TextCell authorCell = new TextCell( template );
117 | authorCell.setBindingIndex( 2 );
118 | authorCell.setLeft( 52 ).setRight( 10 ).setTop( 36 );
119 | authorCell.setForeground( new Color( ui.getDisplay(), new RGB( 123, 123, 123 ) ) );
120 | authorCell.setFont( new Font( ui.getDisplay(), new FontData( "Verdana", 14, SWT.NONE ) ) );
121 | }
122 |
123 | private static void addTitleCell( Template template ) {
124 | TextCell titleCell = new TextCell( template );
125 | titleCell.setBindingIndex( 1 );
126 | titleCell.setLeft( 52 ).setRight( 10 ).setTop( 12 );
127 | titleCell.setFont( new Font( ui.getDisplay(), new FontData( "Verdana", 18, SWT.NONE ) ) );
128 | titleCell.setForeground( new Color( ui.getDisplay(), new RGB( 74, 74, 74 ) ) );
129 | }
130 |
131 | private static void addImageCell( Template template ) {
132 | ImageCell imageCell = new ImageCell( template );
133 | imageCell.setBindingIndex( 0 );
134 | imageCell.setLeft( 10 ).setWidth( 32 ).setTop( 10 ).setHeight( 48 );
135 | }
136 |
137 | @SuppressWarnings( "unchecked" )
138 | private void createViewerInput( TreeViewer viewer ) {
139 | List books = ( List )RWT.getUISession().getAttribute( BOOKS );
140 | List filteredBooks = bookFilter.filter( books );
141 | viewer.setInput( filteredBooks );
142 | }
143 |
144 | private static void addBookSelectionListener( final AbstractPage page, TreeViewer viewer ) {
145 | viewer.addSelectionChangedListener( new ISelectionChangedListener() {
146 | @Override
147 | public void selectionChanged( SelectionChangedEvent event ) {
148 | Object book = ( ( IStructuredSelection )event.getSelection() ).getFirstElement();
149 | if( book != null ) {
150 | PageData data = new PageData();
151 | data.set( BOOK_ITEM, book );
152 | page.openPage( BookDetailsPage.class.getName(), data );
153 | }
154 | }
155 | } );
156 | }
157 |
158 | @Override
159 | public void activate() {
160 | super.activate();
161 | viewer.setSelection( null );
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/ChangeThemeAction.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui;
12 |
13 | import com.eclipsesource.tabris.ui.AbstractAction;
14 |
15 | public class ChangeThemeAction extends AbstractAction {
16 |
17 | @Override
18 | public void execute() {
19 | ReadBookPage page = ( ReadBookPage )getCurrentPage();
20 | page.toggleTheme();
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/Constants.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others. All rights reserved. This
3 | * program and the accompanying materials are made available under the terms of
4 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
5 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
6 | * EclipseSource - initial API and implementation
7 | ******************************************************************************/
8 | package com.eclipsesource.tabris.demos.ui;
9 |
10 | public class Constants {
11 |
12 | public static final String BOOK_KOCH = "koch";
13 | public static final String BOOK_SHIELDS = "shields";
14 | public static final String BOOK_SLOSS = "sloss";
15 | public static final String BOOK_BROOK = "brook";
16 | public static final String BOOK_RUSSEL = "russel";
17 | public static final String BOOK_GAIGE = "gaige";
18 | public static final String BOOK_HAINY = "hainy";
19 | public static final String IMAGE_SCHRODER = "/book_schroder.jpg";
20 | public static final String IMAGE_HISTORY = "/book_a_history.jpg";
21 | public static final String IMAGE_AFTER_VISITING = "/book_after_visiting.jpg";
22 | public static final String IMAGE_AUTOBIOGRAFY = "/book_autobiografy.jpg";
23 | public static final String IMAGE_HOW_LITERATUR = "/book_how_literature.jpg";
24 | public static final String IMAGE_THE_DINNER = "/book_the_dinner.jpg";
25 | public static final String IMAGE_VAMPIRES = "/book_vampires.jpg";
26 | public static final String BOOKS = "booksList";
27 | public static final String TITLE_FONT = "ITEM_TITLE";
28 | public static final String RELATED_BOOKS_FONT = "RELATED_BOOKS_FONT";
29 | public static final String IMAGE_BOOK_STORE_UI = "/book_store_ui.png";
30 | public static final String IMAGE_ACTION_SETTINGS = "/action_settings.png";
31 | public static final String IMAGE_ACTION_SEARCH = "/action_search.png";
32 | public static final String IMAGE_ACTION_SHARE = "/action_share.png";
33 | public static final String IMAGE_ACTION_THEME = "/action_theme.png";
34 | public static final String IMAGE_PAGE_FAVORITE_BOOKS = "/page_favorite_books.png";
35 | public static final String IMAGE_PAGE_POPULAR_BOOKS = "/page_popular_books.png";
36 | public static final String IMAGE_PAGE_ALL_BOOKS = "/page_all_books.png";
37 | public static final String DUMMY_TEXT = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy "
38 | + "nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. "
39 | + "Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper "
40 | + "suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel "
41 | + "eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, "
42 | + "vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et "
43 | + "iusto odio dignissim qui blandit praesent luptatum zzril delenit augue "
44 | + "duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis "
45 | + "eleifend option congue nihil imperdiet doming id quod mazim placerat facer "
46 | + "possim assum. Typi non habent claritatem insitam; est usus legentis in "
47 | + "iis qui facit eorum claritatem. Investigationes demonstraverunt lectores "
48 | + "legere me lius quod ii legunt saepius. Claritas est etiam processus "
49 | + "dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est "
50 | + "notare quam littera gothica, quam nunc putamus parum claram, anteposuerit "
51 | + "litterarum formas humanitatis per seacula quarta decima et quinta decima. "
52 | + "Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes "
53 | + "in futurum.";
54 |
55 | private Constants() {
56 | // prevent instantiation
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/FavoriteBooksPage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui;
12 |
13 | import java.util.ArrayList;
14 | import java.util.List;
15 |
16 | public class FavoriteBooksPage extends BooksListPage {
17 |
18 | private static class FavoriteBookFilter implements BookFilter {
19 |
20 | @Override
21 | public List filter( List books ) {
22 | List result = new ArrayList();
23 | for( Book book : books ) {
24 | if( book.isPopular() ) {
25 | result.add( book );
26 | }
27 | }
28 | return result;
29 | }
30 | }
31 |
32 | public FavoriteBooksPage() {
33 | setBookFilter( new FavoriteBookFilter() );
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/PopularBooksPage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui;
12 |
13 | import java.util.ArrayList;
14 | import java.util.List;
15 |
16 | public class PopularBooksPage extends BooksListPage {
17 |
18 | private static class PopularBookFilter implements BookFilter {
19 |
20 | public List filter( List books ) {
21 | List result = new ArrayList();
22 | for( Book book : books ) {
23 | if( book.isFavorite() ) {
24 | result.add( book );
25 | }
26 | }
27 | return result;
28 | }
29 | }
30 |
31 | public PopularBooksPage() {
32 | setBookFilter( new PopularBookFilter() );
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/ReadBookPage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui;
12 |
13 | import static com.eclipsesource.tabris.demos.ui.Constants.DUMMY_TEXT;
14 |
15 | import org.eclipse.jface.layout.GridDataFactory;
16 | import org.eclipse.jface.layout.GridLayoutFactory;
17 | import org.eclipse.swt.SWT;
18 | import org.eclipse.swt.layout.GridLayout;
19 | import org.eclipse.swt.widgets.Composite;
20 | import org.eclipse.swt.widgets.Label;
21 |
22 | import com.eclipsesource.tabris.ui.AbstractPage;
23 | import com.eclipsesource.tabris.ui.PageData;
24 |
25 | public class ReadBookPage extends AbstractPage {
26 |
27 | public static final String BOOK_ITEM = "bookItem";
28 | private Label textLabel;
29 | private Composite container;
30 |
31 | @Override
32 | public void createContent( Composite parent, PageData data ) {
33 | container = new Composite( parent, SWT.NONE );
34 | container.setBackground( parent.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
35 | GridLayout layout = GridLayoutFactory.fillDefaults().spacing( 0, 0 ).numColumns( 1 ).equalWidth( false ).create();
36 | layout.marginWidth = 16;
37 | layout.marginHeight = 16;
38 | container.setLayout( layout );
39 | createText();
40 | setPageTitle( data );
41 | }
42 |
43 | private void createText() {
44 | textLabel = new Label( container, SWT.WRAP );
45 | textLabel.setForeground( container.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
46 | textLabel.setLayoutData( GridDataFactory.fillDefaults().align( SWT.FILL, SWT.FILL ).grab( true, true ).create() );
47 | textLabel.setText( DUMMY_TEXT );
48 | }
49 |
50 | private void setPageTitle( PageData data ) {
51 | Book book = data.get( BOOK_ITEM, Book.class );
52 | setTitle( book.getTitle() );
53 | }
54 |
55 | public void toggleTheme() {
56 | if( container.getBackground().equals( container.getDisplay().getSystemColor( SWT.COLOR_BLACK ) ) ) {
57 | textLabel.setForeground( container.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
58 | textLabel.setBackground( container.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
59 | container.setBackground( container.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
60 | } else {
61 | textLabel.setForeground( container.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
62 | textLabel.setBackground( container.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
63 | container.setBackground( container.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
64 | }
65 | }
66 |
67 | @Override
68 | public void activate() {
69 | setSettingsActionVisibility( false );
70 | }
71 |
72 | @Override
73 | public void deactivate() {
74 | setSettingsActionVisibility( true );
75 | }
76 |
77 | private void setSettingsActionVisibility( boolean visible ) {
78 | setActionVisible( SettingsAction.class.getName(), visible );
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/SearchResultsPage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others. All rights reserved. This
3 | * program and the accompanying materials are made available under the terms of
4 | * the Eclipse Public License v1.0 which accompanies this distribution, and is
5 | * available at http://www.eclipse.org/legal/epl-v10.html Contributors:
6 | * EclipseSource - initial API and implementation
7 | ******************************************************************************/
8 | package com.eclipsesource.tabris.demos.ui;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 | import java.util.regex.Pattern;
13 |
14 | import org.eclipse.swt.widgets.Composite;
15 |
16 | import com.eclipsesource.tabris.ui.PageData;
17 |
18 | public class SearchResultsPage extends BooksListPage {
19 |
20 | public static final String SEARCH_QUERY = "searchQuery";
21 |
22 | private static class ContainsBookFilter implements BookFilter {
23 |
24 | private final String query;
25 |
26 | public ContainsBookFilter( String query ) {
27 | this.query = query;
28 | }
29 |
30 | public List filter( List books ) {
31 | final List result = new ArrayList();
32 | for( Book book : books ) {
33 | if( contains( book.getTitle(), query ) ) {
34 | result.add( book );
35 | }
36 | }
37 | return result;
38 | }
39 |
40 | private boolean contains( String title, String query ) {
41 | return Pattern.compile( Pattern.quote( query ), Pattern.CASE_INSENSITIVE ).matcher( title ).find();
42 | }
43 | }
44 |
45 | @Override
46 | public void createContent( Composite parent, PageData data ) {
47 | String query = getData().get( SEARCH_QUERY, String.class );
48 | setTitle( query );
49 | setBookFilter( new ContainsBookFilter( query ) );
50 | super.createContent( parent, data );
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/SettingsAction.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui;
12 |
13 | import com.eclipsesource.tabris.ui.AbstractAction;
14 |
15 | public class SettingsAction extends AbstractAction {
16 |
17 | @Override
18 | public void execute() {
19 | openPage( SettingsPage.class.getName() );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/SettingsPage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui;
12 |
13 | import org.eclipse.jface.layout.GridDataFactory;
14 | import org.eclipse.jface.layout.GridLayoutFactory;
15 | import org.eclipse.swt.SWT;
16 | import org.eclipse.swt.layout.GridData;
17 | import org.eclipse.swt.widgets.Composite;
18 | import org.eclipse.swt.widgets.Label;
19 |
20 | import com.eclipsesource.tabris.ui.AbstractPage;
21 | import com.eclipsesource.tabris.ui.PageData;
22 |
23 | public class SettingsPage extends AbstractPage {
24 |
25 | @Override
26 | public void createContent( Composite parent, PageData data ) {
27 | Composite container = new Composite( parent, SWT.NONE );
28 | container.setLayout( GridLayoutFactory.fillDefaults().spacing( 0, 0 ).numColumns( 1 ).equalWidth( false ).create() );
29 | Label textLabel = new Label( container, SWT.CENTER );
30 | GridData layoutData = GridDataFactory.fillDefaults().align( SWT.CENTER, SWT.CENTER ).grab( true, true ).create();
31 | textLabel.setLayoutData( layoutData );
32 | textLabel.setText( "Settings" );
33 | }
34 |
35 | @Override
36 | public void activate() {
37 | setActionVisible( SettingsAction.class.getName(), false );
38 | }
39 |
40 | @Override
41 | public void deactivate() {
42 | setActionVisible( SettingsAction.class.getName(), true );
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/ShareAction.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui;
12 |
13 | import static com.eclipsesource.tabris.demos.ui.BookDetailsPage.BOOK_ITEM;
14 | import static java.text.MessageFormat.format;
15 |
16 | import org.eclipse.rap.rwt.RWT;
17 |
18 | import com.eclipsesource.tabris.interaction.AppLauncher;
19 | import com.eclipsesource.tabris.interaction.MailOptions;
20 | import com.eclipsesource.tabris.ui.AbstractAction;
21 |
22 | public class ShareAction extends AbstractAction {
23 |
24 | @Override
25 | public void execute() {
26 | AppLauncher appLauncher = RWT.getClient().getService( AppLauncher.class );
27 | if( appLauncher != null ) {
28 | Book book = getCurrentPageData().get( BOOK_ITEM, Book.class );
29 | String body = format( "Check out the book \"{0}\".", book.getTitle() );
30 | MailOptions launchOptions = new MailOptions( "user@mail.com", body );
31 | appLauncher.open( launchOptions );
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/dynamic/DynamicAction.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui.dynamic;
12 |
13 | import com.eclipsesource.tabris.ui.AbstractAction;
14 |
15 |
16 | public class DynamicAction extends AbstractAction {
17 |
18 | @Override
19 | public void execute() {
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui/dynamic/DynamicUIDemo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013 EclipseSource and others.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * EclipseSource - initial API and implementation
10 | ******************************************************************************/
11 | package com.eclipsesource.tabris.demos.ui.dynamic;
12 |
13 | import org.eclipse.rap.rwt.application.EntryPoint;
14 | import org.eclipse.rap.rwt.application.EntryPointFactory;
15 |
16 | import com.eclipsesource.tabris.ui.PageConfiguration;
17 | import com.eclipsesource.tabris.ui.TabrisUIEntryPoint;
18 | import com.eclipsesource.tabris.ui.UIConfiguration;
19 |
20 |
21 | public class DynamicUIDemo implements EntryPointFactory {
22 |
23 | @Override
24 | public EntryPoint create() {
25 | return new TabrisUIEntryPoint( createConfig() );
26 | }
27 |
28 | private UIConfiguration createConfig() {
29 | UIConfiguration configuration = new UIConfiguration();
30 | configuration.addPageConfiguration( new PageConfiguration( "root", DynamicPage.class )
31 | .setTopLevel( true )
32 | .setTitle( "Dynamic UI Start" ) );
33 | return configuration;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/com.eclipsesource.tabris.demos/tabris.target:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------