Skip to content

Commit 64dab9f

Browse files
committed
Ported Explorer layout to Kickstart
1 parent 3b5b4f7 commit 64dab9f

File tree

111 files changed

+2226
-542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+2226
-542
lines changed

activiti-kickstart-ui/pom.xml

+53-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<modelVersion>4.0.0</modelVersion>
55

66
<name>Activiti - KickStart - UI</name>
7-
<groupId>org.activiti</groupId>
87
<artifactId>activiti-kickstart-ui</artifactId>
98
<packaging>war</packaging>
109

@@ -24,13 +23,26 @@
2423
<groupId>org.apache.maven.plugins</groupId>
2524
<artifactId>maven-compiler-plugin</artifactId>
2625
<configuration>
27-
<source>1.5</source>
28-
<target>1.5</target>
26+
<source>1.6</source>
27+
<target>1.6</target>
2928
<showDeprecation>true</showDeprecation>
3029
<showWarnings>true</showWarnings>
3130
<optimize>true</optimize>
3231
</configuration>
3332
</plugin>
33+
<plugin>
34+
<groupId>org.zeroturnaround</groupId>
35+
<artifactId>jrebel-maven-plugin</artifactId>
36+
<executions>
37+
<execution>
38+
<id>generate-rebel-xml</id>
39+
<phase>process-resources</phase>
40+
<goals>
41+
<goal>generate</goal>
42+
</goals>
43+
</execution>
44+
</executions>
45+
</plugin>
3446

3547
<!-- A simple Jetty test server at http://localhost:8081/activiti-kickstart
3648
can be launched with the Maven goal jetty:run and stopped with jetty:stop -->
@@ -51,17 +63,52 @@
5163
<scanIntervalSeconds>0</scanIntervalSeconds>
5264
<!-- make sure Jetty also finds the widgetset -->
5365
<webAppConfig>
54-
<contextPath>/activiti-kickstart</contextPath>
66+
<contextPath>/activiti-kickstart-ui</contextPath>
5567
<baseResource implementation="org.mortbay.resource.ResourceCollection">
5668
<!-- Workaround for Maven/Jetty issue http://jira.codehaus.org/browse/JETTY-680 -->
5769
<!-- <resources>src/main/webapp,${project.build.directory}/${project.build.finalName}</resources> -->
58-
<resourcesAsCSV>src/main/webapp,${project.build.directory}/${project.build.finalName}
59-
</resourcesAsCSV>
70+
<!-- <resourcesAsCSV>src/main/webapp,${project.build.directory}/${project.build.finalName}</resourcesAsCSV> -->
71+
<resourcesAsCSV>src/main/webapp</resourcesAsCSV>
6072
</baseResource>
6173
</webAppConfig>
6274
</configuration>
6375
</plugin>
6476
</plugins>
77+
<pluginManagement>
78+
<plugins>
79+
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
80+
<plugin>
81+
<groupId>org.eclipse.m2e</groupId>
82+
<artifactId>lifecycle-mapping</artifactId>
83+
<version>1.0.0</version>
84+
<configuration>
85+
<lifecycleMappingMetadata>
86+
<pluginExecutions>
87+
<pluginExecution>
88+
<pluginExecutionFilter>
89+
<groupId>
90+
org.zeroturnaround
91+
</groupId>
92+
<artifactId>
93+
jrebel-maven-plugin
94+
</artifactId>
95+
<versionRange>
96+
[1.0.7,)
97+
</versionRange>
98+
<goals>
99+
<goal>generate</goal>
100+
</goals>
101+
</pluginExecutionFilter>
102+
<action>
103+
<ignore></ignore>
104+
</action>
105+
</pluginExecution>
106+
</pluginExecutions>
107+
</lifecycleMappingMetadata>
108+
</configuration>
109+
</plugin>
110+
</plugins>
111+
</pluginManagement>
65112
</build>
66113

67114
<dependencies>

activiti-kickstart-ui/src/main/java/org/activiti/kickstart/KickStartApplication.java

+57-72
Original file line numberDiff line numberDiff line change
@@ -12,85 +12,70 @@
1212
*/
1313
package org.activiti.kickstart;
1414

