Search in sources :

Example 6 with IsWidget

use of com.google.gwt.user.client.ui.IsWidget in project che by eclipse.

the class SubPanelViewImpl method removeChildSubPanel.

private void removeChildSubPanel(Widget widget) {
    removeWidgetFromSplitPanel(widget.asWidget());
    IsWidget lastWidget = null;
    if (!southSubPanels.isEmpty()) {
        lastWidget = southSubPanels.get(0);
    } else if (!eastSubPanels.isEmpty()) {
        lastWidget = eastSubPanels.get(0);
    }
    if (lastWidget != null) {
        removeWidgetFromSplitPanel(lastWidget.asWidget());
        splitLayoutPanel.add(lastWidget);
    } else {
        ((SubPanelViewImpl) parentPanel).removeWidgetFromSplitPanel(this);
    }
}
Also used : IsWidget(com.google.gwt.user.client.ui.IsWidget)

Example 7 with IsWidget

use of com.google.gwt.user.client.ui.IsWidget in project che by eclipse.

the class EditorPartStackView method selectTab.

/** {@inheritDoc} */
@Override
public void selectTab(@NotNull PartPresenter partPresenter) {
    IsWidget view = partPresenter.getView();
    // set/remove attribute 'active' for Selenium tests
    for (int i = 0; i < contentPanel.getWidgetCount(); i++) {
        contentPanel.getWidget(i).getElement().removeAttribute("active");
    }
    view.asWidget().getElement().setAttribute("active", "");
    int viewIndex = contentPanel.getWidgetIndex(view);
    if (viewIndex < 0) {
        partPresenter.go(partViewContainer);
        viewIndex = contentPanel.getWidgetIndex(view);
    }
    contentPanel.showWidget(viewIndex);
    setActiveTab(partPresenter);
    if (partPresenter instanceof TextEditor) {
        ((TextEditor) partPresenter).activate();
    }
}
Also used : IsWidget(com.google.gwt.user.client.ui.IsWidget) TextEditor(org.eclipse.che.ide.api.editor.texteditor.TextEditor)

Example 8 with IsWidget

use of com.google.gwt.user.client.ui.IsWidget in project che by eclipse.

the class PartStackViewImpl method selectTab.

/** {@inheritDoc} */
@Override
public void selectTab(@NotNull PartPresenter partPresenter) {
    IsWidget view = partPresenter.getView();
    int viewIndex = contentPanel.getWidgetIndex(view);
    boolean isWidgetExist = viewIndex != -1;
    if (!isWidgetExist) {
        partPresenter.go(partViewContainer);
        viewIndex = contentPanel.getWidgetIndex(view);
    }
    contentPanel.showWidget(viewIndex);
    setActiveTab(partPresenter);
}
Also used : IsWidget(com.google.gwt.user.client.ui.IsWidget)

Example 9 with IsWidget

use of com.google.gwt.user.client.ui.IsWidget in project che by eclipse.

the class EditorMultiPartStackViewImpl method addPartStack.

@Override
public void addPartStack(@NotNull final EditorPartStack partStack, final EditorPartStack relativePartStack, final Constraints constraints, final double size) {
    AcceptsOneWidget partViewContainer = new AcceptsOneWidget() {

        @Override
        public void setWidget(IsWidget widget) {
            if (relativePartStack == null) {
                rootView = splitEditorPartViewFactory.create(widget);
                splitEditorParts.put(partStack, rootView);
                contentPanel.remove(emptyEditorsPanel);
                contentPanel.add(rootView);
                return;
            }
            SplitEditorPartView relativePartStackView = splitEditorParts.get(relativePartStack);
            if (relativePartStackView == null) {
                Log.error(getClass(), "Can not find container for specified editor");
                return;
            }
            relativePartStackView.split(widget, constraints.direction, size);
            splitEditorParts.put(partStack, relativePartStackView.getReplica());
            splitEditorParts.put(relativePartStack, relativePartStackView.getSpecimen());
        }
    };
    partStack.go(partViewContainer);
}
Also used : IsWidget(com.google.gwt.user.client.ui.IsWidget) AcceptsOneWidget(com.google.gwt.user.client.ui.AcceptsOneWidget)

Example 10 with IsWidget

