Examples of ListProperty


Examples of org.eclipse.sapphire.ListProperty

            if( collection != null )
            {
                if( collection instanceof ElementList )
                {
                    final ElementList<?> list = (ElementList<?>) collection;
                    final ListProperty listProperty = list.definition();
                    final ElementType listEntryType = listProperty.getType();
                    final ValueProperty listEntryProperty;
                   
                    if( operands().size() > 1 )
                    {
                        final String listEntryPropertyName = cast( operand( 1 ), String.class );
                   
                        final PropertyDef prop = listEntryType.property( listEntryPropertyName );
                       
                        if( prop == null )
                        {
                            throw new FunctionException( missingProperty.format( listEntryType.getSimpleName(), listEntryPropertyName ) );
                        }
                       
                        if( ! ( prop instanceof ValueProperty ) )
                        {
                            throw new FunctionException( notValueProperty.format( listEntryType.getSimpleName(), listEntryPropertyName ) );
                        }
                   
                        listEntryProperty = (ValueProperty) prop;
                    }
                    else
                    {
                        ValueProperty prop = null;
                       
                        for( PropertyDef p : listEntryType.properties() )
                        {
                            if( p instanceof ValueProperty )
                            {
                                prop = (ValueProperty) p;
                                break;
                            }
                        }
                       
                        if( prop == null )
                        {
                            throw new FunctionException( noValueProperties.format( listEntryType.getSimpleName() ) );
                        }
                       
                        listEntryProperty = prop;
                    }
                   
                    for( Element item : list )
                    {
                        items.add( item.property( listEntryProperty ).content() );
                    }
                   
                    final Element listParentElement = list.element();
                    final String listenerModelPath = listProperty.name() + "/" + listEntryProperty.name();
                   
                    if( this.lastListParentElement != listParentElement || ! this.lastListenerModelPath.equals( listenerModelPath ) )
                    {
                        if( this.lastListParentElement != null )
                        {
View Full Code Here

Examples of org.eclipse.sapphire.ListProperty

        addControl(this.addText);

        final StringBuilder buf = new StringBuilder();
        buf.append( "<form><p vspace=\"false\"><a href=\"action\" nowrap=\"true\">" );
        buf.append( "Add " );
        final ListProperty listProperty = (ListProperty) property().definition();
        buf.append( listProperty.getType().getLabel(false, CapitalizationType.NO_CAPS, false/*includeMnemonic*/) );
        buf.append( "</a></p></form>" );
       
        this.addText.setText( buf.toString(), true, false );
        if (this.addTextHyperlinkAdapter == null) {
            this.addTextHyperlinkAdapter = new HyperlinkAdapter() {
View Full Code Here

Examples of org.eclipse.sapphire.ListProperty

    public static final class Condition extends ServiceCondition
    {
        @Override
        public boolean applicable( final ServiceContext context )
        {
            final ListProperty property = context.find( ListProperty.class );
           
            if( property != null )
            {
                final CountConstraint constraint = property.getAnnotation( CountConstraint.class );
                return ( constraint != null && ( constraint.min() > 0 || constraint.max() < Integer.MAX_VALUE ) );
            }
           
            return false;
        }
View Full Code Here

Examples of org.eclipse.sapphire.ListProperty

    public static final class Condition extends ServiceCondition
    {
        @Override
        public boolean applicable( final ServiceContext context )
        {
            final ListProperty property = context.find( ListProperty.class );
            return ( property != null && property.hasAnnotation( CountConstraint.class ) );
        }
View Full Code Here

Examples of org.eclipse.sapphire.ListProperty

    }
   
    protected void handleModelPropertyChange(final PropertyEvent event)
    {
        final Element element = event.property().element();
        final ListProperty property = (ListProperty)event.property().definition();
        ElementList<?> newList = element.property(property);
       
        if (property == this.connListProperty)
        {
          handleConnectionListChange(element, property);
View Full Code Here

Examples of org.eclipse.sapphire.ListProperty

        this.diagramEditor = this.nodeTemplate.getDiagramEditorPart();
        this.connectionDef = (IDiagramConnectionDef)super.definition();
       
        this.diagramConnectionMap = new HashMap<Element, List<StandardDiagramConnectionPart>>();
       
        ListProperty nodeProperty = (ListProperty)this.nodeTemplate.getModelProperty();
        this.propertyName = this.bindingDef.getProperty().content();
        this.connListProperty = (ListProperty)nodeProperty.getType().property(this.propertyName);
       
        initConnPartListener();
       
        this.templateListeners = new CopyOnWriteArraySet<DiagramConnectionTemplateListener>();
       
        this.modelPropertyListener = new FilteredListener<PropertyContentEvent>()
        {
            @Override
            protected void handleTypedEvent( final PropertyContentEvent event )
            {
                handleModelPropertyChange( event );
            }
        };       
       
        String endpointPropStr = this.bindingDef.getEndpoint2().content().getProperty().content();
        this.endpointPath = new ModelPath(endpointPropStr);
       
        ElementList<Element> srcNodeList = getModelElement().property(nodeProperty);
        for (Element srcNodeModel : srcNodeList)
        {
            PropertyDef connProp = srcNodeModel.property(this.propertyName).definition();
            if (connProp instanceof ListProperty)
            {
                ListProperty connListProperty = (ListProperty)connProp;
                ElementList<?> connList = srcNodeModel.property(connListProperty);
                for (Element endpointModel : connList)
                {
                  createNewConnectionPart(endpointModel, srcNodeModel);                 
                }               
View Full Code Here

Examples of org.eclipse.sapphire.ListProperty

        Element srcNodeModel = srcNode.getLocalModelElement();
        PropertyDef modelProperty = this.nodeTemplate.getModelProperty();
        boolean found = false;
        if (modelProperty instanceof ListProperty)
        {
            ListProperty listProperty = (ListProperty)modelProperty;
            ElementList<?> list = getModelElement().property(listProperty);
            for (Element listEntryModelElement : list)
            {
                if (listEntryModelElement == srcNodeModel)
                {
                    found = true;
                    break;
                }               
            }
        }
        else if (modelProperty instanceof ElementProperty)
        {
            ElementProperty elementProperty = (ElementProperty)modelProperty;
            if (getModelElement().property(elementProperty) != null)
            {
                Element localModelElement = getModelElement().property(elementProperty).content();
                if (localModelElement == srcNodeModel)
                {
                    found = true;
                }
            }
        }
        if (!found)
        {
            throw new RuntimeException( "Cannot locate the source node element");
        }
       
        PropertyDef connProp = srcNodeModel.property(this.propertyName).definition();
        Element newEndpoint = null;
        if (connProp instanceof ListProperty)
        {
            ListProperty listProperty = (ListProperty)connProp;
            ElementList<?> list = srcNodeModel.property(listProperty);
            newEndpoint = list.insert();           
        }
       
        // Get serialized value of endpoint
View Full Code Here

Examples of org.eclipse.sapphire.ListProperty

    }
   
    @Override
    public void addModelListener()
    {
        ListProperty nodeProperty = (ListProperty)this.nodeTemplate.getModelProperty();
        ElementList<Element> srcNodeList = getModelElement().property(nodeProperty);
        for (Element srcNodeModel : srcNodeList)
        {
            addModelListener(srcNodeModel);
        }       
View Full Code Here

Examples of org.eclipse.sapphire.ListProperty

    }
   
    @Override
    public void removeModelListener()
    {
        ListProperty nodeProperty = (ListProperty)this.nodeTemplate.getModelProperty();
        ElementList<Element> srcNodeList = getModelElement().property(nodeProperty);
        for (Element srcNodeModel : srcNodeList)
        {
            removeModelListener(srcNodeModel);
        }
View Full Code Here

Examples of org.eclipse.sapphire.ListProperty

        this.shapeFactoryDef = (ShapeFactoryDef)super.definition;
        this.children = new ArrayList<ShapePart>();

        final Element element = getModelElement();
        final String propertyName = this.shapeFactoryDef.getProperty().content();
        final ListProperty property = (ListProperty) resolve( element, propertyName );
        this.list = element.property( property );
       
        for( Element listEntryModelElement : list )
        {
          ShapeFactoryCaseDef shapeFactoryCase = getShapeFactoryCase(listEntryModelElement);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.