Hi.

I try to read and write from and to local files.
I use an AppletLauncher as requestet, but i still get the above error message.
All the jars are signed.

I can open URLs, so i think the browser service works well.
So whats the problem?

See th source code in the atachment.

Regards
Armin Kurz



--
Armin Kurz
Entwicklung

Büro Süd:
E/B/D Integration GmbH
Hauptstr. 67
82327 Tutzing

Tel: +49 (8158) 9 0766-0
Fax: +49 (8158) 9 0766-99

[EMAIL PROTECTED]
http://www.ebd-integration.de
/**
 * 
 */
package client;

import javax.swing.UIManager;

import com.ulcjava.base.client.ClientEnvironmentAdapter;
import com.ulcjava.base.shared.internal.ThrowableUtilities;
import com.ulcjava.base.trusted.AllPermissionsBrowserService;
import com.ulcjava.base.trusted.AllPermissionsFileService;
import com.ulcjava.environment.applet.client.DefaultAppletLauncher;

/**
 * @author armin.kurz
 *
 */
public class GUITestAppletLauncher extends DefaultAppletLauncher
{
        static
        {
                setLookAndFeel();
        }

        public void init()
        {
                super.init();
                ClientEnvironmentAdapter.setFileService(new 
AllPermissionsFileService());               
                ClientEnvironmentAdapter.setBrowserService(new 
AllPermissionsBrowserService());
                setLookAndFeel();
        }


    private static void setLookAndFeel()
    {
        try
        {
                
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                // 
UIManager.setLookAndFeel("org.gtk.java.swing.plaf.gtk.GtkLookAndFeel");         
     
        }
        catch (Exception e)
        {
                throw new RuntimeException("Unable to set Look & Feel : " + 
ThrowableUtilities.toString(e));
        }
    }
}
/**
 * 
 */
package server;

import gui.MainTabbedPane;
import gui.MyFileUploadBoxPane;

import com.ulcjava.base.client.ClientEnvironmentAdapter;
import com.ulcjava.base.trusted.AllPermissionsBrowserService;
import com.ulcjava.base.trusted.AllPermissionsFileService;
import com.ulcjava.environment.applet.application.ULCAppletPane;
import com.ulcjava.environment.applet.development.AppletDevelopmentRunner;

/**
 * @author armin.kurz
 *
 */
public class GUITestEmbeddedApplet extends GUITestApplication {
        
    public void start()
    {
        ULCAppletPane ulcAppletPane = ULCAppletPane.getInstance();
        ulcAppletPane.setName("ULCAppletPane");
        // ulcAppletPane.add(new MainTabbedPane(null));
        ulcAppletPane.add(new MyFileUploadBoxPane(null));
        ulcAppletPane.setVisible(true);         
        }

        /**
         * @param args
         */
        public static void main(String[] args) throws Exception
        {
                
AppletDevelopmentRunner.setApplicationClass(GUITestEmbeddedApplet.class);
                // AppletDevelopmentRunner.setUseGui(true); // open graphical 
user interface            
                AppletDevelopmentRunner.main(args);             
                ClientEnvironmentAdapter.setBrowserService(new 
AllPermissionsBrowserService());
                ClientEnvironmentAdapter.setFileService(new 
AllPermissionsFileService());                               
        }
}
/**
 * 
 */
package gui;

import java.io.InputStream;

import com.ulcjava.base.application.ClientContext;
import com.ulcjava.base.application.ULCBoxPane;
import com.ulcjava.base.application.ULCButton;
import com.ulcjava.base.application.AbstractAction;
import com.ulcjava.base.application.ULCDialog;
import com.ulcjava.base.application.ULCLabel;
import com.ulcjava.base.application.ULCWindow;
import com.ulcjava.base.application.event.ActionEvent;
import com.ulcjava.base.application.util.IFileLoadHandler;
import com.ulcjava.base.shared.FileChooserConfig;

/**
 * @author armin.kurz
 *
 */
