/** * Allows user to quickly create sequences of elements with predefined padding in between. Its * public versions are createXSequence and createYSequence */ private static JPanel createSequence(JComponent... cmps) { JPanel pane = createPanel(); for (JComponent comp : cmps) { CSS.align(comp); pane.add(SwingFactory.createPadding(comp)); } return pane; }
public static JPanel createHolder(JComponent... components) { JPanel panel = createPanel(); for (JComponent cmp : components) { panel.add(cmp); } CSS.holder(panel); return panel; }
/** * Instantiates a new text area field. * * @param form the form * @param permission the permission * @param label the label * @param action the action * @param tab the tab */ public TextAreaField( HasComponents form, short[] permission, String label, NameIdAction action, int tab) { super(new TextArea(), form, permission, label, action, tab); field.addStyleName(CSS.cbtTextAreaFieldField()); field.setTabIndex(tab); panel.add(field); }
public static JTabbedPane createTabs(PaneTabInfo... tabs) { JTabbedPane pane = new JTabbedPane(); CSS.tabbedPane(pane); for (int i = 0; i < tabs.length; i++) { PaneTabInfo tab = tabs[i]; pane.insertTab(tab.getTitle(), null, tab.getComponent(), tab.getTip(), i); } return pane; }
public static JPanel createGrid(JComponent[]... cmps) { JPanel somePanel = createPanel(); int rows = cmps.length; int cols = rows == 0 ? 0 : cmps[0].length; for (JComponent[] row : cmps) { for (JComponent cell : row) { somePanel.add(SwingFactory.createPadding(cell)); } } CSS.grid(somePanel, rows, cols); return SwingFactory.createPadding(somePanel); }
public static JList<String> createListRes(int visibleRowCount) { JList<String> list = new JList<String>(new String[] {"List not loaded..."}); CSS.listAutoResize(list, visibleRowCount); return list; }
public static JList<String> createList(int cellWidth, int cellHeight, int visibleRowCount) { JList<String> list = new JList<String>(new String[] {"List not loaded..."}); CSS.list(list, cellWidth, cellHeight, visibleRowCount); return list; }
public static JPanel createFrame(JComponent pane, int width, int height) { JPanel panel = createHolder(pane); CSS.frame(panel, width, height); return panel; }
public static JTableX createTableX(int width, int height) { JTableX table = new JTableX(); CSS.table(table, width, height); return table; }
public static JPanel createXGrid(JComponent... cmps) { JPanel pane = createXSequence(cmps); CSS.gridByAxis(pane, CSS.X_AXIS, cmps.length); return pane; }
public static <T> JComboBox<T> createCombo(T[] values) { JComboBox<T> combo = new JComboBox<T>(values); CSS.combo(combo); return combo; }
public static JButton createButton(String name) { JButton btn = new JButton(name); CSS.button(btn); return btn; }
public static JLabel createLabel(String string) { JLabel label = new JLabel(string); CSS.label(label); return label; }
public static JTextField createTextField(String text) { JTextField textField = new JTextField(text); CSS.textField(textField); return textField; }
public static JDatePickerImpl createDatePicker() { JDatePickerImpl someImpl = new JDatePickerImpl(new JDatePanelImpl(new UtilDateModel())); CSS.datePicker(someImpl); return someImpl; }
public static JScrollPane createScrollPaneForTable(JComponent component) { JScrollPane scrollPane = new JScrollPane(component); CSS.scrollPaneForTable(scrollPane); return scrollPane; }
public static JScrollPane createScrollPaneForSize(JComponent component, int width, int height) { JScrollPane scrollPane = new JScrollPane(component); CSS.scrollPaneForSize(scrollPane, new Dimension(width, height)); return scrollPane; }
public static JTextArea createTextArea(String text, int rows, int cols) { JTextArea textArea = new JTextArea(); CSS.textArea(textArea, rows, cols); return textArea; }
public static JComponent createTitle(String string) { JLabel title = new JLabel(string); CSS.title(title); return title; }
public static JTextField createPasswordField(String text) { JPasswordField passwdField = new JPasswordField(text); CSS.textField(passwdField); return passwdField; }
public static JPanel createPanel() { JPanel panel = new JPanel(); CSS.panel(panel); return panel; }
public static JPanel createYSequence(JComponent... cmps) { JPanel pane = createSequence(cmps); CSS.boxByAxis(pane, CSS.Y_AXIS, cmps.length); return pane; }
public static JScrollPane createScrollPaneForPage(JPanel cmp) { JScrollPane pane = new JScrollPane(cmp); CSS.scrollPaneForPage(pane); return pane; }
public static JScrollPane createScrollPaneMulti(JComponent cmp) { JScrollPane pane = new JScrollPane(cmp); CSS.scrollPaneMulti(pane); return pane; }
/** * Instantiates a new location field. * * @param form is the form or other HasComponents element that contains the field. * @param permission that controls the visibility of the field. * @param fieldLabel is the optional text to identify the field. * @param buttonLabel the text on the field refresh button. * @param tab index of the field. */ public LocationField( HasComponents form, short[] permission, String fieldLabel, String buttonLabel, int tab) { initialize(panel, form, permission, CSS.cbtLocationField()); if (fieldLabel != null) { this.label = new Label(fieldLabel); this.label.addStyleName(CSS.cbtLocationFieldLabel()); this.label.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { showHelp(); } }); panel.add(this.label); } field.addStyleName(CSS.cbtLocationFieldField()); field.setText(Model.BLANK); field.setTabIndex(tab); panel.add(field); if (buttonLabel != null) { this.button = new Button( buttonLabel, new ClickHandler() { public void onClick(ClickEvent event) { setName(field.getText()); } }); button.addStyleName(CSS.cbtLocationFieldButton()); panel.add(button); } else { field.addBlurHandler( new BlurHandler() { @Override public void onBlur(BlurEvent event) { if (nullable && field.getText().isEmpty()) { setValueAndFireChange(defaultValue); } else { setName(field.getText()); } } }); } field.addKeyDownHandler( new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { if (nullable && field.getText().isEmpty()) { setValueAndFireChange(defaultValue); } else { setName(field.getText()); } } } }); panel.add(lock); }