<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://purl.org/atom/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="0.3">
  <title>FAQ</title>
  <link rel="alternate" href="http://wingsframework.org/cms" />
  <tagline>FAQ</tagline>
  <entry>
    <title>How to execute arbitrary Javascript on the Client Side</title>
    <link rel="alternate" href="http://wingsframework.org/cms/faq/permalink/2007/8/1/132838.html" />
    <author>
      <name>Christian Kochs</name>
    </author>
    <modified>2007-08-01T11:28:38Z</modified>
    <issued>2007-08-01T11:28:38Z</issued>
    <summary type="text/html" mode="escaped">&lt;p&gt;hi dominique and benjamin, &lt;br /&gt;&#xD;
&lt;br /&gt;&#xD;
even though our script manager is still quite rudimentary, it does in fact allow you to execute arbitrary javascript on the client side. in org.wings.plaf.css.script there are 2 simple classes dealing with this: &lt;br /&gt;&#xD;
&lt;br /&gt;&#xD;
- OnPageRenderedScript &lt;br /&gt;&#xD;
- OnHeadersLoadedScript &lt;br /&gt;&#xD;
&lt;br /&gt;&#xD;
both of them implement the ScriptListener interface and can therefore be  added to the script manager. scripts encapsulated in the first class get executed as soon as the page/dom is rendered/updated completely. scripts encapsulated in the second class get executed as soon as all js-headers have been loaded completely. so in your case something like this should work:&lt;/p&gt;&#xD;
&lt;div class="code"&gt;&lt;br /&gt;&#xD;
final StringBuffer script = new StringBuffer(); &lt;br /&gt;&#xD;
script.append(&amp;quot;var x = window.open('&lt;a class="moz-txt-link-freetext" href="http://www.google.de%27,%27my_window/"&gt;http://www.google.de','my_window&lt;/a&gt;',&amp;quot;) &lt;br /&gt;&#xD;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .append(&amp;quot;'width=800,height=600,toolbar=0,menubar=0,location=0,&amp;quot;) &lt;br /&gt;&#xD;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .append(&amp;quot;status=1,resizable=1,scrollbars=1'); x.focus();&amp;quot;); &lt;br /&gt;&#xD;
&lt;br /&gt;&#xD;
final SButton open = new SButton(&amp;quot;Open window!&amp;quot;); &lt;br /&gt;&#xD;
open.addActionListener(new ActionListener() { &lt;br /&gt;&#xD;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void actionPerformed(ActionEvent e) { &lt;br /&gt;&#xD;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ScriptManager.getInstance().addScriptListener( &lt;br /&gt;&#xD;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new OnPageRenderedScript(script.toString())); &lt;br /&gt;&#xD;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;&#xD;
}); &lt;br /&gt;&#xD;
SForm formPanel = new SForm(); &lt;br /&gt;&#xD;
formPanel.add(open);&lt;/div&gt;&#xD;
&lt;p&gt;&lt;br /&gt;&#xD;
furthermore, such scripts are transient since they are evaluated within the window context and not bound to any dom element (unless your script does this binding manually). hence you don't have to &amp;quot;remove&amp;quot; anything here, just use the above code. whenever the button is clicked the script is sent to the client and evaluated there. &lt;br /&gt;&#xD;
&lt;br /&gt;&#xD;
regards, &lt;br /&gt;&#xD;
stephan&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</summary>
    <dc:creator>Christian Kochs</dc:creator>
    <dc:date>2007-08-01T11:28:38Z</dc:date>
  </entry>
  <entry>
    <title>How to trigger a Download</title>
    <link rel="alternate" href="http://wingsframework.org/cms/faq/permalink/2007/6/25/085411.html" />
    <author>
      <name>Holger Engels</name>
    </author>
    <modified>2007-06-25T06:54:11Z</modified>
    <issued>2007-06-25T06:54:11Z</issued>
    <summary type="text/html" mode="escaped">&lt;p&gt;Let's assume you want to integrate a feature into your wingS GUI that enables the user to download a file by clicking some GUI element. You have to find the corresonding event listener and its &lt;tt&gt;actionPerformed()&lt;/tt&gt; method. Than you include the following code sample. It is executed every time the GUI event is triggered.&lt;/p&gt;&#xD;
&lt;div class="code"&gt;&#xD;
&lt;pre&gt;File file;&lt;br /&gt; // insert code to create a file on-the-fly or fetch the handle for an existing one // existing files can be located in directories that can't be reached by the user via URL&lt;br /&gt;FileResource resource = new FileResource(file);&lt;br /&gt; resource.setExternalizerFlags(resource.getExternalizerFlags() | ExternalizeManager.REQUEST);&lt;br /&gt; &lt;br /&gt; Map headers = new HashMap();&lt;br /&gt;headers.put(&amp;quot;Content-Disposition&amp;quot;, &amp;quot;attachment; filename=&amp;quot; + file.getName());&lt;br /&gt;resource.setHeaders(headers.entrySet());&lt;br /&gt; &lt;br /&gt; final ScriptListener listener = new JavaScriptListener(null, null, &amp;quot;location.href='&amp;quot; + resource.getURL() + &amp;quot;'&amp;quot;);SessionManager.getSession().getScriptManager().addScriptListener(listener);&lt;/pre&gt;&#xD;
&lt;/div&gt;&#xD;
&lt;p&gt;Note, that you don't need to create a file at all, if you have the data in memory already. In this case choose another derivate of SResource or implement your own resource, that generates the content on the fly.&lt;/p&gt;</summary>
    <dc:creator>Holger Engels</dc:creator>
    <dc:date>2007-06-25T06:54:11Z</dc:date>
  </entry>
  <entry>
    <title>How do i get rid of the wingS default style for buttons?</title>
    <link rel="alternate" href="http://wingsframework.org/cms/faq/permalink/2007/6/15/162951.html" />
    <author>
      <name>Christian Kochs</name>
    </author>
    <modified>2007-06-15T14:29:51Z</modified>
    <issued>2007-06-15T14:29:51Z</issued>
    <summary type="text/html" mode="escaped">&lt;p&gt;Quick answer: Try button.setStyle(null).&lt;/p&gt;&#xD;
&lt;p class="paragraph"&gt;Long answer: Overwrite/add a new CSS default style for buttons, wings 2 comes with a default CSS style sheet, which also styles the SButtons. Try the Web Developer Plugin, which is freely available for the FireFox browser, then you can live edit the style of the buttons.&lt;/p&gt;&#xD;
&lt;p class="paragraph"&gt;To ignore the Styles for SButton elements you could simply a) overwrite and modify the .SButton CSS declarations or b) apply a different/no css class name to SButtons&lt;/p&gt;&#xD;
&lt;p class="paragraph"&gt;On initialisation the current PLAF assign the component class name as CSS class name (So SButtons will render &amp;lt;button &amp;hellip; class=&amp;quot;SButton&amp;quot;&amp;gt;). This default CSS styles are predefined in the default wings2 style.&lt;/p&gt;&#xD;
&lt;p class="paragraph"&gt;You can either overwrite them by adding custom own styles, meaning registering a new CSS file as demonstrated in wingset demo or by applying antother/no style class to buttons.&lt;/p&gt;</summary>
    <dc:creator>Christian Kochs</dc:creator>
    <dc:date>2007-06-15T14:29:51Z</dc:date>
  </entry>
  <entry>
    <title>For what do I need SDefaultBorder?</title>
    <link rel="alternate" href="http://wingsframework.org/cms/faq/permalink/2007/6/15/162923.html" />
    <author>
      <name>Christian Kochs</name>
    </author>
    <modified>2007-06-15T14:29:23Z</modified>
    <issued>2007-06-15T14:29:23Z</issued>
    <summary type="text/html" mode="escaped">&lt;p&gt;Every component has the SDefaultBorder by default. It is installed by the CG on initialization. If a component has the default border associated, its border styling is determined by the rules in the stylesheet. If the border property is set to null, the component will be rendered without a border, no matter if the stylesheet says something different. If a certain SBorder implementation is applied, it will override the stylesheet rules&lt;/p&gt;</summary>
    <dc:creator>Christian Kochs</dc:creator>
    <dc:date>2007-06-15T14:29:23Z</dc:date>
  </entry>
  <entry>
    <title>How do I get rid of the Nullpointer Exceptions during redeployment of my wingS application in Tomcat?</title>
    <link rel="alternate" href="http://wingsframework.org/cms/faq/permalink/2007/6/15/162820.html" />
    <author>
      <name>Christian Kochs</name>
    </author>
    <modified>2007-06-15T14:28:20Z</modified>
    <issued>2007-06-15T14:28:20Z</issued>
    <summary type="text/html" mode="escaped">&lt;p class="paragraph"&gt;Either retrieve the current CVS version &lt;strong class="bold"&gt;or&lt;/strong&gt; add the following statement to the webapp context:&lt;/p&gt;&#xD;
