Package net.xoetrope.xui

Examples of net.xoetrope.xui.WidgetAdapter


   * @param attribValue the value of the attribute
   * @return 0 for success, non zero for failure or to require some further action
   */
  public static int setAttribute( XProject project, Object comp, String attribName, Object attribValue )
  {
    WidgetAdapter adapter = WidgetAdapter.getInstance();
   
    if ( attribName.equals( "preferredsize" )) {
      String[] vals = attribValue.toString().split( "," );
      adapter.setPreferredSize( comp, Integer.parseInt( vals[ 0 ] ), Integer.parseInt( vals[ 1 ] ));
    }
    else if ( attribName.equals( "minimumsize" )) {
      String[] vals = attribValue.toString().split( "," );
      adapter.setMinimumSize( comp, Integer.parseInt( vals[ 0 ] ), Integer.parseInt( vals[ 1 ] ));
    }
    else if ( attribName.equals( "maximumsize" )) {
      String[] vals = attribValue.toString().split( "," );
      adapter.setMaximumSize( comp, Integer.parseInt( vals[ 0 ] ), Integer.parseInt( vals[ 1 ] ));
    }
    else if ( attribName.equals( "tooltip" ))
      adapter.setTooltip( comp, XuiUtilities.translate( project, attribValue.toString()));
    else if ( attribName.equals( "opaque" ))
      adapter.setOpaque( comp, attribValue.toString().equals( "true" ));
    else if ( attribName.equals( "visible" ))
      adapter.setVisible( comp, attribValue.toString().equals( "true" ));
    else if ( attribName.equals( "enabled" ))
      adapter.setEnabled( comp, attribValue.toString().equals( "true" ));
    else if ( attribName.equals( "alignment" ))
      adapter.setHorizontalAlignment( comp, attribValue.toString());
    else if ( attribName.equals( "border" ))
      adapter.setBorderType( comp, attribValue.toString());
   
    return -1;
  }
View Full Code Here


   * @param errorStatus the error status
   */
  public void applyErrorStyle( Object comp, int errorStatus )
  {
    if ( comp instanceof XTextHolder ) {
      WidgetAdapter adapter = WidgetAdapter.getInstance();
      if ( errorStatus == USE_NORMAL_STYLE )
        adapter.setBackground( comp, normalColor );
      else if ( errorStatus == USE_WARN_STYLE )
        adapter.setBackground( comp, warnColor );
      else if ( errorStatus == USE_FAIL_STYLE )
        adapter.setBackground( comp, failColor );
    }
  }
View Full Code Here

   */
  public static void applyStyle( XProject currentProject, Object comp, String styleName )
  {
    XStyleManager styleManager = currentProject.getStyleManager();
    XStyle xstyle = styleManager.getStyle( styleName );
    WidgetAdapter adapter = WidgetAdapter.getInstance();
    if ( xstyle != null ) {
      adapter.setFont( comp, styleManager.getFont( xstyle ) );
      adapter.setBackground( comp, xstyle.getStyleAsColor( XStyle.COLOR_BACK ) );
      adapter.setForeground( comp, xstyle.getStyleAsColor( XStyle.COLOR_FORE ) );

      if ( comp instanceof XStyleComponent )
        (( XStyleComponent)comp).setStyle( styleName );
    }
  }
View Full Code Here

  {
    Object parent = componentFactory.getParentComponent();
    componentFactory.setParentComponent( page );
    String basePackageName = currentProject.getWidgetPackageName() + ".X";
    String attribStr;
    WidgetAdapter adapter = WidgetAdapter.getInstance();
    try {
//      if ( adapter.requiresParent()) {
//        Object[] args = new Object[ 1 ];
//        args[ 0 ] = parent;
//        menuBar = (XAppender)ReflectionHelper.constructViaReflection( basePackageName + XPage.MENUBAR, args );
//      }
//      else 
        menuBar = (XAppender)Class.forName( basePackageName + XPage.MENUBAR ).newInstance();
      menuBar.setName( page.getName());
     
      XStyle menuStyle = null;
      String menuStyleName = model.getAttribute( "style" );
      Color menuBkColor = null;
      Color menuTextColor = null;
      Font menuFont = null;
      if (( menuStyleName != null ) && ( menuStyleName.length() > 0 )) {
        menuStyle = currentProject.getStyleManager().getStyle( menuStyleName );
        menuBkColor = menuStyle.getStyleAsColor( XStyle.COLOR_BACK );
        menuTextColor = menuStyle.getStyleAsColor( XStyle.COLOR_FORE );
        menuFont = currentProject.getStyleManager().getFont( menuStyleName );
        adapter.setBackground( menuBar, menuBkColor );
        adapter.setForeground( menuBar, menuTextColor );
        adapter.setFont( menuBar, menuFont );
      }

      Vector menuNodes = model.getChildren();
      int numMenus = menuNodes.size();
      for ( int i = 0; i < numMenus; i++ ) {
View Full Code Here

TOP

Related Classes of net.xoetrope.xui.WidgetAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.