use of com.google.gwt.user.client.ui.SimplePanel in project drools-wb by kiegroup.
the class BaseDecisionTableColumnPage method init.
public void init(final NewGuidedDecisionTableColumnWizard wizard) {
this.wizard = wizard;
this.presenter = wizard.getPresenter();
this.content = new SimplePanel();
initialise();
}
use of com.google.gwt.user.client.ui.SimplePanel in project drools-wb by kiegroup.
the class GuidedScoreCardEditor method addCharacteristic.
private FlexTable addCharacteristic(final Characteristic characteristic) {
final FlexTable cGrid = new FlexTable();
cGrid.setBorderWidth(0);
cGrid.setCellPadding(1);
cGrid.setCellSpacing(1);
cGrid.setStyleName("rule-ListHeader");
Button btnAddAttribute = new Button(GuidedScoreCardConstants.INSTANCE.addAttribute(), new ClickHandler() {
public void onClick(final ClickEvent event) {
addAttribute(cGrid, null);
}
});
Button btnRemoveCharacteristic = new Button(GuidedScoreCardConstants.INSTANCE.removeCharacteristic(), new ClickHandler() {
public void onClick(ClickEvent event) {
removeCharacteristic(cGrid);
}
});
String selectedFact = "";
if (characteristic != null) {
selectedFact = characteristic.getFact();
if (selectedFact.lastIndexOf(".") > -1) {
selectedFact = selectedFact.substring(selectedFact.lastIndexOf(".") + 1);
}
}
// Fields List Box
final ListBox dropDownFields = new ListBox();
// Facts List Box
final ListBox dropDownFacts = new ListBox();
final String[] eligibleFacts = oracle.getFactTypes();
for (final String factType : eligibleFacts) {
dropDownFacts.addItem(factType);
}
dropDownFacts.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(final ChangeEvent event) {
characteristicFactChanged(characteristic, dropDownFacts, dropDownFields);
}
});
final int selectedFactIndex = Arrays.asList(eligibleFacts).indexOf(selectedFact);
dropDownFacts.setSelectedIndex(selectedFactIndex >= 0 ? selectedFactIndex : 0);
characteristicFactChanged(characteristic, dropDownFacts, dropDownFields);
cGrid.setWidget(0, 0, new Label(GuidedScoreCardConstants.INSTANCE.name()));
final TextBox tbName = TextBoxFactory.getTextBox(DataType.TYPE_STRING);
cGrid.setWidget(0, 1, tbName);
cGrid.setWidget(0, 2, btnRemoveCharacteristic);
cGrid.setWidget(0, 3, btnAddAttribute);
cGrid.setWidget(1, 0, new Label(GuidedScoreCardConstants.INSTANCE.fact()));
cGrid.setWidget(1, 1, new Label(GuidedScoreCardConstants.INSTANCE.characteristic()));
cGrid.setWidget(1, 2, new Label(GuidedScoreCardConstants.INSTANCE.baselineScore()));
cGrid.setWidget(1, 3, new Label(GuidedScoreCardConstants.INSTANCE.reasonCode()));
cGrid.setWidget(2, 0, dropDownFacts);
cGrid.setWidget(2, 1, dropDownFields);
final TextBox tbBaseline = TextBoxFactory.getTextBox(DataType.TYPE_NUMERIC_DOUBLE);
final boolean useReasonCodesValue = "true".equalsIgnoreCase(ddUseReasonCode.getValue(ddUseReasonCode.getSelectedIndex()));
tbBaseline.setEnabled(useReasonCodesValue);
cGrid.setWidget(2, 2, tbBaseline);
final TextBox tbReasonCode = TextBoxFactory.getTextBox(DataType.TYPE_STRING);
tbReasonCode.setEnabled(useReasonCodesValue);
cGrid.setWidget(2, 3, tbReasonCode);
final SimplePanel gapPanel = new SimplePanel();
gapPanel.add(new HTML("<br/>"));
final VerticalPanel panel = new VerticalPanel();
panel.add(cGrid);
characteristicsAttrPanelMap.put(cGrid, panel);
// panel.add( addAttributeCellTable( cGrid, characteristic ) );
panel.setWidth("100%");
DecoratorPanel decoratorPanel = new DecoratorPanel();
decoratorPanel.add(panel);
characteristicsPanel.add(decoratorPanel);
characteristicsPanel.add(gapPanel);
characteristicsTables.add(cGrid);
cGrid.getColumnFormatter().setWidth(0, "150px");
cGrid.getColumnFormatter().setWidth(1, "250px");
cGrid.getColumnFormatter().setWidth(2, "150px");
cGrid.getColumnFormatter().setWidth(3, "150px");
if (characteristic != null) {
tbReasonCode.setValue(characteristic.getReasonCode());
tbBaseline.setValue("" + characteristic.getBaselineScore());
tbName.setValue(characteristic.getName());
}
return cGrid;
}
use of com.google.gwt.user.client.ui.SimplePanel in project GwtMobile by dennisjzh.
the class HeaderPanel method setRightButton.
public void setRightButton(String buttonName) {
SimplePanel rightButton = ((SimplePanel) ((FlowPanel) getWidget()).getWidget(2));
ClickHandler clickHandler = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
onRightButtonClick(event);
}
};
if (buttonName.toUpperCase().equals("NEXT")) {
rightButton.setWidget(new NextButton(buttonName, clickHandler));
} else {
rightButton.setWidget(new Button(buttonName, clickHandler));
}
}
use of com.google.gwt.user.client.ui.SimplePanel in project GwtMobile by dennisjzh.
the class HeaderPanel method setLeftButton.
public void setLeftButton(String buttonName) {
SimplePanel leftButton = ((SimplePanel) ((FlowPanel) getWidget()).getWidget(0));
ClickHandler clickHandler = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
onLeftButtonClick(event);
}
};
if (buttonName.toUpperCase().equals("BACK")) {
leftButton.setWidget(new BackButton(buttonName, clickHandler));
} else {
leftButton.setWidget(new Button(buttonName, clickHandler));
}
}
use of com.google.gwt.user.client.ui.SimplePanel in project gwt-test-utils by gwt-test-utils.
the class SimplePanelTest method add.
@Test
public void add() {
// Given
SimplePanel panel = new SimplePanel();
RootPanel.get().add(panel);
assertThat(panel.isAttached()).isTrue();
assertThat(panel.getWidget()).isNull();
Button b1 = new Button();
assertThat(b1.isAttached()).isFalse();
assertThat(b1.getParent()).isNull();
// When
panel.add(b1);
// Then
assertThat(b1.isAttached()).isTrue();
assertThat(b1.getParent()).isEqualTo(panel);
assertThat(panel.getWidget()).isEqualTo(b1);
}
Aggregations