Package rocks.xmpp.core.stanza.model.client

Examples of rocks.xmpp.core.stanza.model.client.Presence


        final PresenceListener presenceListener = new PresenceListener() {
            @Override
            public void handle(PresenceEvent e) {
                if (!e.isIncoming()) {
                    final Presence presence = e.getPresence();
                    if (presence.getTo() == null) {
                        waitForPlatform();
                        Platform.runLater(new Runnable() {
                            @Override
                            public void run() {
                                debugController.viewModel.presence.set(presence);
View Full Code Here


        circlePresence.getStyleClass().addAll(CSS_PRESENCE, CSS_UNAVAILABLE);
        viewModel.presence.addListener(new ChangeListener<Presence>() {
            @Override
            public void changed(ObservableValue<? extends Presence> observable, Presence oldValue, Presence newValue) {
                circlePresence.getStyleClass().removeAll(CSS_UNAVAILABLE, CSS_AVAILABLE);
                Presence presence = viewModel.presence.get();
                if (presence != null) {
                    if (presence.isAvailable()) {
                        if (presence.getShow() != null) {
                            switch (presence.getShow()) {
                                case AWAY:
                                    circlePresence.getStyleClass().add(CSS_AWAY);
                                    break;
                                default:
                                    circlePresence.getStyleClass().add(CSS_AVAILABLE);
View Full Code Here

*/
public class OccupantTest {

    @Test
    public void testComparable() {
        Presence presence1 = new Presence();
        presence1.setFrom(Jid.valueOf("room@conference/firstwitch"));
        presence1.getExtensions().add(MucUser.withItem(Affiliation.OWNER, Role.MODERATOR));
        Occupant occupant1 = new Occupant(presence1, true);

        Presence presence2 = new Presence();
        presence2.setFrom(Jid.valueOf("room@conference/secondwitch"));
        presence2.getExtensions().add(MucUser.withItem(Affiliation.OWNER, Role.PARTICIPANT));
        Occupant occupant2 = new Occupant(presence2, true);

        Presence presence2a = new Presence();
        presence2a.setFrom(Jid.valueOf("room@conference/thirdwitch"));
        presence2a.getExtensions().add(MucUser.withItem(Affiliation.OWNER, Role.VISITOR));
        Occupant occupant2a = new Occupant(presence2a, true);

        Presence presence2b = new Presence();
        presence2b.setFrom(Jid.valueOf("room@conference/zzz"));
        presence2b.getExtensions().add(MucUser.withItem(Affiliation.OWNER, Role.VISITOR));
        Occupant occupant2b = new Occupant(presence2b, true);

        Presence presence3 = new Presence();
        presence3.setFrom(Jid.valueOf("room@conference/aaa"));
        presence3.getExtensions().add(MucUser.withItem(Affiliation.ADMIN, Role.MODERATOR));
        Occupant occupant3 = new Occupant(presence3, true);

        Presence presence4 = new Presence();
        presence4.setFrom(Jid.valueOf("room@conference/bbb"));
        presence4.getExtensions().add(MucUser.withItem(Affiliation.MEMBER, Role.PARTICIPANT));
        Occupant occupant4 = new Occupant(presence4, true);

        Presence presence5 = new Presence();
        presence5.setFrom(Jid.valueOf("room@conference/bbb"));
        presence5.getExtensions().add(MucUser.withItem(Affiliation.OUTCAST, Role.PARTICIPANT));
        Occupant occupant5 = new Occupant(presence5, true);

        Presence presence5a = new Presence();
        presence5a.setFrom(Jid.valueOf("room@conference/ccc"));
        presence5a.getExtensions().add(MucUser.withItem(Affiliation.OUTCAST, Role.PARTICIPANT));
        Occupant occupant5a = new Occupant(presence5a, true);

        Presence presence6 = new Presence();
        presence6.setFrom(Jid.valueOf("room@conference/bbb"));
        presence6.getExtensions().add(MucUser.withItem(Affiliation.NONE, Role.PARTICIPANT));
        Occupant occupant6 = new Occupant(presence6, true);

        List<Occupant> occupants = new ArrayList<>();
        occupants.add(occupant1);
        occupants.add(occupant2);
View Full Code Here

                xmppSession1.removePresenceListener(this);
                Assert.assertTrue(e.getPresence().getExtension(LastActivity.class) != null);
            }
        });
        xmppSession1.send(new Message(JULIET));
        xmppSession1.send(new Presence(Presence.Show.AWAY));
    }
View Full Code Here

            public void handle(PresenceEvent e) {
                Assert.assertTrue(e.getPresence().getExtension(LastActivity.class) != null);
            }
        });
        xmppSession1.send(new Message(JULIET));
        xmppSession1.send(new Presence(Presence.Show.AWAY));
    }
View Full Code Here

            @Override
            public void handle(PresenceEvent e) {
                Assert.assertFalse(e.getPresence().getExtension(LastActivity.class) != null);
            }
        });
        xmppSession1.send(new Presence(Presence.Show.CHAT));
    }
View Full Code Here

            @Override
            public void handle(PresenceEvent e) {
                Assert.assertFalse(e.getPresence().getExtension(LastActivity.class) != null);
            }
        });
        xmppSession1.send(new Presence(Presence.Show.DND));
    }
View Full Code Here

            @Override
            public void handle(PresenceEvent e) {
                Assert.assertFalse(e.getPresence().getExtension(LastActivity.class) != null);
            }
        });
        xmppSession1.send(new Presence(Presence.Show.AWAY));
    }
View Full Code Here

    @Test
    public void unmarshalNickname() throws XMLStreamException, JAXBException {
        String xml = "<presence from='narrator@moby-dick.lit' to='starbuck@moby-dick.lit' type='subscribe'>\n" +
                "  <nick xmlns='http://jabber.org/protocol/nick'>Ishmael</nick>\n" +
                "</presence>\n";
        Presence presence = unmarshal(xml, Presence.class);
        Nickname nickname = presence.getExtension(Nickname.class);
        Assert.assertNotNull(nickname);
        Assert.assertEquals(nickname.getValue(), "Ishmael");
    }
View Full Code Here

                    super.bind(contactItem.presence);
                }

                @Override
                protected Paint computeValue() {
                    Presence presence = contactItem.presence.get();
                    if (presence != null && presence.isAvailable()) {
                        return new Color(0.52, 0.84, 0.27, 1);
                    }
                    return Color.LIGHTGREY;
                }
            });
View Full Code Here

TOP

Related Classes of rocks.xmpp.core.stanza.model.client.Presence

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.