public SettingsLayout(String userName, MainPage mainPage) { this.mainPage = mainPage; this.userName = userName; WebApplicationContext context = (WebApplicationContext) mainPage.getContext(); WebBrowser webBrowser = context.getBrowser(); height = webBrowser.getScreenHeight() - 310; setMargin(true); setSpacing(true); vl.setMargin(true); vl.setSpacing(true); panelEmail.setWidth("100%"); addComponent(hl); hl.setFirstComponent(panelEmail); hl.setSecondComponent(panelPassword); oldEmail.setValue(GeneralController.getEmailFromUserName(userName)); oldEmail.setWidth("250"); oldEmail.setReadOnly(false); newEmail.setWidth("250"); newEmail.addValidator(new EmailValidator("Email должен содержать знак '@' и полный домен.")); saveButton = new Button("Сохранить изменения"); saveButton.setVisible(true); saveButton.setIcon(new ThemeResource("icons/32/save.png")); resetUserPasswordButton.setVisible(true); resetUserPasswordButton.setIcon(new ThemeResource("icons/32/group_key.png")); resetUserPasswordButton.addListener(this); oldEmailInscription.setReadOnly(true); panelEmail.addComponent(oldEmailInscription); panelEmail.addComponent(oldEmail); panelEmail.addComponent(newEmail); panelEmail.addComponent(saveButton); panelPassword.addComponent(label); panelPassword.addComponent(resetUserPasswordButton); panelEmail.setHeight(height); panelPassword.setHeight(height); saveButton.addListener(this); }
private void CreateForm() throws SQLException { box = new VBox(); HBox Hbox = new HBox(); Hbox.setAlignment(Pos.CENTER); Hbox.getChildren().add(box); Hbox.setLayoutX(width / 2 - Hbox.getWidth() / 2); root.getChildren().add(Hbox); root.getChildren().add(box); // final Label logn=new Label("For connecting to the database press the button "); final Button ok = new Button("Connect to server"); box.setAlignment(Pos.TOP_CENTER); box.maxWidth(width); box.minWidth(width); log = "root"; psswrd = "0000"; Hbox.setLayoutX(width / 2 - 135); Hbox.setLayoutY(height / 2 - 80); final Button ok2 = new Button("Connect to server"); ok2.setOnAction(event -> System.out.println("Button was pressed.")); ok.setOnAction( event -> { try { System.out.println("Button was pressed."); db = new MySQLAccess("univer", log, psswrd); // logn.setVisible(false); ok.setVisible(false); /*final Button qq=new Button("qq"); ok.setLayoutX(width / 2 - 80); ok.setLayoutY(height / 2 - 80); box.setAlignment(Pos.TOP_CENTER); box.maxWidth(width); box.minWidth(width); box.getChildren().addAll(qq);*/ OutputInformation(); /* final Button qq=new Button("qq"); ok.setLayoutX(width / 2 - 80); ok.setLayoutY(height / 2 - 80); box.setAlignment(Pos.TOP_CENTER); box.maxWidth(width); box.minWidth(width); box.getChildren().addAll(qq);*/ } catch (ClassNotFoundException e) { System.out.println(e); } catch (SQLException e) { System.out.println(e); } }); box.getChildren().add(ok2); }
/* sets or hides fields depending on which tab is shown */ public void setVisibleComponents(nonHumanMgt.SelType sType) { boolean catTab = (sType == nonHumanMgt.SelType.category); // these only appear on the resources tab cbbCategory.setVisible(!catTab); lblSubCategory.setVisible(!catTab); cbbSubCategory.setVisible(!catTab); // these only appear on the categories tab lblMembers.setVisible(catTab); cbbMembers.setVisible(catTab); lbxSubCatItems.setVisible(catTab); btnAddSubCat.setVisible(catTab); btnRemoveSubCat.setVisible(catTab); // nullify lists if (catTab) { cbbCategory.setItems(null); cbbSubCategory.setItems(null); } else lbxSubCatItems.setItems(null); }
public Selectedtag(DataEvent eventdata, DataTag tagdata) { this.eventdata = eventdata; this.tagdata = tagdata; label = new JLabel(tagdata.getFullPath()); label.setForeground(View.GREY_DARK); unselect = new Button(" X "); unselect.setVisible(false); setDraggable(true); setMouseoverFg(MOUSEOVER_FG); setMouseoutFg(MOUSEOUT_FG); add(unselect); add(label, new Anchor(unselect, Anchor.RIGHT, Anchor.HORIZONTAL)); }
protected void showSubCatAddFields(boolean adding) { txtSubCat.setVisible(adding); btnConfirmAddSubCat.setVisible(adding); btnCancelAddSubCat.setVisible(adding); }
@Override public void exited() { label.setForeground(View.GREY_DARK); unselect.setVisible(false); }
@Override public void entered() { label.setForeground(Color.BLACK); unselect.setVisible(true); }
@Override public Component generateRow(final SimpleComment comment, int rowIndex) { final MHorizontalLayout layout = new MHorizontalLayout() .withMargin(new MarginInfo(true, true, true, false)) .withWidth("100%") .withStyleName("message"); UserBlock memberBlock = new UserBlock( comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName()); layout.addComponent(memberBlock); CssLayout rowLayout = new CssLayout(); rowLayout.setStyleName("message-container"); rowLayout.setWidth("100%"); MHorizontalLayout messageHeader = new MHorizontalLayout() .withMargin(new MarginInfo(true, true, false, true)) .withWidth("100%") .withStyleName("message-header"); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel timePostLbl = new ELabel( AppContext.getMessage( GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), AppContext.formatPrettyTime(comment.getCreatedtime())), ContentMode.HTML) .withDescription(AppContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setSizeUndefined(); timePostLbl.setStyleName("time-post"); messageHeader.with(timePostLbl).expand(timePostLbl); // Message delete button Button msgDeleteBtn = new Button(); msgDeleteBtn.setIcon(FontAwesome.TRASH_O); msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY); messageHeader.addComponent(msgDeleteBtn); if (hasDeletePermission(comment)) { msgDeleteBtn.setVisible(true); msgDeleteBtn.addClickListener( new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { ConfirmDialogExt.show( UI.getCurrent(), AppContext.getMessage( GenericI18Enum.DIALOG_DELETE_TITLE, AppContext.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { CommentService commentService = ApplicationContextUtil.getSpringBean(CommentService.class); commentService.removeWithSession( comment, AppContext.getUsername(), AppContext.getAccountId()); owner.removeRow(layout); } } }); } }); } else { msgDeleteBtn.setVisible(false); } rowLayout.addComponent(messageHeader); Label messageContent = new SafeHtmlLabel(comment.getComment()); messageContent.setStyleName("message-body"); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout() .withSpacing(false) .withWidth("100%") .withStyleName("message-footer"); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); attachmentDisplay.setWidth("100%"); messageFooter.with(attachmentDisplay).withAlign(attachmentDisplay, Alignment.MIDDLE_RIGHT); rowLayout.addComponent(messageFooter); } layout.with(rowLayout).expand(rowLayout); return layout; }