List of usage examples for com.vaadin.server FontAwesome CHAIN_BROKEN
FontAwesome CHAIN_BROKEN
To view the source code for com.vaadin.server FontAwesome CHAIN_BROKEN.
Click Source Link
From source file:org.jumpmind.metl.ui.views.deploy.EditAgentPanel.java
License:Open Source License
public EditAgentPanel(ApplicationContext context, TabbedPanel tabbedPanel, Agent agent) { this.context = context; this.tabbedPanel = tabbedPanel; this.agent = agent; this.backgroundRefresherService = context.getBackgroundRefresherService(); HorizontalLayout editAgentLayout = new HorizontalLayout(); editAgentLayout.setSpacing(true);/* w w w . j av a2 s . com*/ editAgentLayout.setMargin(new MarginInfo(true, false, false, true)); editAgentLayout.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); addComponent(editAgentLayout); final ComboBox startModeCombo = new ComboBox("Start Mode"); startModeCombo.setImmediate(true); startModeCombo.setNullSelectionAllowed(false); AgentStartMode[] modes = AgentStartMode.values(); for (AgentStartMode agentStartMode : modes) { startModeCombo.addItem(agentStartMode.name()); } startModeCombo.setValue(agent.getStartMode()); startModeCombo.addValueChangeListener(event -> { agent.setStartMode((String) startModeCombo.getValue()); context.getConfigurationService().save((AbstractObject) EditAgentPanel.this.agent); }); editAgentLayout.addComponent(startModeCombo); editAgentLayout.setComponentAlignment(startModeCombo, Alignment.BOTTOM_LEFT); Button parameterButton = new Button("Parameters"); parameterButton.addClickListener(new ParameterClickListener()); editAgentLayout.addComponent(parameterButton); editAgentLayout.setComponentAlignment(parameterButton, Alignment.BOTTOM_LEFT); HorizontalLayout buttonGroup = new HorizontalLayout(); final TextField hostNameField = new TextField("Hostname"); hostNameField.setImmediate(true); hostNameField.setTextChangeEventMode(TextChangeEventMode.LAZY); hostNameField.setTextChangeTimeout(100); hostNameField.setWidth(20, Unit.EM); hostNameField.setNullRepresentation(""); hostNameField.setValue(agent.getHost()); hostNameField.addValueChangeListener(event -> { agent.setHost((String) hostNameField.getValue()); EditAgentPanel.this.context.getConfigurationService().save((AbstractObject) agent); EditAgentPanel.this.context.getAgentManager().refresh(agent); }); buttonGroup.addComponent(hostNameField); buttonGroup.setComponentAlignment(hostNameField, Alignment.BOTTOM_LEFT); Button getHostNameButton = new Button("Get Host"); getHostNameButton.addClickListener(event -> hostNameField.setValue(AppUtils.getHostName())); buttonGroup.addComponent(getHostNameButton); buttonGroup.setComponentAlignment(getHostNameButton, Alignment.BOTTOM_LEFT); editAgentLayout.addComponent(buttonGroup); editAgentLayout.setComponentAlignment(buttonGroup, Alignment.BOTTOM_LEFT); Button exportButton = new Button("Export Agent Config", event -> exportConfiguration()); editAgentLayout.addComponent(exportButton); editAgentLayout.setComponentAlignment(exportButton, Alignment.BOTTOM_LEFT); CheckBox autoRefresh = new CheckBox("Auto Refresh", Boolean.valueOf(agent.isAutoRefresh())); autoRefresh.setImmediate(true); autoRefresh.addValueChangeListener(event -> { agent.setAutoRefresh(autoRefresh.getValue()); EditAgentPanel.this.context.getConfigurationService().save((AbstractObject) agent); EditAgentPanel.this.context.getAgentManager().refresh(agent); }); editAgentLayout.addComponent(autoRefresh); editAgentLayout.setComponentAlignment(autoRefresh, Alignment.BOTTOM_LEFT); CheckBox allowTestFlowsField = new CheckBox("Allow Test Flows", Boolean.valueOf(agent.isAllowTestFlows())); allowTestFlowsField.setImmediate(true); allowTestFlowsField.addValueChangeListener(event -> { agent.setAllowTestFlows(allowTestFlowsField.getValue()); EditAgentPanel.this.context.getConfigurationService().save((AbstractObject) agent); EditAgentPanel.this.context.getAgentManager().refresh(agent); }); editAgentLayout.addComponent(allowTestFlowsField); editAgentLayout.setComponentAlignment(allowTestFlowsField, Alignment.BOTTOM_LEFT); ButtonBar buttonBar = new ButtonBar(); addComponent(buttonBar); addDeploymentButton = buttonBar.addButton("Add Deployment", Icons.DEPLOYMENT); addDeploymentButton.addClickListener(new AddDeploymentClickListener()); editButton = buttonBar.addButton("Edit", FontAwesome.EDIT); editButton.addClickListener(event -> editClicked()); enableButton = buttonBar.addButton("Enable", FontAwesome.CHAIN); enableButton.addClickListener(event -> enableClicked()); disableButton = buttonBar.addButton("Disable", FontAwesome.CHAIN_BROKEN); disableButton.addClickListener(event -> disableClicked()); removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O); removeButton.addClickListener(event -> removeClicked()); runButton = buttonBar.addButton("Run", Icons.RUN); runButton.addClickListener(event -> runClicked()); container = new BeanItemContainer<AgentDeploymentSummary>(AgentDeploymentSummary.class); container.setItemSorter(new TableItemSorter()); table = new Table(); table.setSizeFull(); table.setCacheRate(100); table.setPageLength(100); table.setImmediate(true); table.setSelectable(true); table.setMultiSelect(true); table.setContainerDataSource(container); table.setVisibleColumns("name", "projectName", "type", "status", "logLevel", "startType", "startExpression"); table.setColumnHeaders("Deployment", "Project", "Type", "Status", "Log Level", "Start Type", "Start Expression"); table.addGeneratedColumn("status", new StatusRenderer()); table.addItemClickListener(new TableItemClickListener()); table.addValueChangeListener(new TableValueChangeListener()); table.setSortContainerPropertyId("type"); table.setSortAscending(true); addComponent(table); setExpandRatio(table, 1.0f); refresh(); setButtonsEnabled(); backgroundRefresherService.register(this); }