Package org.eclipse.sapphire

Examples of org.eclipse.sapphire.Element


       
        final ElementList<?> list = (ElementList<?>) property();
       
        if( ! list.isEmpty() )
        {
            final Element element = list.get( 0 );
            final ValueProperty property = (ValueProperty) element.properties().first().definition();
            final String value = element.property( property ).text();
            checked = ( value != null && value.startsWith( this.prefix ) );
        }
       
        setChecked( checked );
    }
View Full Code Here


        final InputDialog dialog = new InputDialog( ( (FormComponentPresentation) context ).shell(), "Create", "Create a new entity with the specified name.", "", inputValidator );
       
        if( dialog.open() != Window.CANCEL )
        {
            final String entityName = dialog.getValue();
            final Element element = getModelElement();
           
            final IValuePropertyActionsGalleryEntity entity = element.nearest( IValuePropertyActionsGallery.class ).getEntities().insert();
            entity.setName( entityName );
           
            ( (Value<?>) property() ).write( entityName );
        }
       
View Full Code Here

        }
   
        @Override
        public String getText( final Object obj )
        {
            final Element element = ( (TableRow) obj ).element();
            final Value<?> value = this.columnHandler.property( element );
           
            final String text = value.text();
            String label = null;
           
View Full Code Here

        }

        @Override
        public boolean canEdit( final Object obj )
        {
            final Element element = ( (TableRow) obj ).element();
           
            boolean canEdit;
           
            if( this.columnHandler.property( element ).enabled() )
            {
View Full Code Here

    {
        super.init( action, def );
       
        this.prefix = def.getParam( "prefix" ) + " ";
       
        final Element element = getModelElement();
       
        final Listener listener = new FilteredListener<PropertyContentEvent>()
        {
            @Override
            protected void handleTypedEvent( final PropertyContentEvent event )
            {
                refreshEnabledState();
                refreshCheckedState();
            }
        };
       
        final String path = property().name();
       
        element.attach( listener, path );
       
        refreshEnabledState();
        refreshCheckedState();
       
        attach
        (
            new FilteredListener<DisposeEvent>()
            {
                @Override
                protected void handleTypedEvent( final DisposeEvent event )
                {
                    element.detach( listener, path );                       
                }
            }
        );
    }
View Full Code Here

            private Listener listener;
           
            @Override
            protected Object evaluate()
            {
                final Element element = operand( 0, Element.class, false );
                final Property parent = element.parent();
               
                if( parent instanceof ElementList )
                {
                    final ElementList<?> list = (ElementList<?>) parent;
                   
View Full Code Here

        }
  }
 
  private void handleNodeAboutToBeDeleted(DiagramNodePart nodePart)
  {
    Element nodeModel = nodePart.getLocalModelElement();
        // Check top level connections to see whether we need to remove the connection parent element
        for (DiagramConnectionTemplate connTemplate : getAllConnectionTemplates())
        {
            if (connTemplate.getConnectionType() == DiagramConnectionTemplate.ConnectionType.OneToMany)
            {
                Element connParentElement = connTemplate.getConnectionParentElement(nodeModel);
                if (connParentElement != null)
                {
                    ElementList<?> connParentList = (ElementList<?>) connParentElement.parent();
                    connParentList.remove(connParentElement);
                }
            }
        }
       
View Full Code Here

     *
     * @param nodePart
     */
    private void refreshAttachedConnections(DiagramNodePart nodePart)
    {
      Element nodeElement = nodePart.getLocalModelElement();
      for (DiagramConnectionPart connPart : list())
      {
       if (connPart.removable() &&
           (connPart.getEndpoint1() == nodeElement ||
               connPart.getEndpoint2() == nodeElement))
View Full Code Here

    }
   
    @Override
    public void init()
    {
        final Element element = getModelElement();
       
        this.diagramEditor = (SapphireDiagramEditorPagePart)parent();
        this.connectionDef = (IDiagramConnectionDef)super.definition();
       
        this.propertyName = this.bindingDef.getProperty().content();
        this.modelProperty = (ListProperty) element.property(this.propertyName).definition();
       
        initConnPartListener();
       
        this.templateListeners = new CopyOnWriteArraySet<DiagramConnectionTemplateListener>();
                   
        String endpt1PropStr = this.bindingDef.getEndpoint1().content().getProperty().content();
        String endpt2PropStr = this.bindingDef.getEndpoint2().content().getProperty().content();
        this.originalEndpoint2Path = new ModelPath(endpt2PropStr);
       
        ElementType type = this.modelProperty.getType();
        this.endpoint1Property = type.property(endpt1PropStr);
        this.endpoint2Property = type.property(this.originalEndpoint2Path);
               
        if (getConnectionType() == ConnectionType.OneToOne)
        {
            this.endpoint1Path = new ModelPath(endpt1PropStr);
            this.endpoint2Path = new ModelPath(endpt2PropStr);
            this.connListProperty = this.modelProperty;
        }
        else
        {
            ModelPath.PropertySegment head = (ModelPath.PropertySegment)this.originalEndpoint2Path.head();
            PropertyDef prop = type.property(head.getPropertyName());
            if (prop instanceof ListProperty)
            {
                this.endpoint1Path = new ModelPath("../" + endpt1PropStr);
                this.endpoint2Path = this.originalEndpoint2Path.tail();
                this.connListProperty = (ListProperty)prop;
            }
            else
            {
                throw new RuntimeException("Invaid Model Path:" + this.originalEndpoint2Path);
            }
        }
       
        // initialize the connection parts
        ElementList<?> list = element.property(this.modelProperty);
        for( Element listEntryModelElement : list )
        {
            // check the type of connection: 1x1 connection versus 1xn connection           
            if (getConnectionType() == ConnectionType.OneToOne)
            {   
View Full Code Here

        }
        else
        {           
            for (StandardDiagramConnectionPart connPart : this.diagramConnections)
            {
                Element connModel = connPart.getLocalModelElement();
                if (connModel.parent().element() == connListParent)
                {
                    connList.add(connPart);
                }
            }           
        }
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.Element

Copyright © 2018 www.massapicom. 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.