Create a new button in the toolbar
501711
function createButton(opts) {
    opts = _.defaults(opts || {}, {
        // Aria label for the button
        label: '',

        // Icon to show
        icon: '',

        // Inner text
        text: '',

        // Right or left position
        position: 'left',

        // Other class name to add to the button
        className: '',

        // Triggered when user click on the button
        onClick: defaultOnClick,

        // Button is a dropdown
        dropdown: null,

        // Position in the toolbar
        index: null
    });

    buttons.push(opts);
    updateButton(opts);
}
863849
private void createButtonBar() {
		// Update and reset controls for the repeater.
		WPanel buttonPanel = new WPanel(WPanel.Type.FEATURE);
		buttonPanel.setMargin(new Margin(Size.MEDIUM, null , Size.LARGE, null));
		buttonPanel.setLayout(new BorderLayout());

		WButton updateButton = new WButton("Update");
		updateButton.setImage("/image/document-save-5.png");
		updateButton.setImagePosition(WButton.ImagePosition.EAST);
		buttonPanel.add(updateButton, BorderLayout.EAST);

		WButton resetButton = new WButton("Reset");
		resetButton.setImage("/image/edit-undo-8.png");
		resetButton.setImagePosition(WButton.ImagePosition.WEST);
		resetButton.setAction(new Action() {
			@Override
			public void execute(final ActionEvent event) {
				repeater.setData(fetchDataList());
			}
		});
		buttonPanel.add(resetButton, BorderLayout.WEST);
		add(buttonPanel);
		add(new WAjaxControl(updateButton, repeater));
		add(new WAjaxControl(resetButton, repeater));
	}
1285413
public void addToolbarButtons(ToolScreen toolScreen)
    {
        new SCannedBox(toolScreen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), toolScreen, null, ScreenConstants.DEFAULT_DISPLAY, null, Packages.SCAN, MenuConstants.SELECT, Packages.SCAN, null);
    }
1112548
function createActionButton (title, callback, appendTo) {
    appendTo = appendTo || 'buttons';
    var buttons = document.getElementById(appendTo);
    var div = document.createElement('div');
    var button = document.createElement('a');
    button.textContent = title;
    button.onclick = function (e) {
        e.preventDefault();
        callback();
    };
    button.classList.add('topcoat-button');
    div.appendChild(button);
    buttons.appendChild(div);
}
59098
private void createButtons() {
        iconButton = new NoFocusButton("InternalFrameTitlePane.iconifyButtonAccessibleName");
        iconButton.addActionListener(iconifyAction);

        if (iconButtonToolTip != null && iconButtonToolTip.length() != 0) {
            iconButton.setToolTipText(iconButtonToolTip);
        }

        maxButton = new NoFocusButton("InternalFrameTitlePane.maximizeButtonAccessibleName");
        maxButton.addActionListener(maximizeAction);

        closeButton = new NoFocusButton("InternalFrameTitlePane.closeButtonAccessibleName");
        closeButton.addActionListener(closeAction);

        if (closeButtonToolTip != null && closeButtonToolTip.length() != 0) {
            closeButton.setToolTipText(closeButtonToolTip);
        }

        setButtonTooltips();
    }
1368981
protected Component newButtonBar(String s) {      	
        buttonBar = new AjaxWizardButtonBar(s, this) {
            public void onCancel(AjaxRequestTarget target) {
                EntityBrowserPanel panel = findParent(EntityBrowserPanel.class);
                panel.backwardWorkspace(target);
            }
        };
        buttonBar.setFinishSteps(finishSteps);
        return buttonBar;
    }
898819
@UiHandler("m_newButton")
    void onClickNew(ClickEvent e) {

        String aliasPath = m_newAliasPath.getText();
        String resourcePath = m_newResourcePath.getText();
        m_controller.editNewAlias(aliasPath, resourcePath, CmsAliasMode.valueOf(m_newMode.getFormValueAsString()));
    }
