Re: gwt httpclient and json

2009-10-09 Thread Marcelo Emanoel B. Diniz

with RequestBuilder can you only contact the server that the
application is on... but since you are using json as data interchange
format
you can use the json padding technique and can contact any server :D

http://code.google.com/webtoolkit/articles/using_gwt_for_json_mashups.html

On Oct 9, 10:37 am, Gasparoff gaspa...@gmail.com wrote:
 Hi guys,

 I just started playing with GWT (found it very nice :),
 so yes, my questions may be nooby, sorry for that ;)

 After some tutorials I wanted to create simple app
 that will retrieve json data (i thought about twitter api -
 because it gives nice responses in many formats)

 So basically i would like to make call to Twitter API,
 and display obtained data (json).

 I thought about gwt httpclient request, but havent found
 mauch useful examples of getting url with it.

 Can you please suggest me any nice tutorials about that,
 or write some code? It would be incredibly helpful.

 thanks in advance
 G.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Wiping application memory on the broser after user logout or window/tab close

2009-10-07 Thread Marcelo Emanoel B. Diniz

as said earlier there's no way to trigger the browser's garbage
collector but you could help him and set to null some references...
unregister any handlers you have... and so on :) this should point to
the garbage collector that it should free that memory hope it helped
you

On Oct 7, 8:32 am, francescoNemesi nem...@yahoo.com wrote:
 Thanks, I knew that... I ìm looking for workarounds.

 Thanks again

 On Oct 7, 9:07 am, alex.d alex.dukhov...@googlemail.com wrote:



  You can't trigger browser's garbage collector.

  On Oct 7, 7:23 am, francescoNemesi nem...@yahoo.com wrote:

   Hi,

   my application has a logout button. When the user logs out the
   application invalidates and cleans up the HttpSession on the server
   side. I would like to do the same on the client, i.e. I would like to
   clean up all (or as much as possible) the memory used by the
   application on the client side.

   Is this possible? Any ideas or best practice on how to do this?

   Any help is greatly appreciated. Thanks

   Kind Regards,
   Francesco
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: problem in storing and retreiving multi lingual data

2009-08-26 Thread Marcelo Emanoel B. Diniz

on eclipse you can change the encoding of your project... try it.. you
should always use only one encoding... for everything... or else you
end up with problems like this... try to set your project encoding to
utf-8 and see if it solve your problem :)

On Aug 27, 2:33 am, vasem want want.va...@gmail.com wrote:
 Hi all,

 we are developing a multi lingual application which has
 oracle as the DB, the problem is that when user enters
 the data it is stored and retrieved as a junk data
 somehow somewhere the uni coding is being
 encoded by gwt or somewhere,

 we tried the same stuff through oracle forms and it is
 storing the multilingual data correctly (in this case we tried chinese)

 does anyone have a clue on this

 cheers

 vas
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Plain OO question

2009-08-25 Thread Marcelo Emanoel B. Diniz

I would implement something diferent...
each Course would have a CourseCalculator for instance... and then
diferent types of calculator could be injected...

public interface CourseCalculator {

 public Double calculate();

}

public class Course {

private CourseCalculator calculator;

public Course(){
  //some init code...
}

public void setCalculator(CourseCalculator calculator) {
//bla bla bla...
}

public CourseCalculator getCalculator(){
//bla bla bla...
}
}


public class LimitedTimeCalculator() implements CourseCalculator{
  public LimitedTimeCalculator(Date initialDate, Date finalDate){
  //init everything...
  }

  public Double calculate(){
Date today = new Date();
if(inRange(today, initialDate, finalDate)){
   //   return price with discount :D
}
//return normal price...
  }
}

public class LotsOfCoursesCalculator implements CourseCalculator {


   public LotsOfCoursesCalculator(ListCourse courses){
   // you know what this should do...
   }


   public Double calculate(){
   if (courses.size()  min){
   //return price with discount...
   }
   //return normal price...
   }
}


Enjoy it :D


