Ejemplo n.º 1
0
  @Override
  protected IFigure createFigure() {
    final IFigure figure = createBaseFigure();
    ComponentInterface ci =
        ((WorkflowNode) getModel())
            .getComponentDescription()
            .getComponentInstallation()
            .getComponentRevision()
            .getComponentInterface();

    if (ci.getShape() == ComponentShape.CIRCLE) {
      final int size = 16;
      final int newOffset = 3;
      errorFigure.setBounds(new Rectangle(newOffset, newOffset, size, size));
      warningFigure.setBounds(new Rectangle(newOffset, newOffset, size, size));
      final int localX = 22;
      final int localY = 20;
      localFigure.setBounds(new Rectangle(localX, localY, size, size));
    } else if (ci.getSize() == ComponentSize.SMALL) {
      final int size = 16;
      final int newOffsetX = 22;
      final int newOffsetY = 1;
      warningFigure.setBounds(new Rectangle(newOffsetX, newOffsetY, size, size));
      final int localX = 22;
      final int localY = 22;
      localFigure.setBounds(new Rectangle(localX, localY, size, size));
    }
    figure.add(errorFigure);
    figure.add(warningFigure);
    figure.add(localFigure);
    figure.add(deprecatedFigure);
    return figure;
  }
Ejemplo n.º 2
0
  @Override
  public void addPages() {
    List<String> toolNames = new LinkedList<>();

    for (String id : integrationService.getIntegratedComponentIds()) {
      toolNames.add(id.substring(id.lastIndexOf(".") + 1));
    }

    List<String> groupNames = new ArrayList<>();
    LogicalNodeId localNode =
        serviceRegistryAccess.getService(PlatformService.class).getLocalDefaultLogicalNodeId();
    Collection<ComponentInstallation> installations =
        getInitialComponentKnowledge().getAllInstallations();
    installations = ComponentUtils.eliminateComponentInterfaceDuplicates(installations, localNode);
    for (ComponentInstallation ci : installations) {
      ComponentInterface componentInterface = ci.getComponentRevision().getComponentInterface();
      String groupName = componentInterface.getGroupName();
      if (!groupName.startsWith("_") && !groupNames.contains(groupName)) {
        groupNames.add(groupName);
      }
    }

    Collections.sort(groupNames, String.CASE_INSENSITIVE_ORDER);

    editConfigurationPage =
        new ChooseConfigurationPage(
            Messages.chooseConfigPageTitle,
            integrationContextRegistry.getAllIntegrationContexts(),
            this,
            wizardType);

    characteristicsPage =
        new ToolCharacteristicsPage(
            Messages.firstToolIntegrationPageTitle, configurationMap, toolNames, groupNames);

    inOutputPage = new InOutputConfigurationPage(Messages.inOuputPage, configurationMap);
    propertyPage = new PropertyConfigurationPage(Messages.propertyPage, configurationMap);
    toolPage = new ToolConfigurationPage(Messages.toolPage, configurationMap);
    scriptPage = new ScriptConfigurationPage(Messages.scriptPage, configurationMap);

    addPage(editConfigurationPage);
    addPage(characteristicsPage);
    addPage(inOutputPage);
    addPage(propertyPage);
    addPage(toolPage);
    addPage(scriptPage);

    this.getShell().setMinimumSize(MINIMUM_WIDTH, MINIMUM_HEIGHT);

    IntegrationWizardPageContributorRegistry contributorRegistry =
        serviceRegistryAccess.getService(IntegrationWizardPageContributorRegistry.class);
    for (IntegrationWizardPageContributor contributor : contributorRegistry.getAllContributors()) {
      List<ToolIntegrationWizardPage> pages = contributor.getAdditionalPagesList(configurationMap);
      additionalPages.put(contributor.getType(), pages);
      for (ToolIntegrationWizardPage page : pages) {
        addPage(page);
      }
    }
  }
