本文整理匯總了Java中com.vaadin.server.ThemeResource類的典型用法代碼示例。如果您正苦於以下問題:Java ThemeResource類的具體用法?Java ThemeResource怎麽用?Java ThemeResource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ThemeResource類屬於com.vaadin.server包,在下文中一共展示了ThemeResource類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createEditFields
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
@Override
protected ComponentContainer createEditFields() {
final ExtaFormLayout form = new ExtaFormLayout();
appTitleField = new EditField("Заголовок приложения");
form.addComponent(appTitleField);
iconPathField = new ComboBox("Иконка приложения");
for (final String icon : lookup(UserSettingsService.class).getFaviconPathList()) {
iconPathField.addItem(icon);
iconPathField.setItemIcon(icon, new ThemeResource(getLast(Splitter.on('/').split(icon))));
}
iconPathField.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ICON_ONLY);
iconPathField.setWidth(85, Unit.PIXELS);
iconPathField.setTextInputAllowed(false);
iconPathField.setNullSelectionAllowed(false);
form.addComponent(iconPathField);
isShowSalePointIdsField = new MCheckBox("Показывать раздел \"Идентификация\" в карточке торговой точки");
form.addComponent(isShowSalePointIdsField);
isDevServerField = new MCheckBox("Режим отладки");
form.addComponent(isDevServerField);
return form;
}
示例2: getLegendLineLayout
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
/**
* @param txtCode
* @return une ligne de légende
*/
private HorizontalLayout getLegendLineLayout(String txtCode) {
HorizontalLayout hlLineLegend = new HorizontalLayout();
hlLineLegend.setWidth(100, Unit.PERCENTAGE);
hlLineLegend.setSpacing(true);
Image flagImg = new Image(null, new ThemeResource("images/icon/Flag-" + txtCode + "-icon.png"));
Label label = new Label(applicationContext.getMessage("formation.table.flagEtat.tooltip." + txtCode, null,
UI.getCurrent().getLocale()));
hlLineLegend.addComponent(flagImg);
hlLineLegend.setComponentAlignment(flagImg, Alignment.MIDDLE_LEFT);
hlLineLegend.addComponent(label);
hlLineLegend.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
hlLineLegend.setExpandRatio(label, 1);
return hlLineLegend;
}
示例3: buildToolbarButton
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
/**
* @param toolbar
* HorizontalLayout which contains all the action Buttons
* @param toolbarButton
* Which Tool bar button to create (Provided using ENUM constant)
* @param listner
* Click listener called when this button is clicked
* @return
*/
public static Button buildToolbarButton(HorizontalLayout toolbar, ToolbarButtons toolbarButton,
ClickListener listner) {
Button button = new Button(toolbarButton.getText());
button.addStyleName(StyleConstants.BUTTON_TOOLBAR);
button.setDescription(toolbarButton.getTooltip());
button.setStyleName(ValoTheme.BUTTON_LINK);
if (StringUtils.isNotEmpty(toolbarButton.getImageLocation())) {
button.setIcon(new ThemeResource(toolbarButton.getImageLocation()), toolbarButton.toString());
}
button.setEnabled(false);
button.setId(toolbarButton.getId());
button.addClickListener(listner);
toolbar.addComponent(button);
return button;
}
示例4: createHeader
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
@SuppressWarnings("serial")
private HorizontalLayout createHeader(String title) {
HorizontalLayout header = ViewUtil.createSubHeader(title, getSubViewHelpGuid());
Button refresh = new Button();
refresh.setStyleName(Reindeer.BUTTON_LINK);
refresh.setDescription("Refresh");
refresh.setIcon(new ThemeResource("img/Refresh.png"));
refresh.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
populateTable();
}
});
header.addComponent(refresh);
return header;
}
示例5: createDataSource
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
private Container createDataSource() {
Container languageItems = new IndexedContainer();
languageItems.addContainerProperty("icon", ThemeResource.class, null);
languageItems.addContainerProperty("caption", String.class, "");
fillItem(languageItems.addItem(Locale.ENGLISH), "English", "en");
fillItem(languageItems.addItem(new Locale("pl")), "Polski", "pl");
return languageItems;
}
示例6: createDummyData
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
public static List<StaticCustomer> createDummyData() {
LinkedList<StaticCustomer> list = new LinkedList<>();
for (int i = 1; i <= 10000; i++) {
StaticCustomer customer = new StaticCustomer();
customer.setId(i);
customer.setFirstName(testData.getFirstName());
customer.setLastName(testData.getLastName());
NativeSelect foodSelect = new NativeSelect(null, Arrays.asList(StaticCustomer.Food.values()));
foodSelect.setValue(testData.getItem(StaticCustomer.Food.values()));
customer.setFood(foodSelect);
customer.setPhoto(new ThemeResource("../demotheme/demophotos/cat"
+ testData.getNumberBetween(1, 4)
+ ".jpg"));
list.add(customer);
}
return list;
}
示例7: createDummyData
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
public static List<Customer> createDummyData() {
LinkedList<Customer> list = new LinkedList<>();
for (int i = 1; i <= 10000; i++) {
Customer customer = new Customer();
customer.setId(i);
customer.setFirstName(testData.getFirstName());
customer.setLastName(testData.getLastName());
customer.setFood(testData.getItem(Customer.Food.values()));
customer.setPhoto(new ThemeResource("../demotheme/demophotos/cat"
+ testData.getNumberBetween(1, 4)
+ ".jpg"));
list.add(customer);
}
return list;
}
示例8: createImageChild
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
private Component createImageChild() {
String resourceName;
switch (childCounter.incrementAndGet() % 4) {
case 1:
resourceName = "images/goldenbridge2.jpg";
break;
case 2:
resourceName = "images/chavatar.png";
break;
case 3:
resourceName = "images/goldenbridge.jpg";
break;
default:
resourceName = "images/redwood.jpg";
break;
}
ScaleImage image = new ScaleImage(new ThemeResource(resourceName));
image.addStyleName("simple-cover");
image.setSizeFull();
return GridStackStyling.createPaperItemWrapper(image);
}
示例9: getIcon
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
/**
* Gets getIcon corresponding to given localization key.
* @param key The localization key.
* @return The localized getIcon.
*/
public Resource getIcon(final String key) {
if (PropertiesUtil.hasProperty("icon", key)) {
final String value = PropertiesUtil.getProperty("icon", key).trim();
if (value.startsWith("FontAwesome.")) {
final String iconName = value.substring(value.indexOf('.') + 1);
for (final FontAwesome icon : FontAwesome.values()) {
if (icon.name().equals(iconName)) {
return icon;
}
}
throw new IllegalArgumentException("No such icon in FontAwesome: " + iconName);
} else {
return new ThemeResource("icons/" + value + ".png");
}
}
return new ThemeResource("icons/" + key + ".png");
}
示例10: createAddResidueMenu
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
public void createAddResidueMenu(MenuItem parent) {
String notation=theCanvas.getWorkspace().getGlycanRenderer().getGraphicOptions().NOTATION;
MenuItem structureMenu=parent.addItem("Add residue", null);
for (String superclass : ResidueDictionary.getSuperclasses()) {
MenuItem superClassMenu=structureMenu.addItem(superclass,null);
for (ResidueType t : ResidueDictionary.getResidues(superclass)) {
if (t.canHaveParent()){
superClassMenu.addItem(t.getName(), new Command(){
private static final long serialVersionUID=4750928193466060500L;
@Override
public void menuSelected(MenuItem selectedItem) {
theCanvas.addResidueByNameToSelected(selectedItem.getText());
}
}).setIcon(new ThemeResource("icons"+File.separator+"residues"+File.separator+notation+File.separator+t.getName()+".png"));
}
}
if(superClassMenu.getChildren()==null){
structureMenu.removeChild(superClassMenu);
}
}
}
示例11: createChangeResidueMenu
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
private void createChangeResidueMenu(MenuItem parent) {
MenuItem structureMenu=parent.addItem("Change residue", null);
String notation=theCanvas.getWorkspace().getGlycanRenderer().getGraphicOptions().NOTATION;
for (String superclass : ResidueDictionary.getSuperclasses()) {
MenuItem superClassMenu=structureMenu.addItem(superclass,null);
for (ResidueType t : ResidueDictionary.getResidues(superclass)){
superClassMenu.addItem(t.getName(), new Command(){
private static final long serialVersionUID=-7886271503255704127L;
@Override
public void menuSelected(MenuItem selectedItem) {
theCanvas.changeSelectedToResidueByName(selectedItem.getText());
}
}).setIcon(new ThemeResource("icons"+File.separator+"residues"+File.separator+notation+File.separator+t.getName()+".png"));
}
if(superClassMenu.getChildren()==null){
structureMenu.removeChild(superClassMenu);
}
}
structureMenu.setEnabled(false);
menuItemsWithResidueSelectionDependency.add(structureMenu);
}
示例12: buildUserMenu
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
private Component buildUserMenu() {
final User user = getCurrentUser();
final MenuBar settings = new MenuBar();
settings.addStyleName("user-menu");
settingsItem = settings.addItem("", new ThemeResource("img/profile-pic-300px.jpg"), null);
if (!User.GUEST.equals(user)) {
settingsItem.addItem(Messages.getString("Caption.Menu.EditProfile"),
e -> userSettingsWindowPresenter.showWindow(user));
settingsItem.addSeparator();
}
String itemCaption = Messages.getString("Caption.Menu.Logout");
if (User.GUEST.equals(user)) {
itemCaption = Messages.getString("Caption.Menu.LoginOther");
user.setUsername(Messages.getString("Caption.User.Guest"));
}
settingsItem.addItem(itemCaption, e -> mainEvent.fire(new MainUIEvent.UserLoggedOutEvent()));
updateUserName();
return settings;
}
示例13: initLayoutHeader
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
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);
}
示例14: Tabsheet
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
public Tabsheet() {
TabBarView tabBarView = new TabBarView();
tabBarView.addTab(getTable(), "First", new ThemeResource(
"../runo/icons/64/folder.png"));
tabBarView.addTab(getDateSelector(), "Other", new ThemeResource(
"../runo/icons/64/document.png"));
tabBarView.addTab(getComboBox(), "Third", new ThemeResource(
"../runo/icons/64/document-pdf.png"));
Tab tab = tabBarView.addTab(getFields(), "4th", new ThemeResource(
"../runo/icons/64/email.png"));
tabBarView.setSelectedTab(tab);
makeSmallTabletSize(tabBarView);
addComponent(tabBarView);
}
示例15: AboutView
import com.vaadin.server.ThemeResource; //導入依賴的package包/類
public AboutView() {
setCaption(Messages.getString("aboutTitle")); //$NON-NLS-1$
setModal(true);
setResizable(false);
center();
VerticalLayout main = new VerticalLayout();
Resource logoResource = new ThemeResource("img/omc-logo.png"); //$NON-NLS-1$
Image appLogoImage = new Image("",logoResource); //$NON-NLS-1$
Label appLabel = new Label(appName + " v." + version); //$NON-NLS-1$
Label developerLabel = new Label(developer);
Link githubLink = new Link(github, new ExternalResource(github));
main.addComponents(appLogoImage, appLabel, developerLabel, githubLink);
main.setComponentAlignment(appLabel, Alignment.MIDDLE_CENTER);
main.setComponentAlignment(developerLabel, Alignment.MIDDLE_CENTER);
main.setComponentAlignment(githubLink, Alignment.MIDDLE_CENTER);
setContent(main);
}