Search in sources :

Example 1 with UpdateEvent

use of org.apache.syncope.client.console.topology.TopologyTogglePanel.UpdateEvent in project syncope by apache.

the class TopologyNodePanel method onEvent.

@Override
public void onEvent(final IEvent<?> event) {
    if (event.getPayload() instanceof UpdateEvent) {
        final UpdateEvent updateEvent = UpdateEvent.class.cast(event.getPayload());
        final String key = updateEvent.getKey();
        final AjaxRequestTarget target = updateEvent.getTarget();
        if (node.getKind() == Kind.CONNECTOR && key.equalsIgnoreCase(node.getKey())) {
            ConnInstanceTO conn = new ConnectorRestClient().read(key);
            String displayName = // [SYNCOPE-1233]
            StringUtils.isBlank(conn.getDisplayName()) ? conn.getBundleName() : conn.getDisplayName();
            final String resourceName = displayName.length() > 14 ? displayName.subSequence(0, 10) + "..." : displayName;
            label.setDefaultModelObject(resourceName);
            target.add(label);
            node.setDisplayName(displayName);
        }
    }
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ConnectorRestClient(org.apache.syncope.client.console.rest.ConnectorRestClient) ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO) UpdateEvent(org.apache.syncope.client.console.topology.TopologyTogglePanel.UpdateEvent)

Aggregations

ConnectorRestClient (org.apache.syncope.client.console.rest.ConnectorRestClient)1 UpdateEvent (org.apache.syncope.client.console.topology.TopologyTogglePanel.UpdateEvent)1 ConnInstanceTO (org.apache.syncope.common.lib.to.ConnInstanceTO)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1