Search in sources :

Example 1 with EditorUIInformation

use of org.knime.core.node.workflow.EditorUIInformation in project knime-core by knime.

the class EditorGridSettingsDialog method setValues.

private void setValues() {
    EditorUIInformation build = m_settings.build();
    m_snap.setSelection(build.getSnapToGrid());
    m_show.setSelection(build.getShowGrid());
    m_xGrid.setText("" + build.getGridX());
    m_yGrid.setText("" + build.getGridY());
    settingsChanged();
}
Also used : EditorUIInformation(org.knime.core.node.workflow.EditorUIInformation)

Example 2 with EditorUIInformation

use of org.knime.core.node.workflow.EditorUIInformation in project knime-core by knime.

the class ConnectionContainerEditPart method refreshVisuals.

/**
 * {@inheritDoc}
 */
@Override
protected void refreshVisuals() {
    super.refreshVisuals();
    LOGGER.debug("refreshing visuals for: " + getModel());
    ConnectionUIInformation ei = null;
    ei = getModel().getUIInfo();
    LOGGER.debug("modelling info: " + ei);
    // make flow variable port connections look red.
    CurvedPolylineConnection fig = (CurvedPolylineConnection) getFigure();
    if (getModel().isFlowVariablePortConnection()) {
        fig.setForegroundColor(AbstractPortFigure.getFlowVarPortColor());
    }
    // update 'curved' settings and line width
    EditorUIInformation uiInfo = getCurrentEditorSettings();
    fig.setCurved(uiInfo.getHasCurvedConnections());
    fig.setLineWidth(uiInfo.getConnectionLineWidth());
    // recreate list of bendpoints
    ArrayList<AbsoluteBendpoint> constraint = new ArrayList<AbsoluteBendpoint>();
    if (ei != null) {
        int[][] p = ei.getAllBendpoints();
        for (int i = 0; i < p.length; i++) {
            AbsoluteBendpoint bp = new AbsoluteBendpoint(p[i][0], p[i][1]);
            constraint.add(bp);
        }
    }
    fig.setRoutingConstraint(constraint);
}
Also used : AbsoluteBendpoint(org.eclipse.draw2d.AbsoluteBendpoint) EditorUIInformation(org.knime.core.node.workflow.EditorUIInformation) ArrayList(java.util.ArrayList) ConnectionUIInformation(org.knime.core.node.workflow.ConnectionUIInformation) CurvedPolylineConnection(org.knime.workbench.editor2.figures.CurvedPolylineConnection) AbsoluteBendpoint(org.eclipse.draw2d.AbsoluteBendpoint) Point(org.eclipse.draw2d.geometry.Point)

Example 3 with EditorUIInformation

use of org.knime.core.node.workflow.EditorUIInformation in project knime-core by knime.

the class ToggleGridAction method runOnNodes.

/**
 * {@inheritDoc}
 */
@Override
public void runOnNodes(final NodeContainerEditPart[] nodeParts) {
    final WorkflowEditor editor = getEditor();
    EditorUIInformation settings = editor.getCurrentEditorSettings();
    EditorUIInformation newSet = EditorUIInformation.builder().setSnapToGrid(!settings.getSnapToGrid()).build();
    editor.applyEditorSettings(newSet);
    editor.markDirty();
}
Also used : WorkflowEditor(org.knime.workbench.editor2.WorkflowEditor) EditorUIInformation(org.knime.core.node.workflow.EditorUIInformation)

Example 4 with EditorUIInformation

use of org.knime.core.node.workflow.EditorUIInformation in project knime-core by knime.

the class EditorUIInformationTest method testBuilderAndGetters.

@Test
public void testBuilderAndGetters() {
    EditorUIInformation eui = EditorUIInformation.builder().setConnectionLineWidth(1).setGridX(10).setGridY(11).setHasCurvedConnections(true).setShowGrid(false).setSnapToGrid(true).setZoomLevel(.1).build();
    assertEquals(eui.getConnectionLineWidth(), 1);
    assertEquals(eui.getGridX(), 10);
    assertEquals(eui.getGridY(), 11);
    assertEquals(eui.getHasCurvedConnections(), true);
    assertEquals(eui.getShowGrid(), false);
    assertEquals(eui.getSnapToGrid(), true);
    assertEquals(eui.getZoomLevel(), .1, 0);
}
Also used : EditorUIInformation(org.knime.core.node.workflow.EditorUIInformation) Test(org.junit.Test)

Example 5 with EditorUIInformation

use of org.knime.core.node.workflow.EditorUIInformation in project knime-core by knime.

the class EditorUIInformationTest method testEqualsAndHashCode.

@Test
public void testEqualsAndHashCode() {
    EditorUIInformation eui = EditorUIInformation.builder().setConnectionLineWidth(1).setGridX(10).setGridY(11).setHasCurvedConnections(true).setShowGrid(false).setSnapToGrid(true).setZoomLevel(.1).build();
    EditorUIInformation eui2 = EditorUIInformation.builder().setConnectionLineWidth(1).setGridX(10).setGridY(11).setHasCurvedConnections(true).setShowGrid(false).setSnapToGrid(true).setZoomLevel(.1).build();
    assertTrue(eui.equals(eui2));
    assertEquals(eui.hashCode(), eui2.hashCode());
}
Also used : EditorUIInformation(org.knime.core.node.workflow.EditorUIInformation) Test(org.junit.Test)

Aggregations

EditorUIInformation (org.knime.core.node.workflow.EditorUIInformation)7 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)1 AbsoluteBendpoint (org.eclipse.draw2d.AbsoluteBendpoint)1 Point (org.eclipse.draw2d.geometry.Point)1 ConnectionUIInformation (org.knime.core.node.workflow.ConnectionUIInformation)1 WorkflowManagerUI (org.knime.core.ui.node.workflow.WorkflowManagerUI)1 WorkflowEditor (org.knime.workbench.editor2.WorkflowEditor)1 CurvedPolylineConnection (org.knime.workbench.editor2.figures.CurvedPolylineConnection)1