001    package jmaster.jumploader.app;
002    
003    import jmaster.jumploader.jsface.api.IJSUploader;
004    import jmaster.jumploader.model.api.IModel;
005    import jmaster.jumploader.model.api.config.AppletConfig;
006    import jmaster.jumploader.model.api.config.UploaderConfig;
007    import jmaster.jumploader.model.api.config.ViewConfig;
008    import jmaster.jumploader.view.api.main.IMainView;
009    
010    /**
011     * IJumpLoaderApplet
012     * 
013     * @author timur
014     */
015    
016    public interface IJumpLoaderApplet {
017            //---------------------------------------------------------------
018            //      constants
019            //---------------------------------------------------------------
020            //
021            //      JavaScript callbacks
022            public static final String JS_CALLBACK_APPLET_INITIALIZED = "appletInitialized";
023            public static final String JS_CALLBACK_UPLOADER_FILE_ADDED = "uploaderFileAdded";
024            public static final String JS_CALLBACK_UPLOADER_FILE_REMOVED = "uploaderFileRemoved";
025            public static final String JS_CALLBACK_UPLOADER_FILE_MOVED = "uploaderFileMoved";
026            public static final String JS_CALLBACK_UPLOADER_FILE_STATUS_CHANGED = "uploaderFileStatusChanged";
027            public static final String JS_CALLBACK_UPLOADER_FILE_PARTITION_UPLOADED = "uploaderFilePartitionUploaded";
028            public static final String JS_CALLBACK_UPLOADER_FILES_RESET = "uploaderFilesReset";
029            public static final String JS_CALLBACK_UPLOADER_STATUS_CHANGED = "uploaderStatusChanged";
030            public static final String JS_CALLBACK_UPLOADER_SELECTION_CHANGED = "uploaderSelectionChanged";
031            public static final String JS_CALLBACK_UPLOAD_VIEW_FILE_OPEN_DIALOG_FILES_SELECTED = "uploadViewOpenDialogFilesSelected";
032            public static final String JS_CALLBACK_MAIN_VIEW_MESSAGE_SHOWN = "mainViewMessageShown";
033            //---------------------------------------------------------------
034            //      business methods
035            //---------------------------------------------------------------
036            /**
037             * applet info retrieval (name, version) 
038             */
039            public String getAppletInfo();
040            /**
041             * model retrieval
042             */
043            public IModel getModel();
044            /**
045             * uploader interface retrieval
046             */
047            public IJSUploader getUploader();
048            /**
049             * main view retrieval
050             */
051            public IMainView getMainView();
052            /**
053             * view config retrieval
054             */
055            public ViewConfig getViewConfig();
056            /**
057             * uploader config retrieval
058             */
059            public UploaderConfig getUploaderConfig();
060            /**
061             * applet config retrieval
062             */
063            public AppletConfig getAppletConfig();
064            /**
065             * show/hide frame
066             */
067            public void showFrame( boolean show );
068            /**
069             * set ui default
070             */
071            public void setUiDefault( String key, String value );
072            /**
073             * ui default retrieval
074             */
075            public Object getUiDefault( String key );
076            /**
077             * inject property
078             * @param target a target bean to inject property to, if target is null then target is this applet
079             * @param property a proeprty name, may be dot separated path
080             * @param value a text representation of property
081             * @return error message or null, if ok
082             */
083            public String injectProperty( Object target, String property, String value );
084            public String injectProperty( String property, String value );
085            /**
086             * retrieve property
087             */
088            public Object getProperty( String property );
089            /**
090             * shows whether applet is being destroyed
091             */
092            public boolean isDestroying();
093            /**
094             * shows whether applet is being stopped
095             */
096            public boolean isStopping();
097            
098            /**
099             * show file open dialog
100             */
101            void showOpenDialog();
102            
103            /**
104             * this method should be executed from JS when 
105             * view layout has changed in order to invalidate given view
106             */
107            void updateView(Object view);
108    }