Search in sources :

Example 1 with Rectangle

use of org.apache.hop.core.gui.Rectangle in project hop by apache.

the class DrawAsyncLoggingIconExtensionPoint method callExtensionPoint.

@Override
public void callExtensionPoint(ILogChannel log, IVariables variables, WorkflowPainterExtension ext) {
    // 
    if (!ext.actionMeta.isPipeline()) {
        return;
    }
    try {
        // This next map contains a simple "true" flag for every pipeline that contains a status
        // 
        Map<String, String> pipelineMap = ext.actionMeta.getAttributesMap().get(Defaults.ASYNC_STATUS_GROUP);
        if (pipelineMap == null) {
            return;
        }
        String serviceName = pipelineMap.get(Defaults.ASYNC_ACTION_PIPELINE_SERVICE_NAME);
        if (serviceName == null) {
            return;
        }
        // Draw an icon
        // 
        Rectangle r = drawLogIcon(ext.gc, ext.x1, ext.y1, ext.iconSize, this.getClass().getClassLoader());
        ext.areaOwners.add(new AreaOwner(AreaOwner.AreaType.CUSTOM, r.x, r.y, r.width, r.height, ext.offset, ext.actionMeta, STRING_AREA_OWNER_PREFIX + serviceName));
    } catch (Exception e) {
        // Just log the error, not that important
        log.logError("Error drawing async log icon", e);
    }
}
Also used : AreaOwner(org.apache.hop.core.gui.AreaOwner) Rectangle(org.apache.hop.core.gui.Rectangle)

Example 2 with Rectangle

use of org.apache.hop.core.gui.Rectangle in project hop by apache.

the class BeePainter method drawBee.

public Rectangle drawBee(IGc gc, int x, int y, int iconSize, ClassLoader classLoader) throws Exception {
    int imageWidth = 20;
    int imageHeight = 20;
    int locationX = x + iconSize;
    int locationY = y + iconSize - imageHeight - // -5 to prevent us from hitting the left bottom circle of the icon
    5;
    gc.drawImage(new SvgFile("bee.svg", classLoader), locationX, locationY, imageWidth, imageHeight, gc.getMagnification(), 0);
    return new Rectangle(locationX, locationY, imageWidth, imageHeight);
}
Also used : Rectangle(org.apache.hop.core.gui.Rectangle) SvgFile(org.apache.hop.core.svg.SvgFile)

Example 3 with Rectangle

use of org.apache.hop.core.gui.Rectangle in project hop by apache.

the class ContextDialog method selectItemPageDown.

private void selectItemPageDown(Rectangle area) {
    ScrollBar verticalBar = wScrolledComposite.getVerticalBar();
    List<AreaOwner> bottomAreas = new ArrayList<>();
    for (AreaOwner areaOwner : areaOwners) {
        if (areaOwner.getOwner() instanceof Item) {
            // Only keep the items to the left
            // 
            Rectangle r = areaOwner.getArea();
            if (r.y > area.y + area.height + verticalBar.getPageIncrement()) {
                bottomAreas.add(areaOwner);
            }
        }
    }
    if (bottomAreas.isEmpty())
        bottomAreas.add(lastShownItem.getAreaOwner());
    selectClosest(area, bottomAreas);
}
Also used : AreaOwner(org.apache.hop.core.gui.AreaOwner) Rectangle(org.apache.hop.core.gui.Rectangle)

Example 4 with Rectangle

use of org.apache.hop.core.gui.Rectangle in project hop by apache.

the class DrawTransformDebugLevelBeeExtensionPoint method callExtensionPoint.

@Override
public void callExtensionPoint(ILogChannel logChannelInterface, IVariables variables, PipelinePainterExtension ext) {
    try {
        // The next statement sometimes causes an exception in WebSpoon
        // Keep it in the try/catch block
        // 
        Map<String, String> transformLevelMap = ext.pipelineMeta.getAttributesMap().get(Defaults.DEBUG_GROUP);
        if (transformLevelMap != null) {
            String transformName = ext.transformMeta.getName();
            final TransformDebugLevel debugLevel = DebugLevelUtil.getTransformDebugLevel(transformLevelMap, transformName);
            if (debugLevel != null) {
                Rectangle r = drawBee(ext.gc, ext.x1, ext.y1, ext.iconSize, this.getClass().getClassLoader());
                ext.areaOwners.add(new AreaOwner(AreaOwner.AreaType.CUSTOM, r.x, r.y, r.width, r.height, ext.offset, ext.transformMeta, debugLevel));
            }
        }
    } catch (Exception e) {
    // Ignore error, not that important
    }
}
Also used : AreaOwner(org.apache.hop.core.gui.AreaOwner) Rectangle(org.apache.hop.core.gui.Rectangle)

Example 5 with Rectangle

use of org.apache.hop.core.gui.Rectangle in project hop by apache.

the class ContextDialog method selectItem.

private void selectItem(Item selectedItem, boolean scroll) {
    for (Item item : items) {
        item.setSelected(false);
    }
    if (selectedItem == null) {
        wlTooltip.setText("");
    } else {
        this.selectedItem = selectedItem;
        wlTooltip.setText(Const.NVL(selectedItem.getAction().getTooltip(), ""));
        selectedItem.setSelected(true);
        // 
        if (scroll && totalContentHeight > 0) {
            Rectangle itemArea = selectedItem.getAreaOwner().getArea();
            org.eclipse.swt.graphics.Rectangle clientArea = wScrolledComposite.getClientArea();
            ScrollBar verticalBar = wScrolledComposite.getVerticalBar();
            // 
            while (itemArea.y + itemArea.height + 2 * yMargin > verticalBar.getSelection() + clientArea.height) {
                wScrolledComposite.setOrigin(0, Math.min(verticalBar.getSelection() + verticalBar.getPageIncrement(), verticalBar.getMaximum() - verticalBar.getThumb()));
            }
            // 
            while (itemArea.y < verticalBar.getSelection()) {
                wScrolledComposite.setOrigin(0, Math.max(verticalBar.getSelection() - verticalBar.getPageIncrement(), 0));
            }
        }
    }
    wCanvas.redraw();
}
Also used : Rectangle(org.apache.hop.core.gui.Rectangle)

Aggregations

Rectangle (org.apache.hop.core.gui.Rectangle)9 AreaOwner (org.apache.hop.core.gui.AreaOwner)6 SvgFile (org.apache.hop.core.svg.SvgFile)2 ExtensionPoint (org.apache.hop.core.extension.ExtensionPoint)1 IExtensionPoint (org.apache.hop.core.extension.IExtensionPoint)1