Exemplo n.º 1
0
 /**
  * Shows or hides the title bar for the panel.
  *
  * <p>The title bar appears at the top of the panel.
  *
  * <p>The default value is <code>false:</code> the title bar is not shown unless a title is set or
  * the panel is made collapsible.
  *
  * <p>
  *
  * @see WPanel#setTitle(CharSequence title)
  * @see WPanel#setCollapsible(boolean on)
  */
 public void setTitleBar(boolean enable) {
   if (enable && !(this.getTitleBarWidget() != null)) {
     WContainerWidget titleBar = new WContainerWidget();
     this.impl_.bindWidget("titlebar", titleBar);
     titleBar.setStyleClass("titlebar");
     WBreak br;
     titleBar.addWidget(br = new WBreak());
     br.setClearSides(Side.Horizontals);
   } else {
     if (!enable && this.isTitleBar()) {
       this.impl_.bindWidget("titlebar", (WWidget) null);
       this.title_ = null;
       this.collapseIcon_ = null;
     }
   }
 }
Exemplo n.º 2
0
 /** Creates a panel. */
 public WPanel(WContainerWidget parent) {
   super(parent);
   this.collapseIcon_ = null;
   this.title_ = null;
   this.centralWidget_ = null;
   this.animation_ = new WAnimation();
   this.collapsed_ = new Signal(this);
   this.expanded_ = new Signal(this);
   this.collapsedSS_ = new Signal1<Boolean>(this);
   this.expandedSS_ = new Signal1<Boolean>(this);
   String TEMPLATE = "${shadow-x1-x2}${titlebar}${contents}";
   this.setImplementation(this.impl_ = new WTemplate(new WString(TEMPLATE)));
   this.impl_.setStyleClass("Wt-panel Wt-outset");
   // this.implementStateless(WPanel.doExpand,WPanel.undoExpand);
   // this.implementStateless(WPanel.doCollapse,WPanel.undoCollapse);
   WContainerWidget centralArea = new WContainerWidget();
   centralArea.setStyleClass("body");
   this.impl_.bindString("shadow-x1-x2", WTemplate.DropShadow_x1_x2);
   this.impl_.bindWidget("titlebar", (WWidget) null);
   this.impl_.bindWidget("contents", centralArea);
   this.setJavaScriptMember(
       WT_RESIZE_JS,
       "function(self, w, h) {self.style.height= h + 'px';if (Wt3_2_2.boxSizing(self)) {h -= Wt3_2_2.px(self, 'borderTopWidth') + Wt3_2_2.px(self, 'borderBottomWidth');}var c = self.lastChild;var t = c.previousSibling;if (t.className == 'titlebar')h -= t.offsetHeight;h -= 8;if (h > 0) {c.style.height = h + 'px';$(c).children().each(function() { var self = $(this), padding = self.outerHeight() - self.height();self.height(h - padding);});}};");
 }