本文整理匯總了Java中com.google.gwt.user.client.ui.RadioButton類的典型用法代碼示例。如果您正苦於以下問題:Java RadioButton類的具體用法?Java RadioButton怎麽用?Java RadioButton使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RadioButton類屬於com.google.gwt.user.client.ui包,在下文中一共展示了RadioButton類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setChecked
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
private void setChecked(RadioButton button) {
button.setValue(true);
if (button == domButton) {
setNewSelection(Selection.DOM);
} else if (button == localXmlButton) {
setNewSelection(Selection.LOCAL_XML);
} else if (button == persistenDocumentButton){
setNewSelection(Selection.PERSISTENT_DOCUMENT);
} else if (button == annotationButton){
setNewSelection(Selection.ANNOTATIONS);
} else if (button == logButton){
setNewSelection(Selection.LOG);
} else if (button == optionsButton) {
setNewSelection(Selection.OPTIONS);
}
}
示例2: addSelectionHandler
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
private void addSelectionHandler(final RadioButton radioButton) {
radioButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
userList.setEnabled(false);
moduleSelection.setValue(false);
pluginSelection.setValue(false);
userSelection.setValue(false);
radioButton.setValue(true);
if (userSelection.getValue()) {
userList.setEnabled(true);
}
}
});
}
示例3: RadioButtonDialogView
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
@SuppressWarnings("deprecation")
public RadioButtonDialogView(List<String> radioButtonText, String title) {
super();
setWidget(BINDER.createAndBindUi(this));
setAnimationEnabled(true);
setGlassEnabled(true);
setText(title);
setWidth("100%");
okButton.setText(LocaleDictionary.get().getConstantValue(ReviewValidateConstants.OK_BUTTON));
cancelButton.setText(LocaleDictionary.get().getConstantValue(ReviewValidateConstants.CANCEL_BUTTON));
if (null != radioButtonText && !radioButtonText.isEmpty()) {
for (String text : radioButtonText) {
RadioButton radioButton = new RadioButton("radioButtonGroup", text);
if (radioButtonList == null) {
radioButtonList = new ArrayList<RadioButton>();
}
radioButtonList.add(radioButton);
radioPanel.add(radioButton);
}
}
if (!radioButtonList.isEmpty()) {
radioButtonList.get(0).setChecked(true);
}
radioPanel.setSpacing(5);
radioButtonDialogViewPanel.setSpacing(5);
}
示例4: onOk
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
@UiHandler("okButton")
protected void onOk(ClickEvent event) {
int radioButtonNumber = -1;
if (radioButtonList != null) {
int index = 0;
for (RadioButton radioButton : radioButtonList) {
if (radioButton.isChecked()) {
radioButtonNumber = index;
break;
}
index++;
}
}
listener.onOkClick(radioButtonNumber);
hide();
}
示例5: insertItem
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
/**
* Inserts an item into the list box.
*
* @param item the text of the item to be inserted.
* @param value the item's value.
*/
public void insertItem(String item, String value) {
// create new widget
final RadioButton radioButton = new RadioButton(optionsGroupName, item);
// remove the default gwt-RadioButton style
radioButton.removeStyleName("gwt-RadioButton");
// set value
final InputElement inputElement =
(InputElement) radioButton.getElement().getElementsByTagName("input").getItem(0);
inputElement.removeAttribute("tabindex");
inputElement.setAttribute("value", value);
// set default state
if (defaultSelectedIndex > -1
&& optionsPanel.getElement().getChildCount() == defaultSelectedIndex) {
inputElement.setChecked(true);
currentInputElement.setValue("");
}
// add to widget
optionsPanel.add(radioButton);
}
示例6: insertItem
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
/**
* Inserts an item into the list box.
*
* @param item the text of the item to be inserted.
* @param value the item's value.
*/
public void insertItem(String item, String value) {
// create new widget
final RadioButton radioButton = new RadioButton(optionsGroupName, item);
// remove the default gwt-RadioButton style
radioButton.removeStyleName("gwt-RadioButton");
// set value
final InputElement inputElement =
(InputElement) radioButton.getElement().getElementsByTagName("input").getItem(0);
inputElement.removeAttribute("tabindex");
inputElement.setAttribute("value", value);
// set default state
if (defaultSelectedIndex > -1
&& optionsPanel.getElement().getChildCount() == defaultSelectedIndex) {
inputElement.setChecked(true);
currentItemLabel.setInnerText(item);
}
// add to widget
optionsPanel.add(radioButton);
}
示例7: addButton
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
/**
* Adds the new radio button to the group.
*
* @param label radio button's label
* @param title radio button's tooltip
* @param icon radio button's icon
* @param clickHandler click handler
*/
public void addButton(
String label, String title, @Nullable SVGResource icon, ClickHandler clickHandler) {
final RadioButton radioButton = new RadioButton(GROUP_NAME, label);
radioButton.setTitle(title);
radioButton.setStyleName(resources.getCSS().button());
radioButton.addClickHandler(clickHandler);
final Element radioButtonElement = radioButton.getElement();
final Node labelNode = radioButtonElement.getLastChild();
if (icon != null) {
labelNode.insertFirst(new SVGImage(icon).getElement());
} else {
radioButtonElement.getStyle().setWidth(90, PX);
as(labelNode).getStyle().setWidth(90, PX);
}
mainPanel.add(radioButton);
buttons.add(radioButton);
}
示例8: onClick
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
public void onClick(ClickEvent event) {
// Save current instance - you could just save the text to save
// memory, but you might well want to add getters for other
// attributes of the current instance
if (event.getSource() instanceof RadioButton) {
RadioButton rb = (RadioButton) event.getSource();
String key = DOM.getElementAttribute(rb.getElement(), "id");
if(key != null && key.length() > 0) {
List<UIObject> components = ComponentRepository.getInstance().getComponent(key);
for (UIObject object : components) {
if (object == rb) {
DOM.setElementAttribute(object.getElement(), "isSelected", "true");
} else {
DOM.setElementAttribute(object.getElement(), "isSelected","false");
}
}
}
}
}
示例9: addItem
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
private void addItem(final int val, String imageSrc, String title, int col,String id) {
final RadioButton button = new RadioButton(id);
if (col==2) {
button.setValue(true);
}
button.setTitle(title);
ClickHandler handler = new ClickHandler() {
public void onClick(ClickEvent event) {
value = val;
button.setValue(true);
if (changeHandler != null) {
changeHandler.onChange(null);
}
}
};
button.addClickHandler(handler);
Image image = new Image(imageSrc);
image.setStyleName(PlayerStyles.CLICKABLE);
image.setTitle(title);
image.addClickHandler(handler);
setWidget(0, col, image);
getCellFormatter().setHorizontalAlignment(0, col, HasHorizontalAlignment.ALIGN_CENTER);
setWidget(1, col, button);
getCellFormatter().setHorizontalAlignment(1, col, HasHorizontalAlignment.ALIGN_CENTER);
}
示例10: NestWidget
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
NestWidget()
{
boolean fFirst = true;
for( Pair item : items )
{
RadioButton radio = new RadioButton( groupName, item.text );
stream.addDown( radio );
radios.put( item.id, radio );
if( fFirst && fSelectFirstByDefault )
{
fFirst = false;
radio.setValue( true );
}
}
initWidget( stream );
}
示例11: IneRadioButton
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
/**
* use {@link IneRadioButton#createRadioButtons(String, String...)} to
* create objects
*/
private IneRadioButton(RadioGroup group, String name, String label) {
this.group = group;
rb = new RadioButton(name, label);
initWidget(uiBinder.createAndBindUi(this));
rbIcon.setStyleName(style.rbIconStyle());
}
示例12: KscCustomSelectionView
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
public KscCustomSelectionView() {
m_vertPanel = new VerticalPanel();
m_vertPanel.setStyleName("onms-table-no-borders-margin");
m_submitButton = new Button("Submit");
m_viewRB = new RadioButton("group1", "View");
m_customizeRB = new RadioButton("group1","Customize");
m_createNewRB = new RadioButton("group1","Create New");
m_createNewExistingRB = new RadioButton("group1","Create New from Existing");
m_deleteRB = new RadioButton("group1","Delete");
m_vertPanel.add(m_viewRB);
m_vertPanel.add(m_customizeRB);
m_vertPanel.add(m_createNewRB);
m_vertPanel.add(m_createNewExistingRB);
m_vertPanel.add(m_deleteRB);
m_vertPanel.add(m_submitButton);
}
示例13: setUserDataList
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
@Override
public void setUserDataList(List<PacketUserData> userDataList) {
panelUserCodeList.clear();
radioButtonToUserData = Maps.newHashMap();
for (PacketUserData userData : userDataList) {
SafeUri imageUrl = UriUtils.fromString(Constant.ICON_URL_PREFIX
+ userData.imageFileName);
SafeHtml label = TEMPLATE.image(imageUrl, userData.userCode, userData.playerName);
RadioButton radioButton = new RadioButton(GROUP_USER_CODE, label);
radioButtonToUserData.put(radioButton, userData);
panelUserCodeList.add(radioButton);
if (this.userData.getUserCode() == userData.userCode) {
radioButton.setValue(true);
}
}
}
示例14: OptionsPrintPanel
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
/**
* Create a new instance using a custom resource bundle.
*
* @param resource The custom resource bundle to use.
*/
public OptionsPrintPanel(PrintWidgetResource resource) {
super(resource);
UIBINDER.createAndBindUi(this);
printButton.setEnabled(true);
titleTextBox.getElement().setAttribute("placeholder", MESSAGES.printPrefsTitlePlaceholder());
// fill the pageSizeListBox
for (String pageSizeName : PageSize.getAllNames()) {
pageSizeListBox.addItem(pageSizeName);
}
// fill the postPrintActionRadioButtonMap
postPrintActionRadioButtonMap = new HashMap<PrintConfiguration.PostPrintAction, RadioButton>();
for (PrintConfiguration.PostPrintAction postPrintAction : PrintConfiguration.PostPrintAction.values()) {
RadioButton radioButton = new RadioButton("postPrintAction", Print.getInstance().getPrintUtil()
.toString(postPrintAction));
postPrintActionRadioButtonMap.put(postPrintAction, radioButton);
postPrintActionRadioGroup.add(radioButton);
}
createViewBasedOnConfiguration();
}
示例15: getRadioButton
import com.google.gwt.user.client.ui.RadioButton; //導入依賴的package包/類
private RadioButton getRadioButton(final String name, int chunksToSet) {
RadioButton r = new RadioButton("chunks", name);
r.getElement().setAttribute("chunks", "" + chunksToSet);
r.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Widget w = (Widget) event.getSource();
chunks = Integer.valueOf(w.getElement().getAttribute("chunks"));
getMemoryStats(chunks);
getCpuStats(chunks);
getExtraData(chunks);
}
});
return r;
}