arrow_back history picture_as_pdf This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ~~NOTRANS~~ We have a list of useful code snippets for you. Simply use them for your application. All snippets are free to use and licensed under [[https://www.apache.org/licenses/LICENSE-2.0|Apache 2.0]]. ==== Test DBStorages without Lifecycle objects ==== Access a DBStorage without JVx Server, Lifecycle Object, Security e.g. for Unit tests <file java> //configure DB access DBAccess dba = new DBAccess(); dba.setUrl("..."); dba.setUsername("user"); dba.setPassword("pwd"); dba.open(); //configure storage for Table USERS DBStorage dbs = new DBStorage(); dbs.setFromClause("USERS"); dbs.setDBAccess(dba); dbs.open(); //direct object connection for direct method calls DirectObjectConnection con = new DirectObjectConnection(); con.put("users", dbs); //client connection for RemoteDataBook access to the storage MasterConnection macon = new MasterConnection(con); macon.open(); RemoteDataSource rds = new RemoteDataSource(macon); rds.open(); RemoteDataBook rdbApps = new RemoteDataBook(); rdbApps.setDataSource(rds); rdbApps.setName("users"); rdbApps.open(); </file> ==== A custom Application without menu, toolbar, ... ==== Sometimes we need an application without overhead, e.g for Vaadin UI. <file java> public class SimpleApplication extends Application implements IExceptionListener { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class members //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** the main/content panel. */ private UIPanel panMain; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Initialization //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Creates a new instance of <code>SimpleApplication</code>. * * @param pLauncher the launcher */ public SimpleApplication(UILauncher pLauncher) { super(pLauncher); setName("Simple application"); init(); } /** * Initializes the application. */ private void init() { ExceptionHandler.addExceptionListener(this); panMain = new UIPanel(); panMain.setLayout(new UIBorderLayout()); panMain.add(YOUR COMPONENT, UIBorderLayout.CENTER); setLayout(new UIBorderLayout()); add(panMain); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Interface implementation //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public IContainer getContentPane() { return panMain; } public <OP> IContent showMessage(OP pOpener, int pIconType, int pButtonType, String pMessage, String pOkAction, String pCancelAction) throws Throwable { System.out.println(pMessage); return null; } public void handleException(Throwable pThrowable) { System.out.println(CommonUtil.dump(pThrowable, false)); } } // SimpleApplication </file>