public void openFiles() {
   if (mySplittersElement != null) {
     initializeProgress();
     final JPanel comp = myUIBuilder.process(mySplittersElement, getTopPanel());
     UIUtil.invokeAndWaitIfNeeded(
         new Runnable() {
           @Override
           public void run() {
             if (comp != null) {
               removeAll();
               add(comp, BorderLayout.CENTER);
               mySplittersElement = null;
             }
             // clear empty splitters
             for (EditorWindow window : getWindows()) {
               if (window.getEditors().length == 0) {
                 for (EditorWindow sibling : window.findSiblings()) {
                   sibling.unsplit(false);
                 }
               }
             }
           }
         });
   }
 }
Esempio n. 2
0
 public void actionPerformed(ActionEvent e) {
   if (e.getActionCommand().equals(SearchManager.EXIT)) {
     System.exit(1);
   }
   if (e.getActionCommand().equals(SearchManager.GET_SQL)) {
     manager.setSQL(builder.getSQL());
   }
   if (e.getSource() == manager.getSearchTypeCtrl()) {
     String selection = manager.getSearchType();
     if (selection.equals("") == false) {
       BuilderFactory factory = new BuilderFactory();
       // create an appropriate builder instance
       builder = factory.getUIBuilder(selection);
       // configure the director with the builder
       UIDirector director = new UIDirector(builder);
       // director invokes different builder
       // methods
       director.build();
       // get the final build object
       JPanel UIObj = builder.getSearchUI();
       manager.displayNewUI(UIObj);
     }
   }
 }
 public Container startApp(Resources res, String resPath, boolean loadTheme) {
   initVars();
   UIBuilder.registerCustomComponent("Button", com.codename1.ui.Button.class);
   UIBuilder.registerCustomComponent("ComponentGroup", com.codename1.ui.ComponentGroup.class);
   UIBuilder.registerCustomComponent("MapComponent", com.codename1.maps.MapComponent.class);
   UIBuilder.registerCustomComponent("Tabs", com.codename1.ui.Tabs.class);
   UIBuilder.registerCustomComponent("MultiButton", com.codename1.components.MultiButton.class);
   UIBuilder.registerCustomComponent("Form", com.codename1.ui.Form.class);
   UIBuilder.registerCustomComponent("Label", com.codename1.ui.Label.class);
   UIBuilder.registerCustomComponent("TextArea", com.codename1.ui.TextArea.class);
   UIBuilder.registerCustomComponent("Container", com.codename1.ui.Container.class);
   if (loadTheme) {
     if (res == null) {
       try {
         if (resPath.endsWith(".res")) {
           res = Resources.open(resPath);
           System.out.println(
               "Warning: you should construct the state machine without the .res extension to allow theme overlays");
         } else {
           res = Resources.openLayered(resPath);
         }
       } catch (java.io.IOException err) {
         err.printStackTrace();
       }
     }
     initTheme(res);
   }
   if (res != null) {
     setResourceFilePath(resPath);
     setResourceFile(res);
     initVars(res);
     return showForm("Main", null);
   } else {
     Form f = (Form) createContainer(resPath, "Main");
     initVars(fetchResourceFile());
     beforeShow(f);
     f.show();
     postShow(f);
     return f;
   }
 }
 public Container createWidget(Resources res, String resPath, boolean loadTheme) {
   initVars();
   UIBuilder.registerCustomComponent("Button", com.codename1.ui.Button.class);
   UIBuilder.registerCustomComponent("ComponentGroup", com.codename1.ui.ComponentGroup.class);
   UIBuilder.registerCustomComponent("MapComponent", com.codename1.maps.MapComponent.class);
   UIBuilder.registerCustomComponent("Tabs", com.codename1.ui.Tabs.class);
   UIBuilder.registerCustomComponent("MultiButton", com.codename1.components.MultiButton.class);
   UIBuilder.registerCustomComponent("Form", com.codename1.ui.Form.class);
   UIBuilder.registerCustomComponent("Label", com.codename1.ui.Label.class);
   UIBuilder.registerCustomComponent("TextArea", com.codename1.ui.TextArea.class);
   UIBuilder.registerCustomComponent("Container", com.codename1.ui.Container.class);
   if (loadTheme) {
     if (res == null) {
       try {
         res = Resources.openLayered(resPath);
       } catch (java.io.IOException err) {
         err.printStackTrace();
       }
     }
     initTheme(res);
   }
   return createContainer(resPath, "Main");
 }