15+
import javax.servlet.http.HttpServletRequest;
16+
import javax.servlet.http.HttpServletResponse;
17+
18+
import org.activiti.kickstart.ui.MainLayout;
1519
import org.activiti.kickstart.ui.ViewManager;
16-
import org.activiti.kickstart.ui.panel.ActionsPanel;
17-
import org.activiti.kickstart.ui.panel.KickstartWorkflowPanel;
1820

1921
import com.vaadin.Application;
20-
import com.vaadin.ui.CustomLayout;
21-
import com.vaadin.ui.HorizontalLayout;
22-
import com.vaadin.ui.HorizontalSplitPanel;
23-
import com.vaadin.ui.Panel;
22+
import com.vaadin.terminal.gwt.server.HttpServletRequestListener;
2423
import com.vaadin.ui.Window;
25-
import com.vaadin.ui.themes.Reindeer;
2624

2725
/**
2826
* @author Joram Barrez
2927
*/
30-
public class KickStartApplication extends Application {
31-
32-
protected static final long serialVersionUID = 6197397757268207621L;
33-
34-
protected static final String TITLE = "Activiti KickStart";
35-
protected static final String THEME_NAME = "yakalo";
36-
protected static final String CONTENT_LOCATION = "content"; // id of div in layout where app needs to come
37-
38-
// ui
39-
protected ViewManager viewManager;
40-
protected CustomLayout mainLayout; // general layout of the app
41-
protected HorizontalSplitPanel splitPanel; // app uses a split panel: left actions, right work area
42-
protected ActionsPanel actionsPanel; // left panel with user actions
43-
protected Panel currentWorkArea; // right panel of ui where actual work happens
44-
45-
public void init() {
46-
setTheme(THEME_NAME);
47-
initMainWindow();
48-
initDefaultWorkArea();
49-
}
50-
51-
protected void initMainWindow() {
52-
53-
Window mainWindow = new Window(TITLE);
54-
setMainWindow(mainWindow);
55-
Panel p = new Panel();
56-
p.setSizeFull();
57-
mainWindow.setContent(p);
58-
59-
mainLayout = new CustomLayout(THEME_NAME); // uses layout defined in webapp/Vaadin/themes/yakalo
60-
mainLayout.setSizeFull();
61-
p.setContent(mainLayout);
62-
63-
initSplitPanel();
64-
initViewManager();
65-
initActionsPanel();
66-
}
67-
68-
protected void initSplitPanel() {
69-
splitPanel = new HorizontalSplitPanel();
70-
splitPanel.setSplitPosition(170, HorizontalSplitPanel.UNITS_PIXELS);
71-
splitPanel.setStyleName(Reindeer.LAYOUT_WHITE);
72-
splitPanel.setSizeFull();
73-
74-
mainLayout.addComponent(splitPanel, CONTENT_LOCATION);
75-
}
76-
77-
protected void initActionsPanel() {
78-
this.actionsPanel = new ActionsPanel(viewManager);
79-
splitPanel.setFirstComponent(actionsPanel);
80-
}
81-
82-
protected void initViewManager() {
83-
this.viewManager = new ViewManager(this, splitPanel);
84-
}
85-
86-
protected void initDefaultWorkArea() {
87-
viewManager.switchWorkArea(ViewManager.EDIT_ADHOC_WORKFLOW, new KickstartWorkflowPanel(viewManager));
88-
}
89-
90-
// GETTERS /////////////////////////////////////////////////////////////////////////
91-
92-
public ViewManager getViewManager() {
93-
return viewManager;
94-
}
28+
public class KickStartApplication extends Application implements HttpServletRequestListener {
29+
30+
protected static final long serialVersionUID = 6197397757268207621L;
31+
32+
protected static final String TITLE = "Activiti KickStart";
33+
protected static final String THEME_NAME = "activiti";
34+
35+
// Thread local storage of instance for each user
36+
protected static ThreadLocal<KickStartApplication> current = new ThreadLocal<KickStartApplication>();
37+
38+
// ui
39+
protected ViewManager viewManager;
40+
protected MainLayout mainLayout; // general layout of the app
41+
42+
public void init() {
43+
initMainWindow();
44+
}
45+
46+
public static KickStartApplication get() {
47+
return current.get();
48+
}
49+
50+
protected void initMainWindow() {
51+
Window mainWindow = new Window(TITLE);
52+
mainWindow.setTheme(THEME_NAME);
53+
setMainWindow(mainWindow);
54+
55+
this.mainLayout = new MainLayout();
56+
mainWindow.setContent(mainLayout);
57+
58+
this.viewManager = new ViewManager(mainLayout);
59+
}
60+
61+
// GETTERS
62+
// /////////////////////////////////////////////////////////////////////////
63+
64+
public ViewManager getViewManager() {
65+
return viewManager;
66+
}
67+
68+
// HttpServletRequestListener
69+
// ///////////////////////////////////////////////////////
70+
71+
public void onRequestStart(HttpServletRequest request, HttpServletResponse response) {
72+
// Set current application object as thread-local to make it easy accessible
73+
current.set(this);
74+
}
75+
76+
public void onRequestEnd(HttpServletRequest request, HttpServletResponse response) {
77+
// Clean up thread-local app
78+
current.remove();
79+
}
9580

9681
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* Licensed under the Apache License, Version 2.0 (the "License");
2+
* you may not use this file except in compliance with the License.
3+
* You may obtain a copy of the License at
4+
*
5+
* http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
* limitations under the License.
12+
*/
13+
14+
package org.activiti.kickstart.ui;
15+
16+
import com.vaadin.terminal.Resource;
17+
import com.vaadin.terminal.ThemeResource;
18+
19+
20+
/**
21+
* Contains statically created {@link Resource} instances for all the images.
22+
*
23+
* @author Joram Barrez
24+
*/
25+
public class Images {
26+
27+
public static final Resource MAIN_MENU_CREATE_WORKFLOW = new ThemeResource("img/mm-tasks.png");
28+
public static final Resource MAIN_MENU_EDIT_WORKFLOW = new ThemeResource("img/mm-process.png");
29+
public static final Resource MAIN_MENU_SETTINGS = new ThemeResource("img/mm-manage.png");
30+
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/* Licensed under the Apache License, Version 2.0 (the "License");
2+
* you may not use this file except in compliance with the License.
3+
* You may obtain a copy of the License at
4+
*
5+
* http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
* limitations under the License.
12+
*/
13+
14+
package org.activiti.kickstart.ui;
15+
16+
import org.activiti.kickstart.KickStartApplication;
17+
18+
import com.vaadin.ui.Component;
19+
import com.vaadin.ui.CssLayout;
20+
import com.vaadin.ui.VerticalLayout;
21+
22+
23+
/**
24+
* @author Joram Barrez
25+
* @author Frederik Heremans
26+
*/
27+
public class MainLayout extends VerticalLayout {
28+
29+
private static final long serialVersionUID = 1L;
30+
31+
private static final String STYLE_MAIN_WRAPPER = "main";
32+
private static final String STYLE_HEADER = "header";
33+
private static final String STYLE_MAIN_CONTENT = "main-content";
34+
35+
protected CssLayout header;
36+
protected CssLayout main;
37+
protected CssLayout footer;
38+
39+
protected ViewManager viewManager;
40+
protected MainMenuBar mainMenuBar;
41+
42+
public MainLayout() {
43+
this.viewManager = KickStartApplication.get().getViewManager();
44+
45+
setSizeFull();
46+
addStyleName(STYLE_MAIN_WRAPPER);
47+
48+
initHeader();
49+
initMainMenuBar();
50+
initMain();
51+
}
52+
53+
public void setMainContent(Component mainContent) {
54+
main.removeAllComponents();
55+
main.addComponent(mainContent);
56+
}
57+
58+
public void setFooter(Component footerContent) {
59+
footer.removeAllComponents();
60+
footer.addComponent(footerContent);
61+
}
62+
63+
public void setMainNavigation(String navigation) {
64+
mainMenuBar.setMainNavigation(navigation);
65+
}
66+
67+
protected void initHeader() {
68+
header = new CssLayout();
69+
header.addStyleName(STYLE_HEADER);
70+
header.setWidth(100, UNITS_PERCENTAGE);
71+
addComponent(header);
72+
}
73+
74+
protected void initMainMenuBar() {
75+
this.mainMenuBar = new MainMenuBar();
76+
header.addComponent(mainMenuBar);
77+
}
78+
79+
protected void initMain() {
80+
main = new CssLayout();
81+
main.setSizeFull();
82+
main.addStyleName(STYLE_MAIN_CONTENT);
83+
addComponent(main);
84+
setExpandRatio(main, 1.0f);
85+
}
86+
87+
}

0 commit comments

Comments
 (0)