protected boolean willFillHorizontally( Widget widget, Map<String, String> attributes ) { if ( widget instanceof GwtMetawidget ) { return true; } return SimpleLayoutUtils.isSpanAllColumns( attributes ); }
String labelText = metawidget.getLabelString( attributes ); if ( SimpleLayoutUtils.needsLabel( labelText, elementName ) ) { JLabel label = new JLabel(); label.setName( attributes.get( NAME ) + LABEL_NAME_SUFFIX ); StrippedMnemonicAndFirstIndex stripMnemonic = SimpleLayoutUtils.stripMnemonic( labelText ); String labelTextToUse = stripMnemonic.getStrippedMnemonic();
public void layoutWidget( View view, String elementName, Map<String, String> attributes, ViewGroup container, AndroidMetawidget metawidget ) { // Ignore empty Stubs if ( view instanceof Stub && ( (Stub) view ).getChildCount() == 0 ) { return; } ViewGroup viewToAddTo = newViewToAddTo( container ); String labelText = metawidget.getLabelString( attributes ); boolean needsLabel = SimpleLayoutUtils.needsLabel( labelText, elementName ); // Labels if ( needsLabel ) { TextView textView = new TextView( metawidget.getContext() ); textView.setText( labelText + ": " ); AndroidUtils.applyStyle( textView, mLabelStyle, metawidget ); viewToAddTo.addView( textView ); } // View layoutWidget( view, viewToAddTo, container, needsLabel ); }
if ( SimpleLayoutUtils.needsLabel( labelText, elementName ) ) { JLabel label = new JLabel(); label.setName( attributes.get( NAME ) + LABEL_NAME_SUFFIX ); StrippedMnemonicAndFirstIndex strippedMnemonicAndFirstIndex = SimpleLayoutUtils.stripMnemonic( labelText ); String labelTextToUse = strippedMnemonicAndFirstIndex.getStrippedMnemonic();
if ( SimpleLayoutUtils.needsLabel( labelText, elementName ) ) { Label label = new Label( composite, SWT.None ); label.setData( NAME, attributes.get( NAME ) + LABEL_NAME_SUFFIX );
if ( SimpleLayoutUtils.needsLabel( labelText, elementName ) ) { JLabel label = new JLabel(); label.setName( attributes.get( NAME ) + LABEL_NAME_SUFFIX ); StrippedMnemonicAndFirstIndex strippedMnemonicAndFirstIndex = SimpleLayoutUtils.stripMnemonic( labelText ); String labelTextToUse = strippedMnemonicAndFirstIndex.getStrippedMnemonic();
protected boolean willFillHorizontally( JComponent component, Map<String, String> attributes ) { if ( component instanceof JScrollPane ) { return true; } if ( component instanceof SwingMetawidget ) { return true; } return SimpleLayoutUtils.isSpanAllColumns( attributes ); }
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; }
if ( SimpleLayoutUtils.needsLabel( labelText, elementName ) ) { JLabel label = new JLabel(); label.setName( attributes.get( NAME ) + LABEL_NAME_SUFFIX ); StrippedMnemonicAndFirstIndex stripMnemonic = SimpleLayoutUtils.stripMnemonic( labelText ); String labelTextToUse = stripMnemonic.getStrippedMnemonic();
protected boolean willFillHorizontally( Control control, Map<String, String> attributes ) { if ( control instanceof SwtMetawidget ) { return true; } return SimpleLayoutUtils.isSpanAllColumns( attributes ); }
controlLayoutData.horizontalSpan = mNumberOfColumns * LABEL_AND_CONTROL; if ( SimpleLayoutUtils.needsLabel( labelText, elementName ) ) { controlLayoutData.horizontalSpan--; } else if ( !SimpleLayoutUtils.needsLabel( labelText, elementName ) ) { controlLayoutData.horizontalSpan = LABEL_AND_CONTROL;
protected boolean willFillHorizontally( JComponent component, Map<String, String> attributes ) { if ( component instanceof JScrollPane ) { return true; } if ( component instanceof SwingMetawidget ) { return true; } return SimpleLayoutUtils.isSpanAllColumns( attributes ); }
if ( !SimpleLayoutUtils.needsLabel( labelText, null ) ) { return false;
if ( childComponent instanceof UIMetawidget || childComponent instanceof UIData || SimpleLayoutUtils.isSpanAllColumns( metadataAttributes ) ) { colspan = ( state.columns * LABEL_AND_COMPONENT_AND_REQUIRED ) - 2; state.currentColumn = state.columns;
if ( !SimpleLayoutUtils.needsLabel( labelText, null ) ) { return false;
if ( childComponent instanceof UIMetawidget || childComponent instanceof UIData || SimpleLayoutUtils.isSpanAllColumns( metadataAttributes ) ) { colspan = ( state.columns * LABEL_AND_COMPONENT_AND_REQUIRED ) - 2; state.currentColumn = state.columns;
/** * @return true if a label was rendered */ protected boolean layoutLabel( String elementName, Map<String, String> attributes, MetawidgetTag metawidgetTag ) { String labelText = metawidgetTag.getLabelString( attributes ); if ( labelText == null ) { return false; } try { JspWriter writer = metawidgetTag.getPageContext().getOut(); // Output a (possibly localized) label writer.write( "<th" ); writeStyleClass( 0, metawidgetTag ); writer.write( ">" ); if ( SimpleLayoutUtils.needsLabel( labelText, elementName ) ) { writer.write( "<label>" ); writer.write( labelText ); writer.write( ":</label>" ); } writer.write( "</th>" ); return true; } catch ( IOException e ) { throw LayoutException.newException( e ); } }
boolean spanAllColumns = component instanceof JScrollPane || component instanceof SwingMetawidget || SimpleLayoutUtils.isSpanAllColumns( attributes );
if ( SimpleLayoutUtils.needsLabel( labelText, elementName ) ) {
if ( SimpleLayoutUtils.isSpanAllColumns( attributes ) && state.getCurrentColumn() != 1 ) { writer.write( "</tr>" ); state.setCurrentColumn( 1 ); if ( tag instanceof MetawidgetTag || SimpleLayoutUtils.isSpanAllColumns( attributes ) ) { colspan = ( mNumberOfColumns * LABEL_AND_COMPONENT_AND_REQUIRED ) - 2; state.setCurrentColumn( mNumberOfColumns );