From 3f690d86ebae3dfd907d152ccda2046921a69870 Mon Sep 17 00:00:00 2001 From: Heiko Braun Date: Wed, 25 Jul 2012 13:19:18 +0200 Subject: [PATCH] break up form manager API --- .../client/tools/BrowserPresenter.java | 20 ++++++++++++++++--- .../console/client/tools/FXFormManager.java | 3 +++ .../as/console/client/tools/FormProxy.java | 3 ++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/gui/src/main/java/org/jboss/as/console/client/tools/BrowserPresenter.java b/gui/src/main/java/org/jboss/as/console/client/tools/BrowserPresenter.java index 4ab40317f0..1d0e04a665 100644 --- a/gui/src/main/java/org/jboss/as/console/client/tools/BrowserPresenter.java +++ b/gui/src/main/java/org/jboss/as/console/client/tools/BrowserPresenter.java @@ -251,8 +251,18 @@ public void createFormProxy(String templateId, String modelId, final AsyncCallba final FXTemplate fxTemplate = storage.loadTemplate(templateId); final FXModel fxModel = fxTemplate.getModel(modelId); + loadDmrDescription(fxModel.getAddress(), new SimpleCallback() { + + @Override + public void onSuccess(ModelNode modelNode) { + callback.onSuccess(new FormProxy(fxModel, modelNode, BrowserPresenter.this)); + } + }); + } + + public void loadDmrDescription(ModelNode address, final AsyncCallback callback) { ModelNode descriptionOp = new ModelNode(); - descriptionOp.get(ADDRESS).set(fxModel.getAddress()); + descriptionOp.get(ADDRESS).set(address); descriptionOp.get(OP).set(READ_RESOURCE_DESCRIPTION_OPERATION); descriptionOp.get(OPERATIONS).set(true); @@ -280,7 +290,7 @@ public void onSuccess(DMRResponse dmrResponse) { actualDescriptionNode = result; } - callback.onSuccess(new FormProxy(fxModel, actualDescriptionNode, BrowserPresenter.this)); + callback.onSuccess(actualDescriptionNode); } }} ); @@ -291,9 +301,13 @@ public void getProxyData(String templateId, String modelId, final AsyncCallback< final FXTemplate fxTemplate = storage.loadTemplate(templateId); final FXModel fxModel = fxTemplate.getModel(modelId); + loadResourceData(fxModel.getAddress(), callback); + } + public void loadResourceData(ModelNode address, final AsyncCallback callback) + { ModelNode resourceOp = new ModelNode(); - resourceOp.get(ADDRESS).set(fxModel.getAddress()); + resourceOp.get(ADDRESS).set(address); resourceOp.get(OP).set(READ_RESOURCE_OPERATION); dispatcher.execute(new DMRAction(resourceOp), new SimpleCallback() { diff --git a/gui/src/main/java/org/jboss/as/console/client/tools/FXFormManager.java b/gui/src/main/java/org/jboss/as/console/client/tools/FXFormManager.java index d100c9a81d..4395d2e5d7 100644 --- a/gui/src/main/java/org/jboss/as/console/client/tools/FXFormManager.java +++ b/gui/src/main/java/org/jboss/as/console/client/tools/FXFormManager.java @@ -11,4 +11,7 @@ public interface FXFormManager { void createFormProxy(String templateId, String modelId, AsyncCallback callback); void getProxyData(String templateId, String modelId, final AsyncCallback callback); + + void loadDmrDescription(ModelNode address, final AsyncCallback callback); + void loadResourceData(ModelNode address, final AsyncCallback callback); } diff --git a/gui/src/main/java/org/jboss/as/console/client/tools/FormProxy.java b/gui/src/main/java/org/jboss/as/console/client/tools/FormProxy.java index 266b43c354..d334f6bf95 100644 --- a/gui/src/main/java/org/jboss/as/console/client/tools/FormProxy.java +++ b/gui/src/main/java/org/jboss/as/console/client/tools/FormProxy.java @@ -49,7 +49,8 @@ private void createForm(ModelNode description) { public void onAttribute(String name, String description, String type, boolean required) { // whitelist - if(!model.getFieldNames().contains(name)) + if(model.getFieldNames().size()>0 + && !model.getFieldNames().contains(name)) return; if("STRING".equals(type))