Esempio n. 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();
  }
Esempio n. 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();
  }