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();
}
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);
}
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();
}
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);
}
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());
}
Aggregations