On Aug 25, 6:27 am, Alessandro Loche alessandro.lo...@gmail.com
wrote:
 You have that kind of information on entity course, haven't you? After you
 evaluate the conditions, if the result is true (that's means the conditions
 have verified) you apply the evaluation in your rule entity. A rule should
 knows hot to do if the conditions evaluation is true.

 And the only wrong thing is my English.
 (Smile).

 --
 From: Dalla dalla_man...@hotmail.com
 Sent: Tuesday, August 25, 2009 10:07 AM
 To: Google Web Toolkit google-web-toolkit@googlegroups.com
 Subject: Re: Plain OO question





  That seems like a good solution. But to me something seems to be
  missing.
  Let´s say I create a DiscountPriceRule, with a DateRangeCondition.

  How would I apply this to the Course object? It doesn´t (and shouldn
  ´t?) contain any information about when it was bought, how many and so
  on.
  It seems like I would need yet another class, somehing like an
  CourseOrder that would contain this kind of information,
  and that the interface DiscountPriceRule maybe should look like this?

  class CourseOrder {
     Course course;
     Date OrderDate;
     Integer orderAmount
  }

  interface Rule {
     boolean evaluateConditions( CourseOrder c );
     SetCondition getConditions();
     void setConditions( SetCondition conditions );
     EvaluationResult apply ( CourseOrder c );
  }

  Or am I wrong again? :-)

  On 25 Aug, 04:03, Alessandro Loche alessandro.lo...@gmail.com
  wrote:
  You should think in terms of Rules and Conditions.

  interface Rule {
      boolean evaluateConditions( Course c );
      SetCondition getConditions();
      void setConditions( SetCondition conditions );
      EvaluationResult apply ( Course c );

  }

  interface Condition {
      isTrue( Course c);

  }

  Any special offer implements Rule and has one or more Conditions. A
  concrete
  rule call evaluateCondition for each conditions it has. If true, apply
  the
  result trasformation.
  In your case, the rule is the same, something like DiscountPriceRule. But
  the conditions change. One condition is about date range, another one is
  on
  totatal course amount.

  Any condition evaluates itself in a course context, and you can implement
  the apply() method as a Visitor. The EvaluationResult can be a new price
  or
  saving.

  Regards.
  --
  From: Dalla dalla_man...@hotmail.com
  Sent: Monday, August 24, 2009 10:39 PM
  To: Google Web Toolkit google-web-toolkit@googlegroups.com
  Subject:PlainOOquestion

   Hi all

   This is probably a pretty basicOOquestion, but here goes:
   I have a simple Course class, containing a course ID, course name,
   course price etc.

   I´m looking for a good way to implement different types of special
   offers on these courses,
   like buy five courses, get 10% off or from September 1 to September
   15, get 5% off this course.

   What would be the best way to do this?
   I was thinking something like

   interface SpecialOffer {
      double getSpecialOfferPrice(Course c); //Return new price
      double getSpecialOfferSavings(Course c); //Return % saved
   }

   class BuyManyOffer implements SpecialOffer {

       Integer buyManyLimit;

       public LimitedTimeOffer(Date date) {
          this. buyManyLimit = date;
       }

       public double getSpecialOfferPrice(Course c) {
            //return something;
       }
       double getSpecialOfferSavings(Course c) {
           return somethingElse;
       }
   }

   class LimitedTimeOffer implements SpecialOffer {

      

Re: Is there a way to add a mouselistener to a treeitem that has these properties?

2009-07-09 Thread Marcelo Emanoel B. Diniz

Have you tried to wrapp the treeitem and then add the mouse listener
to the wrapper? it should work like you want :)

