001    package org.crsh.shell.ui;
002    
003    import org.crsh.shell.io.ShellWriter;
004    import org.crsh.text.Style;
005    
006    import java.io.IOException;
007    
008    /**
009     * @author <a href="mailto:alain.defrance@exoplatform.com">Alain Defrance</a>
010     */
011    public class FormattingElement extends Element {
012    
013      /** . */
014      private Style style;
015    
016      public FormattingElement(Style style) throws NullPointerException {
017        if (style == null) {
018          throw new NullPointerException();
019        }
020    
021        //
022        this.style = style;
023      }
024      
025      @Override
026      void doPrint(UIWriterContext ctx, ShellWriter writer) throws IOException {
027        writer.append(style);
028      }
029    
030      @Override
031      int width() {
032        return 0;
033      }
034    }