Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SWITCHYARD-653 add validators list to application details view

  • Loading branch information...
commit fcad5d9b412d7597d47e4a821881d4927a7d878e 1 parent 23e50f5
@rcernich rcernich authored
View
1  .gitignore
@@ -2,6 +2,7 @@
.settings
.classpath
target/
+.gwt/
*.iml
*.ipr
*.iws
View
21 gwt/src/main/java/org/switchyard/console/client/model/Application.java
@@ -38,14 +38,15 @@
* @param services the services provided by this application.
*/
public void setServices(List<Service> services);
-
+
/**
* @return the component services defined within this application.
*/
public List<ComponentService> getComponentServices();
-
+
/**
- * @param componentServices the component services defined within this application.
+ * @param componentServices the component services defined within this
+ * application.
*/
public void setComponentServices(List<ComponentService> componentServices);
@@ -58,7 +59,7 @@
* @param transformers the transforms defined within this application.
*/
public void setTransformers(List<Transformer> transformers);
-
+
/**
* @return the artifacts referenced by this application.
*/
@@ -68,5 +69,15 @@
* @param artifacts the artifacts referenced by this application.
*/
public void setArtifacts(List<ArtifactReference> artifacts);
-
+
+ /**
+ * @return the validators used by this application.
+ */
+ public List<Validator> getValidators();
+
+ /**
+ * @param validators the validators used by this application.
+ */
+ public void setValidators(List<Validator> validators);
+
}
View
49 gwt/src/main/java/org/switchyard/console/client/model/Validator.java
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.switchyard.console.client.model;
+
+/**
+ * Validator
+ *
+ * Represents a SwitchYard validator.
+ *
+ * @author Rob Cernich
+ */
+public interface Validator {
+ /**
+ * @return the type name.
+ */
+ public String getName();
+
+ /**
+ * @param name the type name.
+ */
+ public void setName(String name);
+
+ /**
+ * @return the implementation type.
+ */
+ public String getType();
+
+ /**
+ * @param type the implementation type.
+ */
+ public void setType(String type);
+
+}
View
7 gwt/src/main/java/org/switchyard/console/client/ui/application/ApplicationView.java
@@ -27,6 +27,7 @@
import org.jboss.ballroom.client.widgets.forms.Form;
import org.switchyard.console.client.model.Application;
import org.switchyard.console.client.ui.artifacts.ArtifactReferencesList;
+import org.switchyard.console.client.ui.common.ValidatorsList;
import org.switchyard.console.client.ui.widgets.LocalNameFormItem;
import org.switchyard.console.client.ui.widgets.NamespaceFormItem;
@@ -52,6 +53,7 @@
private ApplicationTransformationsEditor _transformationsEditor;
private ApplicationsList _applicationsList;
private Application _selectedApplication;
+ private ValidatorsList _validatorsList;
@Override
public Widget createWidget() {
@@ -79,6 +81,7 @@ public void onSelectionChange(SelectionChangeEvent event) {
_servicesEditor = new ApplicationServicesEditor(_presenter);
_artifactReferencesList = new ArtifactReferencesList();
_transformationsEditor = new ApplicationTransformationsEditor(_presenter);
+ _validatorsList = new ValidatorsList();
_artifactReferencesList.addSelectionChangeHandler(new Handler() {
@Override
@@ -96,7 +99,8 @@ public void onSelectionChange(SelectionChangeEvent event) {
"Displays details for a specific application. Select an application to see its implementation details.")
.setMaster(null, formWidget).addDetail("Services", _servicesEditor.asWidget())
.addDetail("Artifact References", _artifactReferencesList.asWidget())
- .addDetail("Transformers", _transformationsEditor.asWidget());
+ .addDetail("Transformers", _transformationsEditor.asWidget())
+ .addDetail("Validators", _validatorsList.asWidget());
applicationDetailsLayout.build();
formWidget.getParent().setStyleName("fill-layout-width");
@@ -129,6 +133,7 @@ public void setApplication(Application application) {
_artifactReferencesList.setData(application == null ? null : application.getArtifacts());
_servicesEditor.setApplication(application);
_transformationsEditor.setApplication(application);
+ _validatorsList.setData(application == null ? null : application.getValidators());
}
}
View
91 gwt/src/main/java/org/switchyard/console/client/ui/common/ValidatorsList.java
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.switchyard.console.client.ui.common;
+
+import org.jboss.ballroom.client.widgets.tables.DefaultCellTable;
+import org.switchyard.console.client.model.Validator;
+
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.user.cellview.client.ColumnSortEvent;
+import com.google.gwt.user.cellview.client.TextColumn;
+import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.ProvidesKey;
+
+/**
+ * ValidatorsList
+ *
+ * Wraps a table control for displaying validators.
+ *
+ * @author Rob Cernich
+ */
+public class ValidatorsList extends AbstractDataTable<Validator> {
+
+ /**
+ * Create a new ValidatorsList.
+ */
+ public ValidatorsList() {
+ super("Validators");
+ }
+
+ @Override
+ protected void createColumns(DefaultCellTable<Validator> table, ListDataProvider<Validator> dataProvider) {
+ TextColumn<Validator> nameColumn = new TextColumn<Validator>() {
+ @Override
+ public String getValue(Validator validator) {
+ return validator.getName();
+ }
+ };
+ nameColumn.setSortable(true);
+
+ TextColumn<Validator> typeColumn = new TextColumn<Validator>() {
+ @Override
+ public String getValue(Validator validator) {
+ return validator.getType();
+ }
+ };
+ typeColumn.setSortable(true);
+
+ ColumnSortEvent.ListHandler<Validator> sortHandler = new ColumnSortEvent.ListHandler<Validator>(
+ dataProvider.getList());
+ sortHandler.setComparator(nameColumn, createColumnCommparator(nameColumn));
+ sortHandler.setComparator(typeColumn, createColumnCommparator(typeColumn));
+
+ table.addColumn(nameColumn, "Name");
+ table.addColumn(typeColumn, "Type");
+
+ table.addColumnSortHandler(sortHandler);
+ table.getColumnSortList().push(typeColumn);
+ table.getColumnSortList().push(nameColumn);
+
+ table.setWidth("100%", false);
+ table.setColumnWidth(nameColumn, 70, Style.Unit.PCT);
+ table.setColumnWidth(typeColumn, 30, Style.Unit.PCT);
+ }
+
+ @Override
+ protected ProvidesKey<Validator> createKeyProvider() {
+ return new ProvidesKey<Validator>() {
+ @Override
+ public Object getKey(Validator item) {
+ return "" + item.getName() + ":" + item.getType();
+ }
+ };
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.