Java 类com.vaadin.ui.NativeButton 实例源码

项目:osc-core    文件:MainUI.java   
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);
    }
}
项目:HomeWire-Server    文件:RelayWidgetFactory.java   
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);
}
项目:minimal-j    文件:VaadinEditorLayout.java   
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);
}
项目:GlycanBuilderVaadin7Version    文件:ImportStructureFromStringDialog.java   
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");
}
项目:VaadinUtils    文件:JasperReportLayout.java   
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);
}
项目:vaadin-oauthpopup    文件:DemoUI.java   
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);
}
项目:osc-core    文件:MainUI.java   
private void clearSubmenuSelection(CssLayout subMenu) {
    for (Component next : subMenu) {
        if (next instanceof NativeButton) {
            next.removeStyleName("selected");
        }
    }
}
项目:konekti    文件:CalculatorPortlet.java   
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);

}
项目:VaadinUtils    文件:JasperReportLayout.java   
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);
}
项目:VaadinUtils    文件:TimePicker.java   
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);
    }
}
项目:jdal    文件:FormUtils.java   
/**
 * 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;
}
项目:VaadinUtils    文件:TimePicker.java   
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);
    }
}
项目:VaadinUtils    文件:TimePicker24.java   
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);
    }
}
项目:VaadinUtils    文件:TimePicker24.java   
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);
    }
}
项目:academ    文件:CrearCompetencia.java   
@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;
}
项目:jdal    文件:VaadinPaginator.java   
private Button createButton(String icon) {
    Button b = nativeButtons ? new NativeButton() : new Button() ;
    b.setIcon(new ThemeResource(icon));

    return b;
}
项目:holon-vaadin7    文件:DefaultButtonBuilder.java   
/**
 * Constructor
 * @param nativeMode <code>true</code> to create a "native" button, i.e. implemented using the native button of web
 *        browsers, using the HTML <code>&lt;button&gt;</code> element.
 */
public DefaultButtonBuilder(boolean nativeMode) {
    super(nativeMode ? new NativeButton() : new Button());
}
项目:holon-vaadin    文件:DefaultButtonBuilder.java   
/**
 * Constructor
 * @param nativeMode <code>true</code> to create a "native" button, i.e. implemented using the native button of web
 *        browsers, using the HTML <code>&lt;button&gt;</code> element.
 */
public DefaultButtonBuilder(boolean nativeMode) {
    super(nativeMode ? new NativeButton() : new Button());
}