On Jul 9, 3:32 pm, ProtoLD protosh...@gmail.com wrote:
 Is there any response on this?  Working as intended...somehow?  Even
 though it doesn't work?

 On Jul 8, 4:03 pm, ProtoLD protosh...@gmail.com wrote:



  I need to add a mouselistener to my tree items that pops up a mini-
  menu to the side of the tree item.  On this menu there will be 3 icons
  that are clickable with different actions.  I'm not asking for someone
  to write this for me, I've done it about 30 times or so, but cannot
  get around IE/GWT browser issues.  Honestly the IE issue is more
  important.  The problem is this, if I apply the mouselistener to the
  table, it considers it a mouseout when moving over spaced out areas
  between the name and the new icons.  An example is this:

  (dashes are spaces)

  ENCOMPASSING FLEXTABLE
  { XXXNAMEXXX---ICON1---ICON2---ICON3 }

  If I move from name to icon1 it acts as a mouseout in IE and the
  gwt browser (not in firefox, but I need IE for the job).  This is
  using the sinkEvents method on the encompassing table.  The same
  applies if I try doing it to the name icon alone, although for more
  obvious reasons.  The second problem is, the Button class for whatever
  reason doesn't have a mouselistener, and the HTML class doesn't seem
  to respond nearly as well to clickevents after it's been reset a few
  times (because the icons should vanish when you go to another element
  or outside the tree).

  I've looked at the Google quick-tips and tried applying the same
  knowledge here, but nothing seems to deal with the problems of adding
  multiple items on the same tree item as you mouseover and still having
  the mouselistener mouseover and mouseout events working
  correctly.  If anyone has a solution for this problem...even (ugh)
  upgrading to 1.6 (I'm running 1.5.x), I will take it at this point.

  The ONLY thing I have gotten to work even halfway decently is a timer
  that makes them disappear after two seconds, but this was deemed
  unacceptable unfortunately.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Runtime.exec()

2009-07-06 Thread Marcelo Emanoel B. Diniz

Your only way to do it is through signed applets :)

there is a project that helps to integrate applets and gwt

http://code.google.com/p/gwtai

On Jul 6, 4:28 am, brett.wooldridge brett.wooldri...@gmail.com
wrote:
 You can't do it, dude.  There is no way out of the JavaScript sandbox
 unless
 you write a native plugin that the user agrees to install.  If that
 were not the
 case, what would prevent a website from (for example) using JavaScript
 to
 execute delete commands on all of your files?

 -Brett

 On Jul 5, 9:34 pm, giovaneoce...@hotmail.com



 giovaneoce...@hotmail.com wrote:
  I can't because i have to execute the command on the client side, not
  server side.
  The command that i have to exec is tracert, that make the tracerouting
  from client.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: same-origin security restriction

2009-06-28 Thread Marcelo Emanoel B. Diniz

the problem is with the port that serves the authentication code...
SOP takes to account server and port you'll have to write a proxy
or change the port of the service...

On Jun 27, 3:48 am, Surya master...@gmail.com wrote:
 I have tomcat server running on port 6828. I have GWT hosted mode
 running on jetty .

 When i try to access tomcat on 6828 for spring authentication using
 the code :::

 RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
                 builder.setHeader(Content-Type, application/x-www-form-
 urlencoded);
                 builder.setHeader(Expires,0);

                 try {

                         builder.sendRequest(postData, this);
                 } catch (RequestException e) {
                         console.addMessage(Exception during authentication  
 + e.getMessage
 ());
                 }

 I get the following exception on the builder.sendRequest
 (postData,this) line.

 com.google.gwt.http.client.RequestPermissionException: The 
 URLhttp://localhost:6828/xx/j_spring_security_checkis invalid or
 violates the same-origin security restriction
 Detailed Message : Access is denied.

 I am really running short of time. Some one please help me out.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Communicate w/ existing GWT-RPC service

2009-04-29 Thread Marcelo Emanoel B. Diniz

To simple reuse the services classes and the vo classes I would
separate them in a diferent module...
export them...(with the .java) and reuse on another module... the main
point in my opinion would be to
configurate the service url...

