@ -10,18 +10,16 @@ import org.gcube.portlets.user.notifications.client.NotificationsServiceAsync;
import org.gcube.portlets.user.notifications.client.view.templates.CategoryWrapper ;
import org.gcube.portlets.user.notifications.shared.NotificationPreference ;
import com.github.gwtbootstrap.client.ui.Button ;
import com.github.gwtbootstrap.client.ui.Modal ;
import com.github.gwtbootstrap.client.ui.ModalFooter ;
import com.github.gwtbootstrap.client.ui.constants.ButtonType ;
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.rpc.AsyncCallback ;
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.HasVerticalAlignment ;
import com.google.gwt.user.client.ui.Image ;
import com.google.gwt.user.client.ui.VerticalPanel ;
@ -35,26 +33,33 @@ public class NotificationSettingsDialog extends Modal {
public static final String loading = GWT . getModuleBaseURL ( ) + "../images/feeds-loader.gif" ;
public static final String mailSentOK = GWT . getModuleBaseURL ( ) + "../images/yes.png" ;
public static final String mailSentNOK = GWT . getModuleBaseURL ( ) + "../images/warning_blue.png" ;
public static final int WIDTH = 950 ;
ArrayList < CategoryWrapper > myCategories = new ArrayList < CategoryWrapper > ( ) ;
private VerticalPanel placeholder = new VerticalPanel ( ) ;
private ModalFooter footer = new ModalFooter ( ) ;
private Button cancel = new Button ( "Cancel" ) ;
private Button save = new Button ( "Save" ) ;
public NotificationSettingsDialog ( LinkedHashMap < String , ArrayList < NotificationPreference > > preferences , final NotificationsServiceAsync notificationService ) {
super ( ) ;
setAnimation ( true ) ;
//container.setStyleName("user-notification");
setWidth ( 950 ) ;
setWidth ( WIDTH ) ;
setTitle ( "Notification Settings" ) ;
//this is needed cuz i didnt figure out
placeholder . setWidth ( WIDTH + "px" ) ;
placeholder . setHorizontalAlignment ( HasAlignment . ALIGN_CENTER ) ;
add ( placeholder ) ;
for ( String category : preferences . keySet ( ) ) {
CategoryWrapper cat = new CategoryWrapper ( category , preferences . get ( category ) ) ;
add ( cat ) ;
myCategories . add ( cat ) ;
}
setTitle ( "Notification Settings" ) ;
ModalFooter footer = new ModalFooter ( ) ;
save . setType ( ButtonType . PRIMARY ) ;
footer . add ( save ) ;
footer . add ( cancel ) ;
@ -93,27 +98,16 @@ public class NotificationSettingsDialog extends Modal {
}
//TODO: does not work
private void showDeliveryResult ( boolean success ) {
clear ( ) ;
if ( success ) {
setTitle ( "Notifications Settings Saved" ) ;
add ( new HTML ( "<span style=\"font-size: 24px;\">Notifications Settings correctly saved.</span>" ) ) ;
add ( new Image ( mailSentOK ) ) ;
placeholder . add ( new HTML ( "<span style=\"font-size: 20px;\">Notifications Settings saved correctly</span>" ) ) ;
placeholder . add ( new Image ( mailSentOK ) ) ;
}
else {
setTitle ( "Notifications Settings Saving Error" ) ;
add ( new Image ( mailSentNOK ) ) ;
add ( new HTML ( "There were problems contacting the server, please try again in a short while." ) ) ;
Button close = new Button ( "Close" ) ;
close . addClickHandler ( new ClickHandler ( ) {
@Override
public void onClick ( ClickEvent event ) {
hide ( ) ;
}
} ) ;
placeholder . add ( new Image ( mailSentNOK ) ) ;
placeholder . add ( new HTML ( "<span style=\"font-size: 20px;\">Sorry, there were problems contacting the server, please try again in a short while.</span>" ) ) ;
}
Button close = new Button ( "Close" ) ;
close . addClickHandler ( new ClickHandler ( ) {
@Override
@ -121,7 +115,7 @@ public class NotificationSettingsDialog extends Modal {
hide ( ) ;
}
} ) ;
ModalFooter footer = new ModalFoote r( ) ;
footer. clea r( ) ;
footer . add ( close ) ;
add ( footer ) ;