Search in sources :

Example 1 with LineStyle

use of au.gov.asd.tac.constellation.utilities.visual.LineStyle in project constellation by constellation-app.

the class GraphVisualAccess method getConnectionLineStyle.

@Override
public LineStyle getConnectionLineStyle(final int connection) {
    LineStyle style = null;
    final LineStyle mixStyle = LineStyle.SOLID;
    if (transactionLineStyle != Graph.NOT_FOUND) {
        switch(connectionElementTypes[connection]) {
            case LINK:
                final int linkId = connectionElementIds[connection];
                for (int i = 0; i < accessGraph.getLinkTransactionCount(linkId); i++) {
                    final int transactionId = accessGraph.getLinkTransaction(linkId, i);
                    final LineStyle transStyle = accessGraph.getObjectValue(transactionLineStyle, transactionId);
                    if (style != null && !style.equals(transStyle)) {
                        style = mixStyle;
                    } else {
                        style = transStyle;
                    }
                }
                break;
            case EDGE:
                final int edgeId = connectionElementIds[connection];
                for (int i = 0; i < accessGraph.getEdgeTransactionCount(edgeId); i++) {
                    final int transactionId = accessGraph.getEdgeTransaction(edgeId, i);
                    final LineStyle transStyle = accessGraph.getObjectValue(transactionLineStyle, transactionId);
                    if (style != null && !style.equals(transStyle)) {
                        style = mixStyle;
                    } else {
                        style = transStyle;
                    }
                }
                break;
            case TRANSACTION:
            default:
                style = accessGraph.getObjectValue(transactionLineStyle, connectionElementIds[connection]);
                break;
        }
    }
    return style != null ? style : VisualGraphDefaults.DEFAULT_TRANSACTION_LINE_STYLE;
}
Also used : LineStyle(au.gov.asd.tac.constellation.utilities.visual.LineStyle)

Example 2 with LineStyle

use of au.gov.asd.tac.constellation.utilities.visual.LineStyle in project constellation by constellation-app.

the class CreateTransactionTypePlugin method edit.

@Override
public void edit(final GraphWriteMethods graph, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException {
    final String name = parameters.getStringValue(NAME_PARAMETER_ID);
    if (name == null) {
        throw new IllegalArgumentException("A name must be supplied");
    }
    final String description = parameters.getStringValue(DESCRIPTION_PARAMETER_ID);
    if (description == null) {
        throw new IllegalArgumentException("A description must be supplied");
    }
    final ConstellationColor color = parameters.getColorValue(COLOR_PARAMETER_ID);
    final String lsName = parameters.getStringValue(LINE_STYLE_PARAMETER_ID);
    final LineStyle lineStyle = LineStyle.valueOf(lsName);
    final boolean directed = parameters.getBooleanValue(DIRECTED_PARAMETER_ID);
    final String stype = parameters.getStringValue(SUPER_TYPE_PARAMETER_ID);
    final SchemaTransactionType superType = stype != null ? SchemaTransactionTypeUtilities.getType(stype) : null;
    final String otype = parameters.getStringValue(OVERRIDDEN_TYPE_PARAMETER_ID);
    final SchemaTransactionType overridenType = otype != null ? SchemaTransactionTypeUtilities.getType(otype) : null;
    final boolean incomplete = parameters.getBooleanValue(INCOMPLETE_PARAMETER_ID);
    final Map<String, String> properties = null;
    final SchemaTransactionType stt = new SchemaTransactionType(name, description, color, lineStyle, directed, superType, overridenType, properties, incomplete);
    SchemaTransactionTypeUtilities.addCustomType(stt, true);
}
Also used : ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) SchemaTransactionType(au.gov.asd.tac.constellation.graph.schema.type.SchemaTransactionType) LineStyle(au.gov.asd.tac.constellation.utilities.visual.LineStyle)

Example 3 with LineStyle

use of au.gov.asd.tac.constellation.utilities.visual.LineStyle in project constellation by constellation-app.

the class LineStyleAttributeDescriptionNGTest method testConvertFromString.

/**
 * Test of convertFromString method, of class LineStyleAttributeDescription.
 */
@Test
public void testConvertFromString() {
    System.out.println("convertFromString");
    final LineStyleAttributeDescription instance = new LineStyleAttributeDescription();
    final LineStyle nullResult = instance.convertFromString(null);
    // should be the default here
    assertEquals(nullResult, LineStyle.SOLID);
    final LineStyle blankResult = instance.convertFromString("   ");
    // should be the default here as well
    assertEquals(blankResult, LineStyle.SOLID);
    final LineStyle validResult = instance.convertFromString("DASHED");
    assertEquals(validResult, LineStyle.DASHED);
}
Also used : LineStyle(au.gov.asd.tac.constellation.utilities.visual.LineStyle) Test(org.testng.annotations.Test)

Aggregations

LineStyle (au.gov.asd.tac.constellation.utilities.visual.LineStyle)3 SchemaTransactionType (au.gov.asd.tac.constellation.graph.schema.type.SchemaTransactionType)1 ConstellationColor (au.gov.asd.tac.constellation.utilities.color.ConstellationColor)1 Test (org.testng.annotations.Test)1