List of usage examples for com.vaadin.ui CheckBox CheckBox
public CheckBox(String caption)
From source file:org.eclipse.hawkbit.ui.filtermanagement.DistributionSetSelectWindow.java
License:Open Source License
private VerticalLayout initView() { final Label label = new Label(i18n.getMessage(UIMessageIdProvider.LABEL_AUTO_ASSIGNMENT_DESC)); checkBox = new CheckBox(i18n.getMessage(UIMessageIdProvider.LABEL_AUTO_ASSIGNMENT_ENABLE)); checkBox.setId(UIComponentIdProvider.DIST_SET_SELECT_ENABLE_ID); checkBox.setImmediate(true);/*from w w w . j a v a 2 s . co m*/ checkBox.addValueChangeListener( event -> switchAutoAssignmentInputsVisibility((boolean) event.getProperty().getValue())); actionTypeOptionGroupLayout = new ActionTypeOptionGroupAutoAssignmentLayout(i18n); dsCombo = new DistributionSetSelectComboBox(i18n); final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.addComponent(label); verticalLayout.addComponent(checkBox); verticalLayout.addComponent(actionTypeOptionGroupLayout); verticalLayout.addComponent(dsCombo); return verticalLayout; }
From source file:org.eclipse.hawkbit.ui.management.dstable.DistributionTable.java
License:Open Source License
private CheckBox enableMaintenanceWindowControl() { final CheckBox enableMaintenanceWindow = new CheckBox( getI18n().getMessage("caption.maintenancewindow.enabled")); enableMaintenanceWindow.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID); enableMaintenanceWindow.addStyleName(ValoTheme.CHECKBOX_SMALL); enableMaintenanceWindow.addStyleName("dist-window-maintenance-window-enable"); enableMaintenanceWindow.addValueChangeListener(event -> { final Boolean isMaintenanceWindowEnabled = enableMaintenanceWindow.getValue(); maintenanceWindowLayout.setVisible(isMaintenanceWindowEnabled); maintenanceWindowLayout.setEnabled(isMaintenanceWindowEnabled); enableSaveButton(!isMaintenanceWindowEnabled); maintenanceWindowLayout.clearAllControls(); });/*from w w w .j av a 2s . c om*/ return enableMaintenanceWindow; }
From source file:org.eclipse.hawkbit.ui.management.footer.ManagementConfirmationWindowLayout.java
License:Open Source License
private CheckBox enableMaintenanceWindowControl() { final CheckBox enableMaintenanceWindow = new CheckBox(i18n.getMessage("caption.maintenancewindow.enabled")); enableMaintenanceWindow.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID); enableMaintenanceWindow.addStyleName(ValoTheme.CHECKBOX_SMALL); enableMaintenanceWindow.addStyleName("dist-window-maintenance-window-enable"); enableMaintenanceWindow.addValueChangeListener(event -> { final Boolean isMaintenanceWindowEnabled = enableMaintenanceWindow.getValue(); maintenanceWindowLayout.setVisible(isMaintenanceWindowEnabled); maintenanceWindowLayout.setEnabled(isMaintenanceWindowEnabled); enableSaveButton(!isMaintenanceWindowEnabled); maintenanceWindowLayout.clearAllControls(); });/*from w w w. j a va2s.c om*/ return enableMaintenanceWindow; }
From source file:org.esn.esobase.view.tab.QuestTranslateTab.java
public QuestTranslateTab(DBService service_) { this.setSizeFull(); this.setSpacing(false); this.setMargin(false); this.service = service_; QuestChangeListener questChangeListener = new QuestChangeListener(); FilterChangeListener filterChangeListener = new FilterChangeListener(); questListlayout = new HorizontalLayout(); questListlayout.setWidth(100f, Unit.PERCENTAGE); questListlayout.setSpacing(false);//from www . j ava 2 s.co m questListlayout.setMargin(false); locationTable = new ComboBox("?"); locationTable.setPageLength(30); locationTable.setScrollToSelectedItem(true); locationTable.setWidth(100f, Unit.PERCENTAGE); locationTable.addValueChangeListener(filterChangeListener); locationTable.setDataProvider(new ListDataProvider<>(locations)); questTable = new ComboBox("?"); questTable.setWidth(100f, Unit.PERCENTAGE); questTable.setPageLength(15); questTable.setScrollToSelectedItem(true); questTable.setWidth(100f, Unit.PERCENTAGE); questTable.addValueChangeListener(questChangeListener); questTable.setDataProvider(new ListDataProvider<>(questList)); questListlayout.addComponent(questTable); FormLayout locationAndQuestLayout = new FormLayout(locationTable, questTable); locationAndQuestLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); locationAndQuestLayout.setSizeFull(); questListlayout.addComponent(locationAndQuestLayout); translateStatus = new ComboBoxMultiselect("? ", Arrays.asList(TRANSLATE_STATUS.values())); translateStatus.setClearButtonCaption("?"); translateStatus.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { LoadFilters(); LoadContent(); } }); noTranslations = new CheckBox("? ?"); noTranslations.setValue(Boolean.FALSE); noTranslations.addValueChangeListener(filterChangeListener); emptyTranslations = new CheckBox("? "); emptyTranslations.setValue(Boolean.FALSE); emptyTranslations.addValueChangeListener(filterChangeListener); HorizontalLayout checkBoxlayout = new HorizontalLayout(noTranslations, emptyTranslations); checkBoxlayout.setSpacing(false); checkBoxlayout.setMargin(false); translatorBox = new ComboBox(""); translatorBox.setPageLength(15); translatorBox.setScrollToSelectedItem(true); translatorBox.setDataProvider(new ListDataProvider<SysAccount>(service.getSysAccounts())); translatorBox.addValueChangeListener(filterChangeListener); refreshButton = new Button(""); refreshButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { LoadFilters(); LoadContent(); } }); countLabel = new Label(); searchField = new TextField("?? ?"); searchField.setSizeFull(); searchField.addValueChangeListener(filterChangeListener); FormLayout filtersLayout = new FormLayout(translateStatus, translatorBox, checkBoxlayout, searchField); filtersLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); filtersLayout.setSizeFull(); questListlayout.addComponent(filtersLayout); questListlayout.addComponent(refreshButton); questListlayout.addComponent(countLabel); questListlayout.setExpandRatio(locationAndQuestLayout, 0.4f); questListlayout.setExpandRatio(filtersLayout, 0.4f); questListlayout.setExpandRatio(refreshButton, 0.1f); questListlayout.setExpandRatio(countLabel, 0.1f); questListlayout.setHeight(105f, Unit.PIXELS); this.addComponent(questListlayout); infoLayout = new VerticalLayout(); infoLayout.setSizeFull(); infoLayout.setSpacing(false); infoLayout.setMargin(false); tabSheet = new TabSheet(); tabSheet.setSizeFull(); nameLayout = new VerticalLayout(); nameLayout.setSizeFull(); nameHLayout = new HorizontalLayout(); nameHLayout.setSizeFull(); nameHLayout.setSpacing(false); nameHLayout.setMargin(false); nameLayout = new VerticalLayout(); nameLayout.setSizeFull(); nameLayout.setSpacing(false); nameLayout.setMargin(false); questNameEnArea = new TextArea("?"); questNameEnArea.setSizeFull(); questNameEnArea.setRows(1); questNameEnArea.setReadOnly(true); questNameRuArea = new TextArea("? Ru"); questNameRuArea.setSizeFull(); questNameRuArea.setRows(1); questNameRuArea.setReadOnly(true); questNameRawEnArea = new TextArea("? "); questNameRawEnArea.setSizeFull(); questNameRawEnArea.setRows(1); questNameRawEnArea.setReadOnly(true); questNameRawRuArea = new TextArea("? Ru"); questNameRawRuArea.setSizeFull(); questNameRawRuArea.setRows(1); questNameRawRuArea.setReadOnly(true); nameLayout.addComponents(questNameEnArea, questNameRuArea, questNameRawEnArea, questNameRawRuArea); nameHLayout.addComponent(nameLayout); nameTranslateLayout = new VerticalLayout(); nameTranslateLayout.setSizeFull(); nameTranslateLayout.setSpacing(false); nameTranslateLayout.setMargin(false); nameHLayout.addComponent(nameTranslateLayout); infoLayout.addComponent(nameHLayout); descriptionLayout = new VerticalLayout(); descriptionLayout.setSizeFull(); descriptionHLayout = new HorizontalLayout(); descriptionHLayout.setSizeFull(); descriptionHLayout.setSpacing(false); descriptionHLayout.setMargin(false); descriptionLayout = new VerticalLayout(); descriptionLayout.setSizeFull(); descriptionLayout.setSpacing(false); descriptionLayout.setMargin(false); questDescriptionEnArea = new TextArea("?"); questDescriptionEnArea.setSizeFull(); questDescriptionEnArea.setRows(4); questDescriptionEnArea.setReadOnly(true); questDescriptionRuArea = new TextArea("? Ru"); questDescriptionRuArea.setSizeFull(); questDescriptionRuArea.setRows(4); questDescriptionRuArea.setReadOnly(true); questDescriptionRawEnArea = new TextArea("? "); questDescriptionRawEnArea.setSizeFull(); questDescriptionRawEnArea.setRows(4); questDescriptionRawEnArea.setReadOnly(true); questDescriptionRawRuArea = new TextArea("? Ru"); questDescriptionRawRuArea.setSizeFull(); questDescriptionRawRuArea.setRows(4); questDescriptionRawRuArea.setReadOnly(true); descriptionLayout.addComponents(questDescriptionEnArea, questDescriptionRuArea, questDescriptionRawEnArea, questDescriptionRawRuArea); descriptionHLayout.addComponent(descriptionLayout); descriptionTranslateLayout = new VerticalLayout(); descriptionTranslateLayout.setSizeFull(); descriptionTranslateLayout.setSpacing(false); descriptionTranslateLayout.setMargin(false); descriptionHLayout.addComponent(descriptionTranslateLayout); infoLayout.addComponent(descriptionHLayout); tabSheet.addTab(infoLayout, "?"); stepsLayout = new VerticalLayout(); stepsLayout.setSizeFull(); stepsLayout.setSpacing(false); stepsLayout.setMargin(false); stepsData = new TreeData(); stepsGrid = new TreeGrid(new TreeDataProvider(stepsData)); stepsGrid.setSelectionMode(Grid.SelectionMode.NONE); stepsGrid.setRowHeight(250); stepsGrid.setHeaderVisible(false); stepsGrid.setSizeFull(); stepsGrid.setItemCollapseAllowedProvider(new ItemCollapseAllowedProvider() { @Override public boolean test(Object item) { return false; } }); stepsGrid.addColumn(new ValueProvider() { @Override public Object apply(Object source) { if (source instanceof QuestStep) { return "?"; } if (source instanceof QuestDirection) { return " - " + ((QuestDirection) source).getDirectionType().name(); } return null; } }).setId("rowType").setCaption("").setWidth(132).setStyleGenerator(rowStyleGenerator); stepsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestStep) { QuestStep step = (QuestStep) source; if (step.getTextEn() != null && !step.getTextEn().isEmpty()) { TextArea textEnArea = new TextArea("? "); textEnArea.setValue(step.getTextEn()); textEnArea.setReadOnly(true); textEnArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnArea); } if (step.getTextRu() != null && !step.getTextRu().isEmpty()) { TextArea textRuArea = new TextArea(" "); textRuArea.setValue(step.getTextRu()); textRuArea.setReadOnly(true); textRuArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuArea); } } else if (source instanceof QuestDirection) { QuestDirection d = (QuestDirection) source; if (d.getTextEn() != null && !d.getTextEn().isEmpty()) { TextArea textEnArea = new TextArea("? "); textEnArea.setValue(d.getTextEn()); textEnArea.setRows(2); textEnArea.setReadOnly(true); textEnArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnArea); } if (d.getTextRu() != null && !d.getTextRu().isEmpty()) { TextArea textRuArea = new TextArea(" "); textRuArea.setValue(d.getTextRu()); textRuArea.setRows(2); textRuArea.setReadOnly(true); textRuArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuArea); } } return result; } }).setId("ingameText").setStyleGenerator(rowStyleGenerator); stepsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestStep) { QuestStep step = (QuestStep) source; if (step.getSheetsJournalEntry() != null) { TextArea textEnRawArea = new TextArea("? "); textEnRawArea.setValue(step.getSheetsJournalEntry().getTextEn()); textEnRawArea.setReadOnly(true); textEnRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnRawArea); if (step.getSheetsJournalEntry().getTextRu() != null && !step.getSheetsJournalEntry() .getTextRu().equals(step.getSheetsJournalEntry().getTextEn())) { TextArea textRuRawArea = new TextArea(" " + step.getSheetsJournalEntry().getTranslator()); textRuRawArea.setValue(step.getSheetsJournalEntry().getTextRu()); textRuRawArea.setReadOnly(true); textRuRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuRawArea);//, " " } } } else if (source instanceof QuestDirection) { QuestDirection d = (QuestDirection) source; if (d.getSheetsQuestDirection() != null) { TextArea textEnRawArea = new TextArea("? "); textEnRawArea.setValue(d.getSheetsQuestDirection().getTextEn()); textEnRawArea.setRows(2); textEnRawArea.setReadOnly(true); textEnRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnRawArea); if (d.getSheetsQuestDirection().getTextRu() != null && !d.getSheetsQuestDirection() .getTextRu().equals(d.getSheetsQuestDirection().getTextEn())) { TextArea textRuRawArea = new TextArea(" " + d.getSheetsQuestDirection().getTranslator()); textRuRawArea.setValue(d.getSheetsQuestDirection().getTextRu()); textRuRawArea.setRows(2); textRuRawArea.setReadOnly(true); textRuRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuRawArea); } } } return result; } }).setId("rawText").setStyleGenerator(rowStyleGenerator); stepsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { Panel panel = new Panel(); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.setWidth(100f, Unit.PERCENTAGE); panel.setHeight(245f, Unit.PIXELS); final VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestStep) { Set<TranslatedText> list = new HashSet<>(); List<SysAccount> accounts = new ArrayList<>(); QuestStep step = (QuestStep) source; list.addAll(step.getSheetsJournalEntry().getTranslatedTexts()); if (list != null) { for (TranslatedText t : list) { result.addComponent(new TranslationCell(t)); accounts.add(t.getAuthor()); } } if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && step.getSheetsJournalEntry() != null && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) { final TranslatedText translatedText = new TranslatedText(); translatedText.setAuthor(SpringSecurityHelper.getSysAccount()); translatedText.setSpreadSheetsJournalEntry(step.getSheetsJournalEntry()); Button addTranslation = new Button(" ", FontAwesome.PLUS_SQUARE); addTranslation.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (translatedText.getSpreadSheetsJournalEntry() != null) { translatedText.getSpreadSheetsJournalEntry().getTranslatedTexts() .add(translatedText); } result.addComponent(new TranslationCell(translatedText)); event.getButton().setVisible(false); } }); result.addComponent(addTranslation); } } else if (source instanceof QuestDirection) { Set<TranslatedText> list = new HashSet<>(); List<SysAccount> accounts = new ArrayList<>(); QuestDirection d = (QuestDirection) source; list.addAll(d.getSheetsQuestDirection().getTranslatedTexts()); if (list != null) { for (TranslatedText t : list) { result.addComponent(new TranslationCell(t)); accounts.add(t.getAuthor()); } } if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && d.getSheetsQuestDirection() != null && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) { final TranslatedText translatedText = new TranslatedText(); translatedText.setAuthor(SpringSecurityHelper.getSysAccount()); translatedText.setSpreadSheetsQuestDirection(d.getSheetsQuestDirection()); Button addTranslation = new Button(" "); addTranslation.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (translatedText.getSpreadSheetsQuestDirection() != null) { translatedText.getSpreadSheetsQuestDirection().getTranslatedTexts() .add(translatedText); } result.addComponent(new TranslationCell(translatedText)); event.getButton().setVisible(false); } }); result.addComponent(addTranslation); } } panel.setContent(result); return panel; } }).setId("translation").setStyleGenerator(rowStyleGenerator); stepsGrid.setColumns("rowType", "ingameText", "rawText", "translation"); stepsLayout.addComponent(stepsGrid); tabSheet.addTab(stepsLayout, ""); itemsGrid = new Grid(new ListDataProvider(itemList)); itemsGrid.setSelectionMode(Grid.SelectionMode.NONE); itemsGrid.setRowHeight(250); itemsGrid.setHeaderVisible(false); itemsGrid.setSizeFull(); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestItem) { QuestItem item = (QuestItem) source; if (item.getName() != null) { TextArea textEnRawArea = new TextArea("? "); textEnRawArea.setValue(item.getName().getTextEn()); textEnRawArea.setReadOnly(true); textEnRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnRawArea); if (item.getName().getTextRu() != null && !item.getName().getTextRu().equals(item.getName().getTextEn())) { TextArea textRuRawArea = new TextArea( " ? " + item.getName().getTranslator()); textRuRawArea.setValue(item.getName().getTextRu()); textRuRawArea.setReadOnly(true); textRuRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuRawArea);//, " " } } } return result; } }).setId("rawName"); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestItem) { QuestItem item = (QuestItem) source; if (item.getDescription() != null) { TextArea textEnRawArea = new TextArea("? "); textEnRawArea.setValue(item.getDescription().getTextEn()); textEnRawArea.setReadOnly(true); textEnRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textEnRawArea); if (item.getDescription().getTextRu() != null && !item.getDescription().getTextRu().equals(item.getDescription().getTextEn())) { TextArea textRuRawArea = new TextArea( " ?? " + item.getDescription().getTranslator()); textRuRawArea.setValue(item.getDescription().getTextRu()); textRuRawArea.setReadOnly(true); textRuRawArea.setWidth(100f, Unit.PERCENTAGE); result.addComponent(textRuRawArea);//, " " } } } return result; } }).setId("rawDescription"); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { Panel panel = new Panel(); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.setWidth(100f, Unit.PERCENTAGE); panel.setHeight(245f, Unit.PIXELS); final VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestItem) { Set<TranslatedText> list = new HashSet<>(); List<SysAccount> accounts = new ArrayList<>(); QuestItem item = (QuestItem) source; if (item.getName() != null) { String text = item.getName().getTextEn(); list.addAll(item.getName().getTranslatedTexts()); if (list != null) { for (TranslatedText t : list) { result.addComponent(new TranslationCell(t)); accounts.add(t.getAuthor()); } } if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && text != null && !text.isEmpty() && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) { final TranslatedText translatedText = new TranslatedText(); translatedText.setAuthor(SpringSecurityHelper.getSysAccount()); translatedText.setSpreadSheetsItemName(item.getName()); Button addTranslation = new Button(" ", FontAwesome.PLUS_SQUARE); addTranslation.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (translatedText.getSpreadSheetsItemName() != null) { translatedText.getSpreadSheetsItemName().getTranslatedTexts() .add(translatedText); } result.addComponent(new TranslationCell(translatedText)); event.getButton().setVisible(false); } }); result.addComponent(addTranslation); } } } panel.setContent(result); return panel; } }).setId("nameTranslation"); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { Panel panel = new Panel(); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.setWidth(100f, Unit.PERCENTAGE); panel.setHeight(245f, Unit.PIXELS); final VerticalLayout result = new VerticalLayout(); result.setSpacing(false); result.setMargin(false); if (source instanceof QuestItem) { Set<TranslatedText> list = new HashSet<>(); List<SysAccount> accounts = new ArrayList<>(); QuestItem item = (QuestItem) source; if (item.getDescription() != null) { String text = item.getDescription().getTextEn(); list.addAll(item.getDescription().getTranslatedTexts()); if (list != null) { for (TranslatedText t : list) { result.addComponent(new TranslationCell(t)); accounts.add(t.getAuthor()); } } if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && text != null && !text.isEmpty() && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) { final TranslatedText translatedText = new TranslatedText(); translatedText.setAuthor(SpringSecurityHelper.getSysAccount()); translatedText.setSpreadSheetsItemDescription(item.getDescription()); Button addTranslation = new Button(" ", FontAwesome.PLUS_SQUARE); addTranslation.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (translatedText.getSpreadSheetsItemDescription() != null) { translatedText.getSpreadSheetsItemDescription().getTranslatedTexts() .add(translatedText); } result.addComponent(new TranslationCell(translatedText)); event.getButton().setVisible(false); } }); result.addComponent(addTranslation); } } } panel.setContent(result); return panel; } }).setId("descriptionTranslation"); itemsGrid.addComponentColumn(new ValueProvider() { @Override public Object apply(Object source) { VerticalLayout result = new VerticalLayout(); result.setMargin(new MarginInfo(true, false, false, false)); result.setSpacing(false); if (source instanceof QuestItem) { GSpreadSheetsItemName name = ((QuestItem) source).getName(); if (name.getIcon() != null) { Image image = new Image(null, new ExternalResource( "https://elderscrolls.net" + name.getIcon().replaceAll(".dds", ".png"))); result.addComponent(image); return result; } } return result; } }).setId("icon").setWidth(95); itemsGrid.setColumns("icon", "rawName", "nameTranslation", "rawDescription", "descriptionTranslation"); tabSheet.addTab(itemsGrid, ""); this.addComponent(tabSheet); this.setExpandRatio(tabSheet, 1f); GridScrollExtension stepsScrollExtension = new GridScrollExtension(stepsGrid); GridScrollExtension itemsScrollExtension = new GridScrollExtension(itemsGrid); new NoAutcompleteComboBoxExtension(locationTable); new NoAutcompleteComboBoxExtension(questTable); new NoAutcompleteComboBoxExtension(translatorBox); LoadFilters(); }
From source file:org.esn.esobase.view.tab.SearchInRawStringsTab.java
public SearchInRawStringsTab(DBService service_) { this.service = service_; this.setSizeFull(); GridLayout hl = new GridLayout(3, 1); hl.setHeight(100, Unit.PIXELS);/*w w w. j a v a 2s. c o m*/ searchField = new TextField(); searchField.setWidth(500, Unit.PIXELS); searchField .addShortcutListener(new ShortcutListener("Search shortcut", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { search(); } }); hl.addComponent(searchField, 0, 0); isJp = new CheckBox("?"); isJp.setValue(Boolean.FALSE); isJp.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() { @Override public void valueChange(HasValue.ValueChangeEvent<Boolean> event) { setColumns(); } }); hl.addComponent(isJp, 1, 0); searchButton = new Button("?"); searchButton.addClickListener(new ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { search(); } }); hl.addComponent(searchButton, 2, 0); this.addComponent(hl); resultTable = new Table(""); resultTable.setSizeFull(); Styles styles = Page.getCurrent().getStyles(); styles.add(".v-table-cell-wrapper {\n" + " /* Do not specify any margins, paddings or borders here */\n" + " white-space: pre-line;\n" + " overflow: hidden;\n" + "}"); resultTable.addStyleName("v-table-cell-wrapper"); resultTable.setPageLength(0); hc.addContainerProperty("textEn", String.class, null); hc.addContainerProperty("textDe", String.class, null); hc.addContainerProperty("textFr", String.class, null); hc.addContainerProperty("textJp", String.class, null); resultTable.setContainerDataSource(hc); setColumns(); this.addComponent(resultTable); this.setExpandRatio(hl, 5); this.setExpandRatio(resultTable, 95); }
From source file:org.esn.esobase.view.tab.TranslateTab.java
public void Init() { removeAllComponents();/*ww w. j a v a 2 s .co m*/ TopicNpcColumnGenerator topicNpcColumnGenerator = new TopicNpcColumnGenerator(); TopicPlayerColumnGenerator topicPlayerColumnGenerator = new TopicPlayerColumnGenerator(); SubtitleColumnGenerator subtitleColumnGenerator = new SubtitleColumnGenerator(); TranslationColumnGenerator translationColumnGenerator = new TranslationColumnGenerator(); FilterChangeListener filterChangeListener = new FilterChangeListener(); this.setSizeFull(); this.setSpacing(false); this.setMargin(false); npcListlayout = new HorizontalLayout(); npcListlayout.setSpacing(false); npcListlayout.setMargin(false); npcListlayout.setSizeFull(); npcTable = new ComboBox("NPC"); npcTable.setPageLength(30); npcTable.setScrollToSelectedItem(true); npcTable.setWidth(100f, Unit.PERCENTAGE); npcTable.addValueChangeListener(new NpcSelectListener()); npcTable.setScrollToSelectedItem(true); npcTable.setEmptySelectionAllowed(true); locationTable = new ComboBox("?"); locationTable.setPageLength(30); locationTable.setScrollToSelectedItem(true); locationTable.setWidth(100f, Unit.PERCENTAGE); locationTable.addValueChangeListener(filterChangeListener); locationTable.setDataProvider(new ListDataProvider<>(locations)); locationTable.setEmptySelectionAllowed(true); subLocationTable = new ComboBox("?"); subLocationTable.setPageLength(30); subLocationTable.setScrollToSelectedItem(true); subLocationTable.setWidth(100f, Unit.PERCENTAGE); subLocationTable.addValueChangeListener(filterChangeListener); subLocationTable.setDataProvider(new ListDataProvider<>(subLocations)); subLocationTable.setEmptySelectionAllowed(true); questTable = new ComboBox("?"); questTable.setPageLength(30); questTable.setScrollToSelectedItem(true); questTable.setWidth(100f, Unit.PERCENTAGE); questTable.addValueChangeListener(filterChangeListener); questTable.setDataProvider(new ListDataProvider<>(questList)); npcTable.setDataProvider(new ListDataProvider<>(npcList)); FormLayout locationAndNpc = new FormLayout(questTable, locationTable, subLocationTable, npcTable); locationAndNpc.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); locationAndNpc.setSizeFull(); npcListlayout.addComponent(locationAndNpc); translateStatus = new ComboBoxMultiselect("? ", Arrays.asList(TRANSLATE_STATUS.values())); translateStatus.setClearButtonCaption("?"); translateStatus.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { LoadFilters(); LoadNpcContent(); } }); translateStatus.setPageLength(20); noTranslations = new CheckBox("? ?"); noTranslations.setValue(Boolean.FALSE); noTranslations.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() { @Override public void valueChange(HasValue.ValueChangeEvent<Boolean> event) { LoadFilters(); LoadNpcContent(); } }); emptyTranslations = new CheckBox("? "); emptyTranslations.setValue(Boolean.FALSE); emptyTranslations.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() { @Override public void valueChange(HasValue.ValueChangeEvent<Boolean> event) { LoadFilters(); LoadNpcContent(); } }); HorizontalLayout checkBoxlayout = new HorizontalLayout(noTranslations, emptyTranslations); translatorBox = new ComboBox(""); translatorBox.setPageLength(15); translatorBox.setScrollToSelectedItem(true); translatorBox.setDataProvider(new ListDataProvider(service.getSysAccounts())); translatorBox.addValueChangeListener(new HasValue.ValueChangeListener() { @Override public void valueChange(HasValue.ValueChangeEvent event) { LoadFilters(); LoadNpcContent(); } }); refreshButton = new Button(""); refreshButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { LoadFilters(); LoadNpcContent(); } }); countLabel = new Label(); searchField = new TextField("?? ?"); searchField.setSizeFull(); searchField.addValueChangeListener(new HasValue.ValueChangeListener<String>() { @Override public void valueChange(HasValue.ValueChangeEvent<String> event) { LoadFilters(); LoadNpcContent(); } }); FormLayout questAndWithNewTranslations = new FormLayout(translateStatus, translatorBox, checkBoxlayout, searchField); questAndWithNewTranslations.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); questAndWithNewTranslations.setSizeFull(); npcListlayout.addComponent(questAndWithNewTranslations); npcListlayout.addComponent(refreshButton); npcListlayout.addComponent(countLabel); npcListlayout.setExpandRatio(locationAndNpc, 0.4f); npcListlayout.setExpandRatio(questAndWithNewTranslations, 0.4f); npcListlayout.setExpandRatio(refreshButton, 0.1f); npcListlayout.setExpandRatio(countLabel, 0.1f); npcContentLayout = new VerticalLayout(); npcContentLayout.setSizeFull(); npcContentLayout.setSpacing(false); npcContentLayout.setMargin(false); npcTabSheet = new TabSheet(); npcTabSheet.setSizeFull(); npcTabLayout = new VerticalLayout(); locationName = new TextField("? "); npcTabLayout.addComponent(locationName); locationNameRu = new TextField(" ? "); npcTabLayout.addComponent(locationNameRu); npcName = new TextField("? NPC"); npcTabLayout.addComponent(npcName); npcNameRu = new TextField(" NPC"); npcTabLayout.addComponent(npcNameRu); npcTab = npcTabSheet.addTab(npcTabLayout, ""); npcTopicsTable = new Table(); npcTopicsTable.addStyleName(ValoTheme.TABLE_COMPACT); npcTopicsTable.setSizeFull(); npcTopicsTable.setPageLength(0); topicsContainer = new BeanItemContainer<>(Topic.class); npcTopicsTable.setContainerDataSource(topicsContainer); npcTopicsTable.addGeneratedColumn("npcTextG", topicNpcColumnGenerator); npcTopicsTable.addGeneratedColumn("playerTextG", topicPlayerColumnGenerator); npcTopicsTable.removeGeneratedColumn("playerTranslations"); npcTopicsTable.addGeneratedColumn("playerTranslations", translationColumnGenerator); npcTopicsTable.removeGeneratedColumn("npcTranslations"); npcTopicsTable.addGeneratedColumn("npcTranslations", translationColumnGenerator); npcTopicsTable.setVisibleColumns( new Object[] { "playerTextG", "playerTranslations", "npcTextG", "npcTranslations" }); npcTopicsTable.setColumnHeaders(new String[] { " ", "", " NPC", "" }); npcTopicsTable.setColumnExpandRatio("playerTextG", 1f); npcTopicsTable.setColumnExpandRatio("playerTranslations", 1.5f); npcTopicsTable.setColumnExpandRatio("npcTextG", 1.5f); npcTopicsTable.setColumnExpandRatio("npcTranslations", 1.5f); npcTopicsTable.setColumnWidth("actions", 150); npcSubtitlesTable = new Table(); npcSubtitlesTable.addStyleName(ValoTheme.TABLE_COMPACT); npcSubtitlesTable.setSizeFull(); npcSubtitlesTable.setPageLength(0); subtitlesContainer = new BeanItemContainer<>(Subtitle.class); npcSubtitlesTable.setContainerDataSource(subtitlesContainer); npcSubtitlesTable.addGeneratedColumn("textG", subtitleColumnGenerator); npcSubtitlesTable.removeGeneratedColumn("translations"); npcSubtitlesTable.addGeneratedColumn("translations", translationColumnGenerator); npcSubtitlesTable.setVisibleColumns(new Object[] { "textG", "translations" }); npcSubtitlesTable.setColumnHeaders(new String[] { "", "" }); npcSubtitlesTable.setColumnExpandRatio("textG", 1f); npcSubtitlesTable.setColumnExpandRatio("translations", 1f); npcSubtitlesTable.setColumnWidth("actions", 150); npcTopicsTab = npcTabSheet.addTab(npcTopicsTable, ""); npcSubtitlesTab = npcTabSheet.addTab(npcSubtitlesTable, ""); npcContentLayout.addComponent(npcTabSheet); this.addComponent(npcListlayout); this.addComponent(npcContentLayout); this.npcListlayout.setHeight(105f, Unit.PIXELS); this.setExpandRatio(npcContentLayout, 1f); LoadFilters(); new NoAutcompleteComboBoxExtension(questTable); new NoAutcompleteComboBoxExtension(locationTable); new NoAutcompleteComboBoxExtension(subLocationTable); new NoAutcompleteComboBoxExtension(npcTable); new NoAutcompleteComboBoxExtension(translatorBox); }
From source file:org.hip.vif.admin.admin.ui.ReindexView.java
License:Open Source License
private CheckBox createCheckbox(final String inLabel, final String inData) { final CheckBox outCheckBox = new CheckBox(inLabel); outCheckBox.setStyleName("vif-check"); //$NON-NLS-1$ outCheckBox.setData(inData);//from w w w. ja v a 2s . c o m outCheckBox.setImmediate(true); outCheckBox.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent inEvent) { // NOPMD for (final CheckBox lCheckBox : checkBoxes) { final Boolean lValue = lCheckBox.getValue(); if (lValue != null && lValue.booleanValue()) { reindex.setEnabled(true); return; } } reindex.setEnabled(false); } }); checkBoxes.add(outCheckBox); return outCheckBox; }
From source file:org.ikasan.dashboard.ui.administration.panel.UserDirectoryManagementPanel.java
License:BSD License
protected void init() { this.setWidth("100%"); this.setHeight("100%"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);// w w w. j a v a 2 s .c om Panel securityAdministrationPanel = new Panel(); securityAdministrationPanel.setStyleName("dashboard"); securityAdministrationPanel.setWidth("100%"); securityAdministrationPanel.setHeight("100%"); GridLayout gridLayout = new GridLayout(2, 25); gridLayout.setSpacing(true); gridLayout.setWidth("100%"); gridLayout.setHeight("100%"); gridLayout.setMargin(true); gridLayout.setColumnExpandRatio(0, 0.3f); gridLayout.setColumnExpandRatio(1, 0.7f); authenticationMethodCombo.addItem(LOCAL_AUTHENTICATION); authenticationMethodCombo.setItemCaption(LOCAL_AUTHENTICATION, LOCAL_AUTHENTICATION.getCaption()); authenticationMethodCombo.addItem(LDAP_LOCAL_AUTHENTICATION); authenticationMethodCombo.setItemCaption(LDAP_LOCAL_AUTHENTICATION, LDAP_LOCAL_AUTHENTICATION.getCaption()); authenticationMethodCombo.addItem(LDAP_AUTHENTICATION); authenticationMethodCombo.setItemCaption(LDAP_AUTHENTICATION, LDAP_AUTHENTICATION.getCaption()); authenticationMethodDropdownValuesMap.put(LOCAL_AUTHENTICATION.getValue(), LOCAL_AUTHENTICATION); authenticationMethodDropdownValuesMap.put(LDAP_LOCAL_AUTHENTICATION.getValue(), LDAP_LOCAL_AUTHENTICATION); authenticationMethodDropdownValuesMap.put(LDAP_AUTHENTICATION.getValue(), LDAP_AUTHENTICATION); final Label serverSettings = new Label("Server Settings"); serverSettings.setStyleName("large-bold"); gridLayout.addComponent(serverSettings, 0, 0); final Label directoryNameLabel = new Label("Directory Name:"); directoryNameLabel.setSizeUndefined(); this.directoryName = new TextField(); this.directoryName.setWidth("400px"); this.directoryName.setRequired(true); gridLayout.addComponent(directoryNameLabel, 0, 1); gridLayout.addComponent(this.directoryName, 1, 1); gridLayout.setComponentAlignment(directoryNameLabel, Alignment.MIDDLE_RIGHT); final Label ldapServerUrlLabel = new Label("LDAP Server URL:"); ldapServerUrlLabel.setSizeUndefined(); this.ldapServerUrl = new TextField(); this.ldapServerUrl.setWidth("400px"); gridLayout.addComponent(ldapServerUrlLabel, 0, 2); gridLayout.addComponent(this.ldapServerUrl, 1, 2); this.ldapServerUrl.setRequired(true); gridLayout.setComponentAlignment(ldapServerUrlLabel, Alignment.MIDDLE_RIGHT); Label hostnameExample = new Label("Hostname of server running LDAP. Example: ldap://ldap.example.com:389"); gridLayout.addComponent(hostnameExample, 1, 3); final Label ldapBindUserDnLabel = new Label("Username:"); ldapBindUserDnLabel.setSizeUndefined(); this.ldapBindUserDn = new TextField(); this.ldapBindUserDn.setWidth("400px"); this.ldapBindUserDn.setRequired(true); gridLayout.addComponent(ldapBindUserDnLabel, 0, 4); gridLayout.addComponent(this.ldapBindUserDn, 1, 4); gridLayout.setComponentAlignment(ldapBindUserDnLabel, Alignment.MIDDLE_RIGHT); Label usernameExample = new Label("User to log into LDAP. Example: cn=user,DC=domain,DC=name"); gridLayout.addComponent(usernameExample, 1, 5); final Label ldapBindUserPasswordLabel = new Label("Password:"); ldapBindUserPasswordLabel.setSizeUndefined(); this.ldapBindUserPassword = new PasswordField(); this.ldapBindUserPassword.setWidth("100px"); this.ldapBindUserPassword.setRequired(true); gridLayout.addComponent(ldapBindUserPasswordLabel, 0, 6); gridLayout.addComponent(this.ldapBindUserPassword, 1, 6); gridLayout.setComponentAlignment(ldapBindUserPasswordLabel, Alignment.MIDDLE_RIGHT); final Label ldapSchema = new Label("LDAP Schema"); ldapSchema.setStyleName("large-bold"); gridLayout.addComponent(ldapSchema, 0, 7); final Label ldapUserSearchDnLabel = new Label("User DN:"); ldapUserSearchDnLabel.setSizeUndefined(); this.ldapUserSearchDn = new TextField(); this.ldapUserSearchDn.setRequired(true); this.ldapUserSearchDn.setWidth("400px"); gridLayout.addComponent(ldapUserSearchDnLabel, 0, 8); gridLayout.setComponentAlignment(ldapUserSearchDnLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.ldapUserSearchDn, 1, 8); Label userDnExample = new Label("The base DN to use when searching for users."); gridLayout.addComponent(userDnExample, 1, 9); final Label applicationSecurityBaseDnLabel = new Label("Group DN:"); applicationSecurityBaseDnLabel.setSizeUndefined(); this.applicationSecurityBaseDn = new TextField(); this.applicationSecurityBaseDn.setRequired(true); this.applicationSecurityBaseDn.setWidth("400px"); gridLayout.addComponent(applicationSecurityBaseDnLabel, 0, 10); gridLayout.setComponentAlignment(applicationSecurityBaseDnLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.applicationSecurityBaseDn, 1, 10); Label groupDnExample = new Label("The base DN to use when searching for groups."); gridLayout.addComponent(groupDnExample, 1, 11); final Label ldapAttributes = new Label("LDAP Attributes"); ldapAttributes.setStyleName("large-bold"); CheckBox checkbox = new CheckBox("Populate default attributes"); checkbox.setValue(false); checkbox.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { boolean value = (Boolean) event.getProperty().getValue(); if (value == true) { ldapUserSearchFilter.setValue(LDAP_USER_SEARCH_FILTER); emailAttributeName.setValue(EMAIL_ATTRIBUTE_NAME); userAccountNameAttributeName.setValue(USER_ACCOUNT_NAME_ATTRIBUTE_NAME); accountTypeAttributeName.setValue(ACCOUNT_TYPE_ATTRIBUTE_NAME); firstNameAttributeName.setValue(FIRST_NAME_ATTRIBUTE_NAME); surnameAttributeName.setValue(SURNAME_ATTRIBUTE_NAME); departmentAttributeName.setValue(DEPARTMENT_ATTRIBUTE_NAME); ldapUserDescriptionAttributeName.setValue(LDAP_USER_DESCRIPTION_ATTRIBUTE_NAME); memberofAttributeName.setValue(MEMBER_OF_ATTRIBUTE_NAME); applicationSecurityGroupAttributeName.setValue(APPLICATION_SECURITY_GROUP_ATTRIBUTE_NAME); applicationSecurityDescriptionAttributeName .setValue(APPLICATION_SECURITY_DESCRIPTION_ATTRIBUTE_NAME); } else { ldapUserSearchFilter.setValue(""); emailAttributeName.setValue(""); userAccountNameAttributeName.setValue(""); accountTypeAttributeName.setValue(""); firstNameAttributeName.setValue(""); surnameAttributeName.setValue(""); departmentAttributeName.setValue(""); ldapUserDescriptionAttributeName.setValue(""); memberofAttributeName.setValue(""); applicationSecurityGroupAttributeName.setValue(""); applicationSecurityDescriptionAttributeName.setValue(""); } } }); checkbox.setImmediate(true); gridLayout.addComponent(ldapAttributes, 0, 12); gridLayout.addComponent(checkbox, 1, 12); final Label userSearchFieldLabel = new Label("User Search Filter:"); userSearchFieldLabel.setSizeUndefined(); this.ldapUserSearchFilter = new TextField(); this.ldapUserSearchFilter.setWidth("300px"); this.ldapUserSearchFilter.setRequired(true); gridLayout.addComponent(userSearchFieldLabel, 0, 13); gridLayout.setComponentAlignment(userSearchFieldLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.ldapUserSearchFilter, 1, 13); final Label emailAttributeNameLabel = new Label("Email:"); emailAttributeNameLabel.setSizeUndefined(); this.emailAttributeName = new TextField(); this.emailAttributeName.setWidth("300px"); this.emailAttributeName.setRequired(true); gridLayout.addComponent(emailAttributeNameLabel, 0, 14); gridLayout.setComponentAlignment(emailAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.emailAttributeName, 1, 14); final Label userAccountNameAttributeNameLabel = new Label("Account Name:"); userAccountNameAttributeNameLabel.setSizeUndefined(); this.userAccountNameAttributeName = new TextField(); this.userAccountNameAttributeName.setWidth("300px"); this.userAccountNameAttributeName.setRequired(true); gridLayout.addComponent(userAccountNameAttributeNameLabel, 0, 15); gridLayout.setComponentAlignment(userAccountNameAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.userAccountNameAttributeName, 1, 15); final Label accountTypeAttributeNameLabel = new Label("Account Type:"); accountTypeAttributeNameLabel.setSizeUndefined(); this.accountTypeAttributeName = new TextField(); this.accountTypeAttributeName.setWidth("300px"); this.accountTypeAttributeName.setRequired(true); gridLayout.addComponent(accountTypeAttributeNameLabel, 0, 16); gridLayout.setComponentAlignment(accountTypeAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.accountTypeAttributeName, 1, 16); final Label firstNameAttributeNameLabel = new Label("First Name:"); firstNameAttributeNameLabel.setSizeUndefined(); this.firstNameAttributeName = new TextField(); this.firstNameAttributeName.setWidth("300px"); this.firstNameAttributeName.setRequired(true); gridLayout.addComponent(firstNameAttributeNameLabel, 0, 17); gridLayout.setComponentAlignment(firstNameAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.firstNameAttributeName, 1, 17); final Label surnameAttributeNameLabel = new Label("Surname:"); surnameAttributeNameLabel.setSizeUndefined(); this.surnameAttributeName = new TextField(); this.surnameAttributeName.setWidth("300px"); this.surnameAttributeName.setRequired(true); gridLayout.addComponent(surnameAttributeNameLabel, 0, 18); gridLayout.setComponentAlignment(surnameAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.surnameAttributeName, 1, 18); final Label departmentAttributeNameLabel = new Label("User Department:"); departmentAttributeNameLabel.setSizeUndefined(); this.departmentAttributeName = new TextField(); this.departmentAttributeName.setWidth("300px"); this.departmentAttributeName.setRequired(true); gridLayout.addComponent(departmentAttributeNameLabel, 0, 19); gridLayout.setComponentAlignment(departmentAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.departmentAttributeName, 1, 19); final Label ldapUserDescriptionAttributeNameLabel = new Label("User Description:"); ldapUserDescriptionAttributeNameLabel.setSizeUndefined(); this.ldapUserDescriptionAttributeName = new TextField(); this.ldapUserDescriptionAttributeName.setWidth("300px"); this.ldapUserDescriptionAttributeName.setRequired(true); gridLayout.addComponent(ldapUserDescriptionAttributeNameLabel, 0, 20); gridLayout.setComponentAlignment(ldapUserDescriptionAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.ldapUserDescriptionAttributeName, 1, 20); final Label memberOfAttributeNameLabel = new Label("Member Of:"); memberOfAttributeNameLabel.setSizeUndefined(); this.memberofAttributeName = new TextField(); this.memberofAttributeName.setWidth("300px"); this.memberofAttributeName.setRequired(true); gridLayout.addComponent(memberOfAttributeNameLabel, 0, 21); gridLayout.setComponentAlignment(memberOfAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.memberofAttributeName, 1, 21); final Label applicationSecurityGroupAttributeNameLabel = new Label("Group Name:"); applicationSecurityGroupAttributeNameLabel.setSizeUndefined(); this.applicationSecurityGroupAttributeName = new TextField(); this.applicationSecurityGroupAttributeName.setWidth("300px"); this.applicationSecurityGroupAttributeName.setRequired(true); gridLayout.addComponent(applicationSecurityGroupAttributeNameLabel, 0, 22); gridLayout.setComponentAlignment(applicationSecurityGroupAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.applicationSecurityGroupAttributeName, 1, 22); final Label applicationSecurityAttributeNameLabel = new Label("Group Description:"); applicationSecurityAttributeNameLabel.setSizeUndefined(); this.applicationSecurityDescriptionAttributeName = new TextField(); this.applicationSecurityDescriptionAttributeName.setWidth("300px"); this.applicationSecurityDescriptionAttributeName.setRequired(true); gridLayout.addComponent(applicationSecurityAttributeNameLabel, 0, 23); gridLayout.setComponentAlignment(applicationSecurityAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.applicationSecurityDescriptionAttributeName, 1, 23); final BeanItem<AuthenticationMethod> authenticationMethodItem = new BeanItem<AuthenticationMethod>( authenticationMethod); this.directoryName.setPropertyDataSource(authenticationMethodItem.getItemProperty("name")); this.ldapServerUrl.setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapServerUrl")); this.ldapBindUserDn.setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapBindUserDn")); this.ldapBindUserPassword .setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapBindUserPassword")); this.ldapUserSearchDn .setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapUserSearchBaseDn")); this.ldapUserSearchFilter .setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapUserSearchFilter")); this.emailAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("emailAttributeName")); this.userAccountNameAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("userAccountNameAttributeName")); this.accountTypeAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("accountTypeAttributeName")); this.applicationSecurityBaseDn .setPropertyDataSource(authenticationMethodItem.getItemProperty("applicationSecurityBaseDn")); this.applicationSecurityGroupAttributeName.setPropertyDataSource( authenticationMethodItem.getItemProperty("applicationSecurityGroupAttributeName")); this.departmentAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("departmentAttributeName")); this.firstNameAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("firstNameAttributeName")); this.surnameAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("surnameAttributeName")); this.ldapUserDescriptionAttributeName.setPropertyDataSource( authenticationMethodItem.getItemProperty("ldapUserDescriptionAttributeName")); this.applicationSecurityDescriptionAttributeName.setPropertyDataSource( authenticationMethodItem.getItemProperty("applicationSecurityDescriptionAttributeName")); this.memberofAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("memberofAttributeName")); Button saveButton = new Button("Save"); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { logger.info("saving auth method: " + authenticationMethod); authenticationMethod.setMethod(SecurityConstants.AUTH_METHOD_LDAP); if (authenticationMethod.getOrder() == null) { authenticationMethod.setOrder(securityService.getNumberOfAuthenticationMethods() + 1); } securityService.saveOrUpdateAuthenticationMethod(authenticationMethod); } catch (RuntimeException e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); Notification.show("Error trying to save the authentication method!", sw.toString(), Notification.Type.ERROR_MESSAGE); return; } Notification.show("Saved!"); } }); GridLayout buttonLayout = new GridLayout(1, 1); buttonLayout.setWidth("200px"); buttonLayout.setHeight("20px"); buttonLayout.addComponent(saveButton); gridLayout.addComponent(buttonLayout, 0, 24, 1, 24); VerticalLayout wrapperLayout = new VerticalLayout(); wrapperLayout.addComponent(gridLayout); wrapperLayout.setComponentAlignment(gridLayout, Alignment.TOP_CENTER); securityAdministrationPanel.setContent(wrapperLayout); layout.addComponent(securityAdministrationPanel); this.setContent(layout); }
From source file:org.investovator.ui.main.components.DataUploadWindow.java
License:Open Source License
private void setLayout() { //Window Properties setCaption("Upload Data"); setResizable(false);/*from www . j a va2 s . c o m*/ setClosable(true); setModal(true); center(); content = new VerticalLayout(); content.setSpacing(true); content.setMargin(true); companySelectLayout = new HorizontalLayout(); companyDetailUploadLayout = new HorizontalLayout(); newCompanyForm = new FormLayout(); newCompanyCheckBox = new CheckBox("New Company"); companySelect = new ComboBox(); companySelect = new ComboBox(); companySelect.setNullSelectionAllowed(false); companySelect.setImmediate(true); dataTypeSelect = new ComboBox(); dataTypeSelect.setNullSelectionAllowed(false); dataUpload = new Upload(); dataUpload.setCaption("Select Data File"); dataUpload.setButtonCaption(null); detailUpload = new Upload(); detailUpload.setCaption("select Company Info XML"); detailUpload.setButtonCaption(null); symbol = new TextField("Company Symbol"); symbol.setRequired(true); companyName = new TextField("Company Name"); companyName.setRequired(true); submitButton = new Button("Upload Data"); newCompanyForm.addComponent(symbol); newCompanyForm.addComponent(companyName); companyDetailUploadLayout.addComponent(detailUpload); companySelectLayout.addComponent(companySelect); companySelectLayout.addComponent(newCompanyCheckBox); content.addComponent(companySelectLayout); content.addComponent(dataTypeSelect); content.addComponent(dataUpload); content.addComponent(submitButton); content.setComponentAlignment(submitButton, Alignment.MIDDLE_CENTER); setContent(content); setDefaults(); bindListeners(); }
From source file:org.jpos.qi.login.LoginView.java
License:Open Source License
private FormLayout createForm() { FormLayout formLayout = new FormLayout(); formLayout.setMargin(false);//from w ww.j a v a2 s . c om formLayout.setSizeUndefined(); binder = new Binder<>(String.class); username = new TextField(app.getMessage("login.username")); username.setMaxLength(60); binder.forField(username) .withValidator(new RegexpValidator( app.getMessage("errorMessage.invalidField", username.getCaption()), USERNAME_PATTERN)) .bind(string -> string, null); binder.setBean(""); username.focus(); username.setReadOnly(false); password = new PasswordField(); password.setCaption(app.getMessage("login.password")); password.setMaxLength(64); binder.forField(password).asRequired(app.getMessage("errorMessage.req", password.getCaption())) .withValidator(new RegexpValidator( app.getMessage("errorMessage.invalidField", password.getCaption()), PASSWORD_PATTERN)) .bind(string -> string, null); password.setReadOnly(false); rememberMe = new CheckBox(app.getMessage("login.remember")); rememberMe.setDescription(app.getMessage("login.rememberDesc")); formLayout.addComponent(username); formLayout.addComponent(password); if (helper.isRememberEnabled()) formLayout.addComponent(rememberMe); return formLayout; }