com.vaadin.server.ThemeResource Java Examples

The following examples show how to use com.vaadin.server.ThemeResource. 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: RDFUnitDemo.java    From RDFUnit with Apache License 2.0 6 votes vote down vote up
private void initLayoutHeader() {
    headerLayout.setWidth("100%");
    headerLayout.setHeight("80px");
    headerLayout.setId("header");

    Link rdfunit = new Link("",
            new ExternalResource("http://rdfunit.aksw.org/"));
    rdfunit.setIcon(new ThemeResource("images/logo-rdfunit.png"));

    headerLayout.addComponent(rdfunit);

    Link aksw = new Link("",
            new ExternalResource("http://aksw.org/"));
    aksw.setIcon(new ThemeResource("images/logo-aksw.png"));
    aksw.addStyleName("align-right");
    headerLayout.addComponent(aksw);
}
 
Example #2
Source File: ThemeIconProvider.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public Resource getIconResource(String iconPath) {
    Preconditions.checkNotEmptyString(iconPath, "Icon path should not be empty");

    String icon = iconPath.substring(THEME_PREFIX.length());
    return new ThemeResource(icon);
}
 
Example #3
Source File: JobLogTable.java    From chipster with MIT License 5 votes vote down vote up
public Component generateCell(Table source, final Object itemId,
		Object columnId) {

	Property<?> prop = source.getItem(itemId).getItemProperty(JobLogContainer.ERROR_MESSAGE);
	if (prop != null && prop.getType() != null && prop.getType().equals(String.class)) {

		String errorMessage = (String) prop.getValue();

		if (errorMessage != null) {

			Button link = new Button();
			link.setIcon(new ThemeResource("../admin/crystal/agt_update_critical.png"));
			link.setStyleName(BaseTheme.BUTTON_LINK);
			link.setDescription("Show job error message");

			link.addClickListener(new Button.ClickListener() {

				public void buttonClick(ClickEvent event) {

					select(itemId);
					view.showErrorOutput(itemId);
				}
			});

			return link;
		}
	}

	return null;
}
 
Example #4
Source File: Parameter.java    From chipster with MIT License 5 votes vote down vote up
private Button getDeleteButton(final Object itemId) {
	Button btDelete = new Button();
	btDelete.setIcon(new ThemeResource("images/close.png"));
	btDelete.setStyleName(BaseTheme.BUTTON_LINK);
	btDelete.addClickListener(new ClickListener() {
		private static final long serialVersionUID = -3695725710938486562L;

		@Override
		public void buttonClick(ClickEvent event) {
			typeTable.removeItem(itemId);
			enumDefaultValue.removeItem(itemId);
		}
	});
	return btDelete;
}
 
Example #5
Source File: ToolEditorUI.java    From chipster with MIT License 5 votes vote down vote up
private HorizontalLayout getButtonPanel() {
HorizontalLayout hLayout = new HorizontalLayout();
hLayout.setSpacing(true);

btUpdateTextEditor = new Button();
btUpdateTextEditor.setDescription("Update text area");
btUpdateTextEditor.setIcon(new ThemeResource("images/arrow_down.png"));
btUpdateTextEditor.addClickListener(new CSCToolToTextClickListener(this));
hLayout.addComponent(btUpdateTextEditor);
btUpdateToolEditor = new Button();
btUpdateToolEditor.setDescription("Update tool elements");
btUpdateToolEditor.setIcon(new ThemeResource("images/arrow_up.png"));
btUpdateToolEditor.addClickListener(new CSCTextToToolClickListener(this));
hLayout.addComponent(btUpdateToolEditor);
Button btClearAll = new Button("Clear All");
btClearAll.addClickListener(new ClickListener() {
	private static final long serialVersionUID = 1487893808578560989L;

	@Override
	public void buttonClick(ClickEvent event) {
		
		ToolEditorUI.this.addWindow(new ConfirmClearAll(ToolEditorUI.this));
	}
});
hLayout.addComponent(btClearAll);
return hLayout;

  }
 
