gwt custom datepicker css issue with weekend dates on month navigation

2011-11-16 Thread Waqas Sadiq
0 down vote favorite
share [fb] share [tw]


I have developed the code to change the gwt datepicker CSS for a week
for a selected date.

i am able to change the whole week colour, but i move to next week or
previous week and return back to current date, then the css on
weekends is removed but on remaining 5 days, it there.

I am attaching both the classes and css-classes which i am using.

custom datepicker class

import java.util.Date;

import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.logical.shared.ShowRangeHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.i18n.client.constants.DateTimeConstants;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.datepicker.client.DatePicker;

/**

public class CustomeDatePicker extends DatePicker {
private Date date;
public Date getDate() {
return date;
}

public void setDate(Date date) {
this.date = date;
}

@Override
public HandlerRegistration addShowRangeHandler(
ShowRangeHandlerDate handler) {

if(getDate()!=null){
 setWeekStyle(getDate());
}



return super.addShowRangeHandler(handler);
}

public CustomeDatePicker() {

}

@Override
public void addStyleToDates(String styleName, Date date) {

super.addStyleToDates(customeDatePicker, date);

}


@Override
public HandlerRegistration addValueChangeHandler(
ValueChangeHandlerDate handler) {
if(getDate()!=null){
setWeekStyle(getDate());
}
return super.addValueChangeHandler(handler);
}

public void setWeekStyle(Date date) {

setDate(date);
  DateTimeConstants constants =
LocaleInfo.getCurrentLocale().getDateTimeConstants();
  int firstDay =
Integer.parseInt(constants.firstDayOfTheWeek()) - 1;

  int offset = firstDay - date.getDay();
  date.setDate(date.getDate() + offset);


// hun tak
/*  this.removeStyleFromDates(this.getStyleName(), date);*/

Window.alert(setWeekStyle);

/*this.removeStyleFromDates(datePickerDayIsWeekend, date);*/
this.addStyleToDates(customeDatePicker, date);
date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));

/*  this.removeStyleFromDates(datePickerDayIsWeekend, date);
*/  this.addStyleToDates(customeDatePicker, date);
this.getElement().getStyle().setBackgroundColor(red);

this.removeStyleFromDates(datePickerDayIsWeekend, date);
date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));

this.addStyleToDates(customeDatePicker, date);
this.getElement().getStyle().setBackgroundColor(red);

this.removeStyleFromDates(datePickerDayIsWeekend, date);
date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));

this.addStyleToDates(customeDatePicker, date);
this.getElement().getStyle().setBackgroundColor(red);

this.removeStyleFromDates(datePickerDayIsWeekend, date);
date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));

this.addStyleToDates(customeDatePicker, date);
this.getElement().getStyle().setBackgroundColor(red);

this.removeStyleFromDates(datePickerDayIsWeekend, date);
date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));

this.addStyleToDates(customeDatePicker, date);
this.getElement().getStyle().setBackgroundColor(red);
this.removeStyleFromDates(datePickerDayIsWeekend, date);
date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));

this.addStyleToDates(customeDatePicker, date);
this.getElement().getStyle().setBackgroundColor(red);
this.removeStyleFromDates(datePickerDayIsWeekend, date);
date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));
Window.alert(itjay rakh);


}


}

the entry class

import java.util.Date;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ShowRangeEvent;
import com.google.gwt.event.logical.shared.ShowRangeHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.datepicker.client.DatePicker;

/**
 * Entry point classes define codeonModuleLoad()/code.
 */
public class Gwtproj implements EntryPoint {



/**
 * The message displayed to the user when the server cannot be
reached or
 * returns an error.
 */
private static final String SERVER_ERROR = An 

Need to store a hashmap in memory to keep the counters for different user

2011-11-02 Thread Waqas Sadiq
Hi,

I am working on storing different user counters in memory at
application level (not database) and to have  counters to atmost 3.

I developed this code using a singleton class with hashmap to store a
key value pair of user id and and it's counter and time.

After initial, i was using this singleton class on client side, it
worked fine for counters but when browser was refreshed, a new
singleton object was created.

I searched, and come to know that for security reason, javascript
don't use shared objects, so i moved it to rpc call and make it server
side object to overcome it, but when i tested it again, on refresh new
object is created and data lost.

I also tested the static hashmap to hold the data for application
scope, but it has almost the same behavior, once refreshed the
browser, its reset and old data is lost in it. It little different
behavior from normal java web apps where we follow this approach.

Does any one know how can i keep object at application scope in gwt ?

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



opening new window in another tab in IE8

2011-06-05 Thread Waqas Sadiq
When I click on a link, it opens in new tab in Firefox and Chrome but in IE8 it
opens in new window, I want the same functionality for Internet Explorer 8.
Please guide me how can i do that using GWT ?

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.