隨筆-159  評論-114  文章-7  trackbacks-0
          package ?com.broadtext.client.widget;

          import ?com.google.gwt.user.client.DOM;
          import ?com.google.gwt.user.client.Element;
          import ?com.google.gwt.user.client.ui.ComplexPanel;
          import ?com.google.gwt.user.client.ui.UIObject;
          import ?com.google.gwt.user.client.ui.Widget;

          public ? class ?CornerPanel? extends ?ComplexPanel? {????
          ????
          ????
          static ? final ? public ?String?DEFAULT_OUT_DIV_ClASSNAME? = ? " default-corner-outer " ;
          ????
          ????
          static ? final ? public ?String?DEFAULT_CORNER_CLASS_NAME? = ? " default-corner " ;
          ????
          ????
          static ? final ? public ?String?DEFAULT_CORNERB_CLASS_NAME? = ? " default-corner-b " ;
          ????
          ????
          static ? final ? public ?String?DEFAULT_CORNER_MAIN_CLASS_NAME? = ? " default-corner-main " ;
          ????
          ????
          private ?Element?outerDiv;
          ????
          ????
          private ?CornerElementContainer?topCec;
          ????
          ????
          private ?CornerElementContainer?bottomCec;
          ????
          ????
          private ?CornerElement[]?top? = ? new ?CornerElement[ 4 ];
          ????
          ????
          private ?CornerElement[]?bottom? = ? new ?CornerElement[ 4 ];
          ????
          ????
          protected ?Element?mainContainer;
          ????
          ????
          private ? class ?CornerElementContainer? extends ?Widget {
          ????????
          ????????
          private ?CornerElementContainer()
          ????????
          {
          ????????????setElement(DOM.createElement(
          " b " ));
          ????????????setStyleName(DEFAULT_CORNER_CLASS_NAME);
          ????????}

          ????????
          ????????
          public ? void ?addCornerElement(Widget?w)
          ????????
          {
          ????????????w.removeFromParent();
          ????????????DOM.appendChild(
          this .getElement(),?w.getElement());
          ????????}

          ????????
          ????????
          public ? void ?setStyleName(String?style)
          ????????
          {
          ????????????
          super .setStyleName(style);
          ????????}

          ????}

          ????
          ????
          private ? class ?CornerElement? extends ?Widget {
          ????????
          public ?CornerElement(String?stylename)
          ????????
          {
          ????????????setElement(DOM.createElement(
          " b " ));
          ????????????setStyleName(stylename);
          ????????}
          ????????
          ????????
          ????????
          public ? void ?setStyleName(String?style)
          ????????
          {
          ????????????
          super .setStyleName(style);
          ????????}

          ????????
          ????}

          ????
          ????
          ????
          public ?CornerPanel()
          ????
          {
          ????????outerDiv?
          = ?DOM.createDiv();
          ????????mainContainer?
          = ?DOM.createDiv();
          ????????setElement(outerDiv);
          ????????setStyleName(getElement(),?DEFAULT_OUT_DIV_ClASSNAME,?
          true );
          ????????initCorner();
          ????????DOM.appendChild(outerDiv,?topCec.getElement());
          ????????DOM.appendChild(outerDiv,?mainContainer);
          ????????DOM.appendChild(outerDiv,?bottomCec.getElement());
          ????}

          ????
          ????
          ????
          ????
          /**
          ?????*?初始化上面的corner
          ?????*
          ?????
          */

          ????
          private ? void ?initCorner()
          ????
          {
          ????????topCec?
          = ? new ?CornerElementContainer();????????
          ????????
          for ( int ?i? = ? 0 ;?i? < ? 4 ?;?i ++ )
          ????????
          {
          ????????????top[i]?
          = ? new ?CornerElement(DEFAULT_CORNERB_CLASS_NAME? + ?(i? + ? 1 ));
          ????????????topCec.addCornerElement(top[i]);
          ????????}

          ????????
          ????????bottomCec?
          = ? new ?CornerElementContainer();????????
          ????????
          for ( int ?i? = ? 0 ;?i? < ? 4 ?;?i ++ )
          ????????
          {
          ????????????bottom[i]?
          = ? new ?CornerElement(DEFAULT_CORNERB_CLASS_NAME? + ?( 4 ? - ?i));
          ????????????bottomCec.addCornerElement(bottom[i]);
          ????????}
          ????????
          ????}

          ????
          ????
          public ? void ?setOuterStyleName(String?style)
          ????
          {
          ????????setStyleName(style);
          ????}

          ????
          ????
          public ? void ?setCecStyleName(String?style)
          ????
          {????????
          ????????topCec.setStyleName(style);
          ????????bottomCec.setStyleName(style);
          ????}

          ????
          ????
          public ? void ?setCeStyleName(String?style)
          ????
          {
          ????????
          for ( int ?i? = ? 0 ;?i? < ? 4 ?;?i ++ )
          ????????
          {
          ????????????top[i].setStyleName(style?
          + ?(i? + ? 1 ));
          ????????}

          ????????
          for ( int ?i? = ? 0 ;?i? < ? 4 ?;?i ++ )
          ????????
          {
          ????????????bottom[i].setStyleName(style?
          + ?( 4 ? - ?i));
          ????????}

          ????}


          ????
          public ? void ?setMainStyleName(String?style)
          ????
          {
          ????????UIObject.setStyleName(
          this .mainContainer,?style,? true );
          ????}



          ????
          public ? void ?add(Widget?w)? {
          ????????DOM.appendChild(
          this .mainContainer,?w.getElement());
          ????}


          ????
          protected ? void ?add(Widget?w,?Element?container)? {
          ????????
          // nothing?to?do
          ????}


          ????
          public ? void ?addStyleName(String?style)? {
          ????????
          // nothing?to?do
          ????}

          ????
          ????
          ????
          }


          /* ?-------------------------------? */

          /* ?--?default?corner?style?begin-- */

          .default-corner-outer?
          {
          ????background
          : ?#C6DBFF ;
          ????color
          : ?#ccc ;
          }


          .default-corner?
          {
          ????display
          : ?block ;
          ????background
          : ?#fff ;
          }


          .default-corner-b1?
          {
          ????display
          : ?block ;
          ????height
          : ?1px ;
          ????overflow
          : ?hidden ;
          ????margin
          : ?0?5px ;
          ????background
          : ?#C6DBFF ;
          }


          .default-corner-b2?
          {
          ????display
          : ?block ;
          ????height
          : ?1px ;
          ????overflow
          : ?hidden ;
          ????margin
          : ?0?3px ;
          ????background
          : ?#C6DBFF ;
          }


          .default-corner-b3?
          {
          ????display
          : ?block ;
          ????height
          : ?1px ;
          ????overflow
          : ?hidden ;
          ????margin
          : ?0?2px ;
          ????background
          : ?#C6DBFF ;
          }


          .default-corner-b4?
          {
          ????display
          : ?block ;
          ????height
          : ?1px ;
          ????overflow
          : ?hidden ;
          ????background
          : ?#C6DBFF ;
          ????margin
          : ?0?1px ;
          ????height
          : ?2px ; ????
          }


          .default-corner-main?
          {
          ????margin-left
          : ?3px ;
          ????margin-right
          : ?3px ;
          }


          /* ?--?default?corner?style?end?-- */


          posted on 2006-11-13 13:40 北國狼人的BloG 閱讀(527) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 错那县| 徐州市| 葫芦岛市| 芜湖县| 永福县| 乐昌市| 利辛县| 曲靖市| 赣州市| 固安县| 台前县| 天门市| 浠水县| 江孜县| 湘阴县| 湘潭市| 仙居县| 韶关市| 宁化县| 龙岩市| 晋城| 安龙县| 嵊州市| 庄河市| 宣恩县| 南陵县| 中江县| 绥芬河市| 永德县| 和顺县| 永泰县| 邓州市| 丽江市| 石狮市| 乐昌市| 开远市| 陇川县| 刚察县| 元阳县| 宾川县| 南江县|