Skip to content

Commit

Permalink
Fix AS7-5152
Browse files Browse the repository at this point in the history
  • Loading branch information
heiko-braun committed Aug 7, 2012
1 parent bbf7adc commit 2f8f1b9
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package org.jboss.as.console.client.shared.subsys.tx;

import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import org.jboss.as.console.client.shared.help.FormHelpPanel;
import org.jboss.as.console.client.shared.subsys.Baseadress;
import org.jboss.as.console.client.shared.subsys.tx.model.TransactionManager;
import org.jboss.as.console.client.widgets.forms.FormToolStrip;
import org.jboss.ballroom.client.widgets.forms.Form;
import org.jboss.ballroom.client.widgets.forms.FormItem;
import org.jboss.dmr.client.ModelNode;

import java.util.Map;

/**
* @author Heiko Braun
* @date 8/2/12
*/
public class TXModelForm {

private Form<TransactionManager> form;

private TransactionPresenter presenter;
private FormItem[] fields;

public TXModelForm(TransactionPresenter presenter, FormItem... fields) {
this.presenter = presenter;
this.fields = fields;
}

Widget asWidget() {
VerticalPanel layout = new VerticalPanel();
layout.setStyleName("fill-layout");


form = new Form<TransactionManager>(TransactionManager.class);
form.setNumColumns(2);

FormToolStrip<TransactionManager> toolstrip =
new FormToolStrip<TransactionManager>(form, new FormToolStrip.FormCallback<TransactionManager>() {
@Override
public void onSave(Map<String, Object> changeset) {
presenter.onSaveConfig(changeset);
}

@Override
public void onDelete(TransactionManager entity) {

}
});
toolstrip.providesDeleteOp(false);

Widget toolstripWidget = toolstrip.asWidget();
layout.add(toolstripWidget);

FormHelpPanel helpPanel = new FormHelpPanel(new FormHelpPanel.AddressCallback() {
@Override
public ModelNode getAddress() {
ModelNode address = Baseadress.get();
address.add("subsystem", "transactions");
return address;
}
}, form);

layout.add(helpPanel.asWidget());

form.setFields(fields);
form.setEnabled(false);

layout.add(form.asWidget());

return layout;
}

public void edit(TransactionManager tm) {
form.edit(tm);
}

public void clearValues() {
form.clearValues();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,18 @@
import com.google.gwt.dom.client.Style;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import org.jboss.as.console.client.Console;
import org.jboss.as.console.client.core.SuspendableViewImpl;
import org.jboss.as.console.client.shared.help.FormHelpPanel;
import org.jboss.as.console.client.shared.subsys.Baseadress;
import org.jboss.as.console.client.shared.subsys.tx.model.TransactionManager;
import org.jboss.as.console.client.widgets.ContentDescription;
import org.jboss.as.console.client.widgets.forms.FormToolStrip;
import org.jboss.ballroom.client.widgets.ContentHeaderLabel;
import org.jboss.ballroom.client.widgets.forms.CheckBoxItem;
import org.jboss.ballroom.client.widgets.forms.DisclosureGroupRenderer;
import org.jboss.ballroom.client.widgets.forms.Form;
import org.jboss.ballroom.client.widgets.forms.NumberBoxItem;
import org.jboss.ballroom.client.widgets.forms.TextBoxItem;
import org.jboss.ballroom.client.widgets.tabs.FakeTabPanel;
import org.jboss.dmr.client.ModelNode;

import java.util.Map;

/**
* @author Heiko Braun
Expand All @@ -30,7 +23,11 @@
public class TransactionView extends SuspendableViewImpl implements TransactionPresenter.MyView{

private TransactionPresenter presenter = null;
private Form<TransactionManager> form ;
private TXModelForm defaultForm;
private TXModelForm pathForm;
private TXModelForm processIDForm;
private TXModelForm recoveryForm;


@Override
public void setPresenter(TransactionPresenter presenter) {
Expand All @@ -44,26 +41,6 @@ public Widget createWidget() {
FakeTabPanel titleBar = new FakeTabPanel("Transactions");
layout.add(titleBar);

form = new Form<TransactionManager>(TransactionManager.class);
form.setNumColumns(2);

FormToolStrip<TransactionManager> toolstrip =
new FormToolStrip<TransactionManager>(form, new FormToolStrip.FormCallback<TransactionManager>() {
@Override
public void onSave(Map<String, Object> changeset) {
presenter.onSaveConfig(changeset);
}

@Override
public void onDelete(TransactionManager entity) {

}
});
toolstrip.providesDeleteOp(false);

Widget toolstripWidget = toolstrip.asWidget();
layout.add(toolstripWidget);

VerticalPanel panel = new VerticalPanel();
panel.setStyleName("rhs-content-panel");

Expand All @@ -75,15 +52,22 @@ public void onDelete(TransactionManager entity) {

panel.add(new ContentHeaderLabel("Transaction Manager"));
panel.add(new ContentDescription(Console.CONSTANTS.subys_tx_desc()));
// -----


panel.add(toolstripWidget);
// -----

NumberBoxItem defaultTimeout = new NumberBoxItem("defaultTimeout", "Default Timeout");
CheckBoxItem enableStatistics = new CheckBoxItem("enableStatistics", "Enable Statistics");
CheckBoxItem enableTsm = new CheckBoxItem("enableTsmStatus", "Enable TSM Status");

CheckBoxItem jts = new CheckBoxItem("jts", "Enable JTS");
TextBoxItem nodeId = new TextBoxItem("nodeIdentifier", "Node Identifier");

TextBoxItem processIdSocket = new TextBoxItem("processIdSocketBinding", "Process ID Socket");
NumberBoxItem processIdPortMax = new NumberBoxItem("processIdMaxPorts", "Max Ports");
CheckBoxItem processIdUUID = new CheckBoxItem("processIdUUID", "Process ID UUID?");

CheckBoxItem useHornetq = new CheckBoxItem("hornetqStore", "Use HornetQ Store?");

TextBoxItem path = new TextBoxItem("path", "Path");
TextBoxItem relativeTo = new TextBoxItem("relativeTo", "Relative To");
TextBoxItem objectStorePath = new TextBoxItem("objectStorePath", "Object Store Path");
Expand All @@ -93,31 +77,37 @@ public void onDelete(TransactionManager entity) {
TextBoxItem socketBinding = new TextBoxItem("socketBinding", "Socket Binding");
TextBoxItem statusSocketBinding = new TextBoxItem("statusSocketBinding", "Status Socket Binding");

form.setFields(enableStatistics, enableTsm, defaultTimeout, path, relativeTo, objectStorePath, objectStorePathRelativeTo);
form.setFieldsInGroup("Recovery", new DisclosureGroupRenderer(), socketBinding, statusSocketBinding, recoveryListener);

form.setEnabled(false);
// ---

defaultForm = new TXModelForm(presenter, enableStatistics, enableTsm, jts, useHornetq, defaultTimeout, nodeId);
pathForm = new TXModelForm(presenter, path, relativeTo, objectStorePath, objectStorePathRelativeTo);
processIDForm = new TXModelForm(presenter, processIdUUID, processIdSocket, processIdPortMax);
recoveryForm = new TXModelForm(presenter, socketBinding, statusSocketBinding, recoveryListener);

panel.add(defaultForm.asWidget());

TabPanel tabs = new TabPanel();
tabs.setStyleName("default-tabpanel");
tabs.getElement().setAttribute("style", "margin-top:15px;");

FormHelpPanel helpPanel = new FormHelpPanel(new FormHelpPanel.AddressCallback() {
@Override
public ModelNode getAddress() {
ModelNode address = Baseadress.get();
address.add("subsystem", "transactions");
return address;
}
}, form);
tabs.add(processIDForm.asWidget(), "Process ID");
tabs.add(recoveryForm.asWidget(), "Recovery");
tabs.add(pathForm.asWidget(), "Path");

panel.add(helpPanel.asWidget());
tabs.selectTab(0);

panel.add(form.asWidget());
panel.add(tabs);

return layout;
}


@Override
public void setTransactionManager(TransactionManager tm) {
form.edit(tm);
defaultForm.edit(tm);
pathForm.edit(tm);
processIDForm.edit(tm);
recoveryForm.edit(tm);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,70 @@
@Address("/subsystem=transactions")
public interface TransactionManager {

@Binding(detypedName = "socket-binding")
String getSocketBinding();
void setSocketBinding(String s);
@Binding(detypedName = "default-timeout", expr = true)
int getDefaultTimeout();
void setDefaultTimeout(int t);

@Binding(detypedName = "status-socket-binding")
String getStatusSocketBinding();
void setStatusSocketBinding(String s);
@Binding(detypedName = "enable-statistics", expr = true)
boolean isEnableStatistics();
void setEnableStatistics(boolean b);

String getPath();
void setPath(String s);
@Binding(detypedName = "enable-tsm-status", expr = true)
boolean isEnableTsmStatus();
void setEnableTsmStatus(boolean b);

@Binding(detypedName = "relative-to")
String getRelativeTo();
void setRelativeTo(String s);
@Binding(detypedName = "jts", expr = true)
boolean isJts();
void setJts(boolean b);

@Binding(detypedName = "object-store-relative-to")
String getObjectStoreRelativeTo();
void setObjectStoreRelativeTo(String s);
@Binding(detypedName = "node-identifier", expr = true)
String getNodeIdentifier();
void setNodeIdentifier(String s);

@Binding(detypedName = "object-store-path")
@Binding(detypedName = "object-store-path", expr = true)
String getObjectStorePath();
void setObjectStorePath(String s);

@Binding(detypedName = "default-timeout")
int getDefaultTimeout();
void setDefaultTimeout(int t);
@Binding(detypedName = "object-store-relative-to", expr = true)
String getObjectStoreRelativeTo();
void setObjectStoreRelativeTo(String s);

@Binding(detypedName = "enable-statistics")
boolean isEnableStatistics();
void setEnableStatistics(boolean b);
@Binding(expr = true)
String getPath();
void setPath(String s);

@Binding(detypedName = "enable-tsm-status")
boolean isEnableTsmStatus();
void setEnableTsmStatus(boolean b);
@Binding(detypedName = "process-id-socket-binding", expr=true)
String getProcessIdSocketBinding();
void setProcessIdSocketBinding(String s);

@Binding(detypedName = "process-id-socket-max-ports", expr = true)
int getProcessIdMaxPorts();
void setProcessIdMaxPorts(int i);

@Binding(detypedName = "process-id-uuid")
boolean isProcessIdUUID();
void setProcessIdUUID(boolean b);

@Binding(detypedName = "recovery-listener")

@Binding(detypedName = "recovery-listener", expr=true)
boolean isRecoveryListener();
void setRecoveryListener(boolean b);

@Binding(detypedName = "relative-to", expr = true)
String getRelativeTo();
void setRelativeTo(String s);

@Binding(detypedName = "socket-binding", expr = true)
String getSocketBinding();
void setSocketBinding(String s);

@Binding(detypedName = "status-socket-binding", expr = true)
String getStatusSocketBinding();
void setStatusSocketBinding(String s);

@Binding(detypedName = "use-hornetq-store", expr=true)
boolean isHornetqStore();
void setHornetqStore(boolean b);

// Metrics

Expand Down Expand Up @@ -88,5 +113,4 @@ public interface TransactionManager {
long getNumHeuristics();
void setNumHeuristics(long l);


}

0 comments on commit 2f8f1b9

Please sign in to comment.