FAQTable of Contents:Q: How to execute arbitrary Javascript on the Client Side A: hi dominique and benjamin, final StringBuffer script = new StringBuffer(); script.append("var x = window.open('http://www.google.de','my_window',") .append("'width=800,height=600,toolbar=0,menubar=0,location=0,") .append("status=1,resizable=1,scrollbars=1'); x.focus();"); final SButton open = new SButton("Open window!"); open.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ScriptManager.getInstance().addScriptListener( new OnPageRenderedScript(script.toString())); } }); SForm formPanel = new SForm(); formPanel.add(open);
A: 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 actionPerformed() method. Than you include the following code sample. It is executed every time the GUI event is triggered. File file; 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. Q: How do i get rid of the wingS default style for buttons? A: Quick answer: Try button.setStyle(null). 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. 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 On initialisation the current PLAF assign the component class name as CSS class name (So SButtons will render <button … class="SButton">). This default CSS styles are predefined in the default wings2 style. 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. Q: For what do I need SDefaultBorder? A: 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 A: Either retrieve the current CVS version or add the following statement to the webapp context: <Context ...>
<Manager className="org.apache.catalina.session.PersistentManager"
saveOnRestart="false"/>
</Context>
Tomcat will print following Output: No Store configured, persistence disabled Here is the solution for Glassfish: You must have an sun-web.xml configuration file into the WEB-INF folder of your .war application package configured in this way: <sun-web-app> More details on Jan Luehe's blog 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. Q: How to hide the browsers context menu for SPopupMenu? A: If you use Firefox, make sure the option Preferences > Content > Enable Javascript > Advanced > Disable or replace context menus is checked, so that context menus are not hidden by the browsers default context menu. |