Package org.zanata.webtrans.shared.model

Examples of org.zanata.webtrans.shared.model.UserPanelSessionItem


    }

    @Override
    public void onExitWorkspace(ExitWorkspaceEvent event) {
        EditorClientId editorClientId = event.getEditorClientId();
        UserPanelSessionItem item = getUserPanel(editorClientId);
        removeUser(editorClientId);

        workspaceUsersPresenter.removeUser(item.getPanel(), event.getPerson()
                .getId().toString());
        interactionService.personExit(event.getPerson(), item.getSelectedId());

        if (Objects.equal(editorClientId,
                interactionService.getCurrentEditorClientId())) {
            // TODO if this works then localize the message
            eventBus.fireEvent(new NotificationEvent(
View Full Code Here


    private void addTranslator(EditorClientId editorClientId, Person person,
            TransUnitId selectedTransUnitId, HasManageUserPanel panel) {
        String color = getColor(editorClientId);

        UserPanelSessionItem item = getUserPanel(editorClientId);
        if (item == null) {
            item = new UserPanelSessionItem(panel, person);
            addUser(editorClientId, item);
        }

        item.setSelectedId(selectedTransUnitId);

        item.getPanel().setColor(color);

        updateTranslatorStatus(editorClientId, selectedTransUnitId);
    }
View Full Code Here

    public void updateTranslator(TargetContentsDisplay display,
            TransUnitId currentTransUnitId) {
        for (Map.Entry<EditorClientId, UserPanelSessionItem> entry : sessionService
                .getUserSessionMap().entrySet()) {
            EditorClientId editorClientId = entry.getKey();
            UserPanelSessionItem panelSessionItem = entry.getValue();
            if (panelSessionItem.getSelectedId() != null) {
                updateEditorTranslatorList(display,
                        panelSessionItem.getSelectedId(),
                        panelSessionItem.getPerson(), editorClientId,
                        currentTransUnitId);
            }
        }
    }
View Full Code Here

    @Test
    public void onTransUnitEditEvent() {
        // Given:
        EditorClientId editorClientId = editorClientId();
        UserPanelSessionItem sessionItem =
                new UserPanelSessionItem(panel, TestFixture.person());
        TransUnit transUnit = TestFixture.makeTransUnit(2);
        service.getUserSessionMap().put(editorClientId, sessionItem);
        when(hasTransUnitData.getEditorClientId()).thenReturn(editorClientId);
        when(hasTransUnitData.getSelectedTransUnitId()).thenReturn(
                transUnit.getId());
View Full Code Here

        when(distinctColor.getOrCreateColor(editorClientId)).thenReturn("red");

        service.onEnterWorkspace(event);

        assertThat(service.getUserSessionMap(), Matchers.hasKey(editorClientId));
        UserPanelSessionItem userPanel =
                service.getUserSessionMap().get(editorClientId);
        assertThat(userPanel.getPanel(), Matchers.sameInstance(panel));
        verify(panel).setColor("red");
        assertThat(userPanel.getSelectedId(), Matchers.nullValue());
    }
View Full Code Here

        ExitWorkspaceEvent event = mock(ExitWorkspaceEvent.class);
        EditorClientId editorClientId = editorClientId();
        Person person = TestFixture.person();
        when(event.getEditorClientId()).thenReturn(editorClientId);
        when(event.getPerson()).thenReturn(person);
        UserPanelSessionItem sessionItem =
                new UserPanelSessionItem(panel, person);
        TransUnit selectedTransUnit = TestFixture.makeTransUnit(1);
        sessionItem.setSelectedId(selectedTransUnit.getId());
        service.getUserSessionMap().put(editorClientId, sessionItem);

        service.onExitWorkspace(event);

        verify(workspaceUsersPresenter).removeUser(panel,
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.shared.model.UserPanelSessionItem

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.