Example #6
Source File: PolicyContainer.java    From XACML with MIT License 5 votes vote down vote up
public Resource getIcon() {
if (this.data instanceof PolicySetType) {
	return new ThemeResource("../runo/icons/16/folder.png");
}
if (this.data instanceof RuleType) {
	if (((RuleType) this.data).getEffect() == null) {
		logger.warn("Rule has a null Effect");
		return new ThemeResource("icons/deny-16.png");
	}
	if (((RuleType) this.data).getEffect() == EffectType.DENY) {
		return new ThemeResource("icons/deny-16.png");
	}
	return new ThemeResource("icons/permit-16.png");
}
if (this.data instanceof PolicyType) {
	return new ThemeResource("../runo/icons/16/document-txt.png");
}
if (this.data instanceof TargetType) {
	return new ThemeResource("icons/target-green-16.png");
}
if (this.data instanceof ObligationExpressionType) {
	return new ThemeResource("icons/obligation-16.png");
}
if (this.data instanceof AdviceExpressionType) {
	return new ThemeResource("icons/advice-16.png");
}
if (this.data instanceof ConditionType) {
	return new ThemeResource("icons/condition-16.png");
}
if (this.data instanceof VariableDefinitionType) {
	return new ThemeResource("icons/variable-16.png");
}
return null;
     }
 
Example #7
Source File: AbstractView.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the logo to header.
 *
 * @param topHeader
 *            the top header
 */
private static void addLogoToHeader(final HorizontalLayout topHeader) {
	final ThemeResource ciaLogoResource = new ThemeResource("cia-logo.png");
	final Image ciaLogoImage = new Image(null,ciaLogoResource);
	topHeader.addComponent(ciaLogoImage);
	ciaLogoImage.setWidth("60px");
	ciaLogoImage.setHeight("60px");
	topHeader.setComponentAlignment(ciaLogoImage, Alignment.MIDDLE_LEFT);
	topHeader.setExpandRatio(ciaLogoImage, ContentRatio.SMALL);
}
 
Example #8
Source File: DashboardMenu.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static Resource getImage(final boolean gravatar) {
    if (!gravatar) {
        return new ThemeResource("images/profile-pic-57px.jpg");
    }

    return UserDetailsFormatter.getCurrentUserEmail().map(email -> (Resource) new GravatarResource(email))
            .orElse(new ThemeResource("images/profile-pic-57px.jpg"));

}
 
Example #9
Source File: TestIcon.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
public Resource get(boolean isImage, int imageSize) {
	if (!isImage) {
		if (++this.iconCount >= ICONS.size()) {
			this.iconCount = 0;
		}
		return ICONS.get(this.iconCount);
	}
	return new ThemeResource("../runo/icons/" + imageSize + "/document.png");
}
 
Example #10
Source File: TestIcon.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
public Resource get(boolean isImage, int imageSize) {
	if (!isImage) {
		if (++this.iconCount >= ICONS.size()) {
			this.iconCount = 0;
		}
		return ICONS.get(this.iconCount);
	}
	return new ThemeResource("../runo/icons/" + imageSize + "/document.png");
}
 
Example #11
Source File: StringListView.java    From jdal with Apache License 2.0 4 votes vote down vote up
public AddAction() {
	setIcon(new ThemeResource("images/16x16/list-add.png"));
}
 
Example #12
Source File: Dialog.java    From jdal with Apache License 2.0 4 votes vote down vote up
public CloseAction() {
	setIcon(new ThemeResource(DEFAULT_ICON));
}
 
Example #13
Source File: AddAction.java    From jdal with Apache License 2.0 4 votes vote down vote up
public AddAction() {
	setIcon(new ThemeResource("images/table/filenew.png"));
}
 
Example #14
Source File: RemoveAction.java    From jdal with Apache License 2.0 4 votes vote down vote up
public RemoveAction() {
	setIcon(new ThemeResource("images/table/edit-delete.png"));
}
 
Example #15
Source File: StringListView.java    From jdal with Apache License 2.0 4 votes vote down vote up
public RemoveAction() {
	setIcon(new ThemeResource("images/16x16/list-remove.png"));
}
 