use of com.google.gwt.user.client.ui.IsWidget in project che by eclipse.

the class ProcessesPanelPresenterTest method shouldHideStopProcessButtonAtAddingTerminal.

@Test
public void shouldHideStopProcessButtonAtAddingTerminal() throws Exception {
    MachineDto machineDto = mock(MachineDto.class);
    MachineEntity machine = mock(MachineEntity.class);
    when(machine.getId()).thenReturn(MACHINE_ID);
    MachineConfigDto machineConfigDto = mock(MachineConfigDto.class);
    when(machine.getConfig()).thenReturn(machineConfigDto);
    when(machineConfigDto.isDev()).thenReturn(true);
    when(machine.getStatus()).thenReturn(MachineStatus.RUNNING);
    List<MachineDto> machines = new ArrayList<>(1);
    machines.add(machineDto);
    when(workspaceRuntime.getMachines()).thenReturn(machines);
    when(entityFactory.createMachine(machineDto)).thenReturn(machine);
    ProcessTreeNode machineNode = mock(ProcessTreeNode.class);
    when(machineNode.getId()).thenReturn(MACHINE_ID);
    List<ProcessTreeNode> children = new ArrayList<>();
    children.add(machineNode);
    presenter.rootNode = new ProcessTreeNode(ROOT_NODE, null, null, null, children);
    TerminalPresenter terminal = mock(TerminalPresenter.class);
    when(terminalFactory.create(machine, presenter)).thenReturn(terminal);
    IsWidget terminalWidget = mock(IsWidget.class);
    when(terminal.getView()).thenReturn(terminalWidget);
    when(terminalWidget.asWidget()).thenReturn(widget);
    presenter.addCommandOutput(MACHINE_ID, outputConsole);
    presenter.onAddTerminal(MACHINE_ID, presenter);
    verify(terminalFactory).create(eq(machine), eq(presenter));
    verify(terminal).getView();
    verify(view, times(2)).setProcessesData(anyObject());
    verify(view, times(2)).selectNode(anyObject());
    verify(view).addWidget(anyString(), anyString(), anyObject(), eq(terminalWidget), anyBoolean());
    verify(view, times(1)).addProcessNode(anyObject());
    verify(terminal).setVisible(eq(true));
    verify(terminal).connect();
    verify(terminal).setListener(anyObject());
    verify(view).setStopButtonVisibility(anyString(), eq(false));
}
Also used : MachineEntity(org.eclipse.che.ide.api.machine.MachineEntity) IsWidget(com.google.gwt.user.client.ui.IsWidget) MachineDto(org.eclipse.che.api.machine.shared.dto.MachineDto) ArrayList(java.util.ArrayList) MachineConfigDto(org.eclipse.che.api.machine.shared.dto.MachineConfigDto) ProcessTreeNode(org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode) TerminalPresenter(org.eclipse.che.ide.extension.machine.client.perspective.terminal.TerminalPresenter) Test(org.junit.Test)

Aggregations

IsWidget (com.google.gwt.user.client.ui.IsWidget)15 ProcessTreeNode (org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode)8 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)6 MachineEntity (org.eclipse.che.ide.api.machine.MachineEntity)5 MachineConfigDto (org.eclipse.che.api.machine.shared.dto.MachineConfigDto)4 AcceptsOneWidget (com.google.gwt.user.client.ui.AcceptsOneWidget)3 TerminalPresenter (org.eclipse.che.ide.extension.machine.client.perspective.terminal.TerminalPresenter)3 MachineDto (org.eclipse.che.api.machine.shared.dto.MachineDto)2 UIObject (com.google.gwt.user.client.ui.UIObject)1 ReflectionException (com.googlecode.gwt.test.exceptions.ReflectionException)1 HashMap (java.util.HashMap)1 TextEditor (org.eclipse.che.ide.api.editor.texteditor.TextEditor)1 MachineStateEvent (org.eclipse.che.ide.api.machine.events.MachineStateEvent)1 OutputConsole (org.eclipse.che.ide.api.outputconsole.OutputConsole)1 CommandOutputConsole (org.eclipse.che.ide.extension.machine.client.outputspanel.console.CommandOutputConsole)1 Matchers.anyString (org.mockito.Matchers.anyString)1