On Apr 28, 3:30 pm, JoeB joe.berm...@gmail.com wrote:
 I get the general idea, but I'm a little unclear on implementing the
 non-GWT interface in parallel to GWT-RPC.  The beauty of GWT-RPC is
 that the ValueObjects I create in my client package are automatically
 serialized/deserialized by GWT, and my client code and server code are
 developed with the same Java class.  If I want to make the same
 ValueObjects accessible via a different interface (e.g. REST, SOAP,
 etc), then that means I'll have to transform them into some protocol
 on the wire (e.g. convert to XML or JSON).  The tricky part is that
 the ValueObject classes are defined in the GWT client package, but
 they need to be modified in some way to perform this server-side
 transformation for a different interface, and that transformation code
 shouldn't leak into the GWT client.  I guess what I'm saying is that
 it seems like a problem that the ValueObjects are defined in the
 client package because they need to be used for a non-GWT interface in
 the server.  Know what I mean?

 -- Joe
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Help! My Generators don't work for Web Mode :(

2009-03-31 Thread Marcelo Emanoel B. Diniz
Hi Sumit,
The GWT.getTypeName() has been deprecated in favor of getClass().getName().
I was thinking about... the mechanism of binding that I implemented is based
on annotations... based on what I know the annotations are stripped out by
the compiler... is it possible that the compiler remove them before the call
to my generator??

On Mon, Mar 30, 2009 at 9:49 PM, Sumit Chandel sumitchan...@google.comwrote:

 Hi Marcelo,
 Something just struck me. What happens if you use GWT.getTypeName(binded)
 instead of  label.setText(binded.getClass().getName())?

 Hope that helps,
 -Sumit Chandel

 On Thu, Mar 26, 2009 at 6:42 PM, Marcelo Emanoel B. Diniz 
 marceloeman...@gmail.com wrote:


 Hi Sumit here are the generator rule and the generator class:

 rule:
generate-with
 class=br.com.gwt.symbiosis.rebind.generator.BoundModelGenerator
when-type-assignable
 class=br.com.gwt.symbiosis.client.bind.BindingModel /
/generate-with

generate-with
 class=br.com.gwt.symbiosis.rebind.generator.BoundViewGenerator
when-type-assignable
 class=br.com.gwt.symbiosis.client.bind.BindingView /
/generate-with

 View generator class:
 public class BoundViewGenerator extends Generator {

private static final String MODEL_INTERFACE =
 br.com.gwt.symbiosis.client.bind.BindingModel;
private static final String SOURCES_PROPERTY_CHANGES =
 br.com.gwt.symbiosis.client.event.SourcesPropertyChanges;

public String generate(TreeLogger logger, GeneratorContext context,
String typeName) throws UnableToCompleteException {

TypeOracle oracle = context.getTypeOracle();
JClassType type = oracle.findType(typeName);
JClassType modelType = oracle.findType(MODEL_INTERFACE);

BoundModelClass modelClass = new BoundModelClass(type);
modelClass.setModelType(modelType);
BindTypeManager bindManager =
 BindTypeManager.getInstance();

for(JField field : type.getFields()){
JClassType fieldClass =
 field.getType().isClassOrInterface();

for(String className :
 bindManager.getAvailableTypes()){
JClassType bindClass =
 oracle.findType(className);
if(fieldClass.isAssignableTo(bindClass)){
for(ListenerTemplate template :
 bindManager.getTemplatesForType
 (className)){

  modelClass.associateFieldListener(field, template);
}
}
}
}

String packageName = modelClass.getPackageName();
String newLine = System.getProperty(line.separator);

String finalViewClassName =
 Bound_+modelClass.getClassName()
 +_View;
PrintWriter printer = context.tryCreate(logger,
 packageName,
 finalViewClassName);

if (printer == null){
System.out.println(printer == null);
return null;
}

ClassSourceFileComposerFactory composer = null;
composer = new ClassSourceFileComposerFactory(packageName,
 finalViewClassName);
composer.setSuperclass(type.getSimpleSourceName());
composer.addImport(SOURCES_PROPERTY_CHANGES);

SourceWriter sourceWriter =
 composer.createSourceWriter(context,
 printer);

Bound_ViewTemplate template =
 Bound_ViewTemplate.create(newLine);
System.out.println(template.generate(modelClass));
sourceWriter.println(template.generate(modelClass));


context.commit(logger, printer);

return packageName + . + finalViewClassName;
}
 }

 Model generator class:

 public class BoundModelGenerator extends Generator {

private static final String SOURCES_PROPERTY_CHANGES =
 br.com.gwt.symbiosis.client.event.SourcesPropertyChanges;
private static final String PROPERTY_CHANGE_SUPPORT =
 br.com.gwt.symbiosis.client.event.PropertyChangeSupport;
private static final String PROPERTY_CHANGE_LISTENER =
 br.com.gwt.symbiosis.client.event.PropertyChangeListener;
private static final String BOUND_PREFIX = Bound_;

public String generate(TreeLogger logger, GeneratorContext context,
String typeName) throws UnableToCompleteException {

TypeOracle oracle = context.getTypeOracle();
JClassType type = oracle.findType(typeName);

BoundModelClass modelClass = new BoundModelClass(type);
String generatedClass = new Bound_ModelTemplate().generate
 (modelClass);
System.out.println(generatedClass);

String packageName = modelClass.getPackageName();
String

Re: Help! My Generators don't work for Web Mode :(

2009-03-26 Thread Marcelo Emanoel B. Diniz
);

SourceWriter sourceWriter = composer.createSourceWriter
(context, printer);
sourceWriter.println(generatedClass);
context.commit(logger, printer);
return packageName + . + generatedClassName;
}
}

