001/* 002 * ModeShape (http://www.modeshape.org) 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.modeshape.web.shared; 017 018import com.smartgwt.client.types.Alignment; 019import com.smartgwt.client.types.VerticalAlignment; 020import com.smartgwt.client.widgets.layout.HLayout; 021 022/** 023 * 024 * @author kulikov 025 */ 026public class Columns extends HLayout { 027 public Columns(int hAlign, int vAlign) { 028 switch (hAlign) { 029 case Align.LEFT : 030 this.setDefaultLayoutAlign(Alignment.LEFT); 031 this.setLayoutAlign(Alignment.LEFT); 032 this.setAlign(Alignment.LEFT); 033 break; 034 case Align.CENTER : 035 this.setDefaultLayoutAlign(Alignment.CENTER); 036 this.setLayoutAlign(Alignment.CENTER); 037 this.setAlign(Alignment.CENTER); 038 break; 039 case Align.RIGHT : 040 this.setDefaultLayoutAlign(Alignment.RIGHT); 041 this.setLayoutAlign(Alignment.RIGHT); 042 this.setAlign(Alignment.RIGHT); 043 break; 044 } 045 046 047 switch (vAlign) { 048 case Align.TOP : 049 this.setDefaultLayoutAlign(VerticalAlignment.TOP); 050 this.setLayoutAlign(VerticalAlignment.TOP); 051 this.setAlign(VerticalAlignment.TOP); 052 break; 053 case Align.CENTER : 054 this.setDefaultLayoutAlign(VerticalAlignment.CENTER); 055 this.setLayoutAlign(VerticalAlignment.CENTER); 056 this.setAlign(VerticalAlignment.CENTER); 057 break; 058 case Align.BOTTOM : 059 this.setDefaultLayoutAlign(VerticalAlignment.BOTTOM); 060 this.setLayoutAlign(VerticalAlignment.BOTTOM); 061 this.setAlign(VerticalAlignment.BOTTOM); 062 break; 063 } 064 065 } 066 067 public void addStrut( int width ) { 068 HLayout strut = new HLayout(); 069 strut.setWidth(width); 070 strut.setHeight100(); 071 addMember(strut); 072 } 073}