&lt;div class="code"&gt;&#xD;
&lt;pre&gt;&amp;lt;Context ...&amp;gt;&#xD;
    &amp;lt;Manager className=&lt;span class="java-quote"&gt;&amp;quot;org.apache.catalina.session.PersistentManager&amp;quot;&lt;/span&gt; &#xD;
         saveOnRestart=&lt;span class="java-quote"&gt;&amp;quot;&lt;span class="java-keyword"&gt;false&lt;/span&gt;&amp;quot;&lt;/span&gt;/&amp;gt;&#xD;
&amp;lt;/Context&amp;gt;&lt;/pre&gt;&#xD;
&lt;/div&gt;&#xD;
&lt;p class="paragraph"&gt;Tomcat will print following Output: No Store configured, persistence disabled&lt;/p&gt;&#xD;
&lt;p class="paragraph"&gt;Here is the solution for Glassfish:&lt;/p&gt;&#xD;
&lt;p class="paragraph"&gt;You must have an sun-web.xml configuration file into the WEB-INF folder of your .war application package configured in this way:&lt;/p&gt;&#xD;
&lt;div class="code"&gt;&#xD;
&lt;pre&gt;&amp;lt;sun-web-app&amp;gt;    &lt;br /&gt; &amp;lt;session-config&amp;gt;      &lt;br /&gt;    &amp;lt;session-manager&amp;gt;        &lt;br /&gt;      &amp;lt;manager-properties&amp;gt;        &lt;br /&gt;          &amp;lt;property name=&lt;span class="java-quote"&gt;&amp;quot;sessionFilename&amp;quot;&lt;/span&gt; value=&lt;span class="java-quote"&gt;&amp;quot;&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;      &amp;lt;/manager-properties&amp;gt;      &lt;br /&gt;     &amp;lt;/session-manager&amp;gt;    &lt;br /&gt;   &amp;lt;/session-config&amp;gt;  &lt;br /&gt;&amp;lt;/sun-web-app&amp;gt;&lt;/pre&gt;&#xD;
&lt;/div&gt;&#xD;
&lt;p&gt;More details on &lt;span class="nobr"&gt;&lt;a href="http://blogs.sun.com/jluehe/entry/how_to_disable_persisting_of"&gt;Jan Luehe's blog&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p class="paragraph"&gt;Background: wingS dynamically tries to load and instantiate the PLAF (renderer) classes on session initialization and therefore consults the context class loader. If you stop your application Tomcat tries to serialized your session, hence the whole application state. If this failes (i.e. your classes are not fully serializable) the tomcat does not replace the classloader. So after refresh wingS only sees the outdated, old classlaoder which does no longer know the CG classes. We disabled the session serialization as a whole to avoid this in the future.&lt;/p&gt;</summary>
    <dc:creator>Christian Kochs</dc:creator>
    <dc:date>2007-06-15T14:28:20Z</dc:date>
  </entry>
</feed>

