本文整理汇总了Java中com.vaadin.ui.NativeButton类的典型用法代码示例。如果您正苦于以下问题:Java NativeButton类的具体用法?Java NativeButton怎么用?Java NativeButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NativeButton类属于com.vaadin.ui包,在下文中一共展示了NativeButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSubmenu
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
private void buildSubmenu(CssLayout submenu, Set<OSCViewProvider<?>> views) {
for (final OSCViewProvider<?> view : views) {
String viewName = view.getName();
NativeButton b = new NativeButton(viewName);
// selecting default menu button
if (view.getName().equals(VIEW_FRAGMENT_ALERTS)) {
b.addStyleName("selected");
}
b.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
clearMenuSelection();
event.getButton().addStyleName("selected");
if (!MainUI.this.nav.getState().equals(viewName)) {
MainUI.this.nav.navigateTo(viewName);
}
}
});
submenu.setSizeFull();
submenu.addComponent(b);
}
}
示例2: RelayWidget
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
public RelayWidget(String title, Short devId, NetworkServer netServer) {
titleLabel = new Label(title);
titleLabel.setPrimaryStyleName("live-widget-title");
statusButton = new NativeButton("Off", event -> {
netServer.sendDeviceCommand(
new DeviceCommand(
devId,
(Boolean) this.statusButton.getData() ? 0f : 1f
)
);
});
statusButton.setData(false);
statusButton.setPrimaryStyleName("relay-widget-button");
typeLabel = new Label("Relay");
typeLabel.setPrimaryStyleName("live-widget-type");
VerticalLayout rootLayout =
new VerticalLayout(titleLabel, statusButton, typeLabel);
rootLayout.setPrimaryStyleName("live-widget-root");
rootLayout.setSizeUndefined();
setCompositionRoot(rootLayout);
}
示例3: addActionButton
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
private void addActionButton(HorizontalLayout buttonBar, final Action action) {
final Button button = new NativeButton(action.getName());
button.setEnabled(action.isEnabled());
button.setDescription(action.getDescription());
button.setWidth((action.getName().length() + 5) + "ex");
// installShortcut(button, action);
button.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
action.action();
}
});
installActionListener(action, button);
buttonBar.addComponent(button);
buttonBar.setComponentAlignment(button, Alignment.MIDDLE_RIGHT);
}
示例4: initComponents
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
private void initComponents(){
importTypeSelectField=new NativeSelect("Sequence format",theCanvas.getImportFormats());
importTypeSelectField.setNewItemsAllowed(false);
importTypeSelectField.setNullSelectionAllowed(false);
sequenceInputField=new RichTextArea();
sequenceInputField.setImmediate(true);
sequenceInputField.addValueChangeListener(new Property.ValueChangeListener() {
private static final long serialVersionUID=-6654910749910048984L;
@Override
public void valueChange(ValueChangeEvent event) {
sequenceInputField.commit();
sequence=(String)event.getProperty().getValue();
}
});
sequenceInputField.setHeight("90%");
sequenceInputField.setWidth("100%");
sequenceInputField.addStyleName("hide-richtext-toolbar");
ok=new NativeButton("Import");
}
开发者ID:alternativeTime,项目名称:GlycanBuilderVaadin7Version,代码行数:25,代码来源:ImportStructureFromStringDialog.java
示例5: createEmailButton
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
private void createEmailButton(String buttonHeight, HorizontalLayout buttonContainer)
{
emailButton = new NativeButton();
emailButton.setIcon(new ExternalResource("images/seanau/Send Email_32.png"));
emailButton.setDescription("Email");
emailButton.setWidth("50");
emailButton.setHeight(buttonHeight);
emailButton.addClickListener(new ClickEventLogged.ClickListener()
{
private static final long serialVersionUID = 7207441556779172217L;
@Override
public void clicked(ClickEvent event)
{
new JasperReportEmailWindow(reportProperties, builder.getReportParameters());
}
});
buttonContainer.addComponent(emailButton);
}
示例6: addTwitterNativeButton
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
private void addTwitterNativeButton() {
final NativeButton b = new NativeButton("Another Twitter Auth Button");
OAuthPopupOpener opener = new OAuthPopupOpener(
TWITTER_API.scribeApi,
TWITTER_API.apiKey,
TWITTER_API.apiSecret);
opener.extend(b);
opener.addOAuthListener(new OAuthListener() {
@Override
public void authSuccessful(String accessToken,
String accessTokenSecret, String oauthRawResponse) {
Notification.show("authSuccessful");
}
@Override
public void authDenied(String reason) {
Notification.show("authDenied");
}
});
layout.addComponent(b);
}
示例7: clearSubmenuSelection
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
private void clearSubmenuSelection(CssLayout subMenu) {
for (Component next : subMenu) {
if (next instanceof NativeButton) {
next.removeStyleName("selected");
}
}
}
示例8: buildMainLayout
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
private void buildMainLayout() {
layout.setSizeFull();
display.setContentMode(Label.CONTENT_XHTML);
// common part: create layout
// Create a result label that over all 4 columns in the first row
layout.setCaption("Calculadora");
layout.setSpacing(true);
layout.addComponent(display, 0, 0, 3, 0);
layout.setComponentAlignment(display, Alignment.MIDDLE_LEFT);
// The operations for the calculator in the order they appear on the
// screen (left to right, top to bottom)
String[] operations = new String[] { "<h1>7</h1>", "<h1>8</h1>", "<h1>9</h1>", "<h1>/</h1>", "<h1>4</h1>", "<h1>5</h1>", "<h1>6</h1>",
"<h1>*</h1>", "<h1>1</h1>", "<h1>2</h1>", "<h1>3</h1>", "<h1>-</h1>", "<h1>0</h1>", "<h1>=</h1>", "<h1>C</h1>", "<h1>+</h1>" };
for (String caption : operations) {
// Create a button and use this application for event handling
NativeButton button = new NativeButton(caption);
button.setWidth("100%");
button.setHeight("100%");
button.setHtmlContentAllowed(true);
button.addListener(this);
// Add the button to our main layout
layout.addComponent(button);
layout.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
}
// top-level component properties
addComponent(layout);
}
示例9: createScheduleButton
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
private void createScheduleButton(String buttonHeight, HorizontalLayout buttonContainer)
{
scheduleButton = new NativeButton();
JpaBaseDao<ReportEmailScheduleEntity, Long> dao = JpaBaseDao.getGenericDao(ReportEmailScheduleEntity.class);
Long count = dao.getCount(ReportEmailScheduleEntity_.JasperReportPropertiesClassName,
reportProperties.getReportClass().getCanonicalName());
ScheduleIconBuilder iconBuilder = new ScheduleIconBuilder();
String baseIconFileName = "Call Calendar_32";
String path = VaadinServlet.getCurrent().getServletContext().getRealPath("templates/images/seanau/");
// HACK: scoutmaster stores images in a different directory so if the
// images isn't found in the above templates directory
// then search in the /images/seanau director.
if (path == null || !new File(path).exists())
{
path = VaadinServlet.getCurrent().getServletContext().getRealPath("/images/seanau/");
}
String targetFileName = baseIconFileName + "-" + count + ".png";
iconBuilder.buildLogo(count.intValue(), new File(path), baseIconFileName + ".png", targetFileName);
scheduleButton.setIcon(new ExternalResource("images/seanau/" + targetFileName));
scheduleButton.setDescription("Schedule");
scheduleButton.setWidth("50");
scheduleButton.setHeight(buttonHeight);
scheduleButton.addClickListener(new ClickEventLogged.ClickListener()
{
private static final long serialVersionUID = 7207441556779172217L;
@Override
public void clicked(ClickEvent event)
{
new JasperReportSchedulerWindow(reportProperties, builder.getReportParameters());
}
});
buttonContainer.addComponent(scheduleButton);
}
示例10: addMinuteButtons
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
protected void addMinuteButtons(HorizontalLayout minuteButtonPanel, int rows, int cols)
{
String[] numbers = new String[] { "00", "10", "15", "20", "30", "40", "45", "50" };
for (int col = 0; col < cols; col++)
{
VerticalLayout rowsLayout = new VerticalLayout();
for (int row = 0; row < rows; row++)
{
final NativeButton button = new NativeButton("" + numbers[row + (col * rows)]);
rowsLayout.addComponent(button);
button.setStyleName(Reindeer.BUTTON_SMALL);
button.setWidth("30");
button.addClickListener(new ClickListener()
{
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event)
{
String title = button.getCaption();
dateTime.set(Calendar.MINUTE, Integer.parseInt(title));
isSet = true;
setNewValue();
}
});
}
minuteButtonPanel.addComponent(rowsLayout);
}
}
示例11: newNativeButton
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
/**
* Create a new {@link NativeButton} from an {@link ButtonListener}
* @param action button listener
* @return a new native button.
*/
public static NativeButton newNativeButton(ButtonListener action) {
NativeButton b = new NativeButton(action.getCaption(), action);
b.setIcon(action.getIcon());
b.setDescription(action.getDescription());
return b;
}
示例12: addHourButtons
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
protected void addHourButtons(HorizontalLayout hourButtonPanel, int rows, int cols)
{
int[] numbers = new int[] { 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
for (int col = 0; col < cols; col++)
{
VerticalLayout rowsLayout = new VerticalLayout();
for (int row = 0; row < rows; row++)
{
final NativeButton button = new NativeButton("" + numbers[col + (row * cols)]);
rowsLayout.addComponent(button);
button.setStyleName(Reindeer.BUTTON_SMALL);
button.setWidth("30");
button.addClickListener(new ClickListener()
{
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event)
{
int hourToSet = Integer.parseInt(button.getCaption());
hourToSet %= 12;
if (dateTime.get(Calendar.HOUR_OF_DAY) >= 12)
{
hourToSet += 12;
}
dateTime.set(Calendar.HOUR_OF_DAY, hourToSet);
isSet = true;
setNewValue();
}
});
}
hourButtonPanel.addComponent(rowsLayout);
}
}
示例13: addMinuteButtons
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
private void addMinuteButtons(HorizontalLayout minuteButtonPanel, int rows, int cols)
{
String[] numbers = new String[] { "00", "10", "15", "20", "30", "40", "45", "50" };
for (int col = 0; col < cols; col++)
{
VerticalLayout rowsLayout = new VerticalLayout();
for (int row = 0; row < rows; row++)
{
final NativeButton button = new NativeButton("" + numbers[row + (col * rows)]);
rowsLayout.addComponent(button);
button.setStyleName(Reindeer.BUTTON_SMALL);
button.setWidth("30");
// button.setHeight("30");
// button.setAutoFit(false);
// button.setActionType(SelectionType.RADIO);
// button.addToRadioGroup("minuteButtons");
// if (row == 0 && col == 0)
// {
// zeroMinuteButton = button;
//
// }
button.addClickListener(new ClickListener()
{
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event)
{
String title = button.getCaption();
minute = title;
isSet = true;
setNewValue();
}
});
}
minuteButtonPanel.addComponent(rowsLayout);
}
}
示例14: addHourButtons
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
private void addHourButtons(HorizontalLayout hourButtonPanel, int rows, int cols)
{
int[] numbers = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23 };
for (int col = 0; col < cols; col++)
{
VerticalLayout rowsLayout = new VerticalLayout();
for (int row = 0; row < rows; row++)
{
final NativeButton button = new NativeButton("" + numbers[col + (row * cols)]);
rowsLayout.addComponent(button);
button.setStyleName(Reindeer.BUTTON_SMALL);
button.setWidth("30");
// button.setHeight("15");
// button.setAutoFit(false);
// button.setActionType(SelectionType.RADIO);
// button.addToRadioGroup("hourButtons");
// if (row == 0 && col == 0)
// {
// zeroHourButton = button;
//
// }
button.addClickListener(new ClickListener()
{
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event)
{
String title = button.getCaption();
hour = title;
isSet = true;
amPm = AM;
if (Integer.parseInt(hour) > 11)
{
amPm = PM;
}
setNewValue();
}
});
}
hourButtonPanel.addComponent(rowsLayout);
}
}
示例15: buildMainLayout
import com.vaadin.ui.NativeButton; //导入依赖的package包/类
@AutoGenerated
private AbsoluteLayout buildMainLayout() {
// common part: create layout
mainLayout = new AbsoluteLayout();
mainLayout.setImmediate(false);
mainLayout.setWidth("700px");
mainLayout.setHeight("480px");
// top-level component properties
setWidth("700px");
setHeight("480px");
// resutadoAprendizajeSelect
resutadoAprendizajeSelect = new TwinColSelect();
resutadoAprendizajeSelect.setImmediate(false);
resutadoAprendizajeSelect.setWidth("100.0%");
resutadoAprendizajeSelect.setHeight("-1px");
mainLayout.addComponent(resutadoAprendizajeSelect,
"top:60.0px;right:63.0px;left:80.0px;");
// label_1
label_1 = new Label();
label_1.setImmediate(false);
label_1.setWidth("229px");
label_1.setHeight("-1px");
label_1.setValue("Resultados de Aprendizaje Disponibles:");
mainLayout.addComponent(label_1, "top:20.0px;left:80.0px;");
// label_2
label_2 = new Label();
label_2.setImmediate(false);
label_2.setWidth("229px");
label_2.setHeight("-1px");
label_2.setValue("Resultados de Aprendizaje Asociados:");
mainLayout.addComponent(label_2, "top:20.0px;left:380.0px;");
// label_3
label_3 = new Label();
label_3.setImmediate(false);
label_3.setWidth("89px");
label_3.setHeight("18px");
label_3.setValue("Competencia:");
mainLayout.addComponent(label_3, "top:222.0px;left:80.0px;");
// btGuardarCompetencia
btGuardarCompetencia = new NativeButton();
btGuardarCompetencia.setCaption("Guardar");
btGuardarCompetencia.setImmediate(true);
btGuardarCompetencia.setWidth("-1px");
btGuardarCompetencia.setHeight("-1px");
mainLayout.addComponent(btGuardarCompetencia,
"top:418.0px;left:566.0px;");
// textDescripcion
textDescripcion = new TextArea();
textDescripcion.setImmediate(false);
textDescripcion.setWidth("560px");
textDescripcion.setHeight("140px");
textDescripcion.setMaxLength(100);
mainLayout.addComponent(textDescripcion, "top:260.0px;left:80.0px;");
return mainLayout;
}