/** * Returns a GridDataFactory initialized with heuristicly generated defaults for the given control. * To be precise, this method picks the default values that GridLayoutFactory.generateLayout * would have assigned to the control. Does not attach GridData to the control. Callers must * additionally call applyTo(theControl) if they wish to use the generated values. * * <p> * This method is intended for situations where generateLayout is generating layout data * for a particular control that is not quite right for the desired layout. * This allows callers to start with the generated values and tweak one or two settings * before applying the GridData to the control. * </p> * * @see GridLayoutFactory#generateLayout(org.eclipse.swt.widgets.Composite) * @param theControl * @return a GridLayoutFactory initialized with defaults that GridLayoutFactory would have */ public static GridDataFactory defaultsFor(Control theControl) { return LayoutGenerator.defaultsFor(theControl); }
Button button = (Button) control; if (hasStyle(button, SWT.CHECK)) { return nonWrappingLabelData.copy(); boolean wrapping = hasStyle(control, SWT.WRAP); boolean hScroll = hasStyle(control, SWT.H_SCROLL); boolean vScroll = hasStyle(control, SWT.V_SCROLL); boolean containsText = hasMethod(control, "setText", new Class<?>[] { String.class}); //$NON-NLS-1$ boolean userEditable = !hasStyle(control, SWT.READ_ONLY) && containsText && hasMethod(control, "addModifyListener", new Class<?>[] { ModifyListener.class }); //$NON-NLS-1$ if (hasStyle(control, SWT.MULTI)) { vScroll = true;
/** * Generates a GridLayout for the given composite by examining its child * controls and attaching layout data to any immediate children that do not * already have layout data. * * @param toGenerate * composite to generate a layout for */ public static void generateLayout(Composite toGenerate) { Control[] children = toGenerate.getChildren(); for (int i = 0; i < children.length; i++) { Control control = children[i]; // Skip any children that already have layout data if (control.getLayoutData() != null) { continue; } applyLayoutDataTo(control); } }
LayoutGenerator.generateLayout(c);
Button button = (Button) control; if (hasStyle(button, SWT.CHECK)) { return nonWrappingLabelData.copy(); boolean wrapping = hasStyle(control, SWT.WRAP); boolean hScroll = hasStyle(control, SWT.H_SCROLL); boolean vScroll = hasStyle(control, SWT.V_SCROLL); boolean containsText = hasMethod(control, "setText", new Class[] { String.class }); //$NON-NLS-1$ boolean userEditable = !hasStyle(control, SWT.READ_ONLY) && containsText && hasMethod(control, "addModifyListener", new Class[] { ModifyListener.class }); //$NON-NLS-1$ if (hasStyle(control, SWT.MULTI)) { vScroll = true;
/** * Generates a GridLayout for the given composite by examining its child * controls and attaching layout data to any immediate children that do not * already have layout data. * * @param toGenerate * composite to generate a layout for */ public static void generateLayout(Composite toGenerate) { Control[] children = toGenerate.getChildren(); for (Control control : children) { // Skip any children that already have layout data if (control.getLayoutData() != null) { continue; } applyLayoutDataTo(control); } }
LayoutGenerator.generateLayout(c);
Button button = (Button) control; if (hasStyle(button, SWT.CHECK)) { return nonWrappingLabelData.copy(); boolean wrapping = hasStyle(control, SWT.WRAP); boolean hScroll = hasStyle(control, SWT.H_SCROLL); boolean vScroll = hasStyle(control, SWT.V_SCROLL); boolean containsText = hasMethod(control, "setText", new Class<?>[] { String.class}); //$NON-NLS-1$ boolean userEditable = !hasStyle(control, SWT.READ_ONLY) && containsText && hasMethod(control, "addModifyListener", new Class<?>[] { ModifyListener.class }); //$NON-NLS-1$ if (hasStyle(control, SWT.MULTI)) { vScroll = true;
/** * Returns a GridDataFactory initialized with heuristicly generated defaults for the given control. * To be precise, this method picks the default values that GridLayoutFactory.generateLayout * would have assigned to the control. Does not attach GridData to the control. Callers must * additionally call applyTo(theControl) if they wish to use the generated values. * * <p> * This method is intended for situations where generateLayout is generating layout data * for a particular control that is not quite right for the desired layout. * This allows callers to start with the generated values and tweak one or two settings * before applying the GridData to the control. * </p> * * @see GridLayoutFactory#generateLayout(org.eclipse.swt.widgets.Composite) * @param theControl * @return a GridLayoutFactory initialized with defaults that GridLayoutFactory would have * @since 3.3 */ public static GridDataFactory defaultsFor(Control theControl) { return LayoutGenerator.defaultsFor(theControl); }
/** * Generates a GridLayout for the given composite by examining its child * controls and attaching layout data to any immediate children that do not * already have layout data. * * @param toGenerate * composite to generate a layout for */ public static void generateLayout(Composite toGenerate) { Control[] children = toGenerate.getChildren(); for (int i = 0; i < children.length; i++) { Control control = children[i]; // Skip any children that already have layout data if (control.getLayoutData() != null) { continue; } applyLayoutDataTo(control); } }
LayoutGenerator.generateLayout(c);
/** * Returns a GridDataFactory initialized with heuristicly generated defaults for the given control. * To be precise, this method picks the default values that GridLayoutFactory.generateLayout * would have assigned to the control. Does not attach GridData to the control. Callers must * additionally call applyTo(theControl) if they wish to use the generated values. * * <p> * This method is intended for situations where generateLayout is generating layout data * for a particular control that is not quite right for the desired layout. * This allows callers to start with the generated values and tweak one or two settings * before applying the GridData to the control. * </p> * * @see GridLayoutFactory#generateLayout(org.eclipse.swt.widgets.Composite) * @param theControl * @return a GridDataFactory initialized with defaults that GridLayoutFactory would have assigned * @since 3.3 */ public static GridDataFactory defaultsFor(Control theControl) { return LayoutGenerator.defaultsFor(theControl); }
private static void applyLayoutDataTo(Control control) { defaultsFor(control).applyTo(control); }
private static void applyLayoutDataTo(Control control) { defaultsFor(control).applyTo(control); }
private static void applyLayoutDataTo(Control control) { defaultsFor(control).applyTo(control); }