List of usage examples for com.vaadin.ui Button addStyleName
@Override public void addStyleName(String style)
From source file:com.peergreen.webconsole.scope.deployment.internal.components.DeployableWindow.java
License:Open Source License
public DefaultWindow getWindow() { Button close = new Button("Close"); close.addStyleName("wide"); close.addStyleName("default"); final DefaultWindow w = new DefaultWindow(deployableEntry.getName(), getContent(), close); close.addClickListener(new Button.ClickListener() { @Override/*from www . ja v a 2s. c om*/ public void buttonClick(Button.ClickEvent event) { w.close(); } }); w.center(); return w; }
From source file:com.peergreen.webconsole.scope.deployment.internal.components.ExceptionView.java
License:Open Source License
private void showDefaultView() { if (messageView == null) { messageView = new HorizontalLayout(); messageView.setWidth("100%"); StringBuilder sb = new StringBuilder(); sb.append("<span style=\"color:red\">"); sb.append(artifactErrorDetail.getMessage()); sb.append("</span>"); Label message = new Label(sb.toString(), ContentMode.HTML); messageView.addComponent(message); messageView.setComponentAlignment(message, Alignment.TOP_LEFT); Button details = new Button("Details"); details.addStyleName("link"); details.addClickListener(new Button.ClickListener() { @Override/* w w w .j a va2s. c om*/ public void buttonClick(Button.ClickEvent event) { showDetailsView(); } }); messageView.addComponent(details); messageView.setComponentAlignment(details, Alignment.TOP_RIGHT); } removeAllComponents(); addComponent(messageView); }
From source file:com.peergreen.webconsole.scope.deployment.internal.components.ExceptionView.java
License:Open Source License
private void showDetailsView() { if (stackTraceView == null) { stackTraceView = new VerticalLayout(); stackTraceView.setWidth("100%"); StringBuilder sb = new StringBuilder(); sb.append("<span style=\"color:red\"> Message : "); sb.append(artifactErrorDetail.getMessage()); sb.append("<br />"); for (StackTraceElement element : artifactErrorDetail.getStackTrace()) { sb.append(" "); sb.append(" |- "); sb.append(element.getClassName()); sb.append('.'); sb.append(element.getMethodName()); sb.append('('); sb.append(element.getFileName()); sb.append(':'); sb.append(element.getLineNumber()); sb.append(')'); sb.append("<br />"); }/* www . ja v a 2s. c o m*/ sb.append("</span>"); Label stackTrace = new Label(sb.toString(), ContentMode.HTML); stackTraceView.addComponent(stackTrace); stackTraceView.setComponentAlignment(stackTrace, Alignment.TOP_LEFT); Button hideDetails = new Button("Hide"); hideDetails.addStyleName("link"); hideDetails.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { showDefaultView(); } }); stackTraceView.addComponent(hideDetails); stackTraceView.setComponentAlignment(hideDetails, Alignment.TOP_RIGHT); } removeAllComponents(); addComponent(stackTraceView); }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.all.AllView.java
License:Open Source License
@PostConstruct public void init() { setSizeFull();/*from w w w . j a v a 2 s . c om*/ setSpacing(true); setMargin(true); HorizontalLayout header = new HorizontalLayout(); header.setWidth("100%"); header.setSpacing(true); header.setMargin(true); final TextField filter = new TextField(); filter.setInputPrompt("Type artifact name or maven dependency"); filter.setWidth("100%"); filter.addTextChangeListener(new FilterFiles(AbstractDeployableContainer.DEPLOYABLE_NAME, directoryContainer.getContainer(), mavenContainer.getContainer())); header.addComponent(filter); header.setComponentAlignment(filter, Alignment.TOP_LEFT); header.setExpandRatio(filter, 3); HorizontalLayout actionArea = new HorizontalLayout(); final NativeSelect actionSelection = new NativeSelect(); actionSelection.addItem(DeploymentActions.DEPLOY); actionSelection.addItem(DeploymentActions.DEPLOYMENT_PLAN); actionSelection.setWidth("100px"); actionSelection.setNullSelectionAllowed(false); TreeTable directoryTable = createDeployableTable(AbstractDeployableContainer.DEPLOYABLE_NAME, DIRECTORY_ITEM_ID, directoryContainer.getContainer()); TreeTable mavenTable = createDeployableTable(AbstractDeployableContainer.DEPLOYABLE_NAME, MAVEN_ITEM_ID, mavenContainer.getContainer()); //mavenTable.addExpandListener(new TreeItemExpandListener(this, mavenRepositoryService)); Button doButton = new Button("Do"); doButton.addStyleName("default"); doButton.addClickListener( new DoClickListener(artifactBuilder, directoryTable, actionSelection, deploymentViewManager)); actionArea.addComponent(actionSelection); actionArea.addComponent(doButton); header.addComponent(actionArea); header.setExpandRatio(actionArea, 2); header.setComponentAlignment(actionArea, Alignment.TOP_RIGHT); addComponent(header); addComponent(directoryTable); setExpandRatio(directoryTable, 1.5f); addComponent(mavenTable); setExpandRatio(mavenTable, 1.5f); }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.DeployablePanel.java
License:Open Source License
@PostConstruct public void init() { setSizeFull();//w ww .j a v a 2 s . c om VerticalLayout mainContent = new VerticalLayout(); mainContent.setSpacing(true); mainContent.setMargin(true); mainContent.setStyleName("deployable-style"); mainContent.setSizeFull(); HorizontalLayout header = new HorizontalLayout(); header.setWidth("100%"); Button openManager = new Button("Edit repositories"); openManager.addStyleName("link"); openManager.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (tabSheet.getTab(manager) == null) { tabSheet.addTab(manager, "Manager", new ClassResource(getClass(), "/images/22x22/configuration.png"), containers.size()) .setClosable(true); } tabSheet.setSelectedTab(manager); } }); header.addComponent(openManager); header.setComponentAlignment(openManager, Alignment.MIDDLE_RIGHT); mainContent.addComponent(header); tabSheet.setSizeFull(); mainContent.addComponent(tabSheet); mainContent.setExpandRatio(tabSheet, 1.5f); DragAndDropWrapper mainContentWrapper = new DragAndDropWrapper(mainContent); mainContentWrapper.setDropHandler(new DeploymentDropHandler(deploymentViewManager, this, notifierService)); mainContentWrapper.setSizeFull(); setContent(mainContentWrapper); }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.directory.DirectoryView.java
License:Open Source License
@PostConstruct public void init() { File deploy = new File(System.getProperty("user.dir") + File.separator + "deploy"); repositoryManager.addRepository(formatUrl(deploy), "Deploy", RepositoryType.DIRECTORY); File m2 = new File( System.getProperty("user.home") + File.separator + ".m2" + File.separator + "repository"); if (m2.exists()) { repositoryManager.addRepository(formatUrl(m2), "Local M2 repository", RepositoryType.DIRECTORY); }//from w w w . j a v a 2s . c o m File tmp = new File(Constants.STORAGE_DIRECTORY); if (!tmp.exists()) { tmp.mkdirs(); } repositoryManager.addRepository(formatUrl(tmp), "Temporary directory", RepositoryType.DIRECTORY); HorizontalLayout header = new HorizontalLayout(); header.setWidth("100%"); header.setSpacing(true); header.setMargin(true); final TextField filter = new TextField(); filter.setInputPrompt("Filter deployable files"); filter.setWidth("100%"); filter.addTextChangeListener(new FilterFiles(DEPLOYABLE_NAME, getContainer())); header.addComponent(filter); header.setComponentAlignment(filter, Alignment.TOP_LEFT); header.setExpandRatio(filter, 3); HorizontalLayout actionArea = new HorizontalLayout(); final NativeSelect actionSelection = new NativeSelect(); actionSelection.addItem(DeploymentActions.DEPLOY); actionSelection.addItem(DeploymentActions.DELETE); actionSelection.addItem(DeploymentActions.DEPLOYMENT_PLAN); actionSelection.setWidth("100px"); actionSelection.setNullSelectionAllowed(false); Button doButton = new Button("Do"); doButton.addStyleName("default"); doButton.addClickListener( new DoClickListener(artifactBuilder, getTree(), actionSelection, deploymentViewManager)); actionArea.addComponent(actionSelection); actionArea.addComponent(doButton); header.addComponent(actionArea); header.setExpandRatio(actionArea, 2); header.setComponentAlignment(actionArea, Alignment.TOP_RIGHT); addComponent(header); HorizontalLayout repositoryInfo = new HorizontalLayout(); repositoryInfo.setWidth("100%"); repositoryInfo.addComponent(getFetching()); repositoryInfo.setComponentAlignment(getFetching(), Alignment.MIDDLE_LEFT); addComponent(repositoryInfo); getTree().addShortcutListener(new DeleteFileShortcutListener(deploymentViewManager, getTree(), "Delete", ShortcutAction.KeyCode.DELETE, null)); getTree().addExpandListener(new TreeItemExpandListener(this, getRepositoryService(), repositoryManager)); addComponent(getTree()); setExpandRatio(getTree(), 1.5f); }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.maven.MavenView.java
License:Open Source License
@PostConstruct public void init() throws URISyntaxException { repositoryManager.loadRepositoriesInCache(); addRootItemToContainer("Peergreen Releases", new URI("https://forge.peergreen.com/repository/content/repositories/releases/")); addRootItemToContainer("Maven Central", new URI("http://repo1.maven.org/maven2/")); HorizontalLayout header = new HorizontalLayout(); header.setWidth("100%"); header.setSpacing(true);// w ww .j a v a 2 s .c o m header.setMargin(true); final TextField filterG = new TextField(); filterG.setInputPrompt("Filter by group id"); filterG.addTextChangeListener(new FilterFiles(MVN_GROUP_ID, getContainer())); header.addComponent(filterG); header.setComponentAlignment(filterG, Alignment.TOP_LEFT); final TextField filterA = new TextField(); filterA.setInputPrompt("Filter by artifact id"); filterA.addTextChangeListener(new FilterFiles(MVN_ARTIFACT_ID, getContainer())); header.addComponent(filterA); header.setComponentAlignment(filterA, Alignment.TOP_LEFT); // final TextField filterV = new TextField(); // filterV.setInputPrompt("Filter by version"); // filterV.addTextChangeListener(new FilterFiles(MVN_VERSION, getContainer())); // header.addComponent(filterV); // header.setComponentAlignment(filterV, Alignment.TOP_LEFT); HorizontalLayout actionArea = new HorizontalLayout(); final NativeSelect actionSelection = new NativeSelect(); actionSelection.addItem(DeploymentActions.DEPLOY); actionSelection.addItem(DeploymentActions.DEPLOYMENT_PLAN); actionSelection.addItem(CLEAR_FILTER); actionSelection.setWidth("100px"); actionSelection.setNullSelectionAllowed(false); Button doButton = new Button("Do"); doButton.addStyleName("default"); doButton.addClickListener( new DoClickListener(artifactBuilder, getTree(), actionSelection, deploymentViewManager)); doButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (CLEAR_FILTER.equals(actionSelection.getValue())) { getContainer().removeAllContainerFilters(); } } }); actionArea.addComponent(actionSelection); actionArea.addComponent(doButton); header.addComponent(actionArea); header.setExpandRatio(actionArea, 2); header.setComponentAlignment(actionArea, Alignment.TOP_RIGHT); addComponent(header); HorizontalLayout repositoryInfo = new HorizontalLayout(); repositoryInfo.setWidth("100%"); repositoryInfo.addComponent(getFetching()); repositoryInfo.setComponentAlignment(getFetching(), Alignment.MIDDLE_LEFT); addComponent(repositoryInfo); getTree().addExpandListener(new TreeItemExpandListener(this, getRepositoryService(), repositoryManager)); addComponent(getTree()); setExpandRatio(getTree(), 1.5f); updateTree(); }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.repository.BaseRepositoryManagerPanel.java
License:Open Source License
@PostConstruct public void init() { setSizeFull();//from w w w. j a va 2s.com VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setMargin(true); mainLayout.setSpacing(true); setContent(mainLayout); HorizontalLayout header = new HorizontalLayout(); header.setWidth("100%"); header.setSpacing(true); header.setMargin(true); TextField filter = new TextField(); filter.setInputPrompt("Filter repositories"); filter.setWidth("100%"); filter.addTextChangeListener(new RepositoryFilter()); header.addComponent(filter); header.setComponentAlignment(filter, Alignment.TOP_LEFT); Button createRepository = new Button("Add repository"); createRepository.addStyleName("wide"); createRepository.addStyleName("default"); createRepository.addClickListener(new CreateNewRepositoryListener()); header.addComponent(createRepository); header.setComponentAlignment(createRepository, Alignment.TOP_RIGHT); mainLayout.addComponent(header); mainLayout.addComponent(contentLayout); mainLayout.setExpandRatio(contentLayout, 1.5f); updateRepositories(); }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.repository.RepositoryEntry.java
License:Open Source License
private void showDefaultView() { if (defaultView == null) { defaultView = new HorizontalLayout(); defaultView.setWidth("100%"); Label name = new Label(repository.getName()); defaultView.addComponent(name);//from w w w.j a va2 s . c om defaultView.setComponentAlignment(name, Alignment.TOP_LEFT); Button details = new Button("Details"); details.addStyleName("link"); details.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { showDetailsView(); } }); defaultView.addComponent(details); defaultView.setComponentAlignment(details, Alignment.TOP_RIGHT); } removeAllComponents(); addComponent(defaultView); }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.repository.RepositoryEntry.java
License:Open Source License
private void showDetailsView() { if (detailsView == null) { detailsView = new VerticalLayout(); detailsView.setWidth("100%"); Button hideDetails = new Button("Hide"); hideDetails.addStyleName("link"); hideDetails.addClickListener(new Button.ClickListener() { @Override// w w w. j ava 2 s .co m public void buttonClick(Button.ClickEvent event) { showDefaultView(); } }); detailsView.addComponent(hideDetails); detailsView.setComponentAlignment(hideDetails, Alignment.TOP_RIGHT); GridLayout layout = new GridLayout(3, 1); layout.addComponent(new Label("<b>Name</b>", ContentMode.HTML)); layout.addComponent(new Label(" ", ContentMode.HTML)); layout.addComponent(new Label(repository.getName())); layout.newLine(); layout.addComponent(new Label("<b>URL</b>", ContentMode.HTML)); layout.addComponent(new Label(" ", ContentMode.HTML)); layout.addComponent(new Label(repository.getUrl())); layout.newLine(); layout.addComponent(new Label("<b>Type</b>", ContentMode.HTML)); layout.addComponent(new Label(" ", ContentMode.HTML)); layout.addComponent(new Label(repository.getType())); detailsView.addComponent(layout); detailsView.setComponentAlignment(layout, Alignment.TOP_LEFT); } removeAllComponents(); addComponent(detailsView); }