diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2ddd07d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+.gradle
+*.ipr
+*.iml
+*.iws
+build/*
+modules/*/build/*
+out
+test-run
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..53349c2
--- /dev/null
+++ b/README.md
@@ -0,0 +1,11 @@
+# Screen Manipulation
+
+This project demonstrates how to programmatically manipulate screens in [CUBA](https://www.cuba-platform.com) applications.
+
+* `CustomerEdit` screen controller defines dialog options in its `init()` method.
+
+* `CustomerList` is a controller of the simple screen that contains a drop-down list of customers.
+
+* `OrderEdit` screen controller demonstrates two ways of looking up an entity: from a lookup screen and from an arbitrary screen.
+
+Based on CUBA Platform 6.1.1
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..d4f114b
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,223 @@
+
+buildscript {
+ ext.cubaVersion = '6.1.1'
+ repositories {
+ maven {
+ url 'https://repo.cuba-platform.com/content/groups/work'
+ credentials {
+ username(rootProject.hasProperty('repoUser') ? rootProject['repoUser'] : 'cuba')
+ password(rootProject.hasProperty('repoPass') ? rootProject['repoPass'] : 'cuba123')
+ }
+ }
+
+ }
+ dependencies {
+ classpath "com.haulmont.gradle:cuba-plugin:$cubaVersion"
+ }
+}
+
+def globalModule = project(':app-global')
+def coreModule = project(':app-core')
+def guiModule = project(':app-gui')
+def webModule = project(':app-web')
+
+def servletApi = 'org.apache.tomcat:tomcat-servlet-api:8.0.26'
+
+
+apply(plugin: 'idea')
+apply(plugin: 'cuba')
+
+cuba {
+ artifact {
+ group = 'com.company.sample'
+ version = '0.1'
+ isSnapshot = true
+ }
+ tomcat {
+ dir = "$project.rootDir/build/tomcat"
+ }
+ ide {
+ copyright = '''Copyright (c) ${today.year} ${project.name}''' // Copyright Notice for IDEA project
+ classComment ='''/**
+ * @author ${USER}
+ */'''
+ vcs = 'Git'
+
+ }
+}
+
+def hsql = 'org.hsqldb:hsqldb:2.2.9'
+
+configure([globalModule, coreModule, guiModule, webModule]) {
+ apply(plugin: 'java')
+ apply(plugin: 'maven')
+ apply(plugin: 'idea')
+ apply(plugin: 'cuba')
+
+ dependencies {
+ testCompile('junit:junit:4.12')
+ }
+
+ task sourceJar(type: Jar) {
+ from file('src')
+ classifier = 'sources'
+ }
+
+ artifacts {
+ archives sourceJar
+ }
+}
+
+configure(globalModule) {
+ dependencies {
+ compile("com.haulmont.cuba:cuba-global:$cubaVersion")
+
+ }
+
+ task enhance(type: CubaEnhancing)
+
+}
+
+configure(coreModule) {
+
+ configurations {
+ jdbc
+ dbscripts
+ }
+
+ dependencies {
+ compile(globalModule)
+ provided(servletApi)
+ jdbc(hsql)
+ testRuntime(hsql)
+ compile("com.haulmont.cuba:cuba-core:$cubaVersion")
+ testCompile("com.haulmont.cuba:cuba-core-tests:$cubaVersion")
+ testCompile("com.haulmont.cuba:cuba-shared-lib:$cubaVersion")
+ dbscripts("com.haulmont.cuba:cuba-core:$cubaVersion:db@zip")
+
+ }
+
+ task cleanConf(description: 'Cleans up conf directory') << {
+ def dir = new File(cuba.tomcat.dir, '/conf/app-core')
+ if (dir.isDirectory()) {
+ ant.delete(includeemptydirs: true) {
+ fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties')
+ }
+ }
+ }
+
+ task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) {
+ appName = 'app-core'
+ appJars('cuba-core', 'cuba-global',
+ 'app-global', 'app-core')
+ }
+
+ task createDb(dependsOn: assembleDbScripts, description: 'Creates local database', type: CubaDbCreation) {
+ dbms = 'hsql'
+ dbmsVersion = 'null'
+ host = 'localhost'
+ dbName = 'sample'
+ dbUser = 'sa'
+ dbPassword = ''
+ }
+
+ task updateDb(dependsOn: assembleDbScripts, description: 'Updates local database', type: CubaDbUpdate) {
+ dbms = 'hsql'
+ dbmsVersion = 'null'
+ host = 'localhost'
+ dbName = 'sample'
+ dbUser = 'sa'
+ dbPassword = ''
+ }
+}
+
+configure(guiModule) {
+ dependencies {
+ compile(globalModule)
+ compile("com.haulmont.cuba:cuba-gui:$cubaVersion")
+ testCompile("com.haulmont.cuba:cuba-client-tests:$cubaVersion")
+
+ }
+
+ task deployConf(type: Copy) {
+ from file('src')
+ include "com/company/sample/**"
+ into "$cuba.tomcat.dir/conf/app"
+ }
+}
+
+configure(webModule) {
+ configurations {
+ webcontent
+
+ }
+
+ dependencies {
+ provided(servletApi)
+ compile(guiModule)
+ compile("com.haulmont.cuba:cuba-web:$cubaVersion")
+ webcontent("com.haulmont.cuba:cuba-web:$cubaVersion:web@zip")
+ webcontent("com.haulmont.cuba:cuba-web-toolkit:$cubaVersion:web@zip")
+ testCompile("com.haulmont.cuba:cuba-client-tests:$cubaVersion")
+
+ }
+
+ task webArchive(type: Zip) {
+ from file('web')
+ classifier = 'web'
+ }
+
+ artifacts {
+ archives webArchive
+ }
+
+ task deployConf(type: Copy) {
+ from file('src')
+ include "com/company/sample/**"
+ into "$cuba.tomcat.dir/conf/app"
+ }
+
+ task clearMessagesCache(type: CubaClearMessagesCache) {
+ appName = 'app'
+ }
+ deployConf.dependsOn clearMessagesCache
+
+ task cleanConf(description: 'Cleans up conf directory') << {
+ def dir = new File(cuba.tomcat.dir, '/conf/app')
+ if (dir.isDirectory()) {
+ ant.delete(includeemptydirs: true) {
+ fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties')
+ }
+ }
+ }
+
+ task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) {
+ appName = 'app'
+ appJars('cuba-client', 'cuba-gui', 'cuba-rest-api', 'cuba-web', 'cuba-global',
+ 'app-global', 'app-gui', 'app-web')
+ }
+}
+
+
+
+
+task undeploy(type: Delete, dependsOn: ':app-web:cleanConf') {
+ delete("$cuba.tomcat.dir/shared")
+ delete("$cuba.tomcat.dir/webapps/app-core")
+ delete("$cuba.tomcat.dir/webapps/app")
+}
+
+task restart(dependsOn: ['stop', ':app-core:deploy', ':app-web:deploy'], description: 'Redeploys applications and restarts local Tomcat') << {
+ ant.waitfor(maxwait: 6, maxwaitunit: 'second', checkevery: 2, checkeveryunit: 'second') {
+ not {
+ socket(server: 'localhost', port: '8787')
+ }
+ }
+ start.execute()
+}
+
+task wrapper(type: Wrapper) {
+ gradleVersion = '2.6'
+}
+
+apply from: 'extra.gradle'
diff --git a/extra.gradle b/extra.gradle
new file mode 100644
index 0000000..e69de29
diff --git a/modules/core/db/init/hsql/10.create-db.sql b/modules/core/db/init/hsql/10.create-db.sql
new file mode 100644
index 0000000..71384ed
--- /dev/null
+++ b/modules/core/db/init/hsql/10.create-db.sql
@@ -0,0 +1,35 @@
+-- begin SAMPLE_CUSTOMER
+create table SAMPLE_CUSTOMER (
+ ID varchar(36) not null,
+ CREATE_TS timestamp,
+ CREATED_BY varchar(50),
+ VERSION integer not null,
+ UPDATE_TS timestamp,
+ UPDATED_BY varchar(50),
+ DELETE_TS timestamp,
+ DELETED_BY varchar(50),
+ --
+ NAME varchar(255),
+ EMAIL varchar(100),
+ --
+ primary key (ID)
+)^
+-- end SAMPLE_CUSTOMER
+-- begin SAMPLE_ORDER
+create table SAMPLE_ORDER (
+ ID varchar(36) not null,
+ CREATE_TS timestamp,
+ CREATED_BY varchar(50),
+ VERSION integer not null,
+ UPDATE_TS timestamp,
+ UPDATED_BY varchar(50),
+ DELETE_TS timestamp,
+ DELETED_BY varchar(50),
+ --
+ DATE_ date,
+ NUM varchar(100),
+ CUSTOMER_ID varchar(36),
+ --
+ primary key (ID)
+)^
+-- end SAMPLE_ORDER
diff --git a/modules/core/db/init/hsql/20.create-db.sql b/modules/core/db/init/hsql/20.create-db.sql
new file mode 100644
index 0000000..9e17ba2
--- /dev/null
+++ b/modules/core/db/init/hsql/20.create-db.sql
@@ -0,0 +1,4 @@
+-- begin SAMPLE_ORDER
+alter table SAMPLE_ORDER add constraint FK_SAMPLE_ORDER_CUSTOMER_ID foreign key (CUSTOMER_ID) references SAMPLE_CUSTOMER(ID)^
+create index IDX_SAMPLE_ORDER_CUSTOMER on SAMPLE_ORDER (CUSTOMER_ID)^
+-- end SAMPLE_ORDER
diff --git a/modules/core/db/init/hsql/30.create-db.sql b/modules/core/db/init/hsql/30.create-db.sql
new file mode 100644
index 0000000..eadc258
--- /dev/null
+++ b/modules/core/db/init/hsql/30.create-db.sql
@@ -0,0 +1,11 @@
+insert into SAMPLE_CUSTOMER
+(ID, CREATE_TS, CREATED_BY, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, NAME, EMAIL)
+values ('405d5d7d-ed85-10e5-5e45-eeea2e574d18', '2016-04-11 09:34:55', 'admin', 1, '2016-04-11 09:34:55', null, null, null, 'Globex Corporation', 'info@globex.com');
+
+insert into SAMPLE_CUSTOMER
+(ID, CREATE_TS, CREATED_BY, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, NAME, EMAIL)
+values ('d43d25fd-563e-0eb7-0766-0c01c27aae19', '2016-04-11 09:35:13', 'admin', 1, '2016-04-11 09:35:13', null, null, null, 'Sirius Cybernetics Corporation', 'info@sirius.com');
+
+insert into SAMPLE_CUSTOMER
+(ID, CREATE_TS, CREATED_BY, VERSION, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, NAME, EMAIL)
+values ('b01cfb8c-4797-6767-96cc-0b186e18de55', '2016-04-11 09:35:33', 'admin', 1, '2016-04-11 09:35:33', null, null, null, 'Initech', 'info@initech.com');
diff --git a/modules/core/src/app.properties b/modules/core/src/app.properties
new file mode 100644
index 0000000..853f359
--- /dev/null
+++ b/modules/core/src/app.properties
@@ -0,0 +1,23 @@
+###############################################################################
+# Configuration #
+###############################################################################
+
+cuba.dbmsType = hsql
+
+cuba.springContextConfig = cuba-spring.xml spring.xml
+
+cuba.persistenceConfig = cuba-persistence.xml persistence.xml
+
+cuba.metadataConfig = cuba-metadata.xml metadata.xml
+
+cuba.viewsConfig = cuba-views.xml views.xml
+
+cuba.mainMessagePack = com.haulmont.cuba.core com.company.sample.core
+
+###############################################################################
+# Other #
+###############################################################################
+
+cuba.webContextName = app-core
+cuba.availableLocales = English|en
+cuba.localeSelectVisible = false
diff --git a/modules/core/src/com/company/sample/core/messages.properties b/modules/core/src/com/company/sample/core/messages.properties
new file mode 100644
index 0000000..e69de29
diff --git a/modules/core/src/spring.xml b/modules/core/src/spring.xml
new file mode 100644
index 0000000..e9bd820
--- /dev/null
+++ b/modules/core/src/spring.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
diff --git a/modules/core/web/META-INF/context.xml b/modules/core/web/META-INF/context.xml
new file mode 100644
index 0000000..87487a2
--- /dev/null
+++ b/modules/core/web/META-INF/context.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/core/web/WEB-INF/web.xml b/modules/core/web/WEB-INF/web.xml
new file mode 100644
index 0000000..a15b061
--- /dev/null
+++ b/modules/core/web/WEB-INF/web.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+ appPropertiesConfig
+
+ classpath:cuba-app.properties
+ classpath:app.properties
+ /WEB-INF/local.app.properties
+ "file:${catalina.home}/conf/app-core/local.app.properties"
+
+
+
+
+ com.haulmont.cuba.core.sys.AppContextLoader
+
+
+
+ remoting
+ com.haulmont.cuba.core.sys.remoting.RemotingServlet
+ 1
+
+
+
+ remoting
+ /remoting/*
+
+
+
diff --git a/modules/global/src/com/company/sample/entity/Customer.java b/modules/global/src/com/company/sample/entity/Customer.java
new file mode 100644
index 0000000..9adb2ef
--- /dev/null
+++ b/modules/global/src/com/company/sample/entity/Customer.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016 screen-manipulation
+ */
+package com.company.sample.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.persistence.Column;
+import com.haulmont.cuba.core.entity.StandardEntity;
+import com.haulmont.chile.core.annotations.NamePattern;
+
+/**
+ * @author knst
+ */
+@NamePattern("%s|name")
+@Table(name = "SAMPLE_CUSTOMER")
+@Entity(name = "sample$Customer")
+public class Customer extends StandardEntity {
+ private static final long serialVersionUID = 738326219647053638L;
+
+ @Column(name = "NAME")
+ protected String name;
+
+ @Column(name = "EMAIL", length = 100)
+ protected String email;
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+
+}
\ No newline at end of file
diff --git a/modules/global/src/com/company/sample/entity/Order.java b/modules/global/src/com/company/sample/entity/Order.java
new file mode 100644
index 0000000..4ed66b4
--- /dev/null
+++ b/modules/global/src/com/company/sample/entity/Order.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2016 screen-manipulation
+ */
+package com.company.sample.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import com.haulmont.cuba.core.entity.StandardEntity;
+
+/**
+ * @author knst
+ */
+@Table(name = "SAMPLE_ORDER")
+@Entity(name = "sample$Order")
+public class Order extends StandardEntity {
+ private static final long serialVersionUID = -3292919444177021479L;
+
+ @Temporal(TemporalType.DATE)
+ @Column(name = "DATE_")
+ protected Date date;
+
+ @Column(name = "NUM", length = 100)
+ protected String num;
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "CUSTOMER_ID")
+ protected Customer customer;
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setNum(String num) {
+ this.num = num;
+ }
+
+ public String getNum() {
+ return num;
+ }
+
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ public Customer getCustomer() {
+ return customer;
+ }
+
+
+}
\ No newline at end of file
diff --git a/modules/global/src/com/company/sample/entity/messages.properties b/modules/global/src/com/company/sample/entity/messages.properties
new file mode 100644
index 0000000..8c6845b
--- /dev/null
+++ b/modules/global/src/com/company/sample/entity/messages.properties
@@ -0,0 +1,7 @@
+Customer.name = Name
+Customer = Customer
+Customer.email = Email
+Order.customer = Customer
+Order.date = Date
+Order.num = Num
+Order = Order
diff --git a/modules/global/src/metadata.xml b/modules/global/src/metadata.xml
new file mode 100644
index 0000000..3450166
--- /dev/null
+++ b/modules/global/src/metadata.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/global/src/persistence.xml b/modules/global/src/persistence.xml
new file mode 100644
index 0000000..cb3a569
--- /dev/null
+++ b/modules/global/src/persistence.xml
@@ -0,0 +1,9 @@
+
+
+
+ com.company.sample.entity.Customer
+ com.company.sample.entity.Order
+
+
diff --git a/modules/global/src/views.xml b/modules/global/src/views.xml
new file mode 100644
index 0000000..eb399a2
--- /dev/null
+++ b/modules/global/src/views.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/modules/gui/src/com/company/sample/gui/messages.properties b/modules/gui/src/com/company/sample/gui/messages.properties
new file mode 100644
index 0000000..df53089
--- /dev/null
+++ b/modules/gui/src/com/company/sample/gui/messages.properties
@@ -0,0 +1,7 @@
+
+application.caption = CUBA Application
+application.logoImage = branding/app-icon-menu.png
+
+loginWindow.caption = CUBA Login
+loginWindow.welcomeLabel = Welcome to CUBA!
+loginWindow.logoImage = branding/app-icon-login.png
diff --git a/modules/gui/src/screens.xml b/modules/gui/src/screens.xml
new file mode 100644
index 0000000..22e5cdb
--- /dev/null
+++ b/modules/gui/src/screens.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/web/src/com/company/sample/web/App.java b/modules/web/src/com/company/sample/web/App.java
new file mode 100644
index 0000000..c5e17a2
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/App.java
@@ -0,0 +1,6 @@
+package com.company.sample.web;
+
+import com.haulmont.cuba.web.DefaultApp;
+
+public class App extends DefaultApp {
+}
\ No newline at end of file
diff --git a/modules/web/src/com/company/sample/web/customer/CustomerBrowse.java b/modules/web/src/com/company/sample/web/customer/CustomerBrowse.java
new file mode 100644
index 0000000..e54c024
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/customer/CustomerBrowse.java
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2016 screen-manipulation
+ */
+package com.company.sample.web.customer;
+
+import com.haulmont.cuba.gui.components.AbstractLookup;
+
+/**
+ * @author knst
+ */
+public class CustomerBrowse extends AbstractLookup {
+}
\ No newline at end of file
diff --git a/modules/web/src/com/company/sample/web/customer/CustomerEdit.java b/modules/web/src/com/company/sample/web/customer/CustomerEdit.java
new file mode 100644
index 0000000..79dd08c
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/customer/CustomerEdit.java
@@ -0,0 +1,17 @@
+package com.company.sample.web.customer;
+
+import com.haulmont.cuba.gui.components.AbstractEditor;
+import com.company.sample.entity.Customer;
+
+import java.util.Map;
+
+public class CustomerEdit extends AbstractEditor {
+
+ @Override
+ public void init(Map params) {
+ // The same can be done using the element in the XML descriptor
+ getDialogOptions()
+ .setWidth(300) // fixed width
+ .setForceDialog(true); // always open as a dialog
+ }
+}
\ No newline at end of file
diff --git a/modules/web/src/com/company/sample/web/customer/CustomerList.java b/modules/web/src/com/company/sample/web/customer/CustomerList.java
new file mode 100644
index 0000000..a053dfd
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/customer/CustomerList.java
@@ -0,0 +1,34 @@
+package com.company.sample.web.customer;
+
+import com.company.sample.entity.Customer;
+import com.haulmont.cuba.gui.components.AbstractWindow;
+import com.haulmont.cuba.gui.components.Component;
+import com.haulmont.cuba.gui.components.Window;
+import com.haulmont.cuba.gui.data.CollectionDatasource;
+
+import javax.inject.Inject;
+import java.util.Map;
+import java.util.UUID;
+
+public class CustomerList extends AbstractWindow {
+
+ @Inject
+ protected CollectionDatasource customersDs;
+
+ @Override
+ public void init(Map params) {
+ customersDs.refresh();
+ }
+
+ public void select(Component source) {
+ close(Window.COMMIT_ACTION_ID);
+ }
+
+ public void cancel(Component source) {
+ close(Window.CLOSE_ACTION_ID);
+ }
+
+ public Customer getSelectedCustomer() {
+ return customersDs.getItem();
+ }
+}
\ No newline at end of file
diff --git a/modules/web/src/com/company/sample/web/customer/customer-browse.xml b/modules/web/src/com/company/sample/web/customer/customer-browse.xml
new file mode 100644
index 0000000..2593931
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/customer/customer-browse.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/web/src/com/company/sample/web/customer/customer-edit.xml b/modules/web/src/com/company/sample/web/customer/customer-edit.xml
new file mode 100644
index 0000000..bc40598
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/customer/customer-edit.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/web/src/com/company/sample/web/customer/customer-list.xml b/modules/web/src/com/company/sample/web/customer/customer-list.xml
new file mode 100644
index 0000000..37c1481
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/customer/customer-list.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/web/src/com/company/sample/web/customer/messages.properties b/modules/web/src/com/company/sample/web/customer/messages.properties
new file mode 100644
index 0000000..dde051d
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/customer/messages.properties
@@ -0,0 +1,3 @@
+browseCaption = Customer browser
+editCaption = Customer editor
+caption = Customer list
diff --git a/modules/web/src/com/company/sample/web/messages.properties b/modules/web/src/com/company/sample/web/messages.properties
new file mode 100644
index 0000000..3052765
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/messages.properties
@@ -0,0 +1,4 @@
+menu-config.application = Application
+menu-config.about = About
+menu-config.sample$Customer.browse = Customers
+menu-config.sample$Order.browse = Orders
diff --git a/modules/web/src/com/company/sample/web/order/OrderBrowse.java b/modules/web/src/com/company/sample/web/order/OrderBrowse.java
new file mode 100644
index 0000000..9d15bab
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/order/OrderBrowse.java
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2016 screen-manipulation
+ */
+package com.company.sample.web.order;
+
+import com.haulmont.cuba.gui.components.AbstractLookup;
+
+/**
+ * @author knst
+ */
+public class OrderBrowse extends AbstractLookup {
+}
\ No newline at end of file
diff --git a/modules/web/src/com/company/sample/web/order/OrderEdit.java b/modules/web/src/com/company/sample/web/order/OrderEdit.java
new file mode 100644
index 0000000..f65c5ba
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/order/OrderEdit.java
@@ -0,0 +1,45 @@
+package com.company.sample.web.order;
+
+import com.company.sample.entity.Customer;
+import com.company.sample.web.customer.CustomerList;
+import com.haulmont.cuba.gui.WindowManager;
+import com.haulmont.cuba.gui.components.*;
+import com.company.sample.entity.Order;
+
+import javax.inject.Named;
+import java.util.Collection;
+import java.util.Map;
+
+public class OrderEdit extends AbstractEditor {
+
+ @Named("fieldGroup.customer")
+ private PickerField customerField;
+
+ @Override
+ public void init(Map params) {
+ customerField.removeAction(PickerField.LookupAction.NAME);
+ }
+
+ public void selectCustomerFromLookupScreen(Component source) {
+ // Open the customers browser as a lookup screen
+ openLookup("sample$Customer.browse", new Lookup.Handler() {
+ @Override
+ public void handleLookup(Collection items) {
+ // When the lookup screen closes, use the selected entity
+ if (!items.isEmpty()) {
+ getItem().setCustomer((Customer) items.iterator().next());
+ }
+ }
+ }, WindowManager.OpenType.DIALOG.setWidth(600).setHeight(400)); // Open the lookup screen as a dialog with predefined geometry
+ }
+
+ public void selectCustomerFromSimpleScreen(Component source) {
+ // Open the customers list screen
+ CustomerList window = (CustomerList) openWindow("customer-list", WindowManager.OpenType.DIALOG);
+ // Add a listener that will be notified when the screen is closed by action with Window.COMMIT_ACTION_ID
+ window.addCloseWithCommitListener(() -> {
+ // Get a selected entity from the invoked screen and use it
+ getItem().setCustomer(window.getSelectedCustomer());
+ });
+ }
+}
\ No newline at end of file
diff --git a/modules/web/src/com/company/sample/web/order/messages.properties b/modules/web/src/com/company/sample/web/order/messages.properties
new file mode 100644
index 0000000..515d0f3
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/order/messages.properties
@@ -0,0 +1,2 @@
+browseCaption = Order browser
+editCaption = Order editor
diff --git a/modules/web/src/com/company/sample/web/order/order-browse.xml b/modules/web/src/com/company/sample/web/order/order-browse.xml
new file mode 100644
index 0000000..ef732e2
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/order/order-browse.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/web/src/com/company/sample/web/order/order-edit.xml b/modules/web/src/com/company/sample/web/order/order-edit.xml
new file mode 100644
index 0000000..153e182
--- /dev/null
+++ b/modules/web/src/com/company/sample/web/order/order-edit.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/web/src/web-app.properties b/modules/web/src/web-app.properties
new file mode 100644
index 0000000..2c73fc4
--- /dev/null
+++ b/modules/web/src/web-app.properties
@@ -0,0 +1,47 @@
+###############################################################################
+# Configuration #
+###############################################################################
+
+cuba.springContextConfig = cuba-web-spring.xml web-spring.xml
+
+cuba.dispatcherSpringContextConfig = cuba-dispatcher-spring.xml web-dispatcher-spring.xml
+
+cuba.persistenceConfig = cuba-persistence.xml persistence.xml
+
+cuba.metadataConfig = cuba-metadata.xml cuba-gui-metadata.xml cuba-web-metadata.xml metadata.xml
+
+cuba.viewsConfig = cuba-views.xml views.xml
+
+cuba.windowConfig = cuba-web-screens.xml web-screens.xml
+
+cuba.menuConfig = cuba-web-menu.xml web-menu.xml
+
+cuba.permissionConfig = cuba-web-permissions.xml web-permissions.xml
+
+cuba.mainMessagePack = com.haulmont.cuba.web com.company.sample.gui com.company.sample.web
+
+cuba.creditsConfig = cuba-credits.xml
+
+###############################################################################
+# Other #
+###############################################################################
+
+# Middleware connection
+cuba.connectionUrlList = http://localhost:8080/app-core
+
+# Set to false if the middleware works on different JVM
+cuba.useLocalServiceInvocation = true
+
+cuba.webContextName = app
+
+# Web session inactivity timeout in seconds
+cuba.httpSessionExpirationTimeoutSec = 1800
+
+cuba.web.useLightHeader = true
+
+cuba.web.theme = halo
+
+
+cuba.web.foldersPaneEnabled=false
+cuba.availableLocales = English|en
+cuba.localeSelectVisible = false
diff --git a/modules/web/src/web-dispatcher-spring.xml b/modules/web/src/web-dispatcher-spring.xml
new file mode 100644
index 0000000..e898bb0
--- /dev/null
+++ b/modules/web/src/web-dispatcher-spring.xml
@@ -0,0 +1,10 @@
+
+
+
\ No newline at end of file
diff --git a/modules/web/src/web-menu.xml b/modules/web/src/web-menu.xml
new file mode 100644
index 0000000..05e6927
--- /dev/null
+++ b/modules/web/src/web-menu.xml
@@ -0,0 +1,8 @@
+
+
+
+
diff --git a/modules/web/src/web-permissions.xml b/modules/web/src/web-permissions.xml
new file mode 100644
index 0000000..333e996
--- /dev/null
+++ b/modules/web/src/web-permissions.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/modules/web/src/web-screens.xml b/modules/web/src/web-screens.xml
new file mode 100644
index 0000000..c4586ad
--- /dev/null
+++ b/modules/web/src/web-screens.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/modules/web/src/web-spring.xml b/modules/web/src/web-spring.xml
new file mode 100644
index 0000000..df66984
--- /dev/null
+++ b/modules/web/src/web-spring.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/web/web/META-INF/context.xml b/modules/web/web/META-INF/context.xml
new file mode 100644
index 0000000..56473f0
--- /dev/null
+++ b/modules/web/web/META-INF/context.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/web/web/WEB-INF/web.xml b/modules/web/web/WEB-INF/web.xml
new file mode 100644
index 0000000..bc0e3a8
--- /dev/null
+++ b/modules/web/web/WEB-INF/web.xml
@@ -0,0 +1,80 @@
+
+
+
+ Vaadin production mode
+ productionMode
+ false
+
+
+ Web resources version for correct caching in browser
+ webResourcesTs
+ ${webResourcesTs}
+
+
+
+ appPropertiesConfig
+
+ classpath:cuba-web-app.properties
+ classpath:web-app.properties
+ /WEB-INF/local.app.properties
+ "file:${catalina.home}/conf/app/local.app.properties"
+
+
+
+ com.haulmont.cuba.web.sys.WebAppContextLoader
+
+
+ app_servlet
+ com.haulmont.cuba.web.sys.CubaApplicationServlet
+
+ Application class
+ application
+ com.company.sample.web.App
+
+
+ Widgetset name
+ widgetset
+ com.haulmont.cuba.web.toolkit.ui.WidgetSet
+
+
+ UI class
+ UI
+ com.haulmont.cuba.web.AppUI
+
+
+ UIProvider class
+ UIProvider
+ com.haulmont.cuba.web.sys.CubaUIProvider
+
+
+ Heartbeat of active UI in seconds
+ heartbeatInterval
+ 30
+
+
+
+ dispatcher
+ com.haulmont.cuba.web.sys.CubaDispatcherServlet
+ 1
+
+
+ dispatcher
+ /dispatch/*
+
+
+ app_servlet
+ /*
+
+
+ cuba_filter
+ com.haulmont.cuba.web.sys.CubaHttpFilter
+
+
+ cuba_filter
+ /*
+
+
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..88e38ab
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,6 @@
+rootProject.name = 'screen-manipulation'
+include(':app-global', ':app-core', ':app-gui', ':app-web')
+project(':app-global').projectDir = new File(settingsDir, 'modules/global')
+project(':app-core').projectDir = new File(settingsDir, 'modules/core')
+project(':app-gui').projectDir = new File(settingsDir, 'modules/gui')
+project(':app-web').projectDir = new File(settingsDir, 'modules/web')
\ No newline at end of file