772028
public void addToolbarButtons(ToolScreen toolScreen)
    {
        super.addToolbarButtons(toolScreen);
        BaseApplication application = (BaseApplication)this.getTask().getApplication();
        new SCannedBox(toolScreen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), toolScreen, null, ScreenConstants.DEFAULT_DISPLAY, null, application.getResources(ResourceConstants.MAIN_RESOURCE, true).getString(CalendarEntryTypeField.APPOINTMENT), CalendarEntryTypeField.APPOINTMENT, CalendarEntryTypeField.APPOINTMENT, null);
        new SCannedBox(toolScreen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), toolScreen, null, ScreenConstants.DEFAULT_DISPLAY, null, application.getResources(ResourceConstants.MAIN_RESOURCE, true).getString(CalendarEntryTypeField.ANNIVERSARY), CalendarEntryTypeField.ANNIVERSARY, CalendarEntryTypeField.ANNIVERSARY, null);
    }
626776
def setup_toolbar(self):
        """"""
        savefig_btn = create_toolbutton(
                self, icon=ima.icon('filesave'),
                tip=_("Save Image As..."),
                triggered=self.save_figure)

        saveall_btn = create_toolbutton(
                self, icon=ima.icon('save_all'),
                tip=_("Save All Images..."),
                triggered=self.save_all_figures)

        copyfig_btn = create_toolbutton(
            self, icon=ima.icon('editcopy'),
            tip=_("Copy plot to clipboard as image (%s)" %
                  get_shortcut('plots', 'copy')),
            triggered=self.copy_figure)

        closefig_btn = create_toolbutton(
                self, icon=ima.icon('editclear'),
                tip=_("Remove image"),
                triggered=self.close_figure)

        closeall_btn = create_toolbutton(
                self, icon=ima.icon('filecloseall'),
                tip=_("Remove all images from the explorer"),
                triggered=self.close_all_figures)

        vsep1 = QFrame()
        vsep1.setFrameStyle(53)

        goback_btn = create_toolbutton(
                self, icon=ima.icon('ArrowBack'),
                tip=_("Previous Figure ({})".format(
                      get_shortcut('plots', 'previous figure'))),
                triggered=self.go_previous_thumbnail)

        gonext_btn = create_toolbutton(
                self, icon=ima.icon('ArrowForward'),
                tip=_("Next Figure ({})".format(
                      get_shortcut('plots', 'next figure'))),
                triggered=self.go_next_thumbnail)

        vsep2 = QFrame()
        vsep2.setFrameStyle(53)

        zoom_out_btn = create_toolbutton(
                self, icon=ima.icon('zoom_out'),
                tip=_("Zoom out (Ctrl + mouse-wheel-down)"),
                triggered=self.zoom_out)

        zoom_in_btn = create_toolbutton(
                self, icon=ima.icon('zoom_in'),
                tip=_("Zoom in (Ctrl + mouse-wheel-up)"),
                triggered=self.zoom_in)

        self.zoom_disp = QSpinBox()
        self.zoom_disp.setAlignment(Qt.AlignCenter)
        self.zoom_disp.setButtonSymbols(QSpinBox.NoButtons)
        self.zoom_disp.setReadOnly(True)
        self.zoom_disp.setSuffix(' %')
        self.zoom_disp.setRange(0, 9999)
        self.zoom_disp.setValue(100)
        self.figviewer.sig_zoom_changed.connect(self.zoom_disp.setValue)

        zoom_pan = QWidget()
        layout = QHBoxLayout(zoom_pan)
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(zoom_out_btn)
        layout.addWidget(zoom_in_btn)
        layout.addWidget(self.zoom_disp)

        return [savefig_btn, saveall_btn, copyfig_btn, closefig_btn,
                closeall_btn, vsep1, goback_btn, gonext_btn, vsep2, zoom_pan]
6185
def create_toolbar(self, title, object_name, iconsize=24):
        """"""
        toolbar = self.addToolBar(title)
        toolbar.setObjectName(object_name)
        toolbar.setIconSize(QSize(iconsize, iconsize))
        self.toolbarslist.append(toolbar)
        return toolbar
913695
def create_dialog(self):
        """"""
        self.bbox = QDialogButtonBox(QDialogButtonBox.Close)
        self.idx_close = self.bbox.button(QDialogButtonBox.Close)
        self.idx_close.pressed.connect(self.reject)

        btnlayout = QHBoxLayout()
        btnlayout.addStretch(1)
        btnlayout.addWidget(self.bbox)

        layout = QVBoxLayout()
        layout.addWidget(self.toolbar)
        layout.addWidget(self.canvas)
        layout.addLayout(btnlayout)
        layout.addStretch(1)
        self.setLayout(layout)
633750
def toggle_create_button(self):
        """"""
        if len(self._drawn_tags) > 0:
            self.w.create_mask.set_enabled(True)
        else:
            self.w.create_mask.set_enabled(False)