Example #16
Source File: ClearFilterAction.java    From jdal with Apache License 2.0 4 votes vote down vote up
public ClearFilterAction() {
	setIcon(new ThemeResource("images/table/edit-clear.png"));
}
 
Example #17
Source File: RefreshAction.java    From jdal with Apache License 2.0 4 votes vote down vote up
public RefreshAction() {
	setIcon(new ThemeResource("images/table/reload.png"));
}
 
Example #18
Source File: VaadinPaginator.java    From jdal with Apache License 2.0 4 votes vote down vote up
private Button createButton(String icon) {
	Button b = nativeButtons ? new NativeButton() : new Button() ;
	b.setIcon(new ThemeResource(icon));

	return b;
}
 
Example #19
Source File: FindAction.java    From jdal with Apache License 2.0 4 votes vote down vote up
public FindAction() {
	setIcon(new ThemeResource("images/table/edit-find.png"));
}
 
Example #20
Source File: ViewSaveAction.java    From jdal with Apache License 2.0 4 votes vote down vote up
/**
 * @param persistentService
 * @param view
 */
public ViewSaveAction(VaadinView view, Dao persistentService) {
	this.persistentService = persistentService;
	setView(view);
	setIcon(new ThemeResource(DEFAULT_ICON));
}
 
Example #21
Source File: CancelAction.java    From jdal with Apache License 2.0 4 votes vote down vote up
public CancelAction() {
	setIcon(new ThemeResource(DEFAULT_ICON));
}
 
Example #22
Source File: JobLogFilter.java    From chipster with MIT License 4 votes vote down vote up
public JobLogFilter(final JobLogView view, String column, String search) {
	this.view = view;

	searchStringField = new TextField();
	if (search != null) {
		searchStringField.setValue(search);
	}
	searchStringField.setDescription("Search for values starting with this string. Question mark (?) is a wildcard for a single character and asterisk (*) for any number of characters.");  
	searchStringField.addShortcutListener(new ShortcutListener("Search", ShortcutAction.KeyCode.ENTER, null) {

		@Override
		public void handleAction(Object sender, Object target) {
			view.update();
		}
	});

	columnToSearch = new NativeSelect();

	Button clearButton = new Button();
	clearButton.setIcon(new ThemeResource("crystal/button_cancel-bw.png"));
	clearButton.setDescription("Remove filter");
	clearButton.addStyleName("search-button");

	for (int i = 0; i < JobLogContainer.NATURAL_COL_ORDER.length; i++) {

		//Do not search from generated columns
		if (SEARCH_COLUMNS.contains(JobLogContainer.NATURAL_COL_ORDER[i])) {
			columnToSearch.addItem(JobLogContainer.NATURAL_COL_ORDER[i]);
			columnToSearch.setItemCaption(JobLogContainer.NATURAL_COL_ORDER[i],
					JobLogContainer.COL_HEADERS_ENGLISH[i]);
		}
	}

	if (column != null) {
		columnToSearch.setValue(column);
	} else {
		columnToSearch.setValue(JobLogContainer.USERNAME);
	}
	columnToSearch.setNullSelectionAllowed(false);

	clearButton.addClickListener(new Button.ClickListener() {
		public void buttonClick(ClickEvent event) {
			getView().clearFilter(JobLogFilter.this);
		}
	});

	addComponent(columnToSearch);
	addComponent(searchStringField);
	addComponent(clearButton);

	addStyleName("search-filter-bg");
	addStyleName("search-filter");
}
 
Example #23
Source File: AsynchronousView.java    From chipster with MIT License 4 votes vote down vote up
public Button createRefreshButton(ClickListener listener) {
	refreshButton = new Button("Refresh");
	refreshButton.addClickListener(listener);
	refreshButton.setIcon(new ThemeResource("../runo/icons/32/reload.png"));
	return refreshButton;			
}
 
