forked from jbossas/console
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bbf7adc
commit 2f8f1b9
Showing
3 changed files
with
168 additions
and
72 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
gui/src/main/java/org/jboss/as/console/client/shared/subsys/tx/TXModelForm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters