示例#1
0
  public void executeTask(String sTaskClass) {

    m_appview.waitCursorBegin();

    if (m_appuser.hasPermission(sTaskClass)) {
      try {
        ProcessAction myProcess = (ProcessAction) m_appview.getBean(sTaskClass);

        // execute the proces
        try {
          MessageInf m = myProcess.execute();
          if (m != null) {
            // si devuelve un mensaje, lo muestro
            JMessageDialog.showMessage(JPrincipalApp.this, m);
          }
        } catch (BasicException eb) {
          // Si se produce un error lo muestro.
          JMessageDialog.showMessage(JPrincipalApp.this, new MessageInf(eb));
        }
      } catch (BeanFactoryException e) {
        JMessageDialog.showMessage(
            JPrincipalApp.this,
            new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("Label.LoadError"), e));
      }
    } else {
      // No hay permisos para ejecutar la accion...
      JMessageDialog.showMessage(
          JPrincipalApp.this,
          new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.notpermissions")));
    }
    m_appview.waitCursorEnd();
  }
示例#2
0
  public void showTask(String sTaskClass) {

    m_appview.waitCursorBegin();

    if (m_appuser.hasPermission(sTaskClass)) {

      JPanelView m_jMyView = (JPanelView) m_aCreatedViews.get(sTaskClass);

      // cierro la antigua
      if (m_jLastView == null || (m_jMyView != m_jLastView && m_jLastView.deactivate())) {

        // Construct the new view
        if (m_jMyView == null) {

          // Is the view prepared
          m_jMyView = m_aPreparedViews.get(sTaskClass);
          if (m_jMyView == null) {
            // The view is not prepared. Try to get as a Bean...
            try {
              m_jMyView = (JPanelView) m_appview.getBean(sTaskClass);
            } catch (BeanFactoryException e) {
              m_jMyView = new JPanelNull(m_appview, e);
            }
          }

          m_jPanelContainer.add(m_jMyView.getComponent(), sTaskClass);
          m_aCreatedViews.put(sTaskClass, m_jMyView);
        }

        // ejecuto la tarea
        try {
          m_jMyView.activate();
        } catch (BasicException e) {
          JMessageDialog.showMessage(
              this,
              new MessageInf(
                  MessageInf.SGN_WARNING, AppLocal.getIntString("message.notactive"), e));
        }

        // se tiene que mostrar el panel
        m_jLastView = m_jMyView;

        showView(sTaskClass);
        // Y ahora que he cerrado la antigua me abro yo
        String sTitle = m_jMyView.getTitle();
        m_jPanelTitle.setVisible(sTitle != null);
        m_jTitle.setText(sTitle);
      }
    } else {
      // No hay permisos para ejecutar la accion...
      JMessageDialog.showMessage(
          this,
          new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.notpermissions")));
    }
    m_appview.waitCursorEnd();
  }
示例#3
0
  public void initFrame(AppProperties props) {

    m_props = props;

    m_rootapp = new JRootApp();

    if (m_rootapp.initApp(m_props)) {

      if ("true".equals(props.getProperty("machine.uniqueinstance"))) {
        // Register the running application
        try {
          m_instmanager = new InstanceManager(this);
        } catch (Exception e) {
        }
      }

      // Show the application
      add(m_rootapp, BorderLayout.CENTER);

      try {
        this.setIconImage(
            ImageIO.read(
                JRootFrame.class.getResourceAsStream("/com/openbravo/images/favicon.png")));
      } catch (IOException e) {
      }
      setTitle(AppLocal.APP_NAME + " - " + AppLocal.APP_VERSION);
      pack();
      setLocationRelativeTo(null);

      setVisible(true);
    } else {
      new JFrmConfig(props).setVisible(true); // Show the configuration window.
    }
  }
示例#4
0
  /** Creates new form JPrincipalApp */
  public JPrincipalApp(JRootApp appview, AppUser appuser) {

    m_appview = appview;
    m_appuser = appuser;

    m_dlSystem =
        (DataLogicSystem) m_appview.getBean("com.openbravo.pos.forms.DataLogicSystemCreate");

    // Cargamos los permisos del usuario
    m_appuser.fillPermissions(m_dlSystem);

    m_principalnotificator = new JPrincipalNotificator();

    m_actionfirst = null;
    m_jLastView = null;
    m_aPreparedViews = new HashMap<String, JPanelView>();
    m_aCreatedViews = new HashMap<String, JPanelView>();

    initComponents();

    // m_jPanelTitle.setUI(new GradientUI());
    m_jPanelTitle.setBorder(RoundedBorder.createGradientBorder());
    m_jPanelTitle.setVisible(false);

    // Anado el panel nulo
    m_jPanelContainer.add(new JPanel(), "<NULL>");
    showView("<NULL>");

    try {

      ScriptMenu menu = new ScriptMenu();

      ScriptEngine eng = ScriptFactory.getScriptEngine(ScriptFactory.BEANSHELL);
      eng.put("menu", menu);
      eng.eval(m_dlSystem.getResourceAsText("Menu.Root"));

      m_jPanelLeft.setViewportView(menu.getTaskPane());
    } catch (ScriptException e) {
      e.printStackTrace();
      // Error Message
    }
  }
示例#5
0
  @Override
  public Boolean initFrame(AppProperties props) {
    m_props = props;

    m_rootapp = new JRootApp();

    if (m_rootapp.initApp(m_props)) {
      if ("true".equals(props.getProperty("machine.uniqueinstance"))) {
        // Register the running application
        try {
          m_instmanager = new InstanceManager(this);
        } catch (Exception e) {
        }
      }

      // Show the application
      add(m_rootapp, BorderLayout.CENTER);

      try {
        this.setIconImage(
            ImageIO.read(
                JRootFrame.class.getResourceAsStream("/com/openbravo/images/favicon.png")));
      } catch (IOException e) {
      }
      setTitle(AppLocal.APP_NAME + " - " + AppLocal.APP_VERSION);

      // pack();
      this.setSize(800, 600); // set size for normal window state
      this.setExtendedState(MAXIMIZED_BOTH);
      setLocationRelativeTo(null);
      super.initFrame(props);
      setVisible(true);
      return true;
    } else {
      return false;
    }
  }
示例#6
0
  private void formWindowClosing(
      java.awt.event.WindowEvent evt) { // GEN-FIRST:event_formWindowClosing

    m_rootapp.tryToClose();
  } // GEN-LAST:event_formWindowClosing
 private void m_jHoldActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_m_jHoldActionPerformed
   deactivate();
   ((JRootApp) m_App).closeAppView();
 } // GEN-LAST:event_m_jHoldActionPerformed