本文整理汇总了Java中com.google.gwt.user.client.ui.PushButton类的典型用法代码示例。如果您正苦于以下问题:Java PushButton类的具体用法?Java PushButton怎么用?Java PushButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PushButton类属于com.google.gwt.user.client.ui包,在下文中一共展示了PushButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AlertButton
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
/**
* @param title The text that will appear on the button face.
* @param alertStyle the dependent style suffix that will be appended to the default GWT style when the user is to be alerted.
*/
public AlertButton(String title, String alertStyle) {
button = new PushButton(title);
button.addStyleDependentName("SMALLER");
panel = new HorizontalPanel();
panel.setBorderWidth(1);
checkBox = new CheckBox();
panel.add(button);
button.setSize("66", "21");
panel.add(checkBox);
checkBox.setSize("20", "20");
ClientFactory cf = GWT.create(ClientFactory.class);
eventBus = cf.getEventBus();
this.alertStyle = alertStyle;
eventBus.addHandler(WidgetSelectionChangeEvent.TYPE, updateNeededEventHandler);
eventBus.addHandler(VariableSelectionChangeEvent.TYPE, variableChangedEventHandler);
eventBus.addHandler(UpdateFinishedEvent.TYPE, updateFinishedHandler);
eventBus.addHandler(MapChangeEvent.TYPE, mapChangeHandler);
initWidget(panel);
panel.setSize("90", "23");
this.ensureDebugId("AlertButton");
}
示例2: ComplexColorPicker
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
public ComplexColorPicker() {
style.ensureInjected();
// The background color can be set to "none"
noneBtn = new PushButton(messages.none());
noneBtn.addStyleName(ComplexColorPicker.style.buttonsMargins());
noneBtn.setStylePrimaryName(ComplexColorPicker.style.customColorPushbutton());
noneBtn.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
listener.onNoneColorChoose();
}
});
vp = new VerticalPanel();
// We use a simple color picker by default
simplePicker = new SimpleColorPicker(this);
vp.add(simplePicker);
vp.add(noneBtn);
super.add(vp);
}
示例3: createBrowserItemWidget
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
protected Widget createBrowserItemWidget(final int type, boolean enabled) {
final ClickHandler clickHandler = new ClickHandler() {
public void onClick(ClickEvent event) {
switch(type) {
case FIRST:
_page = 0;
break;
case PREV:
--_page;
break;
case NEXT:
++_page;
break;
case LAST:
_page = _pages - 1;
break;
}
fireChange();
}
};
PushButton button = new PushButton();
button.setStylePrimaryName(STYLES_BROWSER[type]);
button.setEnabled(enabled);
if(enabled) button.addClickHandler(clickHandler);
return button;
}
示例4: render
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Object render(final ProjectFundingDTO model, final String property, final ColumnData config, final int rowIndex, final int colIndex,
final ListStore<ProjectFundingDTO> store, final Grid<ProjectFundingDTO> grid) {
// Creates the button with its icon.
final PushButton editButton = new PushButton(IconImageBundle.ICONS.editLinkedProject().createImage());
editButton.setStylePrimaryName(STYLE_EDIT_BUTTON);
// Sets the button click handler.
editButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
view.getPresenterHandler().onLinkedProjectEditClickEvent(model, projectType);
}
});
// Returns this button.
return editButton;
}
示例5: ButtonCaption
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
public ButtonCaption(String label)
{
super();
setWidth("100%");
setStyleName("Caption");
closeImage = new Image(images.closeIconImageData().getSafeUri());
closeImage.setSize("16px","16px");
closeDialog = new PushButton(closeImage);
closeDialog.setStyleName(css.closeIconStyle());
add(text = new InlineLabel(label));
add(closeDialog);
setCellHorizontalAlignment(getElement(),ALIGN_RIGHT);
setCellWidth(closeDialog,"1px");
setCellHeight(closeDialog,"1px");
}
示例6: newShiftDateButton
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
/**
* Returns a new button that shifts the date when clicked.
* @param seconds How many seconds to shift.
* @param label The label to put on the button.
*/
private PushButton newShiftDateButton(final int seconds,
final String label) {
final PushButton button = new PushButton(label);
button.setStyleName(seconds < 0 ? "datePickerPreviousButton"
: "datePickerNextButton");
button.addClickHandler(new ClickHandler() {
public void onClick(final ClickEvent event) {
Date d = box.getValue();
if (d == null) {
if (seconds >= 0) {
return;
}
d = new Date();
}
d.setTime(d.getTime() + seconds * 1000);
d.setSeconds(0);
setDate(d);
}
});
return button;
}
示例7: newSetHoursButton
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
/**
* Returns a new button that sets the hours when clicked.
* @param hours An hour of the day (0-23).
* @param label The label to put on the button.
*/
private PushButton newSetHoursButton(final int hours) {
final PushButton button = new PushButton(Integer.toString(hours));
button.addClickHandler(new ClickHandler() {
public void onClick(final ClickEvent event) {
@SuppressWarnings(/* GWT requires us to use Date */{"deprecation"})
Date d = box.getValue();
if (d == null) {
d = new Date();
d.setMinutes(0);
}
d.setHours(hours);
d.setSeconds(0);
setDate(d);
}
});
return button;
}
示例8: newSetMinutesButton
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
/**
* Returns a new button that sets the minutes when clicked.
* @param minutes A value for minutes (0-59).
* @param label The label to put on the button.
*/
private PushButton newSetMinutesButton(final int minutes,
final String label) {
final PushButton button = new PushButton(label);
button.addClickHandler(new ClickHandler() {
public void onClick(final ClickEvent event) {
@SuppressWarnings(/* GWT requires us to use Date */{"deprecation"})
Date d = box.getValue();
if (d == null) {
d = new Date();
}
d.setMinutes(minutes);
d.setSeconds(0);
setDate(d);
}
});
return button;
}
示例9: ButtonsExample
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
public ButtonsExample() {
super("Buttons");
Button button = new Button("Disabled button");
button.setEnabled(false);
add(button);
CheckBox check = new CheckBox("Check box");
check.setChecked(true);
add(check);
PushButton push = new PushButton("Click me", "Clicked");
add(push);
ToggleButton toggle = new ToggleButton("Up", "Down");
add(toggle);
}
示例10: createPushButton
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
/**
* Helper method to create push buttons.
*
* @param img image to shown on face of push button
* @param tip text to show in tooltip
* @return newly created push button
*/
public static PushButton createPushButton(ImageResource img, String tip,
ClickHandler handler) {
PushButton pb = new PushButton(new Image(img));
pb.addClickHandler(handler);
pb.setTitle(tip);
return pb;
}
示例11: SettingsWidget
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
public SettingsWidget(String title, String panelID, String operationID, String optionID) {
this.operationID = operationID;
this.optionID = optionID;
closeButton = new PushButton("Close");
closeButton.addStyleDependentName("SMALLER");
closeButton.setTitle("Close settings panel for "+panelID);
closeButton.addClickListener(closeClick);
buttonBar = new HorizontalPanel();
buttonBar.add(closeButton);
datasetButton = new DatasetButton();
optionsButton = new OptionsButton(optionID, 300);
datasetButton.setOffset(0);
operations = new OperationsWidget(title);
operations.addClickHandler(operationsClickHandler);
settingsButton = new PushButton (title);
settingsButton.addStyleDependentName("SMALLER");
settingsButton.addClickListener(settingsButtonClick);
settingsPopup = new PopupPanel(false);
buttonBar.add(datasetButton);
buttonBar.add(optionsButton);
settingsLayout = new FlexTable();
settingsLayout.setWidget(0, 0, buttonBar);
settingsLayout.setWidget(1, 0, operations);
settingsPopup.add(settingsLayout);
settingsButton.setWidth("65px");
initWidget(settingsButton);
}
示例12: createCell
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
/**
* Creates the cell for each color.
*
* @param color the color
* @return the widget
*/
private Widget createCell(final String color) {
final PushButton button = new PushButton();
button.setStylePrimaryName(style.simplecolorbutton());
button.setSize(CELL_SIZE, CELL_SIZE);
button.getElement().getStyle().setBackgroundColor(color);
return button;
}
示例13: makeFormButton
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
public static ButtonBase makeFormButton(String text, ClickHandler handler) {
PushButton b = new PushButton();
b.addClickHandler(handler);
b.setHTML(text.replace(" ", " "));
return b;
}
示例14: createToolBarButton
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
private Widget createToolBarButton(ToolbarGVO toolbar, final String imageLocation, final String toolTip, ComponentGVO component, String uuid,String parent) {
Widget w = null;
Image toolbarImage = new Image(imageLocation);
toolbarImage.setSize(toolbar.getItemWidth(),toolbar.getItemHeight());
RendererHelper.addStyle(component, toolbarImage);
PushButton toolbarButton = new PushButton(toolbarImage);
toolbarButton.setTitle(component.getTooltip());
RendererHelper.fillIn(component, toolbarButton, uuid,parent, component.getContext());
w = toolbarButton;
return w;
}
示例15: handleDisplayName
import com.google.gwt.user.client.ui.PushButton; //导入依赖的package包/类
private void handleDisplayName(UIObject uiObject, BuiltInComponentGVO builtInComponentGVO,
String value) {
if (uiObject instanceof HasDataGridMethods) {
HasDataGridMethods hasDataGridMethods = (HasDataGridMethods)uiObject;
String uuid = builtInComponentGVO.getComponentIdUUID();
if (uuid != null) {
boolean containsColumn = uuid.contains(".");
if (containsColumn) {
String columnId = uuid.replaceFirst(".+\\.", "").replaceFirst("\\|.+", "");
hasDataGridMethods.setColumnLabel(columnId, value);
}
}
} else if (uiObject instanceof PushButton) {
((PushButton)uiObject).getUpFace().setText(value);
((PushButton)uiObject).getDownFace().setText(value);
} else if (uiObject instanceof HasText) {
HasText t = (HasText)uiObject;
t.setText(value);
} else if (uiObject instanceof VerticalPanel) {
VerticalPanel vp = (VerticalPanel)uiObject;
Widget tabPanelWidget = vp.getParent().getParent().getParent();
if (tabPanelWidget instanceof TabPanel) {
TabPanel tp = (TabPanel)tabPanelWidget;
TabBar tb = tp.getTabBar();
int tabCount =tp.getWidgetCount();
for (int i=0;i < tabCount;i++){
Widget w = tp.getWidget(i);
if (w == vp){
tb.setTabText(i, value);
}
}
}
} else if (uiObject instanceof QWindowPanel) {
QWindowPanel p = (QWindowPanel) uiObject;
p.setCaption(value);
}
}