I'll put the code at the project's site: http://code.google.com/p/glue4gwt

The strange thing is that when the compile button is pressed... the
generator is called... but the code generated isn't used...
anyway thanks for the help :)

On Mar 24, 12:23 pm, Sumit Chandel sumitchan...@google.com wrote:
 Hi Marcelo,
 It might help to post up the generator rule and especially the generate()
 implementation that is being used to generate the FormView generated type.
 My thought is that whatever is going on in there is depending on rules that
 might not hold true in web mode.

 Cheers,
 -Sumit Chandel

 On Thu, Mar 19, 2009 at 2:46 PM, Marcelo Emanoel B. Diniz 

 marceloeman...@gmail.com wrote:

  this is my entry point

  package br.com.gwt.symbiosis.client;

  import br.com.gwt.symbiosis.client.mock.FormView;

  import com.google.gwt.core.client.EntryPoint;
  import com.google.gwt.core.client.GWT;
  import com.google.gwt.user.client.ui.Label;
  import com.google.gwt.user.client.ui.RootPanel;

  public class Symbiosis implements EntryPoint {

         public void onModuleLoad() {
                 FormView binded = GWT.create(FormView.class);
                 Label label = new Label();
                 label.setText(binded.getClass().getName());
                 RootPanel.get().add(binded);
                 RootPanel.get().add(label);
         }
  }

  on hosted mode the label text is
  br.com.gwt.symbiosis.client.mock.Bound_FormView_View wich is in fact
  what is expected to be...
  but at web mode the label text is
  ''br.com.gwt.symbiosis.client.mock.FormView which in turn is not what
  I need... and doesn't work as expected either... :(

  by the way... there's no complain on the console

  On Mar 19, 3:53 pm, Marcelo Emanoel marceloeman...@gmail.com wrote:
   Hi guys I have a problem with generators... I've manage to do 2
   generators and they work fine on hosted mode however they don't
   work when I compile code to web mode :( What I'm trying to acomplish
   is to build an API for binding... An important thing is that my
   generators work on hosted mode and they are called when the code start
   is compiled
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Help! My Generators don't work for Web Mode :(

2009-03-19 Thread Marcelo Emanoel B. Diniz

this is my entry point

package br.com.gwt.symbiosis.client;

import br.com.gwt.symbiosis.client.mock.FormView;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;

public class Symbiosis implements EntryPoint {

public void onModuleLoad() {
FormView binded = GWT.create(FormView.class);
Label label = new Label();
label.setText(binded.getClass().getName());
RootPanel.get().add(binded);
RootPanel.get().add(label);
}
}

on hosted mode the label text is
br.com.gwt.symbiosis.client.mock.Bound_FormView_View wich is in fact
what is expected to be...
but at web mode the label text is
''br.com.gwt.symbiosis.client.mock.FormView which in turn is not what
I need... and doesn't work as expected either... :(

by the way... there's no complain on the console

On Mar 19, 3:53 pm, Marcelo Emanoel marceloeman...@gmail.com wrote:
 Hi guys I have a problem with generators... I've manage to do 2
 generators and they work fine on hosted mode however they don't
 work when I compile code to web mode :( What I'm trying to acomplish
 is to build an API for binding... An important thing is that my
 generators work on hosted mode and they are called when the code start
 is compiled
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: How i found the real name of a obfuscated function? How i find the code lines?

2009-03-17 Thread Marcelo Emanoel B. Diniz

You can disable obfuscation by putting -style PRETTY on the compiler
command line

On Mar 17, 3:06 pm, MN nietz...@gmail.com wrote:
 I have a error message from a user. but i have only some obfuscated
 code for the stacktrace.

 is there a change to get the realnames method names from this?

 is there some index file to see the function in line 123 is the real
 method name xyz or an indexfile with the obfuscated method name and
 the real method name?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Changing CSS dynamically in GWT code

2009-03-17 Thread Marcelo Emanoel B. Diniz

Can't you just change the style name? something like:

include a all-in-one css:

change the xpto-class-Style to xyzu-classStyle acording to the user
role..?


On Mar 17, 12:07 pm, Sush sush.r...@gmail.com wrote:
 Hi,

 First off my apologies, if this is the duplicate topic.

 I need to change the style of the panel based on the URL parameter
 which contains the syle sheet name (css/LoginMenu.css)

 For differrent users, there would be different set of stylesheets.

 I have added below JSNI code in my LoginPanel.java file . In the
 constructor of this class, I make a call to the below JSNI, before
 adding the panel to the RootPanel. However it throws NPE

 public static native void loadCSS(String url) /*-{
     var fileref=document.createElement(link);
     fileref.setAttribute(rel,stylesheet);
     fileref.setAttribute(type,text/css);
     fileref.setAttribute(href,url);
     $doc.getElementsByTagName(head)[0].appendChild(fileref);

 }-*/;

 I tried below code, this doesn't override or replace the default css
 file in LoginMenu.gwt.xml

 private native void loadCSS1 (String cssHref) /*-{
         alert(cssHref);
          document.write('link rel=stylesheet type=text/css href=' +
 cssHref + '');
         }-*/;

 I would highly appreciate if you could provide me more information or
 the already discussed links on this topic.

 Thank you.

 Regards,
 -Sushama
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Custom widget theme?

2009-03-16 Thread Marcelo Emanoel B. Diniz

I think it can't know... but you can have a method that asks the user
which one he's using... for example:

MyWidgetLibrary.setTheme(anyTheme);

and that should change the styleName of the widget :)

On Mar 15, 11:08 am, Riyaz Mansoor riyaz.mans...@gmail.com wrote:
 How would I do this without a - say - ListBox?

 My widget is being used in another application and that user might
 choose to do it in Standard, Dart or other theme. How can my widget
 know what theme is being used and to apply the respective styles?

 On Mar 12, 4:36 pm, Sean slough...@gmail.com wrote:

  Sure, have a listener attached to a drop down box or menu or a button,
  some way for the user to select the theme. And on select
  use .removeStyleName(style) to remove the old style and .addStyleName
  (style) to add the new style name. If this is the only style you have
  applied to the Widget you could just use .setStyleName(style) to
  remove the old ones and use this new style.

  On Mar 11, 11:44 pm, Riyaz Mansoor riyaz.mans...@gmail.com wrote:

   Have widget that I have stylized using CSS. But I have no idea how to
   theme this widget. I want some CSS differences to be seen by the user,
   when different themes are selected.

   Can this be done?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---