Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012 JBoss Inc
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.uberfire.client.common;
 
This form style class is to be extended to provide "form style" dialogs (eg in a popup).
 
 public class FormStyleLayout extends Composite {
 
     private FlexTable         layout      = new FlexTable();
     private int               numInLayout = 0;

    
Create a new layout with a header and and icon.
 
     public FormStyleLayoutImageResource image,
                             String title ) {
         addHeaderimage,
                    title );
 
         initWidget );
     }

    
Create a new layout with a header and and icon.
 
     public FormStyleLayoutImage image,
                             String title ) {
         addHeaderimage,
                    title );
 
         initWidget );
     }

    
This has no header
 
     public FormStyleLayout() {
         initWidget );
     }

    
Clears the layout table.
 
     public void clear() {
          = 0;
         this..clear();
     }

    
Add a widget to the "form"

Parameters:
lbl The label displayed in column 0
editor The Widget displayed in column 1
Returns:
Index of row created
 
     public int addAttributeString lbl,
                              IsWidget editor ) {
         int row = ;
         HTML label = new HTML"<div class='form-field'>" + lbl + "</div>" );
         .setWidget,
                           0,
                           label );
         .setAlignment,
                                 0,
                                 .,
                                 . );
         .setWidget,
                           1,
                           editor );
         .setAlignment,
                                 1,
                                .,
                                . );
        ++;
        return row;
    }

    
Add a widget to the "form"

Parameters:
lbl The label displayed in column 0
editor The Widget displayed in column 1
isVisible Is the new row visible
Returns:
Index of row created
    public int addAttributeString lbl,
                             Widget editor,
                             boolean isVisible ) {
        int rowIndex = addAttributelbl,
                                     editor );
        setAttributeVisibilityrowIndex,
                                isVisible );
        return rowIndex;
    }

    
Add a widget to the "form" across an entire row

Parameters:
w The Widget displayed in column 1
Returns:
Index of row created
    public int addRowWidget w ) {
        int row = ;
        .setWidget,
                          0,
                          w );
                              0,
                              2 );
        ++;
        return row;
    }

    
Set the visibility of an Attribute

Parameters:
row
isVisible
    public void setAttributeVisibilityint row,
                                        boolean isVisible ) {
        .getWidgetrow,
                          0 ).setVisibleisVisible );
        .getWidgetrow,
                          1 ).setVisibleisVisible );
    }

    
Adds a header at the top.
    protected void addHeaderImageResource image,
                              String title ) {
        HTML name = new HTML"<div class='form-field'><b>" + title + "</b></div>" );
        name.setStyleName"resource-name-Label" );
        doHeaderimage,
                  name );
    }

    
Adds a header at the top.
    protected void addHeaderImage image,
                              String title ) {
        HTML name = new HTML"<div class='form-field'><b>" + title + "</b></div>" );
        name.setStyleName"resource-name-Label" );
        doHeaderimage,
                  name );
    }
    private void doHeaderImageResource imageResource,
                           Widget title ) {
        Image image;
        if ( imageResource == null ) {
            image = new Image();
        } else {
            image = new ImageimageResource );
        }
        .setWidget( 0,
                          0,
                          image );
        .setAlignment( 0,
                                0,
                                .,
                                . );
        .setWidget( 0,
                          1,
                          title );
        ++;
    }
    private void doHeaderImage image,
                           Widget title ) {
        if ( image.getAltText() == null ) {
            image.setAltText"" );
        }
        .setWidget( 0,
                          0,
                          image );
        .setAlignment( 0,
                                0,
                                .,
                                . );
        .setWidget( 0,
                          1,
                          title );
        ++;
    }
    protected void addHeaderImageResource image,
                              String title,
                              Widget titleIcon ) {
        HTML name = new HTML"<div class='form-field'><b>" + title + "</b></div>" );
        name.setStyleName"resource-name-Label" );
        HorizontalPanel horiz = new HorizontalPanel();
        horiz.addname );
        horiz.addtitleIcon );
        doHeaderimage,
                  horiz );
    }
    public void setFlexTableWidgetint row,
                                    int col,
                                    Widget widget ) {
        .setWidgetrow,
                          col,
                          widget );
    }
    public int getNumAttributes() {
        return ;
    }
    public Widget getWidget() {
        return super.getWidget();
    }
New to GrepCode? Check out our FAQ X