コード例 #1
0
  public ScreenViewController(DataObjectContext context) {
    loadingPanel = IOUtils.createLoadingPanel();

    visual = new JPanel();
    visual.setLayout(new BorderLayout());
    toolbar = new JToolBar();
    toolbar.setFloatable(false);

    context.addDesignDocumentAwareness(this);
  }
コード例 #2
0
  public void setDesignDocument(final DesignDocument newDesignDocument) {
    IOUtils.runInAWTNoBlocking(
        new Runnable() {
          public void run() {
            if (designDocument != null) {
              ScreenAccessController accessController =
                  designDocument
                      .getListenerManager()
                      .getAccessController(ScreenAccessController.class);
              if (accessController != null) accessController.hideNotify();
            }
            toolbar.removeAll();
            visual.removeAll();

            designDocument = newDesignDocument;

            final ScreenAccessController accessController =
                designDocument != null
                    ? designDocument
                        .getListenerManager()
                        .getAccessController(ScreenAccessController.class)
                    : null;
            if (accessController != null) {
              accessController.showNotify();
              final DataObjectContext context =
                  ProjectUtils.getDataObjectContextForDocument(designDocument);
              if (context != null) {
                designDocument
                    .getTransactionManager()
                    .readAccess(
                        new Runnable() {
                          public void run() {
                            accessController.setScreenSize(
                                MidpProjectPropertiesSupport.getDeviceScreenSizeFromProject(
                                    context));
                          }
                        });
              }
              visual.add(new JScrollPane(accessController.getMainPanel()), BorderLayout.CENTER);

              JToolBar.Separator separator = new JToolBar.Separator();
              separator.setOrientation(JSeparator.VERTICAL);
              toolbar.add(separator);

              toolbar.add(accessController.getToolBar());
            } else {
              visual.add(loadingPanel, BorderLayout.CENTER);
            }
            toolbar.validate();
            visual.validate();
          }
        });
  }
コード例 #3
0
 public void setScreenSize(final Dimension deviceScreenSize) {
   IOUtils.runInAWTNoBlocking(
       new Runnable() {
         public void run() {
           if (designDocument != null) {
             designDocument
                 .getTransactionManager()
                 .readAccess(
                     new Runnable() {
                       public void run() {
                         ScreenAccessController accessController =
                             designDocument
                                 .getListenerManager()
                                 .getAccessController(ScreenAccessController.class);
                         if (accessController != null)
                           accessController.setScreenSize(deviceScreenSize);
                       }
                     });
           }
         }
       });
 }