Java Code Examples for com.vaadin.ui.Button#removeStyleName()

The following examples show how to use com.vaadin.ui.Button#removeStyleName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HawkbitCommonUtil.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Apply style for status label in target table.
 *
 * @param targetTable
 *            target table
 * @param pinBtn
 *            pin button used for status display and pin on mouse over
 * @param itemId
 *            id of the tabel row
 */
public static void applyStatusLblStyle(final Table targetTable, final Button pinBtn, final Object itemId) {
    final Item item = targetTable.getItem(itemId);
    if (item != null) {
        final TargetUpdateStatus updateStatus = (TargetUpdateStatus) item
                .getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue();
        pinBtn.removeStyleName("statusIconRed statusIconBlue statusIconGreen statusIconYellow statusIconLightBlue");
        if (updateStatus == TargetUpdateStatus.ERROR) {
            pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_RED);
        } else if (updateStatus == TargetUpdateStatus.UNKNOWN) {
            pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_BLUE);
        } else if (updateStatus == TargetUpdateStatus.IN_SYNC) {
            pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_GREEN);
        } else if (updateStatus == TargetUpdateStatus.PENDING) {
            pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_YELLOW);
        } else if (updateStatus == TargetUpdateStatus.REGISTERED) {
            pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE);
        }
    }
}
 
Example 2
Source File: AbstractFilterSingleButtonClick.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void processFilterButtonClick(final ClickEvent event) {
    final Button clickedButton = (Button) event.getComponent();
    if (isButtonUnClicked(clickedButton)) {
        /* If same button clicked */
        clickedButton.removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
        alreadyClickedButton = null;
        filterUnClicked(clickedButton);
    } else if (alreadyClickedButton != null) {
        /* If button clicked and some other button is already clicked */
        alreadyClickedButton.removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
        clickedButton.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
        alreadyClickedButton = clickedButton;
        filterClicked(clickedButton);
    } else {
        /* If button clicked and not other button is clicked currently */
        clickedButton.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
        alreadyClickedButton = clickedButton;
        filterClicked(clickedButton);
    }
}
 
Example 3
Source File: MainLayout.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 6 votes vote down vote up
@Override
public void afterViewChange(ViewChangeEvent event) {
	for (int i=0; i<navbar.getComponentCount(); i++) {
		
		if (navbar.getComponent(i) instanceof Button) {
			final Button btn = (Button) navbar.getComponent(i);
			btn.removeStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
			
			String view = (String) btn.getData();
			
			if (event.getViewName().equals(view)) {
				btn.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
			}
		}
	}
					
}
 
Example 4
Source File: TargetTagFilterButtonClick.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected void clearTargetTagFilters() {
    for (final Button button : alreadyClickedButtons) {
        button.removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
    }
    alreadyClickedButtons.clear();
    managementUIState.getTargetTableFilters().getClickedTargetTags().clear();
    eventBus.publish(this, TargetFilterEvent.FILTER_BY_TAG);
}
 
Example 5
Source File: AbstractFilterMultiButtonClick.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void processFilterButtonClick(final ClickEvent event) {
    final Button clickedButton = (Button) event.getComponent();
    if (isButtonUnClicked(clickedButton)) {
        /* If same button clicked */
        clickedButton.removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
        alreadyClickedButtons.remove(clickedButton);
        filterUnClicked(clickedButton);
    } else {
        clickedButton.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
        alreadyClickedButtons.add(clickedButton);
        filterClicked(clickedButton);
    }
}
 
Example 6
Source File: ButtonGroup.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public ButtonGroup withDefaultButton(Button button) {
    for (Component component : ButtonGroup.this) {
        Button currentBtn = (Button) component;
        if (currentBtn.equals(button)) {
            selectedBtn = button;
            selectedBtn.addStyleName(WebThemes.BTN_ACTIVE);
        } else {
            currentBtn.removeStyleName(WebThemes.BTN_ACTIVE);
        }
    }
    return this;
}
 
Example 7
Source File: ButtonBar.java    From jdal with Apache License 2.0 5 votes vote down vote up
@Override
public void buttonClick(ClickEvent event) {
	Button selected = event.getButton();
	selected.addStyleName("selected");
	
	for (Button b : buttons) {
		if (!b.equals(event.getButton()))
			b.removeStyleName("selected");
	}
}
 
Example 8
Source File: TargetTable.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private void resetPinStyle(final Button pinBtn) {
    pinBtn.removeStyleName(TARGET_PINNED);
    pinBtn.addStyleName(SPUIStyleDefinitions.TARGET_STATUS_PIN_TOGGLE);
    final TargetIdName targetIdname = (TargetIdName) pinBtn.getData();
    HawkbitCommonUtil.applyStatusLblStyle(this, pinBtn, targetIdname.getTargetId());
}