/** Same functionality as {@link #growX()} and {@link #growY()}. * <p> * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com. * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>. * @see #growX() * @see #growY() */ public final CC grow() { growX(); growY(); return this; }
/** grow weight for the component horizontally and optionally vertically. * <p> * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com. * @param widthHeight The new shrink weight and height. 1-2 arguments, never null. * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>. * @since 3.7.2 */ public final CC grow(float ... widthHeight) { switch (widthHeight.length) { default: throw new IllegalArgumentException("Illegal argument count: " + widthHeight.length); case 2: growY(widthHeight[1]); case 1: growX(widthHeight[0]); } return this; }
protected String layoutBeforeChild( Control control, String labelText, String elementName, Map<String, String> attributes, Control container, SwtMetawidget metawidget ) { State state = getState( (Composite) container ); // Add label if ( SimpleLayoutUtils.needsLabel( labelText, elementName ) ) { Label label = new Label( (Composite) container, SWT.None ); // Required if ( attributes != null && TRUE.equals( attributes.get( REQUIRED ) ) && !WidgetBuilderUtils.isReadOnly( attributes ) && !metawidget.isReadOnly() ) { label.setText( labelText + "*" + StringUtils.SEPARATOR_COLON ); } else { label.setText( labelText + StringUtils.SEPARATOR_COLON ); } CC labelConstraints = new CC(); labelConstraints.cell( state.currentColumn * 2, state.currentRow ); labelConstraints.growX(); // Top align all labels, not just those belonging to 'tall' controls, // so that tall controls, regular controls and nested Metawidget // controls all line up labelConstraints.alignY( "top" ); // Apply some vertical padding so the label lines up with the control nicely labelConstraints.pad( state.defaultLabelVerticalPadding, 0, state.defaultLabelVerticalPadding, 0 ); // Add it label.setLayoutData( labelConstraints ); label.moveAbove( control ); } return labelText; }
contentPane.add(hyperlink, new CC().dockNorth().gapLeft("10px").gapBottom("10px").gapTop("10px")); contentPane.add(southPanel, new CC().dockSouth().pad(10, 10, 10, 10).alignX("center")); contentPane.add(c, new CC().growX().gap("10px", "10px", "10px", "10px")); dialog.setSize(800, 400); dialog.setVisible(true);
labelConstraints.growX();
public void onEndBuild( SwingMetawidget metawidget ) { // Buttons Facet buttonsFacet = metawidget.getFacet( "buttons" ); if ( buttonsFacet != null ) { State state = getState( metawidget ); if ( state.currentColumn > 0 ) { state.currentColumn = 0; state.currentRow++; } metawidget.add( buttonsFacet, new CC().cell( 0, state.currentRow ).spanX().growX() ); } }
public void onEndBuild( SwtMetawidget metawidget ) { // Buttons Facet buttonsFacet = metawidget.getFacet( "buttons" ); if ( buttonsFacet != null ) { State state = getState( metawidget ); if ( state.currentColumn > 0 ) { state.currentColumn = 0; state.currentRow++; } buttonsFacet.setLayoutData( new CC().cell( 0, state.currentRow ).spanX().growX() ); buttonsFacet.moveBelow( null ); } }
colorsPanel.add(listOfColorsInSchme, new CC().alignY("top")); colorsPanel.add(colorChooser, new CC().alignY("top")); colorsPanel.add(logDetailsTextPane, new CC().spanX().growX()); updateLogDetails(); panel.add(colorsPanel, new CC().spanX().wrap());
buttons.add(btn); bGroup.add(btn); p.add(btn, new CC().growX().gapBottom("8"));
componentConstraints.pushX( 1f ).growX();
controlConstraints.pushX( 1f ).growX();