if (Analyzer.application.getGrammars() == null) {
Analyzer.application.addGrammars(new GrammarsNode(Analyzer.application));
}
Analyzer.application.grammars.addInclude(include);
}
WadlTreeRoot wadlTreeRoot = new WadlTreeRoot();
Tree wadlTree = wadlTreeRoot.buildTree(Analyzer.application);
WadlPanel.wadlArea.clear();
WadlPanel.wadlArea.setWidget(wadlTree);
}
});
containerPanel.add(addSchemaButton);
}
// default namespace
final Button addNamespaceButton = new Button(GuiFactory.strings.addNamespace());
if (!defaultNamespace.isEmpty()) {
final Vector reallyAddDefaultNamespace = new Vector();
containerPanel.add(new HTML("<br />" + GuiFactory.strings.defaultNamespaces()));
ScrollPanel defaultNamespaceContainerPanel = new ScrollPanel();
defaultNamespaceContainerPanel.setStyleName("restDescribe-wadlArea");
defaultNamespaceContainerPanel.setHeight(panelHeight);
VerticalPanel defaultNamespacePanel = new VerticalPanel();
defaultNamespaceContainerPanel.add(defaultNamespacePanel);
containerPanel.add(defaultNamespaceContainerPanel);
Iterator defaultNamespaceIterator = defaultNamespace.iterator();
int i = 0;
HorizontalPanel horizontalNamespacePanel = new HorizontalPanel();
defaultNamespacePanel.add(horizontalNamespacePanel);
Grid grid = new Grid(defaultNamespace.size(), 2);
horizontalNamespacePanel.add(grid);
while (defaultNamespaceIterator.hasNext()) {
final String defaultNamespace = (String) defaultNamespaceIterator.next();
reallyAddDefaultNamespace.add(defaultNamespace);
final CheckBox checkBox = new CheckBox();
checkBox.setChecked(true);
checkBox.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
if (checkBox.isChecked() &&
!reallyAddDefaultNamespace.contains(defaultNamespace)) {
reallyAddDefaultNamespace.add(defaultNamespace);
}
else {
if (reallyAddDefaultNamespace.contains(defaultNamespace)) {
reallyAddDefaultNamespace.remove(defaultNamespace);
}
}
}
});
grid.setWidget(i, 0, checkBox);
grid.setText(i, 1, defaultNamespace);
i++;
}
addNamespaceButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
Iterator addNamespaceIterator = reallyAddDefaultNamespace.iterator();
while (addNamespaceIterator.hasNext()) {
String namespace = (String) addNamespaceIterator.next();
Analyzer.application.addNamespace(
new NamespaceAttribute(null, namespace));
}
WadlTreeRoot wadlTreeRoot = new WadlTreeRoot();
Tree wadlTree = wadlTreeRoot.buildTree(Analyzer.application);
WadlPanel.wadlArea.clear();
WadlPanel.wadlArea.setWidget(wadlTree);
}
});
containerPanel.add(addNamespaceButton);
}
final Button addOtherNamespacesButton = new Button(GuiFactory.strings.addOtherNamespace());
// other namespaces
if (!otherNamespaces.isEmpty()) {
final Vector reallyAddOtherNamespaces = new Vector();
containerPanel.add(new HTML("<br />" + GuiFactory.strings.otherNamespaces()));
ScrollPanel otherNamespacesContainerPanel = new ScrollPanel();
otherNamespacesContainerPanel.setStyleName("restDescribe-wadlArea");
otherNamespacesContainerPanel.setHeight(panelHeight);
VerticalPanel otherNamespacesPanel = new VerticalPanel();
otherNamespacesContainerPanel.add(otherNamespacesPanel);
containerPanel.add(otherNamespacesContainerPanel);
Iterator otherNamespacesIterator = otherNamespaces.iterator();
int i = 0;
HorizontalPanel horizontalNamespacePanel = new HorizontalPanel();
otherNamespacesPanel.add(horizontalNamespacePanel);
Grid grid = new Grid(otherNamespaces.size(), 2);
horizontalNamespacePanel.add(grid);
while (otherNamespacesIterator.hasNext()) {
final String otherNamespace = (String) otherNamespacesIterator.next();
reallyAddOtherNamespaces.add(otherNamespace);
final CheckBox checkBox = new CheckBox();
checkBox.setChecked(true);
checkBox.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
if (checkBox.isChecked() &&
!reallyAddOtherNamespaces.contains(otherNamespace)) {
reallyAddOtherNamespaces.add(otherNamespace);
}
else {
if (reallyAddOtherNamespaces.contains(otherNamespace)) {
reallyAddOtherNamespaces.remove(otherNamespace);
}
}
}
});
grid.setWidget(i, 0, checkBox);
grid.setText(i, 1, otherNamespace);
i++;
}
addOtherNamespacesButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
Iterator addNamespaceIterator = reallyAddOtherNamespaces.iterator();
while (addNamespaceIterator.hasNext()) {
String namespace = (String) addNamespaceIterator.next();
Analyzer.application.addNamespace(
new NamespaceAttribute(null, namespace));
}
WadlTreeRoot wadlTreeRoot = new WadlTreeRoot();
Tree wadlTree = wadlTreeRoot.buildTree(Analyzer.application);
WadlPanel.wadlArea.clear();
WadlPanel.wadlArea.setWidget(wadlTree);
}
});
containerPanel.add(addOtherNamespacesButton);