Package pl.net.bluesoft.util.lang

Examples of pl.net.bluesoft.util.lang.TaskWatch


    private Map<String, String> params = new HashMap<String, String>();

    private static final Logger logger = Logger.getLogger(JbpmStepAction.class.getName());

    public String invoke() throws Exception {
      final TaskWatch watch = new TaskWatch(this.getClass().getSimpleName() + ": " + stepName);
      String res = watch.watchTask("total step processing", new Callable<String>() {
      @Override
      public String call() throws Exception {
            return internalInvoke(watch);
      }

    });
     
      watch.stopAll();
      logger.log(Level.INFO, watch.printSummary());

        return res;
    }
View Full Code Here


    renderView(viewId, viewData);
  }

  private void renderView(final String viewId, Map<String, ?> viewData) {

    TaskWatch watch = new TaskWatch("Rendering view " + viewId);
    final ViewRenderer renderer = rendererMap.get(viewId);
    if (renderer == null) {
      throw new IllegalArgumentException("Unable to find view id: " + viewId);
    }
    currentViewData = viewData != null ? viewData : new HashMap<String, Object>();
    Component comp = null;
    try {
      comp = watch.watchTask("Really rendering", new Callable<Component>() {

        @Override
        public Component call() throws Exception {
          return renderer.render(currentViewData);
        }
      });
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
   
    comp.setWidth(100, Sizeable.UNITS_PERCENTAGE);
    viewContainer.removeAllComponents();
    viewContainer.addComponent(comp);
    viewContainer.setExpandRatio(comp, 1.0f);
    currentViewId = viewId;
   
    try {
      watch.watchTask("Bragging about it", new Callable() {

        @Override
        public Object call() throws Exception {
          fireViewChangedEvent(viewId);
          return null;
        }
      });
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
    watch.stopAll();
    logger.log(Level.INFO, watch.printSummary());
  }
View Full Code Here

    vl.setWidth(100, Sizeable.UNITS_PERCENTAGE);
        List<ProcessStateWidget> widgets = new ArrayList<ProcessStateWidget>(stateConfiguration.getWidgets());
        Collections.sort(widgets, new WidgetPriorityComparator());
       
       
        TaskWatch watch = new TaskWatch(ProcessDataPane.class.getSimpleName() + " - generowanie interfejsu dla kroku " + stateConfiguration.getName());

    final WidgetEventBus widgetEventBus = new WidgetEventBus();

    for (final ProcessStateWidget w : widgets) {
      try {
        watch.watchTask(w.getClassName() + ": " + w.getName(), new Callable() {

          @Override
          public Object call() throws Exception {
            try {
              ProcessToolWidget realWidget = getWidget(w, stateConfiguration, ctx, null, widgetEventBus);
              if (realWidget instanceof ProcessToolVaadinRenderable && (!nvl(w.getOptional(), false) || realWidget.hasVisibleData())) {
                processWidgetChildren(w, realWidget, stateConfiguration, ctx, null, widgetEventBus);
                ProcessToolVaadinRenderable vaadinW = (ProcessToolVaadinRenderable) realWidget;
                vl.addComponent(vaadinW.render());
              }
            }
            catch (Exception e) {
              logger.log(Level.SEVERE, e.getMessage(), e);
              vl.addComponent(new Label(getMessage("process.data.widget.exception-occurred")));
              vl.addComponent(new Label(e.getMessage()));
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              e.printStackTrace(new PrintWriter(baos));
              vl.addComponent(new Label("<pre>" + baos.toString() + "</pre>", CONTENT_XHTML));
            }
            // TODO Auto-generated method stub
            return null;
          }
        });
      } catch (Exception e) {
        throw new RuntimeException(e);
      }

    }
   
    watch.stopAll();
    logger.log(Level.INFO, watch.printSummary());

    addComponent(vl);
    setExpandRatio(vl,1f);

    if (isOwner) {
View Full Code Here

  @Override
  public void refreshData()
  { 
    try
    {
      watch = new TaskWatch(ActivityQueuesPane.class.getSimpleName() + " - lista kolejek " + (onEvent ? " refresh ON_EVENT" : ""));
      watch.watchTask("Total refreshing data", new Callable<Object>() {

        @Override
        public Object call() throws Exception {
          internalRefreshData();
View Full Code Here

TOP

Related Classes of pl.net.bluesoft.util.lang.TaskWatch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.