use of de.catma.ui.component.IconButton in project catma by forTEXT.
the class SelectProjectDialog method addContent.
@Override
protected void addContent(ComponentContainer content) {
VerticalLayout scrollPanel = new VerticalLayout();
scrollPanel.setSizeFull();
content.addComponent(scrollPanel);
HorizontalFlexLayout projectsLayout = new HorizontalFlexLayout();
projectsLayout.setSizeFull();
scrollPanel.addComponent(projectsLayout);
projectsLayout.addStyleNames("select-project-dialog-list");
HorizontalLayout descriptionBar = new HorizontalLayout();
Label description = new Label("Please select the target Project:");
Label title = new Label("Title");
Button sortButton = new IconButton(VaadinIcons.ARROW_DOWN);
sortButton.addClickListener(evt -> {
if (sortButton.getIcon().equals(VaadinIcons.ARROW_DOWN)) {
selectedSortOrder = sortByNameDesc;
sortButton.setIcon(VaadinIcons.ARROW_UP);
} else {
selectedSortOrder = sortByNameAsc;
sortButton.setIcon(VaadinIcons.ARROW_DOWN);
}
initData(projectsLayout);
});
descriptionBar.addComponent(description);
descriptionBar.setExpandRatio(description, 1f);
descriptionBar.addComponent(title);
descriptionBar.addComponent(sortButton);
descriptionBar.setComponentAlignment(sortButton, Alignment.MIDDLE_RIGHT);
descriptionBar.setWidth("100%");
content.addComponent(descriptionBar);
content.addComponent(scrollPanel);
((AbstractOrderedLayout) content).setExpandRatio(scrollPanel, 1f);
getBtOk().setVisible(false);
initData(projectsLayout);
}
use of de.catma.ui.component.IconButton in project catma by forTEXT.
the class ProjectView method initComponents.
/* build the GUI */
private void initComponents() {
progressBar = new ProgressBar();
progressBar.setIndeterminate(false);
progressBar.setVisible(false);
addComponent(progressBar);
setComponentAlignment(progressBar, Alignment.TOP_CENTER);
HorizontalFlexLayout mainPanel = new HorizontalFlexLayout();
mainPanel.setFlexWrap(FlexWrap.WRAP);
mainPanel.addStyleName("project-view-main-panel");
VerticalFlexLayout resourcePanel = new VerticalFlexLayout();
// don't set width 100%
resourcePanel.setSizeUndefined();
resourcePanel.addComponent(new Label("Resources"));
mainPanel.addComponent(resourcePanel);
addComponent(mainPanel);
setExpandRatio(mainPanel, 1.f);
resourcePanel.addComponent(initResourceContent());
teamPanel = new VerticalFlexLayout();
// don't set width 100%
teamPanel.setSizeUndefined();
teamPanel.setVisible(false);
teamPanel.addComponent(new Label("Team"));
mainPanel.addComponent(teamPanel);
teamPanel.addComponent(initTeamContent());
btSynchBell = new IconButton(VaadinIcons.BELL);
btSynchBell.addStyleName("project-view-synch-bell");
getHugeCardBar().addComponentBeforeMoreOptions(btSynchBell);
btSynchBell.setVisible(false);
}
use of de.catma.ui.component.IconButton in project catma by forTEXT.
the class NotLoggedInMainView method initComponents.
private void initComponents() {
setSizeFull();
setAlignItems(AlignItems.CENTER);
addStyleName("home");
HorizontalFlexLayout menuLayout = new HorizontalFlexLayout();
menuLayout.setWidth("100%");
menuLayout.setJustifyContent(JustifyContent.FLEX_END);
menuLayout.setAlignItems(AlignItems.CENTER);
menuLayout.addStyleName("home__menu");
// $NON-NLS-1$
menuLayout.setWidth("100%");
addComponent(menuLayout);
Link aboutLink = new Link("About", new ExternalResource(CATMAPropertyKey.AboutURL.getValue(CATMAPropertyKey.AboutURL.getDefaultValue())));
// $NON-NLS-1$
aboutLink.setTargetName("_blank");
menuLayout.addComponent(aboutLink);
Link imprintLink = new Link("Imprint", new ExternalResource(CATMAPropertyKey.ImprintURL.getValue(CATMAPropertyKey.ImprintURL.getDefaultValue())));
imprintLink.setTargetName("_blank");
menuLayout.addComponent(imprintLink);
Link termsOfUseLink = new Link("Terms of Use", new ExternalResource(CATMAPropertyKey.TermsOfUseURL.getValue(CATMAPropertyKey.TermsOfUseURL.getDefaultValue())));
// $NON-NLS-1$
termsOfUseLink.setTargetName("_blank");
menuLayout.addComponent(termsOfUseLink);
Link privacyLink = new Link("Privacy Policy", new ExternalResource(CATMAPropertyKey.PrivacyPolicyURL.getValue(CATMAPropertyKey.PrivacyPolicyURL.getDefaultValue())));
privacyLink.setTargetName("_blank");
menuLayout.addComponent(privacyLink);
statusLink = new Link("Status", new ExternalResource(CATMAPropertyKey.StatusURL.getValue(CATMAPropertyKey.StatusURL.getDefaultValue())));
statusLink.setTargetName("_blank");
menuLayout.addComponent(statusLink);
IconButton btHelp = new IconButton(VaadinIcons.QUESTION_CIRCLE, click -> {
if (uiHelpWindow.getParent() == null) {
UI.getCurrent().addWindow(uiHelpWindow);
} else {
UI.getCurrent().removeWindow(uiHelpWindow);
}
});
menuLayout.addComponent(btHelp);
VerticalFlexLayout contentPanel = new VerticalFlexLayout();
// $NON-NLS-1$
contentPanel.setHeight("100%");
// $NON-NLS-1$
contentPanel.addStyleName("home__content");
// $NON-NLS-1$
ThemeResource logoResource = new ThemeResource("catma-tailright-final-cmyk.svg");
Image logoImage = new Image(null, logoResource);
logoImage.setStyleName("not-logged-in-main-view-logo");
contentPanel.addComponent(logoImage);
noticePanelVerticalLayout = new VerticalLayout();
noticePanelVerticalLayout.addStyleName("vlayout");
HorizontalFlexLayout noticePanel = new HorizontalFlexLayout(noticePanelVerticalLayout);
noticePanel.addStyleName("not-logged-in-main-view-noticepanel");
noticePanel.setJustifyContent(JustifyContent.CENTER);
contentPanel.addComponent(noticePanel);
renderNotices();
LabelButton btn_signup = new LabelButton("Sign up", event -> new SignUpDialog("Sign Up").show());
LabelButton btn_login = new LabelButton("Sign in", event -> new AuthenticationDialog("Sign In", CATMAPropertyKey.BaseURL.getValue(CATMAPropertyKey.BaseURL.getDefaultValue()), loginService, initService, hazelCastService, sqliteService, eventBus).show());
Link newsLetterLink = new Link("Newsletter", new ExternalResource("https://catma.de/newsletter/"));
newsLetterLink.setTargetName("_blank");
newsLetterLink.addStyleName("button__label");
HorizontalFlexLayout buttonPanel = new HorizontalFlexLayout(btn_signup, btn_login, newsLetterLink);
buttonPanel.addStyleName("home__content__btns");
buttonPanel.setJustifyContent(JustifyContent.CENTER);
contentPanel.addComponent(buttonPanel);
addComponent(contentPanel);
HorizontalFlexLayout bottomPanel = new HorizontalFlexLayout();
bottomPanel.addStyleName("not-logged-in-main-view-fortext-bottom-panel");
addComponent(bottomPanel);
Link fortextButton = new Link("", new ExternalResource("https://fortext.net"));
fortextButton.setIcon(new ThemeResource("fortext_logo.png"));
fortextButton.setTargetName("_blank");
fortextButton.addStyleName("not-logged-in-main-view-fortext-button");
Label fortextLabel = new Label("developed and maintained</br>in cooperation with");
fortextLabel.setContentMode(ContentMode.HTML);
fortextLabel.addStyleName("not-logged-in-main-view-fortext-label");
bottomPanel.addComponent(fortextLabel);
bottomPanel.addComponent(fortextButton);
}
use of de.catma.ui.component.IconButton in project catma by forTEXT.
the class ProjectCard method initComponents.
protected void initComponents() {
addStyleName("projectlist__card");
CssLayout preview = new CssLayout();
preview.addStyleName("projectlist__card__preview");
descriptionLabel = new Label(projectReference.getDescription());
descriptionLabel.setWidth("100%");
preview.addComponents(descriptionLabel);
preview.addLayoutClickListener(evt -> handleOpenProjectRequest());
addComponent(preview);
HorizontalFlexLayout descriptionBar = new HorizontalFlexLayout();
descriptionBar.addStyleName("projectlist__card__descriptionbar");
descriptionBar.setAlignItems(FlexLayout.AlignItems.BASELINE);
descriptionBar.setWidth("100%");
nameLabel = new Label(projectReference.getName());
nameLabel.setWidth("100%");
descriptionBar.addComponent(nameLabel);
IconButton btnRemove = new IconButton(VaadinIcons.TRASH);
descriptionBar.addComponents(btnRemove);
btnRemove.addClickListener((event -> {
ConfirmDialog.show(UI.getCurrent(), "Delete Project", "Do you want to delete the whole Project '" + projectReference.getName() + "'?", "OK", "Cancel", (evt) -> {
try {
if (evt.isConfirmed()) {
projectManager.delete(projectReference.getProjectId());
eventBus.post(new ProjectChangedEvent(projectReference.getProjectId()));
}
} catch (Exception e) {
errorLogger.showAndLogError("can't delete Project " + projectReference.getName(), e);
}
});
}));
IconButton btnEdit = new IconButton(VaadinIcons.PENCIL);
btnEdit.addClickListener(click -> {
new EditProjectDialog(projectReference, projectManager, result -> {
try {
projectManager.updateProject(result);
descriptionLabel.setValue(result.getDescription());
nameLabel.setValue(result.getName());
} catch (IOException e) {
errorLogger.showAndLogError("Failed to update Project", e);
eventBus.post(new ProjectChangedEvent());
}
}).show();
});
descriptionBar.addComponent(btnEdit);
IconButton btnLeave = new IconButton(VaadinIcons.EXIT);
btnLeave.addClickListener((event -> {
ConfirmDialog.show(UI.getCurrent(), "Leave Project", "Do you want to leave '" + projectReference.getName() + "'?", "OK", "Cancel", (evt) -> {
try {
if (evt.isConfirmed()) {
projectManager.leaveProject(projectReference.getProjectId());
}
} catch (Exception e) {
errorLogger.showAndLogError("can't leave project " + projectReference.getName(), e);
}
eventBus.post(new ProjectChangedEvent());
});
}));
descriptionBar.addComponent(btnLeave);
rbacEnforcer.register(RBACConstraint.ifNotAuthorized((role) -> (rbacManager.hasPermission(role, RBACPermission.PROJECT_EDIT)), () -> {
btnEdit.setVisible(false);
btnEdit.setEnabled(false);
}));
rbacEnforcer.register(RBACConstraint.ifNotAuthorized((role) -> (rbacManager.hasPermission(role, RBACPermission.PROJECT_DELETE)), () -> {
btnRemove.setVisible(false);
btnRemove.setEnabled(false);
}));
rbacEnforcer.register(RBACConstraint.ifNotAuthorized((role) -> rbacManager.hasPermission(role, RBACPermission.PROJECT_LEAVE) && !rbacManager.hasPermission(role, RBACPermission.PROJECT_DELETE), () -> {
btnLeave.setVisible(false);
btnLeave.setEnabled(false);
}));
// IconButton buttonAction = new IconButton(VaadinIcons.ELLIPSIS_DOTS_V);
// descriptionBar.addComponents(buttonAction);
addComponents(descriptionBar);
}
use of de.catma.ui.component.IconButton in project catma by forTEXT.
the class TaggerView method initComponents.
private void initComponents() {
setSizeFull();
VerticalLayout taggerPanel = new VerticalLayout();
taggerPanel.setSizeFull();
taggerPanel.setSpacing(true);
taggerPanel.setMargin(new MarginInfo(true, true, true, false));
boolean isRtl = sourceDocument == null ? false : sourceDocument.getSourceContentHandler().getSourceDocumentInfo().getIndexInfoSet().isRightToLeftWriting();
pager = new Pager(taggerID, approxMaxLineLength, maxPageLengthInLines, isRtl);
tagger = new Tagger(taggerID, pager, this, project);
// $NON-NLS-1$
tagger.addStyleName("tagger");
// $NON-NLS-1$
tagger.setWidth("100%");
taggerPanel.addComponent(tagger);
taggerPanel.setExpandRatio(tagger, 1.0f);
HorizontalLayout actionPanel = new HorizontalLayout();
actionPanel.setSpacing(false);
taggerPanel.addComponent(actionPanel);
pagerComponent = new PagerComponent(pager, new PageChangeListener() {
public void pageChanged(int number) {
tagger.setPage(number);
}
});
actionPanel.addComponent(pagerComponent);
linesPerPageSlider = new Slider(1, 100, 0);
// $NON-NLS-1$
linesPerPageSlider.setWidth("100px");
actionPanel.addComponent(linesPerPageSlider);
cbTraceSelection = new IconButton(VaadinIcons.TWIN_COL_SELECT);
// state
cbTraceSelection.setData(false);
cbTraceSelection.setDescription("Allow multiple discontinuous selections");
actionPanel.addComponent(cbTraceSelection);
btClearSearchHighlights = new IconButton(VaadinIcons.ERASER);
btClearSearchHighlights.setDescription("Clear all search highlights");
actionPanel.addComponent(btClearSearchHighlights);
cbAutoShowComments = new IconButton(VaadinIcons.COMMENT);
cbAutoShowComments.setDescription("Toggle live Comments");
// state
cbAutoShowComments.setData(true);
actionPanel.addComponent(cbAutoShowComments);
btAnalyze = new Button("Analyze");
// $NON-NLS-1$
btAnalyze.addStyleName("primary-button");
btAnalyze.setEnabled(project instanceof IndexedProject);
actionPanel.addComponent(btAnalyze);
rightSplitPanel = new VerticalSplitPanel();
rightSplitPanel.setSizeFull();
kwicPanel = new KwicPanel(eventBus, project, KwicProvider.buildKwicProviderByDocumentIdCache(project));
kwicPanel.setExpandResource(VaadinIcons.CLOSE);
kwicPanel.setCompressResource(VaadinIcons.CLOSE);
rightSplitPanel.addComponent(kwicPanel);
hideKwicPanel();
annotationPanel = new AnnotationPanel(project, userMarkupCollectionManager, selectedAnnotationId -> tagger.setTagInstanceSelected(selectedAnnotationId), collection -> handleCollectionValueChange(collection), tag -> tagger.addTagInstanceWith(tag), () -> sourceDocument, eventBus);
rightSplitPanel.addComponent(annotationPanel);
splitPanel = new TaggerSplitPanel();
splitPanel.addComponent(taggerPanel);
splitPanel.addComponent(rightSplitPanel);
splitPanel.setSplitPosition(initialSplitterPositionInPixels, Unit.PIXELS);
// $NON-NLS-1$
splitPanel.addStyleName("catma-tab-spacing");
SplitterPositionChangedListener listener = new SplitterPositionChangedListener() {
@Override
public void positionChanged(SplitterPositionChangedEvent event) {
float width = event.getPosition();
// TODO: if it is PERCENTAGE, work out the splitter position in pixels
if (event.getPositionUnit() != Unit.PIXELS) {
// $NON-NLS-1$
String message = "Must use PIXELS Unit for split position";
errorHandler.showAndLogError(message, new IllegalArgumentException(message));
}
int approxMaxLineLength = getApproximateMaxLineLengthForSplitterPanel(width);
List<ClientTagInstance> absoluteTagInstances = pager.getAbsoluteTagInstances();
Page currentPage = null;
if (pager.hasPages()) {
currentPage = pager.getCurrentPage();
}
pager.setApproxMaxLineLength(approxMaxLineLength);
if (pager.hasPages()) {
// recalculate pages
try {
pager.setText(sourceDocument.getContent(), comments);
int previousPageNumber = pager.getPageNumberFor(currentPage.getPageStart());
tagger.setPage(previousPageNumber);
tagger.setTagInstancesVisible(absoluteTagInstances, true);
pagerComponent.setPage(previousPageNumber);
} catch (IOException e) {
// $NON-NLS-1$
errorHandler.showAndLogError("Error showing the Document!", e);
}
}
}
};
splitPanel.addListener(SplitterPositionChangedEvent.class, listener, SplitterPositionChangedListener.positionChangedMethod);
resourcePanel = new AnnotateResourcePanel(project, sourceDocument, eventBus);
drawer = new SliderPanelBuilder(resourcePanel).mode(SliderMode.LEFT).expanded(sourceDocument == null).build();
addComponent(drawer);
addComponent(splitPanel);
setExpandRatio(splitPanel, 1.0f);
}
Aggregations