Ejemplo n.º 3
0
    @Override
    public void paintFigure(Graphics graphics) {

      int offsetX;
      int offsetY;

      if (ci.getShape() == ComponentShape.CIRCLE) {
        offsetX = OFFSET_SMALL_CIRCLE_COMPONENT_ICON;
        offsetY = OFFSET_SMALL_CIRCLE_COMPONENT_ICON;
        graphics.fillOval(this.getBounds());
        graphics.setAntialias(SWT.ON);
        Rectangle b = this.getBounds().getCopy();
        b.width--;
        b.height--;
        graphics.drawOval(b);

        graphics.setAntialias(SWT.OFF);
      } else {
        offsetX = OFFSET_SMALL_SQUARE_COMPONENT_ICON_X;
        offsetY = OFFSET_SMALL_SQUARE_COMPONENT_ICON_Y;
        graphics.fillRectangle(this.getBounds());
        Rectangle b = this.getBounds().getCopy();
        b.width--;
        b.height--;
        graphics.drawRectangle(b);
      }
      graphics.drawImage(
          icon, new Point(this.getLocation().x + offsetX, this.getLocation().y - 1 + offsetY));
    }
Ejemplo n.º 4
0
  protected IFigure createBaseFigure() {
    Image image = null;
    byte[] icon = null;

    ComponentInterface ci =
        ((WorkflowNode) getModel())
            .getComponentDescription()
            .getComponentInstallation()
            .getComponentRevision()
            .getComponentInterface();

    if (ci.getSize() == ComponentSize.SMALL) {
      icon = ((WorkflowNode) getModel()).getComponentDescription().getIcon24();
    } else {
      icon = ((WorkflowNode) getModel()).getComponentDescription().getIcon32();
    }
    if (icon != null) {
      try {
        image = new Image(Display.getCurrent(), new ByteArrayInputStream(icon));
      } catch (SWTException e) {
        // The images of integrated tools may be broken, so the default will be used.
        LogFactory.getLog(getClass()).info("Could not load tool icon, loading default. ", e);
        image = ImageManager.getInstance().getSharedImage(StandardImages.RCE_LOGO_32);
      }
    } else if (ci.getIdentifier().startsWith(ComponentUtils.MISSING_COMPONENT_PREFIX)) {
      if (ci.getSize() == ComponentSize.SMALL) {
        image = ImageManager.getInstance().getSharedImage(StandardImages.RCE_LOGO_24_GREY);
      } else {
        image = ImageManager.getInstance().getSharedImage(StandardImages.RCE_LOGO_32_GREY);
      }
    } else {
      if (ci.getSize() == ComponentSize.SMALL) {
        image = ImageManager.getInstance().getSharedImage(StandardImages.RCE_LOGO_24);
      } else {
        image = ImageManager.getInstance().getSharedImage(StandardImages.RCE_LOGO_32);
      }
    }
    Color color = getColor(ci);

    if (ci.getSize() == ComponentSize.SMALL) {
      IconLabel iconLabel = new IconLabel(image, ci);
      iconLabel.setOpaque(true);
      iconLabel.setBorder(null);
      iconLabel.setBackgroundColor(color);
      return iconLabel;
    } else {
      final String labelText = ((WorkflowNode) getModel()).getName();
      final Label label = new Label(labelText, image);
      label.setTextPlacement(PositionConstants.SOUTH);
      label.setBorder(new LineBorder());
      label.setOpaque(true);
      label.setBackgroundColor(color);
      return label;
    }
  }
Ejemplo n.º 5
0
 private Color getColor(ComponentInterface ci) {
   // TODO this looks like a SWT resource leak (ie, missing dispose() calls)
   final int dr = 255;
   final int dg = 247;
   final int db = 231;
   Color c = new Color(null, dr, dg, db);
   if (!getWorkflowNode().isEnabled()) {
     final int grey = 0xDD;
     c = new Color(null, grey, grey, grey);
   } else if (ci.getColor() == null) {
     final int r = 0xFF;
     final int g = 0xCC;
     final int b = 0xD2;
     c = new Color(null, r, g, b);
   }
   return c;
 }