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);
}
}
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();
}
}
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);
}
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);
}
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));
}
Aggregations