public class MyFileUploadBoxPane extends ULCBoxPane {

        private ULCButton uploadButton = null;
        private final ULCWindow m_parentWindow;

        private final class UploadActionListener implements 
com.ulcjava.base.application.event.IActionListener {
                public void actionPerformed(
                                com.ulcjava.base.application.event.ActionEvent 
e) {

                        FileChooserConfig fcConfig = new FileChooserConfig();
                fcConfig.setDialogTitle("Datei zum Upload auswählen");
                //fcConfig.addFileFilterConfig(new 
FileChooserConfig.FileFilterConfig(new String[]{".rep"}, "report files 
(*.rep)"));
                //fcConfig.addFileFilterConfig(new 
FileChooserConfig.FileFilterConfig(new String[]{".*"}, ""));         
                ClientContext.loadFile(new IFileLoadHandler() {
                        public void onSuccess(InputStream in, String filePath)
                        {
                                // read the report from the input stream and 
process it
                                 ULCDialog modalDialog = new ULCDialog(
                                                 
MyFileUploadBoxPane.this.m_parentWindow,  // parent window
                                         "Success",     // title
                                         true);              // modal           
  

                                 modalDialog.setSize(400, 400);
                                 modalDialog.add(new ULCLabel("Die Datei: " + 
filePath + " wurde geöffnet."));
                                 modalDialog.setVisible(true);                  
         
                        }
                        public void onFailure(int reason, String description)
                        {
                                // show an alert informing the operation has 
failed
                                 ULCDialog modalDialog = new ULCDialog(
                                                 
MyFileUploadBoxPane.this.m_parentWindow,  // parent window
                                         "Failure",     // title
                                         true);              // modal
                                 
                                 modalDialog.setSize(400, 400);
                                 
                                 String reasonString = null;
                                 switch(reason)
                                 {
                                 case CANCELLED:
                                         reasonString = "Abbruch durch den 
Benutzer";
                                         break;
                                 case FAILED:
                                         reasonString = "Aktion fehlgeschlagen";
                                         break;
                                 default:
                                         reasonString = "Unbekannter Fehler";
                                         break;
                                 }

                                 String messageString = "Datei konnte nicht 
geöffnet werden: " + reasonString + ": " + description;
                                 modalDialog.add(new ULCLabel(messageString));  
                                 modalDialog.setVisible(true);                  
                                         
                                
                        }
                }, fcConfig, MyFileUploadBoxPane.this);                         
                
                }
        }


        public MyFileUploadBoxPane(final ULCWindow parentWindow) {
                super();
                this.m_parentWindow = parentWindow;
                initialize();
        }

        /**
         * This method initializes MyFileUploadBoxPane
         * 
         * @return void
         */
        public void initialize() {
        this.setPreferredSize(new 
com.ulcjava.base.application.util.Dimension(852,631));
        this.set(0, 0, 1, 1, com.ulcjava.base.shared.IDefaults.BOX_LEFT_CENTER, 
getUploadButton());
        }

        /**
         * This method initializes uploadButton 
         *      
         * @return com.ulcjava.base.application.ULCButton       
         */
        private ULCButton getUploadButton() {
                if (uploadButton == null) {
                        uploadButton = new ULCButton();
                        uploadButton.setText("Datei hochladen");
                        uploadButton
                                        .addActionListener(new 
UploadActionListener());
                }
                return uploadButton;
        }

}  //  @jve:decl-index=0:visual-constraint="10,10"
Title: Ultra Light Client: GUI Test
<%! private boolean needsAppletTag(String userAgent) { return userAgent.indexOf("Mac") != -1 && (userAgent.indexOf("MSIE") != -1 || userAgent.indexOf("Safari") != -1); } %> <% String applicationUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/GUITest-embedded-applet.ulc"; if (!needsAppletTag(request.getHeader("User-Agent"))) { %> Your browser does not support JDK 1.4 or higher for applets. <% } else { %> "> Your browser does not support JDK 1.4 or higher for applets. <% } %>

Reply via email to