integrated gwt bootstrap 2 for notification settings modal

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/notifications@115398 82a268e6-3cf1-43bd-a215-b396298e98cf
Feature/23194
Massimiliano Assante 9 years ago
parent 9fc46962bb
commit c56c77c0c8

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/notifications-1.3.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/notifications-1.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -30,5 +30,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/notifications-1.3.1-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/notifications-1.4.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

@ -0,0 +1,3 @@
eclipse.preferences.version=1
validateFragments=false
validation.use-project-settings=true

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="${module}">
<wb-module deploy-name="notifications-portlet">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>

@ -4,4 +4,5 @@
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="java" version="1.7"/>
<installed facet="liferay.portlet" version="6.0"/>
</faceted-project>

@ -13,12 +13,12 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>notifications</artifactId>
<packaging>war</packaging>
<version>1.3.1-SNAPSHOT</version>
<version>1.4.0-SNAPSHOT</version>
<name>gCube Notifications Portlet</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.5.1</gwtVersion>
<gwtVersion>2.7.0</gwtVersion>
<distroDirectory>distro</distroDirectory>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
@ -42,13 +42,20 @@
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.3.2.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.gwtquery</groupId>
<artifactId>gwtquery</artifactId>
@ -85,6 +92,7 @@
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>

@ -3,50 +3,36 @@ package org.gcube.portlets.user.notifications.client.view;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.TreeMap;
import org.gcube.portal.databook.shared.NotificationChannelType;
import org.gcube.portal.databook.shared.NotificationType;
import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
import org.gcube.portlets.user.notifications.client.NotificationsServiceAsync;
import org.gcube.portlets.user.notifications.client.view.templates.CategoryWrapper;
import org.gcube.portlets.user.notifications.client.view.templates.NotificationPreferenceView;
import org.gcube.portlets.user.notifications.shared.NotificationPreference;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.ModalFooter;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasAlignment;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* @author Massimiliano Assante ISTI-CNR
*
*/
public class NotificationSettingsDialog extends GCubeDialog {
public class NotificationSettingsDialog extends Modal {
private VerticalPanel mainPanel = new VerticalPanel();
private VerticalPanel container = new VerticalPanel();
private HorizontalPanel buttonsContainerPanel = new HorizontalPanel();
private HorizontalPanel buttonsPanel = new HorizontalPanel();
public static final String loading = GWT.getModuleBaseURL() + "../images/feeds-loader.gif";
public static final String mailSentOK = GWT.getModuleBaseURL() + "../images/yes.png";
@ -59,32 +45,22 @@ public class NotificationSettingsDialog extends GCubeDialog {
public NotificationSettingsDialog(LinkedHashMap<String, ArrayList<NotificationPreference>> preferences, final NotificationsServiceAsync notificationService) {
super();
ScrollPanel scroller = new ScrollPanel();
scroller.setWidth("890px");
scroller.setHeight("500px");
buttonsPanel.setWidth("100%");
buttonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
container.setStyleName("user-notification");
container.setWidth("850px");
setAnimation(true);
//container.setStyleName("user-notification");
setWidth(950);
for (String category : preferences.keySet()) {
CategoryWrapper cat = new CategoryWrapper(category, preferences.get(category));
container.add(cat);
add(cat);
myCategories.add(cat);
}
buttonsContainerPanel.add(cancel);
buttonsContainerPanel.add(save);
buttonsPanel.add(buttonsContainerPanel);
//container.add(buttonsPanel);
setText("Notification Settings");
scroller.add(container);
mainPanel.add(scroller);
mainPanel.add(buttonsPanel);
setWidget(mainPanel);
setTitle("Notification Settings");
ModalFooter footer = new ModalFooter();
save.setType(ButtonType.PRIMARY);
footer.add(save);
footer.add(cancel);
add(footer);
save.addClickHandler(new ClickHandler() {
@Override
@ -126,12 +102,12 @@ public class NotificationSettingsDialog extends GCubeDialog {
mainPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
mainPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
if (success) {
setText("Notifications Settings Saved");
setTitle("Notifications Settings Saved");
mainPanel.add(new HTML("<span style=\"font-size: 24px;\">Notifications Settings correctly saved.</span>"));
mainPanel.add(new Image(mailSentOK));
}
else {
setText("Notifications Settings Saving Error");
setTitle("Notifications Settings Saving Error");
mainPanel.add(new Image(mailSentNOK));
mainPanel.add(new HTML("There were problems contacting the server, please try again in a short while."));
Button close = new Button("Close");

@ -107,7 +107,6 @@ public class NotificationsPanel extends Composite {
@Override
public void onSuccess(LinkedHashMap<String, ArrayList<NotificationPreference>> result) {
NotificationSettingsDialog dlg = new NotificationSettingsDialog(result, notificationService);
dlg.center();
dlg.show();
showSettingsLoader(false);
}

@ -16,7 +16,7 @@ import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

@ -2,7 +2,7 @@
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:w="urn:import:org.gcube.portlets.widgets.switchbutton.client"
xmlns:e="urn:import:org.gcube.portlets.user.gcubewidgets.client.elements"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui" xmlns:g="urn:import:com.google.gwt.user.client.ui">
<g:HTMLPanel>
<div class="day-wrapper">
<e:Span styleName="day-label" ui:field="categoryLabel" />
@ -10,8 +10,10 @@
<table>
<tr>
<td>
<g:CheckBox ui:field="portalCheckbox">Portal</g:CheckBox>
<g:CheckBox ui:field="emailCheckbox">Email</g:CheckBox>
<b:CheckBox ui:field="portalCheckbox">Portal</b:CheckBox>
</td>
<td>
<b:CheckBox ui:field="emailCheckbox">Email</b:CheckBox>
</td>
<td>
<w:SwitchButton ui:field="switchButton" styleName="paddingLeft" />

@ -15,7 +15,7 @@ import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

@ -1,18 +1,23 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:e="urn:import:org.gcube.portlets.user.gcubewidgets.client.elements"
xmlns:w="urn:import:org.gcube.portlets.widgets.switchbutton.client"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
xmlns:w="urn:import:org.gcube.portlets.widgets.switchbutton.client"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui" xmlns:g="urn:import:com.google.gwt.user.client.ui">
<g:HTMLPanel>
<table class="single-notification-table">
<tr>
<td valign="TOP" style="width: 200px;" align="left">
<e:Span styleName="user-notification" ui:field="prefType" />
</td>
<td valign="TOP" style="width: 250px;">
<g:CheckBox ui:field="portalCheckbox">Portal</g:CheckBox>
<g:CheckBox ui:field="emailCheckbox">Email</g:CheckBox>
<w:SwitchButton ui:field="switchButton" styleName="floatingRight paddingRight"/>
<td valign="TOP" style="width: 60px;">
<b:CheckBox ui:field="portalCheckbox">Portal</b:CheckBox>
</td>
<td valign="TOP" style="width: 60px;">
<b:CheckBox ui:field="emailCheckbox">Email</b:CheckBox>
</td>
<td valign="TOP" style="width: 150px;">
<w:SwitchButton ui:field="switchButton"
styleName="floatingRight paddingRight" />
</td>
<td valign="TOP">
<e:Span styleName="user-notification-comment" ui:field="prefDesc" />

@ -117,6 +117,13 @@ public class SingleNotificationView extends Composite {
case CALENDAR_DELETED_EVENT:
goApp.setHTML("<a class=\"link\" href=\""+toShow.getUri()+"\"> Go to Calendar.</a>");
break;
case TDM_TAB_RESOURCE_SHARE:
goApp.setHTML("<a class=\"link\" href=\""+toShow.getUri()+"\"> See this Tabular Resource.</a>");
break;
case TDM_RULE_SHARE:
case TDM_TEMPLATE_SHARE:
goApp.setHTML("<a class=\"link\" href=\""+toShow.getUri()+"\"> Go to Tabular Data Manager.</a>");
break;
}
}
@ -168,7 +175,11 @@ public class SingleNotificationView extends Composite {
case CALENDAR_DELETED_EVENT:
return images.calendarDelete();
case POST_ALERT:
return images.postAlert();
return images.postAlert();
case TDM_TAB_RESOURCE_SHARE:
case TDM_RULE_SHARE:
case TDM_TEMPLATE_SHARE:
return images.tableShare();
default:
return images.generic();
}

@ -57,4 +57,7 @@ public interface NotificationImages extends ClientBundle {
@Source("notification-generic.png")
ImageResource generic();
@Source("table_share.png")
ImageResource tableShare();
}

@ -90,7 +90,7 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
*/
public String getDevelopmentUser() {
String user = "test.user";
//user = "massimiliano.assante";
user = "massimiliano.assante";
return user;
}
public UserInfo getUserInfo() {
@ -256,17 +256,17 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
/**
*
* @param type the type to look for
* @return the Category if there is correspodance, null otherwise
* @return the Category if there is correspondance, null otherwise
*/
private Properties getCategoriesByType() {
Properties props = new Properties();
try {
ServletContext servletContext = getServletContext();
String contextPath = servletContext.getRealPath(File.separator);
String propertyfile = contextPath + "conf" + File.separator + TYPE_CATEGORIES_FILENAME;
String propertyfile = contextPath + File.separator + "conf" + File.separator + TYPE_CATEGORIES_FILENAME;
File propsFile = new File(propertyfile);
FileInputStream fis = new FileInputStream(propsFile);
props.load( fis);
props.load(fis);
return props;
}
//catch exception in case properties file does not exist
@ -281,10 +281,11 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
*/
private Properties getLabelsByType() {
Properties props = new Properties();
String propertyfile = "";
try {
ServletContext servletContext = getServletContext();
String contextPath = servletContext.getRealPath(File.separator);
String propertyfile = contextPath + "conf" + File.separator + TYPE_LABELS_FILENAME;
propertyfile = contextPath + File.separator + "conf" + File.separator + TYPE_LABELS_FILENAME;
File propsFile = new File(propertyfile);
FileInputStream fis = new FileInputStream(propsFile);
props.load( fis);
@ -292,7 +293,7 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
}
//catch exception in case properties file does not exist
catch(IOException e) {
_log.error(TYPE_LABELS_FILENAME + "file not found under conf dir, returning null");
_log.error(TYPE_LABELS_FILENAME + "file not found under conf dir, returning null propertyfile -> " + propertyfile);
return null;
}
}
@ -305,7 +306,7 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
try {
ServletContext servletContext = getServletContext();
String contextPath = servletContext.getRealPath(File.separator);
String propertyfile = contextPath + "conf" + File.separator + TYPE_DESCRIPTIONS_FILENAME;
String propertyfile = contextPath + File.separator +"conf" + File.separator + TYPE_DESCRIPTIONS_FILENAME;
File propsFile = new File(propertyfile);
FileInputStream fis = new FileInputStream(propsFile);
props.load( fis);

@ -3,11 +3,12 @@
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- To Comment out -->
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
<!-- Other module inherits -->
<!-- inherits gCube Widgets Library -->
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<inherits name='org.gcube.portlets.widgets.switchbutton.SwitchButton' />
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
<!-- Specify the app entry point class. -->

@ -78,9 +78,9 @@ a.link:hover {
}
.single-notification-table {
width: 100%;
width: 920px;
padding: 5px;
border-top: 1px solid #EFEFEF;
border-bottom: 1px solid #EFEFEF;
}
@ -98,7 +98,7 @@ a.link:hover {
.notification-photo {
display: block;
padding: 2px;
border: 1px solid #E6E6E6;
border: none;
}
.user-notification-time {

@ -1,10 +1,13 @@
DOCUMENT_WORKFLOW_EDIT=Document Workflow
DOCUMENT_WORKFLOW_VIEW=Document Workflow
DOCUMENT_WORKFLOW_STEP_REQUEST_TASK=Document Workflow
DOCUMENT_WORKFLOW_FIRST_STEP_REQUEST_INVOLVMENT=Document Workflow
DOCUMENT_WORKFLOW_USER_FORWARD_TO_OWNER=Document Workflow
DOCUMENT_WORKFLOW_FORWARD_STEP_COMPLETED_OWNER=Document Workflow
DOCUMENT_WORKFLOW_STEP_FORWARD_PEER=Document Workflow
DOCUMENT_WORKFLOW_EDIT=Application: Document Workflow
DOCUMENT_WORKFLOW_VIEW=Application: Document Workflow
DOCUMENT_WORKFLOW_STEP_REQUEST_TASK=Application: Document Workflow
DOCUMENT_WORKFLOW_FIRST_STEP_REQUEST_INVOLVMENT=Application: Document Workflow
DOCUMENT_WORKFLOW_USER_FORWARD_TO_OWNER=Application: Document Workflow
DOCUMENT_WORKFLOW_FORWARD_STEP_COMPLETED_OWNER=Application: Document Workflow
DOCUMENT_WORKFLOW_STEP_FORWARD_PEER=Application: Document Workflow
TDM_TAB_RESOURCE_SHARE=Application: Tabular Data Manager
TDM_RULE_SHARE=Application: Tabular Data Manager
TDM_TEMPLATE_SHARE=Application: Tabular Data Manager
WP_FOLDER_SHARE=Workspace Sharing
WP_FOLDER_UNSHARE=Workspace Sharing
WP_ADMIN_UPGRADE=Workspace Sharing
@ -24,4 +27,4 @@ MESSAGE=Social Networking
POST_ALERT=Social Networking
CALENDAR_ADDED_EVENT=Shared Calendars
CALENDAR_UPDATED_EVENT=Shared Calendars
CALENDAR_DELETED_EVENT=Shared Calendars
CALENDAR_DELETED_EVENT=Shared Calendars

@ -24,4 +24,7 @@ DOCUMENT_WORKFLOW_FORWARD_STEP_COMPLETED_OWNER=A document workflow you created w
DOCUMENT_WORKFLOW_STEP_FORWARD_PEER=Someone completed his task on a document workflow where you still need to do yours
CALENDAR_ADDED_EVENT=Someone added a new event in one of your shared calendars
CALENDAR_UPDATED_EVENT=Someone edited an event in one of your shared calendars
CALENDAR_DELETED_EVENT=Someone deleted an event in one of your shared calendars
CALENDAR_DELETED_EVENT=Someone deleted an event in one of your shared calendars
TDM_TAB_RESOURCE_SHARE=Sharing of Tabular Resources with you
TDM_RULE_SHARE=Sharing of Tabular Data Manager Rules with you
TDM_TEMPLATE_SHARE=Sharing of Tabular Data Manager Templates with you

@ -18,6 +18,9 @@ POST_ALERT=Post Alerts
CALENDAR_ADDED_EVENT=Added events
CALENDAR_UPDATED_EVENT=Edited events
CALENDAR_DELETED_EVENT=Deleted events
TDM_TAB_RESOURCE_SHARE=Shared Tabular Resource
TDM_RULE_SHARE=Shared Tabular Data Manager Rule
TDM_TEMPLATE_SHARE=Shared Tabular Data Manager Template
DOCUMENT_WORKFLOW_EDIT=Edit
DOCUMENT_WORKFLOW_VIEW=View
DOCUMENT_WORKFLOW_STEP_REQUEST_TASK=Task request
@ -25,3 +28,4 @@ DOCUMENT_WORKFLOW_FIRST_STEP_REQUEST_INVOLVMENT=Involvement request
DOCUMENT_WORKFLOW_USER_FORWARD_TO_OWNER=Forward
DOCUMENT_WORKFLOW_FORWARD_STEP_COMPLETED_OWNER=Step completed
DOCUMENT_WORKFLOW_STEP_FORWARD_PEER=Forward from peer

Loading…
Cancel
Save