Java Code Examples for org.jivesoftware.smackx.xdata.Form#getFields()
The following examples show how to use
org.jivesoftware.smackx.xdata.Form#getFields() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorkgroupManager.java From Spark with Apache License 2.0 | 5 votes |
private static boolean validateForm(JDialog parent, Form workgroupForm, Form form) { for ( final FormField field : form.getFields()) { if (field.isRequired() && field.getValues().isEmpty()) { String variable = field.getVariable(); String elementName = workgroupForm.getField(variable).getLabel(); UIManager.put("OptionPane.okButtonText", Res.getString("ok")); JOptionPane.showMessageDialog(parent, variable + " is required to complete the form.", "Incomplete Form", JOptionPane.ERROR_MESSAGE); return false; } } return true; }
Example 2
Source File: RoomInformation.java From Spark with Apache License 2.0 | 5 votes |
public void showFormInformation(Form form, final RequestUtils utils) { setLayout(new GridBagLayout()); setBackground(Color.white); int count = 1; for ( final FormField field : form.getFields() ) { String variable = field.getVariable(); String label = field.getLabel(); if (label != null) { final JLabel nameLabel = new JLabel(label); nameLabel.setFont(new Font("Dialog", Font.BOLD, 11)); String value = utils.getValue(variable); if (value == null) { value = ""; } final WrappedLabel valueLabel = new WrappedLabel(); valueLabel.setBackground(Color.white); valueLabel.setText(value); add(nameLabel, new GridBagConstraints(0, count, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); add(valueLabel, new GridBagConstraints(1, count, 3, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 5), 0, 0)); count++; } } final Color linkColor = new Color(69, 92, 137); LinkLabel viewLabel = new LinkLabel(FpRes.getString("message.view.more.information"), null, linkColor, Color.red); viewLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { RoomInformation roomInformation = new RoomInformation(); roomInformation.showAllInformation(utils.getMap()); roomInformation.showRoomInformation(); } }); add(viewLabel, new GridBagConstraints(0, count, 3, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); }