Skip to content

Commit

Permalink
distinguish runtime attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
heiko-braun committed Aug 7, 2012
1 parent c6a9cdd commit 443bd9a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ Widget asWidget() {

SafeHtmlBuilder helpText = new SafeHtmlBuilder();
helpText.appendHtmlConstant("<ul>");
helpText.appendHtmlConstant("<li>").appendEscaped("(*) : Marks a required attribute");
helpText.appendHtmlConstant("<li>").appendEscaped("($) : Indicates that expressions are supported");
helpText.appendHtmlConstant("<li>").appendEscaped("(*): Required attribute");
helpText.appendHtmlConstant("<li>").appendEscaped("+expression: Expressions are supported");
helpText.appendHtmlConstant("<li>").appendEscaped("runtime: Runtime value");
helpText.appendHtmlConstant("</ul>");
StaticHelpPanel help = new StaticHelpPanel(helpText.toSafeHtml());
inner.add(help.asWidget());
Expand Down Expand Up @@ -113,23 +114,28 @@ public void updateDescription(ModelNode address, ModelNode description)
SafeHtmlBuilder childrenBuilder = new SafeHtmlBuilder();

@Override
public void onAttribute(String name, String description, String type, boolean required, boolean expressions) {
public void onAttribute(String name, String description, String type, boolean required, boolean expressions, boolean runtime) {

attributeBuilder.appendHtmlConstant("<tr valign=top>");
attributeBuilder.appendHtmlConstant("<td class='doc-attribute'>");
attributeBuilder.appendEscaped(name);
attributeBuilder.appendHtmlConstant("</td>");

attributeBuilder.appendHtmlConstant("<td>");
attributeBuilder.appendEscaped(type);
String requiredSuffix = required ? " (*)" : "";
attributeBuilder.appendEscaped(requiredSuffix);
String expressionSuffix = expressions? " ($)" : "";
attributeBuilder.appendEscaped(expressionSuffix);
attributeBuilder.appendHtmlConstant("</td>");
attributeBuilder.appendHtmlConstant("</tr>");

attributeBuilder.appendHtmlConstant("<tr class='doc-table-description'>");
attributeBuilder.appendHtmlConstant("<td colspan=2>").appendEscaped(description).appendHtmlConstant("</td>");
attributeBuilder.appendHtmlConstant("<td width=70%>").appendEscaped(description).appendHtmlConstant("</td>");
attributeBuilder.appendHtmlConstant("<td width=30% style='color:#cccccc'>");
String expressionSuffix = expressions? " +expression" : "";
attributeBuilder.appendEscaped(expressionSuffix);
String runtimeSuffix = runtime? " runtime" : "";
attributeBuilder.appendEscaped(runtimeSuffix);
attributeBuilder.appendHtmlConstant("</td>");
attributeBuilder.appendHtmlConstant("</tr>");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private void buildFromDescription()
mapper.map(new DescriptionMapper.Mapping() {

@Override
public void onAttribute(String name, String description, String type, boolean required, boolean expressions) {
public void onAttribute(String name, String description, String type, boolean required, boolean expressions, boolean runtime) {

if("STRING".equals(type))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private void createForm(ModelNode description) {
List<FormItem> items = new LinkedList<FormItem>();

@Override
public void onAttribute(String name, String description, String type, boolean required, boolean expressions) {
public void onAttribute(String name, String description, String type, boolean required, boolean expressions, boolean runtime) {

// whitelist
if(model.getFieldNames().size()>0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void updateDescription(ModelNode address, ModelNode description)
mapper.map(new DescriptionMapper.Mapping() {

@Override
public void onAttribute(String name, String description, String type, boolean required, boolean expressions) {
public void onAttribute(String name, String description, String type, boolean required, boolean expressions, boolean runtime) {

if("STRING".equals(type))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import org.jboss.dmr.client.ModelNode;
import org.jboss.dmr.client.Property;

import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;

Expand All @@ -21,7 +23,7 @@ public DescriptionMapper(ModelNode address, ModelNode description) {
}

public interface Mapping {
void onAttribute(String name, String description, String type, boolean required, boolean expressions);
void onAttribute(String name, String description, String type, boolean required, boolean expressions, boolean runtime);
void onOperation(String name, String description, List<RequestParameter> parameter, ResponseParameter response);
void onChild(String name, String description);

Expand All @@ -38,6 +40,13 @@ public void map(Mapping mapping) {

final List<Property> properties = description.get("attributes").asPropertyList();

Collections.sort(properties, new Comparator<Property>() {
@Override
public int compare(Property property, Property property1) {
return property.getName().compareTo(property1.getName());
}
});

if(!properties.isEmpty())
{

Expand All @@ -57,7 +66,10 @@ public void map(Mapping mapping) {
final boolean expressions = att.getValue().hasDefined("expressions-allowed") ?
att.getValue().get("expressions-allowed").asBoolean() : false;

mapping.onAttribute(name, description, type, (!nillable||required), expressions);
final boolean runtime = att.getValue().hasDefined("storage") ?
att.getValue().get("storage").asString().equals("runtime"): false;

mapping.onAttribute(name, description, type, (!nillable||required), expressions,runtime);
}

}
Expand Down
6 changes: 5 additions & 1 deletion gui/src/main/java/org/jboss/as/console/public/lab.css
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ a:hover, a:active { outline: none; }
margin-right:5px;
}

.doc-table tr:hover {
background-color: #e5e5e5;
}

.doc-attribute {
font-weight: BOLD;
color: #3B4D64;
Expand Down Expand Up @@ -189,7 +193,7 @@ input[type="checkbox"] {
margin-left:5px;
margin-right:5px;
padding:10px;
line-height: 1.4;
line-height: 1.4!important;
}

.browser-dump-line:hover {
Expand Down

0 comments on commit 443bd9a

Please sign in to comment.