944365
def add_to_toolbar(self, toolbar, widget):
        """"""
        actions = widget.toolbar_actions
        if actions is not None:
            add_actions(toolbar, actions)
1332007
private void addToolbarButtons() {

        Button add = CmsToolBar.createButton(
            FontOpenCms.LOGIN,
            CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_LOGINMESSAGE_TOOL_NAME_0));
        add.addClickListener(new ClickListener() {

            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {

                openEditLoginMessageDialog();
            }
        });
        m_uiContext.addToolbarButton(add);

        Button broadcastToAll = CmsToolBar.createButton(
            FontOpenCms.BROADCAST,
            CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_TO_ALL_0));
        broadcastToAll.addClickListener(new ClickListener() {

            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {

                showSendBroadcastDialog(
                    null,
                    CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_TO_ALL_0),
                    m_table);
            }
        });
        m_uiContext.addToolbarButton(broadcastToAll);
        m_infoButton = getStatisticButton();
        m_uiContext.addToolbarButton(m_infoButton);
        Button button = CmsToolBar.createButton(
            FontOpenCms.RESET,
            CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_REFRESH_0));
        button.addClickListener(new ClickListener() {

            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {

                try {
                    m_table.ini();
                    m_infoButton.replaceData(getInfoMap());
                } catch (CmsException e) {
                    //
                }

            }
        });
        m_uiContext.addToolbarButton(button);
    }
319233
def create_widget(self):
        
        d = self.declaration
        self.widget = RadioButton(self.get_context(), None,
                                  d.style or '@attr/radioButtonStyle')
754307
public function clickToolbarButton($button)
	{
		$input = strtolower($button);

		$screenSize = explode("x", $this->config['window_size']);

		if ($screenSize[0] <= 480)
		{
			$this->click('Toolbar');
		}

		switch ($input)
		{
			case "new":
				$this->click(array('xpath' => "//div[@id='toolbar-new']//button"));
				break;
			case "edit":
				$this->click(array('xpath' => "//div[@id='toolbar-edit']//button"));
				break;
			case "publish":
				$this->click(array('xpath' => "//div[@id='toolbar-publish']//button"));
				break;
			case "unpublish":
				$this->click(array('xpath' => "//div[@id='toolbar-unpublish']//button"));
				break;
			case "archive":
				$this->click(array('xpath' => "//div[@id='toolbar-archive']//button"));
				break;
			case "check-in":
				$this->click(array('xpath' => "//div[@id='toolbar-checkin']//button"));
				break;
			case "batch":
				$this->click(array('xpath' => "//div[@id='toolbar-batch']//button"));
				break;
			case "rebuild":
				$this->click(array('xpath' => "//div[@id='toolbar-refresh']//button"));
				break;
			case "trash":
				$this->click(array('xpath' => "//div[@id='toolbar-trash']//button"));
				break;
			case "save":
				$this->click(array('xpath' => "//div[@id='toolbar-apply']//button"));
				break;
			case "save & close":
				$this->click(array('xpath' => "//div[@id='toolbar-save']//button"));
				break;
			case "save & new":
				$this->click(array('xpath' => "//div[@id='toolbar-save-new']//button"));
				break;
			case "cancel":
				$this->click(array('xpath' => "//div[@id='toolbar-cancel']//button"));
				break;
			case "options":
				$this->click(array('xpath' => "//div[@id='toolbar-options']//button"));
				break;
			case "empty trash":
				$this->click(array('xpath' => "//div[@id='toolbar-delete']//button"));
				break;
		}
	}
294870
def create_toolbutton(parent, text=None, shortcut=None, icon=None, tip=None,
                      toggled=None, triggered=None,
                      autoraise=True, text_beside_icon=False):
    """"""
    button = QToolButton(parent)
    if text is not None:
        button.setText(text)
    if icon is not None:
        if is_text_string(icon):
            icon = get_icon(icon)
        button.setIcon(icon)
    if text is not None or tip is not None:
        button.setToolTip(text if tip is None else tip)
    if text_beside_icon:
        button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
    button.setAutoRaise(autoraise)
    if triggered is not None:
        button.clicked.connect(triggered)
    if toggled is not None:
        button.toggled.connect(toggled)
        button.setCheckable(True)
    if shortcut is not None:
        button.setShortcut(shortcut)
    return button