CHE-124 Create/Import wizards are displaying errors while nothing is entered

Signed-off-by: Vitaliy Guliy <vguliy@codenvy.com>
6.19.x
Vitaliy Guliy 2016-02-29 12:38:16 +02:00
parent 5dad4fe7b5
commit 8a90fe2d5e
15 changed files with 286 additions and 110 deletions

View File

@ -297,7 +297,7 @@ public class StringUtils {
}
public static boolean isNullOrEmpty(String s) {
return s == null || "".equals(s);
return s == null || s.isEmpty();
}
public static boolean isNullOrWhitespace(String s) {

View File

@ -177,6 +177,7 @@ body, td {
.gwt-TextBox {
min-height: 22px;
padding: 0 5px 0 5px;
transition: border-bottom 0.2s linear;
}
.gwt-TextArea {
@ -185,9 +186,14 @@ body, td {
resize: none;
}
.gwt-TextBox[success] {
border-bottom: 1px solid successColor;
}
.gwt-TextBox:invalid,
.gwt-TextBox:required,
.gwt-TextBox.inputError {
.gwt-TextBox.inputError,
.gwt-TextBox[error] {
border-bottom: 1px solid errorColor !important;
}
@ -201,11 +207,6 @@ body, td {
-webkit-animation: textFieldFocus 0.2s infinite;
}
.gwt-TextBox:focus {
border-bottom: 1px solid successColor;
transition: border-bottom 0.2s linear;
}
.gwt-TextBox-readonly:focus {
border-bottom: 1px solid textFieldBorderColor;
}

View File

@ -0,0 +1,45 @@
/*******************************************************************************
* Copyright (c) 2012-2016 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.ide.ui;
/**
* An Extension of GWT TextBox.
* Contains methods for marking the text box containing valid or invalid values.
*
* @author Vitaliy Guliy
*/
public class TextBox extends com.google.gwt.user.client.ui.TextBox {
/**
* Marks text box containing valid value.
*/
public void markValid() {
getElement().setAttribute("success", "");
getElement().removeAttribute("error");
}
/**
* Marks text box containing invalid value.
*/
public void markInvalid() {
getElement().removeAttribute("success");
getElement().setAttribute("error", "");
}
/**
* Removes mark from text box.
*/
public void unmark() {
getElement().removeAttribute("success");
getElement().removeAttribute("error");
}
}

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.che.ide.ext.git.client.importer.page;
import com.google.common.base.Strings;
import com.google.gwt.regexp.shared.RegExp;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.inject.Inject;
@ -44,6 +45,8 @@ public class GitImporterPagePresenter extends AbstractWizardPage<ProjectConfigDt
private GitLocalizationConstant locale;
private GitImporterPageView view;
private boolean ignoreChanges;
@Inject
public GitImporterPagePresenter(GitImporterPageView view,
GitLocalizationConstant locale) {
@ -59,6 +62,10 @@ public class GitImporterPagePresenter extends AbstractWizardPage<ProjectConfigDt
@Override
public void projectNameChanged(@NotNull String name) {
if (ignoreChanges) {
return;
}
dataObject.setName(name);
updateDelegate.updateControls();
@ -67,14 +74,18 @@ public class GitImporterPagePresenter extends AbstractWizardPage<ProjectConfigDt
private void validateProjectName() {
if (NameUtils.checkProjectName(view.getProjectName())) {
view.hideNameError();
view.markNameValid();
} else {
view.showNameError();
view.markNameInvalid();
}
}
@Override
public void projectUrlChanged(@NotNull String url) {
if (ignoreChanges) {
return;
}
dataObject.getSource().setLocation(url);
isGitUrlCorrect(url);
@ -166,6 +177,14 @@ public class GitImporterPagePresenter extends AbstractWizardPage<ProjectConfigDt
public void go(@NotNull AcceptsOneWidget container) {
container.setWidget(view);
if (Strings.isNullOrEmpty(dataObject.getName()) && Strings.isNullOrEmpty(dataObject.getSource().getLocation())) {
ignoreChanges = true;
view.unmarkURL();
view.unmarkName();
view.setURLErrorMessage(null);
}
view.setProjectName(dataObject.getName());
view.setProjectDescription(dataObject.getDescription());
view.setProjectUrl(dataObject.getSource().getLocation());
@ -180,6 +199,8 @@ public class GitImporterPagePresenter extends AbstractWizardPage<ProjectConfigDt
view.setInputsEnableState(true);
view.focusInUrlInput();
ignoreChanges = false;
}
/** Gets project name from uri. */
@ -193,6 +214,7 @@ public class GitImporterPagePresenter extends AbstractWizardPage<ProjectConfigDt
if (indexStartProjectName != 0) {
return uri.substring(indexStartProjectName);
}
return "";
}
@ -205,26 +227,38 @@ public class GitImporterPagePresenter extends AbstractWizardPage<ProjectConfigDt
*/
private boolean isGitUrlCorrect(@NotNull String url) {
if (WHITE_SPACE.test(url)) {
view.showUrlError(locale.importProjectMessageStartWithWhiteSpace());
view.markURLInvalid();
view.setURLErrorMessage(locale.importProjectMessageStartWithWhiteSpace());
return false;
}
if (SCP_LIKE_SYNTAX.test(url)) {
view.hideUrlError();
view.markURLValid();
view.setURLErrorMessage(null);
return true;
}
if (!PROTOCOL.test(url)) {
view.showUrlError(locale.importProjectMessageProtocolIncorrect());
view.markURLInvalid();
view.setURLErrorMessage(locale.importProjectMessageProtocolIncorrect());
return false;
}
if (!(HOST1.test(url) || HOST2.test(url))) {
view.showUrlError(locale.importProjectMessageHostIncorrect());
view.markURLInvalid();
view.setURLErrorMessage(locale.importProjectMessageHostIncorrect());
return false;
}
if (!(REPO_NAME.test(url))) {
view.showUrlError(locale.importProjectMessageNameRepoIncorrect());
view.markURLInvalid();
view.setURLErrorMessage(locale.importProjectMessageNameRepoIncorrect());
return false;
}
view.hideUrlError();
view.markURLValid();
view.setURLErrorMessage(null);
return true;
}
}

View File

@ -45,24 +45,42 @@ public interface GitImporterPageView extends View<GitImporterPageView.ActionDele
}
/**
* Show the name error.
* Marks URL field containing valid value.
*/
void showNameError();
void markURLValid();
/**
* Hide the name error.
* Marks URL field containing invalid value.
*/
void hideNameError();
void markURLInvalid();
/**
* Show URL error.
* Removes mark from URL field.
*/
void showUrlError(@NotNull String message);
void unmarkURL();
/**
* Hide URL error.
* Displays error message under URL field.
*
* @param message
* message
*/
void hideUrlError();
void setURLErrorMessage(@NotNull String message);
/**
* Marks name field containing valid value.
*/
void markNameValid();
/**
* Marks name field containing invalid value.
*/
void markNameInvalid();
/**
* Removes mark from Name field.
*/
void unmarkName();
/**
* Set the project's URL.

View File

@ -23,12 +23,11 @@ import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.TextBox;
import com.google.inject.Inject;
import org.eclipse.che.ide.ext.git.client.GitResources;
import org.eclipse.che.ide.ui.TextBox;
import javax.validation.constraints.NotNull;
@ -144,25 +143,38 @@ public class GitImporterPageViewImpl extends Composite implements GitImporterPag
}
@Override
public void showNameError() {
projectName.addStyleName(style.inputError());
public void markURLValid() {
projectUrl.markValid();
}
@Override
public void hideNameError() {
projectName.removeStyleName(style.inputError());
public void markURLInvalid() {
projectUrl.markInvalid();
}
@Override
public void showUrlError(@NotNull String message) {
projectUrl.addStyleName(style.inputError());
labelUrlError.setText(message);
public void unmarkURL() {
projectUrl.unmark();
}
@Override
public void hideUrlError() {
projectUrl.removeStyleName(style.inputError());
labelUrlError.setText("");
public void setURLErrorMessage(@NotNull String message) {
labelUrlError.setText(message != null ? message : "");
}
@Override
public void markNameValid() {
projectName.markValid();
}
@Override
public void markNameInvalid() {
projectName.markInvalid();
}
@Override
public void unmarkName() {
projectName.unmark();
}
@NotNull

View File

@ -11,7 +11,8 @@
-->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:ide='urn:import:org.eclipse.che.ide.ui'>
<ui:with field='locale' type='org.eclipse.che.ide.ext.git.client.GitLocalizationConstant'/>
<ui:with field="style" type="org.eclipse.che.ide.ext.git.client.importer.page.GitImporterPageViewImpl.Style"/>
<g:DockLayoutPanel unit="PX" addStyleNames="{style.mainPanel}">
@ -20,7 +21,7 @@
<g:FlowPanel height="65px" addStyleNames="{style.namePanel}">
<g:Label text="{locale.gitImporterPageProjectUrl}"
addStyleNames="{style.labelPosition}"/>
<g:TextBox ui:field="projectUrl" addStyleNames="{style.inputField} {style.alignRight}" tabIndex="3"
<ide:TextBox ui:field="projectUrl" addStyleNames="{style.inputField} {style.alignRight}" tabIndex="3"
debugId="file-importProject-projectUrl"/>
<g:Label ui:field="labelUrlError" width="100%" wordWrap="true" addStyleNames="{style.labelErrorPosition}"/>
</g:FlowPanel>
@ -31,7 +32,7 @@
<g:FlowPanel height="50px" addStyleNames="{style.namePanel}">
<g:Label text="{locale.gitImporterPageProjectName}"
addStyleNames="{style.labelPosition}"/>
<g:TextBox ui:field="projectName" addStyleNames="{style.inputField} {style.alignRight}"
<ide:TextBox ui:field="projectName" addStyleNames="{style.inputField} {style.alignRight}"
tabIndex="4"
debugId="file-importProject-projectName" title="{locale.gitImporterPageProjectNamePrompt}"/>
</g:FlowPanel>
@ -51,7 +52,7 @@
<g:FlowPanel height="55px" addStyleNames="{style.namePanel}">
<g:Label text="{locale.gitImporterPageKeepDirectoryField}" addStyleNames="{style.labelPosition}"/>
<g:TextBox ui:field="directoryName" addStyleNames="{style.inputField} {style.alignRight}"
<ide:TextBox ui:field="directoryName" addStyleNames="{style.inputField} {style.alignRight}"
tabIndex="9" debugId="file-importProject-keepDirectoryName" title="{locale.gitImporterPageBranchField}"/>
</g:FlowPanel>
@ -62,7 +63,7 @@
<g:FlowPanel height="20px" addStyleNames="{style.namePanel}">
<g:Label text="{locale.gitImporterPageBranchField}" addStyleNames="{style.labelPosition}"/>
<g:TextBox ui:field="branch" addStyleNames="{style.inputField} {style.alignRight}"
<ide:TextBox ui:field="branch" addStyleNames="{style.inputField} {style.alignRight}"
tabIndex="10" debugId="file-importProject-branchName" title="{locale.gitImporterPageBranchField}"/>
</g:FlowPanel>

View File

@ -85,7 +85,9 @@ public class GitImporterPagePresenterTest {
presenter.projectUrlChanged(incorrectUrl);
verify(view).showUrlError(eq(locale.importProjectMessageStartWithWhiteSpace()));
verify(view).markURLInvalid();
verify(view).setURLErrorMessage(eq(locale.importProjectMessageStartWithWhiteSpace()));
verify(dataObject).setName(eq(name));
verify(view).setProjectName(name);
verify(updateDelegate).updateControls();
@ -174,7 +176,9 @@ public class GitImporterPagePresenterTest {
presenter.projectUrlChanged(incorrectUrl);
verify(view).showUrlError(eq(locale.importProjectMessageProtocolIncorrect()));
verify(view).markURLInvalid();
verify(view).setURLErrorMessage(eq(locale.importProjectMessageProtocolIncorrect()));
verify(source).setLocation(eq(incorrectUrl));
verify(view).setProjectName(anyString());
verify(updateDelegate).updateControls();
@ -188,8 +192,10 @@ public class GitImporterPagePresenterTest {
presenter.projectNameChanged(correctName);
verify(dataObject).setName(eq(correctName));
verify(view).hideNameError();
verify(view, never()).showNameError();
verify(view).markURLValid();
verify(view).setURLErrorMessage(eq(null));
verify(view, never()).markURLInvalid();
verify(updateDelegate).updateControls();
}
@ -201,8 +207,8 @@ public class GitImporterPagePresenterTest {
presenter.projectNameChanged(correctName);
verify(dataObject).setName(eq(correctName));
verify(view).hideNameError();
verify(view, never()).showNameError();
verify(view).markNameValid();
verify(view, never()).markNameInvalid();
verify(updateDelegate).updateControls();
}
@ -225,7 +231,7 @@ public class GitImporterPagePresenterTest {
presenter.projectNameChanged(incorrectName);
verify(dataObject).setName(eq(incorrectName));
verify(view).showNameError();
verify(view).markNameInvalid();
verify(updateDelegate).updateControls();
}
@ -294,9 +300,9 @@ public class GitImporterPagePresenterTest {
}
private void verifyInvocationsForCorrectUrl(String correctUrl) {
verify(view, never()).showUrlError(anyString());
verify(view, never()).markURLInvalid();
verify(source).setLocation(eq(correctUrl));
verify(view).hideUrlError();
verify(view).markURLValid();
verify(view).setProjectName(anyString());
verify(updateDelegate).updateControls();
}

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.che.ide.ext.github.client.importer.page;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.gwt.core.client.JsArrayMixed;
import com.google.gwt.regexp.shared.RegExp;
@ -74,6 +75,8 @@ public class GithubImporterPagePresenter extends AbstractWizardPage<ProjectConfi
private final AppContext appContext;
private OAuth2Authenticator gitHubAuthenticator;
private boolean ignoreChanges;
@Inject
public GithubImporterPagePresenter(GithubImporterPageView view,
OAuth2AuthenticatorRegistry gitHubAuthenticatorRegistry,
@ -99,6 +102,10 @@ public class GithubImporterPagePresenter extends AbstractWizardPage<ProjectConfi
@Override
public void projectNameChanged(@NotNull String name) {
if (ignoreChanges) {
return;
}
dataObject.setName(name);
updateDelegate.updateControls();
@ -110,14 +117,18 @@ public class GithubImporterPagePresenter extends AbstractWizardPage<ProjectConfi
*/
private void validateProjectName() {
if (NameUtils.checkProjectName(view.getProjectName())) {
view.hideNameError();
view.markNameValid();
} else {
view.showNameError();
view.markNameInvalid();
}
}
@Override
public void projectUrlChanged(@NotNull String url) {
if (ignoreChanges) {
return;
}
dataObject.getSource().setLocation(url);
isGitUrlCorrect(url);
@ -189,7 +200,17 @@ public class GithubImporterPagePresenter extends AbstractWizardPage<ProjectConfi
public void go(@NotNull AcceptsOneWidget container) {
container.setWidget(view);
updateView();
if (Strings.isNullOrEmpty(dataObject.getName()) && Strings.isNullOrEmpty(dataObject.getSource().getLocation())) {
ignoreChanges = true;
view.unmarkURL();
view.unmarkName();
view.setURLErrorMessage(null);
}
view.setProjectName(dataObject.getName());
view.setProjectDescription(dataObject.getDescription());
view.setProjectUrl(dataObject.getSource().getLocation());
view.setKeepDirectoryChecked(false);
view.setDirectoryName("");
@ -198,15 +219,8 @@ public class GithubImporterPagePresenter extends AbstractWizardPage<ProjectConfi
view.setInputsEnableState(true);
view.focusInUrlInput();
}
/**
* Updates the view.
*/
private void updateView() {
view.setProjectName(dataObject.getName());
view.setProjectDescription(dataObject.getDescription());
view.setProjectUrl(dataObject.getSource().getLocation());
ignoreChanges = false;
}
@Override
@ -291,7 +305,9 @@ public class GithubImporterPagePresenter extends AbstractWizardPage<ProjectConfi
dataObject.setDescription(repository.getDescription());
dataObject.getSource().setLocation(repository.getRepositoryUrl());
updateView();
view.setProjectName(repository.getName());
view.setProjectDescription(repository.getDescription());
view.setProjectUrl(repository.getRepositoryUrl());
updateDelegate.updateControls();
}
@ -402,26 +418,38 @@ public class GithubImporterPagePresenter extends AbstractWizardPage<ProjectConfi
*/
private boolean isGitUrlCorrect(@NotNull String url) {
if (WHITE_SPACE.test(url)) {
view.showUrlError(locale.importProjectMessageStartWithWhiteSpace());
view.markURLInvalid();
view.setURLErrorMessage(locale.importProjectMessageStartWithWhiteSpace());
return false;
}
if (SCP_LIKE_SYNTAX.test(url)) {
view.hideUrlError();
view.markURLValid();
view.setURLErrorMessage(null);
return true;
}
if (!PROTOCOL.test(url)) {
view.showUrlError(locale.importProjectMessageProtocolIncorrect());
view.markURLInvalid();
view.setURLErrorMessage(locale.importProjectMessageProtocolIncorrect());
return false;
}
if (!(HOST1.test(url) || HOST2.test(url))) {
view.showUrlError(locale.importProjectMessageHostIncorrect());
view.markURLInvalid();
view.setURLErrorMessage(locale.importProjectMessageHostIncorrect());
return false;
}
if (!(REPO_NAME.test(url))) {
view.showUrlError(locale.importProjectMessageNameRepoIncorrect());
view.markURLInvalid();
view.setURLErrorMessage(locale.importProjectMessageNameRepoIncorrect());
return false;
}
view.hideUrlError();
view.markURLValid();
view.setURLErrorMessage(null);
return true;
}
}

View File

@ -66,24 +66,42 @@ public interface GithubImporterPageView extends View<GithubImporterPageView.Acti
}
/**
* Show the name error.
* Marks URL field containing valid value.
*/
void showNameError();
void markURLValid();
/**
* Hide the name error.
* Marks URL field containing invalid value.
*/
void hideNameError();
void markURLInvalid();
/**
* Show URL error.
* Removes mark from URL field.
*/
void showUrlError(@NotNull String message);
void unmarkURL();
/**
* Hide URL error.
* Displays error message under URL field.
*
* @param message
* message
*/
void hideUrlError();
void setURLErrorMessage(@NotNull String message);
/**
* Marks name field containing valid value.
*/
void markNameValid();
/**
* Marks name field containing invalid value.
*/
void markNameInvalid();
/**
* Removes mark from Name field.
*/
void unmarkName();
/**
* Set the project's URL.

View File

@ -39,7 +39,6 @@ import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.view.client.SelectionChangeEvent;
import com.google.gwt.view.client.SingleSelectionModel;
import com.google.inject.Inject;
@ -48,6 +47,7 @@ import org.eclipse.che.ide.Resources;
import org.eclipse.che.ide.ext.github.client.GitHubLocalizationConstant;
import org.eclipse.che.ide.ext.github.client.GitHubResources;
import org.eclipse.che.ide.ext.github.client.load.ProjectData;
import org.eclipse.che.ide.ui.TextBox;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
@ -239,30 +239,44 @@ public class GithubImporterPageViewImpl extends Composite implements GithubImpor
projectName.setText("");
projectDescription.setText("");
githubPanel.removeFromParent();
hideUrlError();
hideNameError();
unmarkURL();
unmarkName();
}
@Override
public void showNameError() {
projectName.addStyleName(style.inputError());
public void markURLValid() {
projectUrl.markValid();
}
@Override
public void hideNameError() {
projectName.removeStyleName(style.inputError());
public void markURLInvalid() {
projectUrl.markInvalid();
}
@Override
public void showUrlError(@NotNull String message) {
projectUrl.addStyleName(style.inputError());
labelUrlError.setText(message);
public void unmarkURL() {
projectUrl.unmark();
}
@Override
public void hideUrlError() {
projectUrl.removeStyleName(style.inputError());
labelUrlError.setText("");
public void setURLErrorMessage(@NotNull String message) {
labelUrlError.setText(message != null ? message : "");
}
@Override
public void markNameValid() {
projectName.markValid();
}
@Override
public void markNameInvalid() {
projectName.markInvalid();
}
@Override
public void unmarkName() {
projectName.unmark();
}
@NotNull

View File

@ -12,7 +12,8 @@
-->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:p1='urn:import:com.google.gwt.user.cellview.client'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:ide='urn:import:org.eclipse.che.ide.ui'>
<ui:with field='locale' type='org.eclipse.che.ide.ext.github.client.GitHubLocalizationConstant'/>
<ui:with field='resources' type='org.eclipse.che.ide.ext.github.client.GitHubResources'/>
<ui:with field="style" type="org.eclipse.che.ide.ext.github.client.importer.page.GithubImporterPageViewImpl.GithubStyle"/>
@ -22,7 +23,7 @@
<g:FlowPanel height="65px" addStyleNames="{style.namePanel}">
<g:Label text="{locale.githubImporterPageProjectUrl}"
addStyleNames="{style.labelPosition}"/>
<g:TextBox ui:field="projectUrl" addStyleNames="{style.inputField} {style.alignRight}"
<ide:TextBox ui:field="projectUrl" addStyleNames="{style.inputField} {style.alignRight}"
tabIndex="3"
debugId="file-importProject-projectUrl"/>
<g:Label ui:field="labelUrlError" width="100%" wordWrap="true" addStyleNames="{style.labelErrorPosition}"/>
@ -34,7 +35,7 @@
<g:FlowPanel height="50px" addStyleNames="{style.namePanel}">
<g:Label text="{locale.githubImporterPageProjectName}"
addStyleNames="{style.labelPosition}"/>
<g:TextBox ui:field="projectName" addStyleNames="{style.inputField} {style.alignRight}"
<ide:TextBox ui:field="projectName" addStyleNames="{style.inputField} {style.alignRight}"
tabIndex="4"
debugId="file-importProject-projectName" title="{locale.githubImporterPageProjectNamePrompt}"/>
</g:FlowPanel>
@ -52,7 +53,7 @@
</g:FlowPanel>
<g:FlowPanel height="20px" addStyleNames="{style.namePanel}">
<g:Label text="{locale.githubImporterPageKeepDirectoryField}" addStyleNames="{style.labelPosition}"/>
<g:TextBox ui:field="directoryName" addStyleNames="{style.inputField} {style.alignRight}"
<ide:TextBox ui:field="directoryName" addStyleNames="{style.inputField} {style.alignRight}"
tabIndex="9" debugId="file-importProject-keepDirectoryName" title="{locale.githubImporterPageProjectNamePrompt}"/>
</g:FlowPanel>
@ -84,4 +85,4 @@
</g:FlowPanel>
</g:north>
</g:DockLayoutPanel>
</ui:UiBinder>
</ui:UiBinder>

View File

@ -239,7 +239,8 @@ public class GithubImporterPagePresenterTest {
presenter.projectUrlChanged(incorrectUrl);
verify(view).showUrlError(eq(locale.importProjectMessageStartWithWhiteSpace()));
verify(view).markURLInvalid();
verify(view).setURLErrorMessage(eq(locale.importProjectMessageStartWithWhiteSpace()));
verify(source).setLocation(eq(incorrectUrl));
verify(view).setProjectName(anyString());
verify(updateDelegate).updateControls();
@ -328,7 +329,8 @@ public class GithubImporterPagePresenterTest {
presenter.projectUrlChanged(correctUrl);
verify(view).showUrlError(eq(locale.importProjectMessageProtocolIncorrect()));
verify(view).markURLInvalid();
verify(view).setURLErrorMessage(eq(locale.importProjectMessageProtocolIncorrect()));
verify(source).setLocation(eq(correctUrl));
verify(view).setProjectName(anyString());
verify(updateDelegate).updateControls();
@ -342,8 +344,8 @@ public class GithubImporterPagePresenterTest {
presenter.projectNameChanged(correctName);
verify(dataObject).setName(eq(correctName));
verify(view).hideNameError();
verify(view, never()).showNameError();
verify(view).markNameValid();
verify(view, never()).markNameInvalid();
verify(updateDelegate).updateControls();
}
@ -355,8 +357,8 @@ public class GithubImporterPagePresenterTest {
presenter.projectNameChanged(correctName);
verify(dataObject).setName(eq(correctName));
verify(view).hideNameError();
verify(view, never()).showNameError();
verify(view).markNameValid();
verify(view, never()).markNameInvalid();
verify(updateDelegate).updateControls();
}
@ -379,7 +381,7 @@ public class GithubImporterPagePresenterTest {
presenter.projectNameChanged(incorrectName);
verify(dataObject).setName(eq(incorrectName));
verify(view).showNameError();
verify(view).markNameInvalid();
verify(updateDelegate).updateControls();
}
@ -471,9 +473,9 @@ public class GithubImporterPagePresenterTest {
}
private void verifyInvocationsForCorrectUrl(String correctUrl) {
verify(view, never()).showUrlError(anyString());
verify(view, never()).markURLInvalid();
verify(source).setLocation(eq(correctUrl));
verify(view).hideUrlError();
verify(view).markURLValid();
verify(view).setProjectName(anyString());
verify(updateDelegate).updateControls();
}

View File

@ -86,14 +86,14 @@ public class MachineExtension {
CustomCommandType arbitraryCommandType) {
machineResources.getCss().ensureInjected();
workspaceAgent.openPart(outputsContainerPresenter, PartStackType.INFORMATION);
workspaceAgent.openPart(consolesPanelPresenter, PartStackType.INFORMATION);
eventBus.addHandler(WsAgentStateEvent.TYPE, new WsAgentStateHandler() {
@Override
public void onWsAgentStarted(WsAgentStateEvent event) {
machinePortProvider.get();
perspectiveManager.setPerspectiveId(PROJECT_PERSPECTIVE_ID);
workspaceAgent.openPart(outputsContainerPresenter, PartStackType.INFORMATION);
workspaceAgent.openPart(consolesPanelPresenter, PartStackType.INFORMATION);
}
@Override

View File

@ -171,11 +171,7 @@ public class ProcessTreeRenderer implements NodeRenderer<ProcessTreeNode> {
private SpanElement createCommandElement(ProcessTreeNode node) {
SpanElement root = Elements.createSpanElement();
if (node.isRunning()) {
root.setAttribute("running", "true");
} else {
root.setAttribute("running", "false");
}
root.setAttribute("running", "" + node.isRunning());
root.appendChild(createCloseElement(node));
root.appendChild(createStopProcessElement(node));