Package org.wicketstuff.progressbar.spring

Examples of org.wicketstuff.progressbar.spring.Task$Message


     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setMessageRef(Message newMessageRef) {
        Message oldMessageRef = messageRef;
        messageRef = newMessageRef;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET,
                    Bpmn2Package.MESSAGE_FLOW__MESSAGE_REF, oldMessageRef, messageRef));
    }
View Full Code Here


     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setMessageRef(Message newMessageRef) {
        Message oldMessageRef = messageRef;
        messageRef = newMessageRef;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET,
                    Bpmn2Package.CORRELATION_PROPERTY_RETRIEVAL_EXPRESSION__MESSAGE_REF,
                    oldMessageRef, messageRef));
View Full Code Here

     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setMessageRef(Message newMessageRef) {
        Message oldMessageRef = messageRef;
        messageRef = newMessageRef;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET,
                    Bpmn2Package.SEND_TASK__MESSAGE_REF, oldMessageRef, messageRef));
    }
View Full Code Here

     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setInMessageRef(Message newInMessageRef) {
        Message oldInMessageRef = inMessageRef;
        inMessageRef = newInMessageRef;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET,
                    Bpmn2Package.OPERATION__IN_MESSAGE_REF, oldInMessageRef, inMessageRef));
    }
View Full Code Here

     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setOutMessageRef(Message newOutMessageRef) {
        Message oldOutMessageRef = outMessageRef;
        outMessageRef = newOutMessageRef;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET,
                    Bpmn2Package.OPERATION__OUT_MESSAGE_REF, oldOutMessageRef, outMessageRef));
    }
View Full Code Here

      @Override
      public PictogramElement add(IAddContext context) {
        IGaService gaService = Graphiti.getGaService();
        IPeService peService = Graphiti.getPeService();
        Message msg = (Message) context.getNewObject();

        int width = context.getWidth() > 0 ? context.getWidth() : 30;
        int height = context.getHeight() > 0 ? context.getHeight() : 20;
        int textArea = 15;

        ContainerShape container = peService.createContainerShape(context.getTargetContainer(), true);
        Rectangle invisibleRect = gaService.createInvisibleRectangle(container);
        gaService.setLocationAndSize(invisibleRect, context.getX(), context.getY(), width, height + textArea);

        Envelope envelope = GraphicsUtil.createEnvelope(invisibleRect, 0, 0, width, height);
        envelope.rect.setFilled(true);
        StyleUtil.applyBGStyle(envelope.rect, this);
        envelope.line.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));

        Shape textShape = peService.createShape(container, false);
        peService
            .setPropertyValue(textShape, UpdateBaseElementNameFeature.TEXT_ELEMENT, Boolean.toString(true));
        Text text = gaService.createDefaultText(getDiagram(), textShape, msg.getName());
        text.setStyle(StyleUtil.getStyleForText(getDiagram()));
        text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
        text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
        gaService.setLocationAndSize(text, 0, height, width, textArea);
View Full Code Here

      super(fp, "Message", "Represents the content of a communication between two Participants");
    }

    @Override
    public RootElement createRootElement() {
      Message message = ModelHandler.FACTORY.createMessage();
      message.setName("Message");
      return message;
    }
View Full Code Here

    public void testMessageUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = unmarshaller.unmarshall(getTestJsonFile("message.json"));
        assertTrue(definitions.getRootElements().size() == 1);
        assertTrue(definitions.getRootElements().iterator().next() instanceof Message);
        Message msg = (Message) definitions.getRootElements().iterator().next();
        assertEquals("message", msg.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

  }

  @Test
  public void testTaskExecution() {
    final Integer[] data = new Integer[]{0};
    Task task = new Task() {
      @Override
      public void run() {
        for(int i = 0; i < 2; i++) {
          data[0]++;
          updateProgress(i, 2);
          if(isCancelled()) {
            return;
          }
        }
      }
    };
    assertEquals("Task progress initially 0", 0, task.getProgress());
    Long taskId = taskService.schedule(task);
    assertEquals("Task can be found by ID", task, taskService.getTask(taskId));
    taskService.start(taskId);
    assertEquals("Task was executed", 2, data[0]);
    assertEquals("Task progress is 100", 100, task.getProgress());
    assertTrue("Task is done after finish", task.isDone());
    assertNotNull("Task NOT removed from service after done",
        taskService.getTask(taskId));
    taskService.finish(taskId);
    assertNull("Task removed from service with finish",
        taskService.getTask(taskId));

    data[0] = 0;
    task.reset();
    assertEquals("Task progress is 0 after reset", 0, task.getProgress());
    // cancel should stop task at 50%
    task.cancel();
    Long newTaskId = taskService.scheduleAndStart(task);
    assertFalse("Unique id generated", taskId.equals(newTaskId));

    assertEquals("Cancelled after 50%", 1, data[0]);
    assertTrue("Task was cancelled", task.isCancelled());
    assertEquals("Progress is 50%", 50, task.getProgress());
    // done if cancelled?
    assertTrue("Task is done", task.isDone());
  }
View Full Code Here

  // TODO Task with error / exception

  @Test
  public void testTaskMessaging() {
    Task task = new Task() {
      @Override
      public void run() {
        error("error.message");
        warn("warn.message");
        info("info.message");
      }
    };
    Long taskId = taskService.scheduleAndStart(task);

    // wait some time

    task = taskService.getTask(taskId);
    List<Task.Message> messages = task.getMessages();
    assertEquals(3, messages.size());
    assertEquals(Message.Severity.ERROR, messages.get(0).severity);
    assertEquals("error.message", messages.get(0).messageKey);
    assertNull(messages.get(0).arguments);
View Full Code Here

TOP

Related Classes of org.wicketstuff.progressbar.spring.Task$Message

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.