Package org.eclipse.sapphire.samples.contacts

Examples of org.eclipse.sapphire.samples.contacts.Contact


    protected Object run( final Presentation context )
    {
        final String name = ( (Value<?>) this.property ).text();
        final ContactRepository cdb = this.property.element().nearest( ContactRepository.class );
       
        final Contact newContact = cdb.getContacts().insert();
        newContact.setName( name );
       
        return null;
    }
View Full Code Here


        final IAttendee attendee = (IAttendee) modelElement;
        final String name = attendee.getName().text();
       
        if( name != null )
        {
            Contact contact = null;
           
            for( Contact c : editor.getContactRepository().getContacts() )
            {
                if( name.equals( c.getName().text() ) )
                {
View Full Code Here

            return new ValuePropertyBinding()
            {
                @Override
                public String read()
                {
                    final Contact c = findContactRecord( false );
                    return ( c != null ? c.getEMail().text() : null );
                }
               
                @Override
                public void write( final String value )
                {
                    final Contact c = findContactRecord( value != null );
                   
                    if( c != null )
                    {
                        c.setEMail( value );
                    }
                }
            };
        }
        else if( pdef == IAttendee.PROP_IN_CONTACT_REPOSITORY )
View Full Code Here

        return null;
    }

    private Contact findContactRecord( final boolean createIfNecessary )
    {
        Contact c = null;
        final String name = this.base.getName().text();
       
        if( name != null )
        {
            for( Contact contact : this.contacts.getContacts() )
            {
                if( name.equals( contact.getName().text() ) )
                {
                    c = contact;
                    break;
                }
            }
   
            if( c == null && createIfNecessary )
            {
                c = this.contacts.getContacts().insert();
                c.setName( name );
            }
   
            for( Contact contact : this.contacts.getContacts() )
            {
                contact.attach( this.listener );
View Full Code Here

    @Override
    public boolean doEquals( final Object obj )
    {
        if( obj instanceof Contact )
        {
            final Contact c1 = context( Contact.class );
            final Contact c2 = (Contact) obj;
           
            return equal( c1.getName().text(), c2.getName().text() );
        }
        else
        {
            return false;
        }
View Full Code Here

    }

    @Override
    public int doHashCode()
    {
        final Contact c = context( Contact.class );
        final String name = c.getName().text();
       
        return ( name == null ? 1 : name.hashCode() );
    }
View Full Code Here

    @Override
    protected void compute( final Set<String> values )
    {
        final SendContactOp op = context( SendContactOp.class );
        final Contact contact = op.getContact().content();
       
        if( contact != null )
        {
            for( Contact c : contact.nearest( ContactRepository.class ).getContacts() )
            {
                final String email = c.getEMail().text();
               
                if( email != null )
                {
View Full Code Here

    @Override
    protected void compute( final Set<String> values )
    {
        values.add( "Personal" );
       
        final Contact c = context( Contact.class );
        final ContactRepository cdb = c.nearest( ContactRepository.class );
       
        if( cdb != null )
        {
            for( Contact contact : cdb.getContacts() )
            {
View Full Code Here

public final class SendContactActionHandler extends SapphireActionHandler
{
    @Override
    protected Object run( final Presentation context )
    {
        final Contact contact = (Contact) getModelElement();
       
        final SendContactOp operation = SendContactOp.TYPE.instantiate();
       
        try
        {
View Full Code Here

    @Override
    protected String compute()
    {
        final SendContactOp op = context( SendContactOp.class );
        final Contact contact = op.getContact().content();
        final StringBuilder buf = new StringBuilder();
       
        buf.append( "<html><body>\n" );
       
        if( contact != null )
        {
            buf.append( "<b>" );
            buf.append( contact.getName().text() );
            buf.append( "</b>\n" );
            buf.append( "<br/><hr/>\n" );
           
            if( ! contact.getPhoneNumbers().isEmpty() )
            {
                buf.append( "<p><table>\n" );
               
                for( PhoneNumber phone : contact.getPhoneNumbers() )
                {
                    buf.append( "<tr><td><i>" );
                    buf.append( phone.getType().text() );
                    buf.append( "</i></td><td>" );
                   
                    final String areaCode = phone.getAreaCode().text();
                    final String localNumber = phone.getLocalNumber().text();
                   
                    if( areaCode != null )
                    {
                        buf.append( '(' );
                        buf.append( areaCode );
                        buf.append( ") " );
                    }
                   
                    buf.append( localNumber );
                   
                    buf.append( "</td></tr>\n" );
                }
               
                buf.append( "</table></p>\n" );
            }
           
            final ContactAddress address = contact.getAddress();
           
            if( address != null && address.getStreet().content() != null )
            {
                buf.append( "<p>" );
                buf.append( address.getStreet().text() );
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.samples.contacts.Contact

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.