List of usage examples for com.vaadin.server ThemeResource ThemeResource
public ThemeResource(String resourceId)
From source file:edu.kit.dama.ui.admin.administration.usergroup.UserGroupForm.java
License:Apache License
private Button getCreateUserGroupButton() { if (createUserGroupButton == null) { String id = "createUserGroupButton"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + "..."); createUserGroupButton = new Button(); createUserGroupButton.setId(DEBUG_ID_PREFIX + id); createUserGroupButton.setIcon(new ThemeResource(IconContainer.GROUP_ADD)); createUserGroupButton.setStyleName(BaseTheme.BUTTON_LINK); createUserGroupButton.setDescription("Create a new UserGroup"); createUserGroupButton.setWidth("14%"); createUserGroupButton.addClickListener((Button.ClickEvent event) -> { showCreateGroupWindow();//from w w w . j a v a 2 s .co m }); } return createUserGroupButton; }
From source file:edu.kit.dama.ui.admin.administration.usergroup.UserGroupTablePanel.java
License:Apache License
protected void addTableFilter(String filterExpression, String columnId, UserGroupFilter.SearchSpace searchSpace) { // Add requested filter IndexedContainer container = (IndexedContainer) getUserGroupTable().getContainerDataSource(); UserGroupFilter userGroupFilter = new UserGroupFilter(filterExpression, columnId, searchSpace); container.addContainerFilter(userGroupFilter); filters.put(columnId, new FilterProperties<>(filterExpression, searchSpace)); // Set filter icon at corresponding table columns if missing ThemeResource filterAddIcon = new ThemeResource(IconContainer.FILTER_ADD); if (!filterAddIcon.equals(getUserGroupTable().getColumnIcon(columnId))) { // Set missing filterAddIcon getUserGroupTable().setColumnIcon(columnId, filterAddIcon); }/*from w w w.j a v a 2 s. c o m*/ }
From source file:edu.kit.dama.ui.admin.DataManagerSettingsPanel.java
License:Apache License
private void buildMainComponentContainer() { String id = "mainComponent"; LOGGER.debug(new StringBuilder("Building ").append(DEBUG_ID_PREFIX).append(id).append(" ...").toString()); mainComponentContainer = new TabSheet(); mainComponentContainer.setId(new StringBuilder(DEBUG_ID_PREFIX).append(id).toString()); mainComponentContainer.setSizeFull(); // Add tab for user administration mainComponentContainer.addTab(getUserAdministrationTab(), "User Administration", new ThemeResource(IconContainer.USERS)); mainComponentContainer.addTab(getGroupAdministrationTab(), "Group Administration", new ThemeResource(IconContainer.GROUPS)); mainComponentContainer.addTab(getAccessPointConfigurationTab(), "Staging Access Points", new ThemeResource(IconContainer.ACCESS_POINT)); mainComponentContainer.addTab(getProcessorConfigurationTab(), "Staging Processors", new ThemeResource(IconContainer.STAGING_PROCESSOR)); mainComponentContainer.addTab(getExecutionEnvironmentConfigurationTab(), "Execution Environments", new ThemeResource(IconContainer.EXECUTION_ENVIRONMENT)); mainComponentContainer.addTab(getDataWorkflowConfigurationTab(), "Data Workflow Tasks", new ThemeResource(IconContainer.DATA_WORKFLOW)); mainComponentContainer.addTab(getJobScheduleConfigurationTab(), "Job Scheduling", new ThemeResource(IconContainer.JOB_SCHEDULE)); // Add listener for tab change mainComponentContainer.addSelectedTabChangeListener((TabSheet.SelectedTabChangeEvent event) -> { if (!event.getTabSheet().getSelectedTab().isEnabled()) { UIComponentTools.showError("You are not authorized to access or modify these settings."); return; }//ww w . j a va2s .co m if (event.getTabSheet().getSelectedTab().equals(userAdministrationTab)) { userAdministrationTab.update(); } else if (event.getTabSheet().getSelectedTab().equals(groupAdministrationTab)) { groupAdministrationTab.update(); } else if (event.getTabSheet().getSelectedTab().equals(accessPointConfigurationTab)) { accessPointConfigurationTab.update(); } else if (event.getTabSheet().getSelectedTab().equals(processorConfigurationTab)) { processorConfigurationTab.update(); } else if (event.getTabSheet().getSelectedTab().equals(dataWorkflowConfigurationTab)) { dataWorkflowConfigurationTab.update(); } else if (event.getTabSheet().getSelectedTab().equals(executionEnvironmentConfigurationTab)) { executionEnvironmentConfigurationTab.update(); } else if (event.getTabSheet().getSelectedTab().equals(jobScheduleConfigurationTab)) { jobScheduleConfigurationTab.update(); } if (!event.getTabSheet().getSelectedTab().isEnabled()) { //check again and show error if privileges have changed...in that case recommend a reload UIComponentTools.showError( "You are not authorized to access or modify these settings. Please reload the page."); } }); mainLayout = new VerticalLayout(mainComponentContainer); mainLayout.setSpacing(true); mainLayout.setMargin(true); mainLayout.setSizeFull(); }
From source file:edu.kit.dama.ui.admin.LoginInformationBar.java
License:Apache License
private void buildMainLayout() { loggedInAsLabel = new Label("Login Username"); loggedInAsLabel.addStyleName("myboldcaption"); loggedInUserLabel = new Label(); activeGroupLabel = new Label("Active Group"); activeGroupLabel.addStyleName("myboldcaption"); groupSelection = new ComboBox(); groupSelection.addValueChangeListener(this); activeRoleLabel = new Label("Current Role"); activeRoleLabel.addStyleName("myboldcaption"); roleLabel = new Label(); Label spacer1 = new Label(""); home = buildMenuItem("home", new ThemeResource("img/70x48/logo_default.png")); profile = buildMenuItem("profile", new ThemeResource("img/70x48/preferences.png")); simon = buildMenuItem("simon", new ThemeResource("img/70x48/simon.png")); settings = buildMenuItem("settings", new ThemeResource("img/70x48/gears_preferences.png")); exit = buildMenuItem("exit", new ThemeResource("img/70x48/exit.png")); final AbsoluteLayout helps = new AbsoluteLayout(); helps.setHeight("48px"); helps.setWidth("100%"); addHelpItem("home", "Return to the main page.", helps); addHelpItem("profile", "Open your profile, e.g. to change your password.", helps); addHelpItem("simon", "Open the <b>SI</b>mple<b>MON</b>itoring Tool, e.g. to check the availability of single services.", helps);/*from ww w .ja va 2 s . co m*/ addHelpItem("settings", "Open the system settings. (Only available for Group Managers and Administrators)", helps); addHelpItem("exit", "Logout.", helps); HorizontalLayout navigation = new HorizontalLayout(home, profile, simon, settings, exit, helps, spacer1); navigation.setExpandRatio(helps, .9f); navigation.setExpandRatio(spacer1, .1f); navigation.setSizeFull(); navigation.addStyleName("mynavigationmargin"); navigation.addLayoutClickListener((LayoutEvents.LayoutClickEvent event) -> { if (home.equals(event.getClickedComponent())) { parent.updateView(VIEW.INFORMATION); } else if (profile.equals(event.getClickedComponent())) { parent.updateView(VIEW.PROFILE); } else if (simon.equals(event.getClickedComponent())) { parent.updateView(VIEW.SIMON); } else if (settings.equals(event.getClickedComponent())) { parent.updateView(VIEW.SETTINGS); } else if (exit.equals(event.getClickedComponent())) { parent.logout(); } }); GridLayout loginInformationLayout = new UIUtils7.GridLayoutBuilder(3, 2) .addComponent(loggedInAsLabel, Alignment.MIDDLE_CENTER, 0, 0, 1, 1) .addComponent(activeGroupLabel, Alignment.MIDDLE_CENTER, 1, 0, 1, 1) .addComponent(activeRoleLabel, Alignment.MIDDLE_CENTER, 2, 0, 1, 1) .addComponent(loggedInUserLabel, Alignment.MIDDLE_CENTER, 0, 1, 1, 1) .addComponent(groupSelection, Alignment.MIDDLE_CENTER, 1, 1, 1, 1) .addComponent(roleLabel, Alignment.MIDDLE_CENTER, 2, 1, 1, 1).getLayout(); loginInformationLayout.setSpacing(true); mainLayout = new UIUtils7.GridLayoutBuilder(5, 2) .addComponent(navigation, Alignment.MIDDLE_LEFT, 0, 0, 3, 2) .addComponent(loginInformationLayout, Alignment.MIDDLE_RIGHT, 3, 0, 2, 2).getLayout(); mainLayout.setColumnExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(1, .01f); mainLayout.setColumnExpandRatio(2, .01f); mainLayout.setColumnExpandRatio(3, .01f); mainLayout.setColumnExpandRatio(4, .01f); mainLayout.setSpacing(true); mainLayout.setMargin(new MarginInfo(false, true, false, true)); mainLayout.setSizeFull(); }
From source file:edu.kit.dama.ui.admin.MainControlPanel.java
License:Apache License
/** * Create a new cell for the UI. Each cell contains an image located in the * provided resource and a help label for the cell adverse to it. * Furthermore, a style is provided which can be 'help-left' or 'help-right' * depending on which side the help text should be aligned (help in left col * -> align right).//from w w w .j a va 2 s . co m * * @param pResourceString The image resource string. * @param The alignment of the image (TOP_LEFT or TOP_RIGHT, depending on * the column) * @param cellNumber The cell number (0-3) counting from top left to bottom * right * @param pHelp The help string which may contain HTML tags. * @param pStyle The help label style ('help-left' or 'help-right'). * * @return The cell layout. */ private VerticalLayout createCell(String pResourceString, Alignment pAlignment, int cellNumber, String pHelp, String pStyle) { final String cellHeight = "132px"; //create the cell image Image cellImage = new Image(null, new ThemeResource(pResourceString)); cellImage.addStyleName("border"); //create the cell image wrapper, which provides the shadow and this show/hide functionality VerticalLayout imageWrapper = new VerticalLayout(cellImage); imageWrapper.addComponent(cellImage); imageWrapper.setComponentAlignment(cellImage, Alignment.MIDDLE_CENTER); imageWrapper.setWidth(cellHeight); imageWrapper.setHeight(cellHeight); imageWrapper.addStyleName("shadow"); imageWrapper.addStyleName("visible"); //help label for the cell adverse to the current cell Label oppositeCellHelp = new Label(pHelp, ContentMode.HTML); oppositeCellHelp.addStyleName(pStyle); oppositeCellHelp.setSizeFull(); oppositeCellHelp.addStyleName("invisible"); oppositeCellHelp.setHeight(cellHeight); //the cell layout containing image and help label VerticalLayout cell = new VerticalLayout(); cell.addComponent(imageWrapper); cell.setComponentAlignment(imageWrapper, pAlignment); cell.setMargin(true); cell.addComponent(oppositeCellHelp); cell.setComponentAlignment(oppositeCellHelp, Alignment.MIDDLE_CENTER); //define component ids depending on the provided cell number //--------- //| 0 | 1 | //| 2 | 3 | //--------- //Each cell gets the id 'image<cellNumber>' //The currently created wrapper and help label are getting the cellId of the adverse cell (0 -> 1, 1 -> 0, 2 -> 3, 3 -> 2). //These ids are used then by edu.kit.dama.ui.admin.client.HelpConnector to show/hide elements on mouse over. switch (cellNumber) { case 0: cellImage.setId("image0"); //this cell contains the help for cell 1 imageWrapper.setId("image1_wrapper"); oppositeCellHelp.setId("image1_help"); break; case 1: cellImage.setId("image1"); //this cell contains the help for cell 0 imageWrapper.setId("image0_wrapper"); oppositeCellHelp.setId("image0_help"); break; case 2: cellImage.setId("image2"); //this cell contains the help for cell 3 imageWrapper.setId("image3_wrapper"); oppositeCellHelp.setId("image3_help"); break; case 3: cellImage.setId("image3"); //this cell contains the help for cell 2 imageWrapper.setId("image2_wrapper"); oppositeCellHelp.setId("image2_help"); break; } //link the HelpExtension to the image new HelpExtension().extend(cellImage); return cell; }
From source file:edu.kit.dama.ui.admin.ProfileView.java
License:Apache License
/** * Build the main layout.// www . j a v a 2 s. c o m */ private void buildMainLayout() { //information area screenName = new Label(); screenName.setCaption("Screen Name:"); screenName.setStyleName("form"); firstName = new Label(); firstName.setCaption("First Name:"); firstName.setStyleName("form"); lastName = new Label(); lastName.setCaption("Last Name:"); lastName.setStyleName("form"); email = new Label(); email.setCaption("Email:"); email.setStyleName("form"); FormLayout userInformationForm = new FormLayout(screenName, firstName, lastName, email); userInformationForm.setStyleName("form"); userInformationForm.setCaption("User Information"); tokenDialog = new ServiceAccessTokenDialog(); //Credentials //table with serviceId, key, secret for logged in userId //---mainLogin and webdav are special (username = email), others can be configured in AuthenticatorFactory //---support for adding/regenerating new tokens (support for random secrets) //---support for blocking? //---'show secrets' button credentialTable = new Table("Credentials"); credentialTable.setSelectable(true); credentialTable.setMultiSelect(false); credentialTable.addContainerProperty("ServiceId", String.class, null); credentialTable.addContainerProperty("Key", String.class, null); credentialTable.addContainerProperty("Secret", String.class, null); credentialTable.addStyleName("myboldcaption"); credentialTable.setSizeFull(); Button addCredential = new Button(); addCredential.setIcon(new ThemeResource(IconContainer.ADD)); Button modifyCredential = new Button(); modifyCredential.setIcon(new ThemeResource(IconContainer.EDIT)); Button removeCredential = new Button(); removeCredential.setIcon(new ThemeResource(IconContainer.DELETE)); Button reloadCredentialTable = new Button(); reloadCredentialTable.setIcon(new ThemeResource(IconContainer.REFRESH)); reloadCredentialTable.addClickListener(((event) -> { reload(); })); CheckBox showPasswords = new CheckBox("Show Secrets"); showPasswords.addValueChangeListener((Property.ValueChangeEvent event) -> { showSecrets(showPasswords.getValue()); }); removeCredential.addClickListener((event) -> { Long selection = (Long) credentialTable.getValue(); if (selection != null) { ConfirmationWindow7.showConfirmation("Delete Credential", "If you delete the selected credential, you won't be able to access the associated service any longer.<br/> " + "Do you wish to proceed?", ConfirmationWindow7.OPTION_TYPE.YES_NO_OPTION, ConfirmationWindow7.MESSAGE_TYPE.WARNING, (ConfirmationWindow7.RESULT pResult) -> { switch (pResult) { case YES: removeCredential(selection); break; default: //do nothing } }); } }); modifyCredential.addClickListener((event) -> { Long selection = (Long) credentialTable.getValue(); if (selection != null) { updateCredential(selection); } }); addCredential.addClickListener((event) -> { createCredential(); }); VerticalLayout buttonLayout = new VerticalLayout(addCredential, modifyCredential, removeCredential, reloadCredentialTable); buttonLayout.setComponentAlignment(modifyCredential, Alignment.TOP_LEFT); buttonLayout.setComponentAlignment(removeCredential, Alignment.TOP_LEFT); buttonLayout.setComponentAlignment(reloadCredentialTable, Alignment.TOP_LEFT); buttonLayout.setMargin(true); UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(2, 3); builder.fillRow(userInformationForm, 0, 0, 1); builder.addComponent(credentialTable, 0, 1).addComponent(buttonLayout, 1, 1); builder.fillRow(showPasswords, 0, 2, 1); mainLayout = builder.getLayout(); mainLayout.setSpacing(true); mainLayout.setMargin(true); mainLayout.setRowExpandRatio(1, 1.0f); mainLayout.setColumnExpandRatio(0, .9f); mainLayout.setColumnExpandRatio(1, .1f); mainLayout.setSizeFull(); reload(); }
From source file:edu.kit.dama.ui.admin.schedule.JobScheduleConfigurationTab.java
License:Apache License
/** * Get the load implementation class button. * * @return The load implementation class button. *///from ww w.j a v a2s. c o m private Button getLoadImplementationClassButton() { if (loadImplementationClassButton == null) { String id = "loadImplementationClassField"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); loadImplementationClassButton = new Button(); loadImplementationClassButton.setId(DEBUG_ID_PREFIX + id); loadImplementationClassButton.setIcon(new ThemeResource(IconContainer.TEXT_CODE_JAVA_INPUT)); loadImplementationClassButton.setWidth("100%"); loadImplementationClassButton.setDescription("Load the entered implementation " + "class for setting the configuration of the requested job"); loadImplementationClassButton.addClickListener((Button.ClickEvent event) -> { try { SimpleSchedule newSchedule = createSchedule(); newSchedule.setId(UNSCHEDULED_JOB_UNIQUE_ID); addNewElementInstance(newSchedule); setEnabledComponents(ListSelection.VALID); } catch (ConfigurationException ex) { UIComponentTools.showError("Implementation class not loadable! Cause: " + ex.getMessage()); LOGGER.error("Failed to load requested implementation class. Cause: " + ex.getMessage(), ex); } }); } return loadImplementationClassButton; }
From source file:edu.kit.dama.ui.admin.schedule.SchedulerBasePropertiesLayout.java
License:Apache License
/** * Default constructor./* w ww .ja va 2 s .c o m*/ */ public SchedulerBasePropertiesLayout() { super(); LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ..."); setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1)); setSizeFull(); setMargin(true); setSpacing(true); setColumns(3); setRows(3); //first row addComponent(getIdField(), 0, 0); addComponent(getGroupField(), 1, 0); addComponent(getNameField(), 2, 0); //second row addComponent(getDescriptionArea(), 0, 1, 2, 1); Button addTriggerButton = new Button(); addTriggerButton.setDescription("Add a new trigger."); addTriggerButton.setIcon(new ThemeResource(IconContainer.ADD)); addTriggerButton.addClickListener((Button.ClickEvent event) -> { addTrigger(); }); Button removeTriggerButton = new Button(); removeTriggerButton.setDescription("Remove the selected trigger."); removeTriggerButton.setIcon(new ThemeResource(IconContainer.DELETE)); removeTriggerButton.addClickListener((Button.ClickEvent event) -> { removeTrigger(); }); Button refreshTriggerButton = new Button(); refreshTriggerButton.setDescription("Refresh the list of triggers."); refreshTriggerButton.setIcon(new ThemeResource(IconContainer.REFRESH)); refreshTriggerButton.addClickListener((Button.ClickEvent event) -> { reloadTriggers(); }); VerticalLayout buttonLayout = new VerticalLayout(addTriggerButton, refreshTriggerButton, removeTriggerButton); buttonLayout.setComponentAlignment(addTriggerButton, Alignment.TOP_RIGHT); buttonLayout.setComponentAlignment(removeTriggerButton, Alignment.TOP_RIGHT); buttonLayout.setMargin(true); GridLayout triggerLayout = new UIUtils7.GridLayoutBuilder(2, 2).addComponent(getTriggerTable(), 0, 0, 1, 2) .addComponent(buttonLayout, 1, 0, 1, 2).getLayout(); triggerLayout.setSizeFull(); triggerLayout.setMargin(false); triggerLayout.setColumnExpandRatio(0, .95f); triggerLayout.setColumnExpandRatio(1, .05f); triggerLayout.setRowExpandRatio(0, .9f); triggerLayout.setRowExpandRatio(1, .05f); triggerLayout.setRowExpandRatio(2, .05f); //third row addComponent(triggerLayout, 0, 2, 2, 2); addTriggerComponent = new AddTriggerComponent(this); setRowExpandRatio(1, .3f); setRowExpandRatio(2, .6f); }
From source file:edu.kit.dama.ui.admin.staging.accesspoints.StagingAccessPointConfigurationTab.java
License:Apache License
/** * * @return/*from w w w .ja v a2 s . co m*/ */ public Button getLoadImplementationClassButton() { if (loadImplementationClassButton == null) { String id = "loadImplementationClassField"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); loadImplementationClassButton = new Button(); loadImplementationClassButton.setId(DEBUG_ID_PREFIX + id); loadImplementationClassButton.setIcon(new ThemeResource(IconContainer.TEXT_CODE_JAVA_INPUT)); loadImplementationClassButton.setWidth("100%"); // loadImplementationClassButton.setStyleName(BaseTheme.BUTTON_LINK); // loadImplementationClassButton.setImmediate(true); loadImplementationClassButton.setDescription("Load the entered implementation class for setting the " + "configuration of the requested access point"); loadImplementationClassButton.addClickListener((Button.ClickEvent event) -> { try { StagingAccessPointConfiguration newAccessPoint = createAccessPoint(); commitAccessPoint(newAccessPoint); addNewElementInstance(newAccessPoint); setEnabledComponents(ListSelection.VALID); UIComponentTools.showInformation("Staging access point successfully created."); } catch (ConfigurationException ex) { UIComponentTools.showError("Implementation class not loadable! Cause: " + ex.getMessage()); LOGGER.error("Failed to load requested implementation class. Cause: " + ex.getMessage(), ex); } }); } return loadImplementationClassButton; }
From source file:edu.kit.dama.ui.admin.staging.processors.StagingProcessorConfigurationTab.java
License:Apache License
/** * * @return/*from w w w .j av a 2 s .c om*/ */ public Button getLoadImplementationClassButton() { if (loadImplementationClassButton == null) { String id = "loadImplementationClassField"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); loadImplementationClassButton = new Button(); loadImplementationClassButton.setId(DEBUG_ID_PREFIX + id); loadImplementationClassButton.setIcon(new ThemeResource(IconContainer.TEXT_CODE_JAVA_INPUT)); loadImplementationClassButton.setWidth("100%"); loadImplementationClassButton.setDescription("Load the entered implementation " + "class for setting the configuration of the requested processor"); implementationClassField.addStyleName(CSSTokenContainer.BOLD_CAPTION); implementationClassField.addStyleName("v-textfield"); loadImplementationClassButton.addClickListener((Button.ClickEvent event) -> { try { StagingProcessor newProcessor = createProcessor(); commitProcessor(newProcessor); addNewElementInstance(newProcessor); setEnabledComponents(ListSelection.VALID); UIComponentTools.showInformation("Staging processor successfully created."); } catch (ConfigurationException ex) { UIComponentTools.showError("Implementation class not loadable! Cause: " + ex.getMessage()); LOGGER.error("Failed to load requested implementation class. Cause: " + ex.getMessage(), ex); } }); } return loadImplementationClassButton; }