Example #24
Source File: XacmlAdminConsole.java    From XACML with MIT License 4 votes vote down vote up
@AutoGenerated
private HorizontalLayout buildHorizontalLayout_1() {
	// common part: create layout
	horizontalLayout_1 = new HorizontalLayout();
	horizontalLayout_1.setImmediate(false);
	horizontalLayout_1.setWidth("100.0%");
	horizontalLayout_1.setHeight("40px");
	horizontalLayout_1.setMargin(false);
	
	// embedded_1
	embedded_1 = new Embedded();
	embedded_1.setImmediate(false);
	embedded_1.setWidth("30px");
	embedded_1.setHeight("30px");
	embedded_1.setSource(new ThemeResource("img/att.png"));
	embedded_1.setType(1);
	embedded_1.setMimeType("image/png");
	horizontalLayout_1.addComponent(embedded_1);
	horizontalLayout_1.setComponentAlignment(embedded_1, new Alignment(33));
	
	// caption
	caption = new Label();
	caption.setImmediate(false);
	caption.setWidth("-1px");
	caption.setHeight("-1px");
	caption.setValue("AT&T Policy Engine Admin Console");
	horizontalLayout_1.addComponent(caption);
	horizontalLayout_1.setExpandRatio(caption, 1.0f);
	horizontalLayout_1.setComponentAlignment(caption, new Alignment(33));
	
	// labelWelcome
	labelWelcome = new Label();
	labelWelcome.setImmediate(false);
	labelWelcome.setWidth("-1px");
	labelWelcome.setHeight("40px");
	labelWelcome.setValue("Label");
	horizontalLayout_1.addComponent(labelWelcome);
	horizontalLayout_1.setComponentAlignment(labelWelcome,
			new Alignment(34));
	
	return horizontalLayout_1;
}
 
Example #25
Source File: ContextMenuUI.java    From context-menu with Apache License 2.0 4 votes vote down vote up
private void fillMenu(ContextMenu menu) {
    final MenuItem item = menu.addItem("Checkable \u00d6",
            e -> Notification.show("checked: " + e.isChecked())
    );
    item.setCheckable(true);
    item.setChecked(true);

    MenuItem item2 = menu.addItem("Disabled",new ClassResource("/images/tiger.jpg"),
            e -> Notification.show("disabled")
    );
    item2.setDescription("Disabled item");
    item2.setEnabled(false);

    MenuItem item3 = menu.addItem("Invisible",
            e -> Notification.show("invisible")
    );
    item3.setVisible(false);

    menu.addSeparator();

    //The path is /resources/images/kitten.jpg
    ClassResource ico = new ClassResource("/images/kitten.jpg");
    MenuItem item4 = menu.addItem("Icon + Description + <b>HTML</b>",ico,
            e -> Notification.show("icon")
    );
    item4.setDescription("Test tooltip");
    but3.addClickListener(e -> item4.setDescription(""));
    MenuItem item5 = menu.addItem("Custom stylename",
            e -> Notification.show("stylename")
    );
    //The path is /webapp/VAADIN/themes/contextmenu/images
    ThemeResource resource = new ThemeResource("images/cat.jpg");
    item5.setIcon(resource);

    item5.setStyleName("teststyle");

    MenuItem item6 = menu.addItem("Submenu");
    item6.addItem("Subitem", VaadinIcons.OPTION, e -> Notification.show("SubItem"));
    item6.addSeparator();
    item6.addItem("Subitem",new ThemeResource("images/cat2.jpg"), e -> Notification.show("SubItem"))
            .setDescription("Test");
    MenuItem openWindowNotification = item6.addItem(
            "Open Window + Notification",
            e -> Notification.show("Open Vaadin.com"));
    new BrowserWindowOpener("https://vaadin.com").extend(openWindowNotification);

    MenuItem openWindowDummy = item6.addItem("Open Google");
    new BrowserWindowOpener("https://google.com").extend(openWindowDummy);

    new BrowserWindowOpener("https://yahoo.com")
            .extend(item6.addItem("SubMenu2").addItem("Yahoo!"));
}
 
Example #26
Source File: FallbackIconProvider.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public Resource getIconResource(String iconPath) {
    Preconditions.checkNotEmptyString(iconPath, "Icon path should not be empty");

    return new ThemeResource(iconPath);
}