List of usage examples for com.jgoodies.forms.layout CellConstraints BOTTOM
Alignment BOTTOM
To view the source code for com.jgoodies.forms.layout CellConstraints BOTTOM.
Click Source Link
From source file:presentation.timer.GuiBoxTimerPanel.java
License:Open Source License
private void initialize() { FormLayout layout = new FormLayout("f:320:grow, 10, 100:grow, 160:grow, 7, pref", // columns "pref, t:220:grow, pref, 10, pref, 90:grow, 90:grow, 20"); // rows PanelBuilder builder = new PanelBuilder(this, layout); builder.setDefaultDialogBorder();//w ww . j a v a2 s . c o m CellConstraints cc = new CellConstraints(); builder.addSeparator(ControlMain.getProperty("label_recordTimer"), cc.xyw(1, 1, 4)); builder.add(this.getJScrollPaneRecordTimerTable(), cc.xyw(1, 2, 4)); builder.add(this.getJPanelDauerTimer(), cc.xyw(1, 3, 4, CellConstraints.CENTER, CellConstraints.TOP)); builder.addSeparator(ControlMain.getProperty("label_systemTimer"), cc.xyw(1, 5, 4)); builder.add(this.getJScrollPaneSystemTimerTable(), cc.xywh(1, 6, 4, 2)); builder.add(this.getJPanelDauerTimer2(), cc.xyw(1, 8, 4, CellConstraints.CENTER, CellConstraints.TOP)); builder.addTitle(ControlMain.getProperty("label_actRecTimer"), cc.xy(6, 1)); builder.add(this.getJPanelButtonsRecordTimer(), cc.xywh(6, 2, 1, 1, CellConstraints.FILL, CellConstraints.TOP)); builder.addTitle(ControlMain.getProperty("label_actSysTimer"), cc.xy(6, 5, CellConstraints.CENTER, CellConstraints.DEFAULT)); builder.add(this.getJPanelButtonsSystemTimer(), cc.xywh(6, 6, 1, 1, CellConstraints.CENTER, CellConstraints.TOP)); builder.add(this.getJPanelButtonsGui(), cc.xywh(6, 7, 1, 2, CellConstraints.CENTER, CellConstraints.BOTTOM)); }
From source file:se.streamsource.streamflow.client.ui.account.AccountView.java
License:Apache License
public AccountView(@Service ApplicationContext context, @Structure Module module) { this.context = context; ActionMap am = context.getActionMap(this); setActionMap(am);//from ww w . j a v a 2 s . c o m JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(new EmptyBorder(new Insets(10, 10, 10, 10))); accountForm = new JPanel(); panel.add(accountForm, BorderLayout.NORTH); FormLayout accountLayout = new FormLayout("75dlu, 5dlu, 120dlu:grow", "pref, pref, pref, pref, pref"); DefaultFormBuilder accountBuilder = new DefaultFormBuilder(accountLayout, accountForm); // accountBuilder.setDefaultDialogBorder(); accountBinder = module.objectBuilderFactory().newObject(StateBinder.class); accountBinder.setResourceMap(context.getResourceMap(getClass())); connectedBinder = module.objectBuilderFactory().newObject(StateBinder.class); AccountSettingsValue accountTemplate = accountBinder.bindingTemplate(AccountSettingsValue.class); accountBuilder.appendSeparator(i18n.text(AccountResources.account_separator)); accountBuilder.nextLine(); accountBuilder.add(new JLabel(i18n.text(AccountResources.account_name_label))); accountBuilder.nextColumn(2); accountBuilder.add(accountBinder.bind(TEXTFIELD.newField(), accountTemplate.name())); accountBuilder.nextLine(); accountBuilder.add(new JLabel(i18n.text(AccountResources.server_label))); accountBuilder.nextColumn(2); accountBuilder.add(accountBinder.bind(TEXTFIELD.newField(), accountTemplate.server())); accountBuilder.nextLine(); accountBuilder.add(new JLabel(i18n.text(AccountResources.username_label))); accountBuilder.nextColumn(2); accountBuilder.add(accountBinder.bind(TEXTFIELD.newField(), accountTemplate.userName())); accountBuilder.nextLine(); accountBuilder.add(new JLabel(i18n.text(AccountResources.password_label))); accountBuilder.nextColumn(2); accountBuilder.add(accountBinder.bind(PASSWORD.newField(), accountTemplate.password())); accountBuilder.nextLine(); accountEditor = new FormEditor(accountForm); contactForm = new JPanel(); panel.add(contactForm, BorderLayout.CENTER); FormLayout contactLayout = new FormLayout("75dlu, 5dlu,80dlu, 80dlu", "pref, pref, pref, pref, pref, pref, pref, pref, pref, pref, pref, pref"); DefaultFormBuilder contactBuilder = new DefaultFormBuilder(contactLayout, contactForm); JToggleButton editBtn = new JToggleButton(am.get("edit")); editBtn.setHorizontalAlignment(SwingConstants.LEFT); contactBuilder.add(editBtn, new CellConstraints(4, 5, 1, 1, CellConstraints.FILL, CellConstraints.BOTTOM, new Insets(0, 0, 0, 0))); StreamflowButton testBtn = new StreamflowButton(am.get("test")); testBtn.setHorizontalAlignment(SwingConstants.LEFT); contactBuilder.add(testBtn, new CellConstraints(4, 6, 1, 1, CellConstraints.FILL, CellConstraints.BOTTOM, new Insets(0, 0, 0, 0))); StreamflowButton changepasswordBtn = new StreamflowButton(am.get("changepassword")); changepasswordBtn.setHorizontalAlignment(SwingConstants.LEFT); contactBuilder.add(changepasswordBtn, new CellConstraints(4, 7, 1, 1, CellConstraints.FILL, CellConstraints.BOTTOM, new Insets(0, 0, 0, 0))); setViewportView(panel); }
From source file:se.streamsource.streamflow.client.ui.administration.surface.AccessPointView.java
License:Apache License
public AccessPointView(@Service ApplicationContext appContext, @Uses final AccessPointModel model, @Structure Module module) {//from w w w . j ava2 s . c o m this.model = model; this.labels = module.objectBuilderFactory().newObjectBuilder(CaseLabelsView.class) .use(model.getLabelsModel()).newInstance(); setLayout(new BorderLayout()); setActionMap(appContext.getActionMap(this)); RefreshComponents refreshComponents = new RefreshComponents(); model.addObserver(refreshComponents); actionBinder = module.objectBuilderFactory().newObjectBuilder(ActionBinder.class).use(getActionMap()) .newInstance(); valueBinder = module.objectBuilderFactory().newObject(ValueBinder.class); actionBinder.setResourceMap(appContext.getResourceMap(getClass())); LinkValueConverter linkValueConverter = new LinkValueConverter(); FormLayout layout = new FormLayout("90dlu, 5dlu, 150:grow", "pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, " + "pref, 12dlu, pref, 2dlu, pref, 12dlu, pref, 2dlu, default:grow"); JPanel panel = new JPanel(layout); DefaultFormBuilder builder = new DefaultFormBuilder(layout, panel); builder.setBorder(Borders.createEmptyBorder(Sizes.DLUY8, Sizes.DLUX4, Sizes.DLUY2, Sizes.DLUX8)); CellConstraints cc = new CellConstraints(); MacOsUIWrapper.convertAccelerators(appContext.getActionMap(AccessPointView.class, this)); selectedProject.setFont(selectedProject.getFont().deriveFont(Font.BOLD)); selectedCaseType.setFont(selectedCaseType.getFont().deriveFont(Font.BOLD)); selectedForm.setFont(selectedForm.getFont().deriveFont(Font.BOLD)); selectedTemplate.getLabel().setFont(selectedTemplate.getLabel().getFont().deriveFont(Font.BOLD)); ActionMap am = getActionMap(); // Select project javax.swing.Action projectAction = am.get("project"); projectButton = new StreamflowButton(projectAction); projectButton.registerKeyboardAction(projectAction, (KeyStroke) projectAction.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); projectButton.setHorizontalAlignment(SwingConstants.LEFT); builder.add(projectButton, cc.xy(1, 1)); builder.add(valueBinder.bind("project", selectedProject, linkValueConverter), new CellConstraints(3, 1, 1, 1, CellConstraints.LEFT, CellConstraints.CENTER, new Insets(5, 0, 0, 0))); // Select case type javax.swing.Action caseTypeAction = am.get("casetype"); caseTypeButton = new StreamflowButton(caseTypeAction); caseTypeButton.registerKeyboardAction(caseTypeAction, (KeyStroke) caseTypeAction.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); caseTypeButton.setHorizontalAlignment(SwingConstants.LEFT); builder.add(caseTypeButton, cc.xy(1, 3)); builder.add(valueBinder.bind("caseType", selectedCaseType, linkValueConverter), new CellConstraints(3, 3, 1, 1, CellConstraints.LEFT, CellConstraints.CENTER, new Insets(5, 0, 0, 0))); // Select labels javax.swing.Action labelAction = labels.getActionMap().get("addLabel"); labelButton = new StreamflowButton(labelAction); labelButton.registerKeyboardAction(labelAction, (KeyStroke) labelAction.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); labelButton.setHorizontalAlignment(SwingConstants.LEFT); builder.add(labelButton, cc.xy(1, 5, CellConstraints.FILL, CellConstraints.TOP)); labels.setPreferredSize(new Dimension(500, 60)); labels.setTextBold(true); labels.setButtonRelation(labelButton); builder.add(labels, new CellConstraints(3, 5, 1, 1, CellConstraints.LEFT, CellConstraints.TOP, new Insets(5, 0, 0, 0))); // Select form javax.swing.Action formAction = am.get("form"); formButton = new StreamflowButton(formAction); formButton.registerKeyboardAction(formAction, (KeyStroke) formAction.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); formButton.setHorizontalAlignment(SwingConstants.LEFT); builder.add(formButton, cc.xy(1, 7, CellConstraints.FILL, CellConstraints.TOP)); // Open replace selection field value editor javax.swing.Action replaceSelectionFieldValueAction = am.get("openReplaceSelectionFieldValueEditor"); replaceSelectionFieldValueEditButton = new StreamflowButton(replaceSelectionFieldValueAction); /*replaceSelectionFieldValueEditButton.registerKeyboardAction( replaceSelectionFieldValueAction, (KeyStroke) replaceSelectionFieldValueAction .getValue( javax.swing.Action.ACCELERATOR_KEY ), JComponent.WHEN_IN_FOCUSED_WINDOW ); */ replaceSelectionFieldValueEditButton.setHorizontalAlignment(SwingConstants.RIGHT); PanelBuilder panelBuilder = new PanelBuilder(new FormLayout("150dlu,5dlu,250:grow", "pref")); panelBuilder.add(valueBinder.bind("form", selectedForm, linkValueConverter)); panelBuilder.nextColumn(2); panelBuilder.add(replaceSelectionFieldValueEditButton, new CellConstraints(3, 1, 1, 1, CellConstraints.RIGHT, CellConstraints.CENTER, new Insets(0, 0, 0, 0))); //panelBuilder.setBorder(BorderFactory.createLineBorder(Color.RED)); builder.add(panelBuilder.getPanel()/*valueBinder.bind( "form", selectedForm, linkValueConverter )*/, new CellConstraints(3, 7, 1, 1, CellConstraints.LEFT, CellConstraints.CENTER, new Insets(5, 0, 0, 0))); // Select template javax.swing.Action templateAction = am.get("template"); templateButton = new StreamflowButton(templateAction); templateButton.registerKeyboardAction(templateAction, (KeyStroke) templateAction.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); templateButton.setHorizontalAlignment(SwingConstants.LEFT); builder.add(templateButton, cc.xy(1, 9, CellConstraints.FILL, CellConstraints.TOP)); builder.add(valueBinder.bind("template", actionBinder.bind("removeTemplate", selectedTemplate)), new CellConstraints(3, 9, 1, 1, CellConstraints.LEFT, CellConstraints.CENTER, new Insets(3, 0, 0, 0))); builder.add(new JLabel(text(AdministrationResources.cookieExpirationHours)), cc.xy(1, 13, CellConstraints.LEFT, CellConstraints.BOTTOM)); builder.add( valueBinder.bind("cookieExpirationHours", actionBinder.bind("changeCookieExpirationHours", cookieExpiration = new JTextField())), new CellConstraints(3, 13, 1, 1, CellConstraints.FILL, CellConstraints.BOTTOM, new Insets(3, 0, 0, 0))); mailSelectionLabel.setText(text(AdministrationResources.changeMailSelectionMessage)); mailSelectionLabel.setToolTipText(text(AdministrationResources.changeMailSelectionMessageHint)); builder.add(mailSelectionLabel, cc.xy(1, 15, CellConstraints.LEFT, CellConstraints.BOTTOM)); builder.add( valueBinder.bind("mailSelectionMessage", actionBinder.bind("changeMailSelectionMessage", mailSelectionField)), new CellConstraints(3, 15, 1, 1, CellConstraints.FILL, CellConstraints.BOTTOM, new Insets(3, 0, 0, 0))); PanelBuilder signPanel = new PanelBuilder(new FormLayout("180dlu, 15dlu, 180dlu", "default:grow")); CellConstraints signPanelCc = new CellConstraints(); PanelBuilder primarySignPanel = new PanelBuilder(new FormLayout("180dlu", "pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, default:grow")); CellConstraints primaryCc = new CellConstraints(); primarySignPanel.addSeparator(text(AdministrationResources.signature_1), primaryCc.xy(1, 1)); primarySignPanel.add(valueBinder.bind("primarysign", actionBinder.bind("setSignActive1", signActive1 = new JCheckBox(text(AdministrationResources.active))), new ValueBinder.Converter<RequiredSignatureValue, Boolean>() { public Boolean toComponent(RequiredSignatureValue value) { return value != null ? value.active().get() : Boolean.FALSE; } }), primaryCc.xy(1, 3)); primarySignPanel.addLabel(text(AdministrationResources.name_label), primaryCc.xy(1, 5)); primarySignPanel.add( valueBinder.bind("primarysign", actionBinder.bind("setSignName1", signName1 = new JTextField()), new ValueBinder.Converter<RequiredSignatureValue, String>() { public String toComponent(RequiredSignatureValue value) { return value != null ? value.name().get() : ""; } }), primaryCc.xy(1, 7)); refreshComponents.enabledOn("updateprimarysign", signName1); primarySignPanel.add(new JLabel(text(AdministrationResources.description_label)), primaryCc.xy(1, 9)); primarySignPanel.add(valueBinder.bind("primarysign", actionBinder.bind("setSignDescription1", signDescription1 = new JTextField()), new ValueBinder.Converter<RequiredSignatureValue, String>() { public String toComponent(RequiredSignatureValue value) { return value != null ? value.description().get() : ""; } }), primaryCc.xy(1, 11)); refreshComponents.enabledOn("updateprimarysign", signDescription1); signPanel.add(primarySignPanel.getPanel(), signPanelCc.xy(1, 1, CellConstraints.LEFT, CellConstraints.TOP)); PanelBuilder secondarySignPanel = new PanelBuilder(new FormLayout("180dlu", "pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 12dlu, pref, 2dlu, pref, 2dlu, default:grow")); CellConstraints secondaryCc = new CellConstraints(); secondarySignPanel.addSeparator(text(AdministrationResources.signature_2), secondaryCc.xy(1, 1)); PanelBuilder secondaryOptionsPanel = new PanelBuilder(new FormLayout("70dlu,5dlu,70dlu,pref:grow", "pref")); secondaryOptionsPanel.add(valueBinder.bind("secondarysign", actionBinder.bind("setSignActive2", signActive2 = new JCheckBox(text(AdministrationResources.active))), new ValueBinder.Converter<RequiredSignatureValue, Boolean>() { public Boolean toComponent(RequiredSignatureValue value) { return value != null ? value.active().get() : Boolean.FALSE; } }), secondaryCc.xy(1, 1)); refreshComponents.enabledOn("updatesecondarysignactive", signActive2); secondaryOptionsPanel.add(valueBinder.bind("secondarysign", actionBinder.bind("setSecondMandatory", mandatory2 = new JCheckBox(text(AdministrationResources.mandatory))), new ValueBinder.Converter<RequiredSignatureValue, Boolean>() { public Boolean toComponent(RequiredSignatureValue value) { return value != null ? value.mandatory().get() : Boolean.FALSE; } }), secondaryCc.xy(3, 1)); refreshComponents.enabledOn("updatesecondarysign", mandatory2); secondarySignPanel.add(secondaryOptionsPanel.getPanel(), secondaryCc.xy(1, 3)); secondarySignPanel.add(new JLabel(text(AdministrationResources.name_label)), secondaryCc.xy(1, 5)); secondarySignPanel.add( valueBinder.bind("secondarysign", actionBinder.bind("setSignName2", signName2 = new JTextField()), new ValueBinder.Converter<RequiredSignatureValue, String>() { public String toComponent(RequiredSignatureValue value) { return value != null ? value.name().get() : ""; } }), secondaryCc.xy(1, 7)); refreshComponents.enabledOn("updatesecondarysign", signName2); secondarySignPanel.add(new JLabel(text(AdministrationResources.description_label)), secondaryCc.xy(1, 9)); secondarySignPanel.add(valueBinder.bind("secondarysign", actionBinder.bind("setSignDescription2", signDescription2 = new JTextField()), new ValueBinder.Converter<RequiredSignatureValue, String>() { public String toComponent(RequiredSignatureValue value) { return value != null ? value.description().get() : ""; } }), secondaryCc.xy(1, 11)); refreshComponents.enabledOn("updatesecondarysign", signDescription2); // Select form javax.swing.Action form2Action = am.get("setSecondForm"); form2Button = new StreamflowButton(form2Action); form2Button.registerKeyboardAction(form2Action, (KeyStroke) form2Action.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); form2Button.setHorizontalAlignment(SwingConstants.LEFT); refreshComponents.enabledOn("updatesecondarysign", form2Button); PanelBuilder form2ButtonPanel = new PanelBuilder(new FormLayout("70dlu, 5dlu, 150dlu:grow", "pref")); CellConstraints form2ButtonPanelCc = new CellConstraints(); form2ButtonPanel.add(form2Button, form2ButtonPanelCc.xy(1, 1, CellConstraints.FILL, CellConstraints.TOP)); form2ButtonPanel.add(valueBinder.bind("secondarysign", selectedForm2 = new JLabel(), new ValueBinder.Converter<RequiredSignatureValue, String>() { public String toComponent(RequiredSignatureValue value) { return value != null ? value.formdescription().get() : ""; } }), form2ButtonPanelCc.xy(3, 1, CellConstraints.LEFT, CellConstraints.CENTER)); secondarySignPanel.add(form2ButtonPanel.getPanel(), secondaryCc.xy(1, 13)); secondarySignPanel.add(new JLabel(text(AdministrationResources.question_label)), secondaryCc.xy(1, 17)); secondarySignPanel.add(valueBinder.bind("secondarysign", actionBinder.bind("setQuestion", formQuestion2 = new JTextField()), new ValueBinder.Converter<RequiredSignatureValue, String>() { public String toComponent(RequiredSignatureValue value) { return value != null ? value.question().get() : ""; } }), secondaryCc.xy(1, 19)); refreshComponents.enabledOn("updatesecondarysign", formQuestion2); signPanel.add(secondarySignPanel.getPanel(), signPanelCc.xy(3, 1, CellConstraints.LEFT, CellConstraints.TOP)); builder.add(signPanel.getPanel(), new CellConstraints(1, 17, 3, 1, CellConstraints.FILL, CellConstraints.FILL, new Insets(0, 0, 0, 0))); JPanel templatePanel = new JPanel(); templatePanel.setVisible(false); FormLayout templateFormLayout = new FormLayout("75dlu, 5dlu, fill:p:grow", "pref, pref, fill:p:grow, pref"); DefaultFormBuilder templateFormBuilder = new DefaultFormBuilder(templateFormLayout, templatePanel); templateFormBuilder.addSeparator(text(AdministrationResources.emailTemplates)); templateFormBuilder.nextLine(); templateFormBuilder.append(text(AdministrationResources.subject), valueBinder.bind("subject", actionBinder.bind("changeSubject", subject = new JTextField()))); templateFormBuilder.nextLine(); templateFormBuilder.append(new JScrollPane(emailTemplateList)); templateFormBuilder.append(new JScrollPane(actionBinder.bind("save", emailTemplateText))); templateFormBuilder.nextLine(); emailTemplateList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { if (emailTemplateList.getSelectedIndex() != -1) { emailTemplateText.setText(model.getAccessPointValue().messages().get() .get(emailTemplateList.getSelectedValue())); } } } }); refreshComponents.visibleOn("updatesecondarysign", templatePanel); builder.add(templatePanel, new CellConstraints(1, 19, 3, 1, CellConstraints.FILL, CellConstraints.FILL, new Insets(0, 0, 0, 0))); add(new JScrollPane(panel), BorderLayout.CENTER); new RefreshWhenShowing(this, this); }
From source file:se.streamsource.streamflow.client.ui.workspace.cases.general.CaseGeneralView.java
License:Apache License
public CaseGeneralView(@Service ApplicationContext appContext, @Uses CaseGeneralModel generalModel, @Uses CaseLogView caseLogView, @Structure Module module) { this.appContext = appContext; this.model = generalModel; RefreshComponents refreshComponents = new RefreshComponents(); model.addObserver(refreshComponents); ObjectBuilderFactory obf = module.objectBuilderFactory(); this.labels = obf.newObjectBuilder(CaseLabelsView.class).use(generalModel.newLabelsModel()).newInstance(); this.caseNotes = obf.newObjectBuilder(CaseNoteView.class).use(generalModel.newCaseNoteModel()) .newInstance();/*ww w . ja v a2 s . com*/ RefreshComponents refreshLabelComponents = new RefreshComponents(); labels.getModel().addObserver(refreshLabelComponents); this.forms = obf.newObjectBuilder(PossibleFormsView.class).use(generalModel.newPossibleFormsModel()) .newInstance(); refreshComponents.visibleOn("changedescription", forms); this.setBorder(BorderFactory.createEmptyBorder()); getVerticalScrollBar().setUnitIncrement(30); setActionMap(appContext.getActionMap(this)); ActionMap am = getActionMap(); MacOsUIWrapper.convertAccelerators(appContext.getActionMap(CaseGeneralView.class, this)); actionBinder = obf.newObjectBuilder(ActionBinder.class).use(am).newInstance(); valueBinder = obf.newObject(ValueBinder.class); actionBinder.setResourceMap(appContext.getResourceMap(getClass())); // Layout and form for the right panel FormLayout leftLayout = new FormLayout("70dlu, 2dlu, 200:grow, 70dlu", "pref, pref, pref, pref, 20dlu, pref, pref, pref, pref"); leftPane = new JPanel(leftLayout); leftPane.setFocusable(false); DefaultFormBuilder leftBuilder = new DefaultFormBuilder(leftLayout, leftPane); leftBuilder.setBorder(Borders.createEmptyBorder(Sizes.DLUY2, Sizes.DLUX2, Sizes.DLUY2, Sizes.DLUX11)); selectedCaseType.getLabel().setFont(selectedCaseType.getLabel().getFont().deriveFont(Font.BOLD)); selectedCaseType.getButton().addActionListener(am.get("removeCaseType")); valueBinder.bind("caseType", selectedCaseType); // Description & DueDate leftBuilder.setExtent(3, 1); JLabel descriptionLabel = leftBuilder.getComponentFactory() .createLabel(i18n.text(WorkspaceResources.description_label)); leftBuilder.add(descriptionLabel); descriptionLabel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); leftBuilder.nextColumn(3); JLabel dueOnLabel = leftBuilder.append(i18n.text(WorkspaceResources.due_on_label)); dueOnLabel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); leftBuilder.nextLine(); leftBuilder.setExtent(3, 1); JPanel descPanel = new JPanel(new BorderLayout()); descPanel.add(valueBinder.bind("description", actionBinder.bind("changeDescription", descriptionField = (JTextField) TEXTFIELD.newField())), BorderLayout.WEST); leftBuilder.add(descPanel); descriptionField.setName("txtCaseDescription"); leftBuilder.add( valueBinder.bind("dueOn", actionBinder.bind("changeDueOn", dueOnField = (JXDatePicker) DATEPICKER.newField())), new CellConstraints(4, 2, 1, 1, CellConstraints.LEFT, CellConstraints.BOTTOM, new Insets(4, 0, 0, 0))); leftBuilder.nextLine(); descriptionLabel.setLabelFor(descriptionField); dueOnLabel.setLabelFor(dueOnField); refreshComponents.enabledOn("changedescription", descriptionField); refreshComponents.enabledOn("changedueon", dueOnField); // Select case type javax.swing.Action caseTypeAction = am.get("changeCaseType"); caseTypeButton = new StreamflowButton(caseTypeAction); caseTypeButton.registerKeyboardAction(caseTypeAction, (KeyStroke) caseTypeAction.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); caseTypeButton.setHorizontalAlignment(SwingConstants.LEFT); refreshComponents.enabledOn("casetype", caseTypeButton, selectedCaseType); leftBuilder.add(caseTypeButton, new CellConstraints(1, 3, 1, 1, CellConstraints.FILL, CellConstraints.TOP, new Insets(2, 0, 5, 0))); leftBuilder.add(selectedCaseType, new CellConstraints(3, 3, 1, 1, CellConstraints.LEFT, CellConstraints.BOTTOM, new Insets(5, 5, 0, 0))); JLabel priorityLabel = leftBuilder.getComponentFactory() .createLabel(i18n.text(WorkspaceResources.priority_label)); priorityLabel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); leftBuilder.add(priorityLabel, new CellConstraints(4, 3, 1, 1, CellConstraints.FILL, CellConstraints.BOTTOM, new Insets(4, 0, 0, 0))); leftBuilder.nextLine(); // Select labels javax.swing.Action labelAction = labels.getActionMap().get("addLabel"); labelButton = new StreamflowButton(labelAction); // NotificationGlassPane.registerButton(labelButton); labelButton.registerKeyboardAction(labelAction, (KeyStroke) labelAction.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); labelButton.setHorizontalAlignment(SwingConstants.LEFT); labels.setButtonRelation(labelButton); refreshLabelComponents.enabledOn("addlabel", labelButton, labels); leftBuilder.add(labelButton, new CellConstraints(1, 4, 1, 1, CellConstraints.FILL, CellConstraints.TOP, new Insets(5, 0, 0, 0))); labels.setPreferredSize(new Dimension(500, 50)); leftBuilder.add(labels, new CellConstraints(3, 4, 1, 1, CellConstraints.LEFT, CellConstraints.TOP, new Insets(5, 0, 0, 0))); JPanel prioPanel = new JPanel(new BorderLayout()); prioPanel.add(valueBinder.bind("priority", actionBinder.bind("changePriority", casePriority = (JComboBox) COMBOBOX.newField()))); leftBuilder.add(prioPanel, new CellConstraints(4, 4, 1, 1, CellConstraints.FILL, CellConstraints.TOP, new Insets(2, 0, 0, 0))); priorityLabel.setLabelFor(casePriority); refreshComponents.visibleOn("changepriority", casePriority, priorityLabel); refreshComponents.enabledOn("changepriority", casePriority, priorityLabel); casePriority.setRenderer(new DefaultListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { final PriorityValue itemValue = (PriorityValue) value; String val = itemValue == null ? "" : itemValue.text().get(); JPanel panel = new JPanel(); panel.setOpaque(false); FormLayout layout = new FormLayout("10dlu, 60dlu:grow", "pref"); DefaultFormBuilder formBuilder = new DefaultFormBuilder(layout, panel); panel.setBorder(BorderFactory.createEmptyBorder(2, 0, 1, 0)); JLabel label = new JLabel() { @Override protected void paintComponent(Graphics g) { Color color = getBackground(); if (itemValue != null) { if (!Strings.empty(itemValue.color().get())) color = new Color(parseInt(itemValue.color().get())); else color = Color.BLACK; } final Color FILL_COLOR = ColorUtil.removeAlpha(color); Graphics2D g2 = (Graphics2D) g.create(); try { g2.setRenderingHint(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON); g2.setColor(Color.LIGHT_GRAY); final int DIAM = Math.min(getWidth(), getHeight()); final int inset = 3; g2.fill(new Ellipse2D.Float(inset, inset, DIAM - 2 * inset, DIAM - 2 * inset)); g2.setColor(FILL_COLOR); final int border = 1; g2.fill(new Ellipse2D.Float(inset + border, inset + border, DIAM - 2 * inset - 2 * border, DIAM - 2 * inset - 2 * border)); } finally { g2.dispose(); } } }; label.setPreferredSize(new Dimension(10, 10)); formBuilder.add((Strings.empty(val) || "-".equals(val)) ? new JLabel() : label, new CellConstraints( 1, 1, 1, 1, CellConstraints.FILL, CellConstraints.FILL, new Insets(0, 0, 0, 0))); JLabel text = new JLabel(val); formBuilder.add(text, new CellConstraints(2, 1, 1, 1, CellConstraints.LEFT, CellConstraints.FILL, new Insets(0, 0, 0, 0))); return panel; } }); leftBuilder.nextLine(); leftBuilder.add(caseNotes, new CellConstraints(1, 6, 4, 1, CellConstraints.FILL, CellConstraints.TOP, new Insets(0, 2, 5, 0))); // Forms JLabel formsLabel = new JLabel(i18n.text(WorkspaceResources.forms_label)); refreshComponents.visibleOn("changedescription", formsLabel); leftBuilder.add(formsLabel, new CellConstraints(1, 7, 1, 1, CellConstraints.LEFT, CellConstraints.TOP, new Insets(5, 0, 0, 0))); leftBuilder.nextLine(); JPanel formsPanel = new JPanel(new BorderLayout()); formsPanel.add(forms, BorderLayout.WEST); leftBuilder.add(formsPanel, new CellConstraints(1, 8, 3, 1, CellConstraints.FILL, CellConstraints.FILL, new Insets(5, 0, 0, 0))); // Limit pickable dates to future Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); calendar.add(Calendar.DAY_OF_MONTH, 1); dueOnField.getMonthView().setLowerBound(calendar.getTime()); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); dueOnField.getEditor().setFormatterFactory( new DefaultFormatterFactory(new DatePickerFormatter(new DateFormat[] { dateFormat }) { @Override public Object stringToValue(String text) throws ParseException { Object result; try { result = super.stringToValue(text); } catch (ParseException pe) { dialogs.showMessageDialog(dueOnField, text(WorkspaceResources.wrong_format_msg) + " " + ((SimpleDateFormat) dateFormat).toPattern(), text(WorkspaceResources.wrong_format_title)); throw pe; } return result; } })); // Main panel that contains both left and right pane JPanel formsContainer = new JPanel(); formsContainer.setLayout(new GridLayout(1, 2)); formsContainer.setBorder(Borders.createEmptyBorder("2dlu, 2dlu, 2dlu, 2dlu")); formsContainer.add(leftPane); formsContainer.add(caseLogView); setViewportView(formsContainer); setFocusTraversalPolicy(new LayoutFocusTraversalPolicy()); setFocusCycleRoot(true); setFocusable(true); new RefreshWhenShowing(this, this); }
From source file:se.streamsource.streamflow.client.ui.workspace.cases.general.forms.geo.GeoLocationFieldPanel.java
License:Apache License
private JPanel createControlPanel() { JComboBox<MapType> mapTypeSelector = createMapTypeSelector(); JPanel modeButtonPanel = createModeButtonPanel(); addressInfoLabel = new JLabel(); helpHintLabel = new JLabel(); FormLayout layout = new FormLayout("60dlu", "pref, 4dlu, pref, 4dlu, pref, 4dlu, pref:grow"); JPanel controlPanel = new JPanel(layout); controlPanel.add(mapTypeSelector, new CellConstraints(1, 1)); controlPanel.add(modeButtonPanel, new CellConstraints(1, 3, CellConstraints.FILL, CellConstraints.DEFAULT)); controlPanel.add(addressInfoLabel, new CellConstraints(1, 5)); controlPanel.add(helpHintLabel, new CellConstraints(1, 7, CellConstraints.DEFAULT, CellConstraints.BOTTOM)); return controlPanel; }
From source file:torpedo.LoginForm.java
public LoginForm(MainFrame frame) { userNameLbl = new JLabel("Felhasznlnv:"); userName = new JTextField(20); pwdLbl = new JLabel("Jelsz:"); pwd = new JPasswordField(20); loginBtn = new JButton("Bejelentlezs"); regBtn = new JButton("Regisztrci"); errorMsgLbl = new JLabel(); errorMsgLbl.setForeground(Color.red); this.frame = frame; this.setLayout(new FormLayout("100px, 250px, 200px", "100px, 70px, 70px, 70px, 100px")); CellConstraints c = new CellConstraints(); this.add(errorMsgLbl, c.xy(2, 1, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(userNameLbl, c.xy(2, 2, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(userName, c.xy(2, 2, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(pwdLbl, c.xy(2, 3, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(pwd, c.xy(2, 3, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(loginBtn, c.xy(2, 4, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(regBtn, c.xy(2, 4, CellConstraints.RIGHT, CellConstraints.BOTTOM)); loginBtn.addMouseListener(new LoginEvent(this.frame)); regBtn.addMouseListener(new MouseAdapter() { @Override// w ww .ja v a 2 s. c o m public void mouseClicked(MouseEvent e) { frame.showCard("regForm"); //SettingsForm s=new SettingsForm(); } }); }
From source file:torpedo.RegForm.java
public RegForm(MainFrame frame) { userNameLbl = new JLabel("Felhasznlnv:"); userName = new JTextField(20); nickNameLbl = new JLabel("Becenv:"); nickName = new JTextField(20); countryLbl = new JLabel("Orszg:"); country = new JComboBox(); pwdLbl = new JLabel("Jelsz:"); pwd = new JPasswordField(20); confPwdLbl = new JLabel("Jelsz megerstse:"); confPwd = new JPasswordField(20); errorMsgLbl = new JLabel(); errorMsgLbl.setForeground(Color.red); regBtn = new JButton("Regisztrls"); backBtn = new JButton("<< Vissza"); for (int i = 0; i < 10; i++) { country.addItem(new ComboItem("Visible String " + i, "Value " + i)); }//from w w w . j a v a 2s.c o m this.frame = frame; this.setLayout(new FormLayout("100px, 350px, 200px", "70px, 70px, 70px, 70px, 70px, 70px, 70px")); CellConstraints c = new CellConstraints(); this.add(errorMsgLbl, c.xy(2, 1, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(userNameLbl, c.xy(2, 2, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(userName, c.xy(2, 2, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(nickName, c.xy(2, 3, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(nickNameLbl, c.xy(2, 3, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(country, c.xy(2, 4, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(countryLbl, c.xy(2, 4, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(pwdLbl, c.xy(2, 5, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(pwd, c.xy(2, 5, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(confPwdLbl, c.xy(2, 6, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(confPwd, c.xy(2, 6, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(regBtn, c.xy(2, 7, CellConstraints.RIGHT, CellConstraints.BOTTOM)); this.add(backBtn, c.xy(2, 7, CellConstraints.LEFT, CellConstraints.BOTTOM)); regBtn.addMouseListener(new RegEvent(this.frame)); backBtn.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { frame.showCard("loginForm"); } }); }
From source file:torpedo.SettingsForm.java
public SettingsForm(User user) { this.user = user; ArrayList result = new ArrayList(); result = Db.getProfile();// w w w . jav a 2 s . c o m userNameLbl = new JLabel("Felhasznlnv:"); userName = new JTextField(20); nickNameLbl = new JLabel("Becenv:"); nickName = new JTextField(20); countryLbl = new JLabel("Orszg:"); country = new JComboBox(); pwdLbl = new JLabel("Jelsz:"); pwd = new JPasswordField(20); confPwdLbl = new JLabel("Jelsz megerstse:"); confPwd = new JPasswordField(20); errorMsgLbl = new JLabel(); errorMsgLbl.setForeground(Color.red); regBtn = new JButton("Regisztrls"); backBtn = new JButton("<< Vissza"); for (int i = 0; i < 10; i++) { country.addItem(new ComboItem("Visible String " + i, "Value " + i)); } this.frame = frame; this.setLayout(new FormLayout("100px, 350px, 200px", "70px, 70px, 70px, 70px, 70px, 70px, 70px")); CellConstraints c = new CellConstraints(); this.add(errorMsgLbl, c.xy(2, 1, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(userNameLbl, c.xy(2, 2, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(userName, c.xy(2, 2, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(nickName, c.xy(2, 3, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(nickNameLbl, c.xy(2, 3, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(country, c.xy(2, 4, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(countryLbl, c.xy(2, 4, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(pwdLbl, c.xy(2, 5, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(pwd, c.xy(2, 5, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(confPwdLbl, c.xy(2, 6, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(confPwd, c.xy(2, 6, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(regBtn, c.xy(2, 7, CellConstraints.RIGHT, CellConstraints.BOTTOM)); this.add(backBtn, c.xy(2, 7, CellConstraints.LEFT, CellConstraints.BOTTOM)); int result = JOptionPane.showConfirmDialog(null, this, "Test", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { System.out.println("asd"); } else { System.out.println("Cancelled"); } /*regBtn.addMouseListener(new RegEvent(this.frame)); backBtn.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { frame.showCard("loginForm"); } });*/ }