コード例 #1
0
ファイル: WAbstractMedia.java プロジェクト: clawplach/jwt
 /**
  * Consctructor for a media widget.
  *
  * <p>A freshly constructed media widget has no options set, no media sources, and has preload
  * mode set to PreloadAuto.
  */
 public WAbstractMedia(WContainerWidget parent) {
   super(parent);
   this.sources_ = new ArrayList<WAbstractMedia.Source>();
   this.sourcesRendered_ = 0;
   this.mediaId_ = "";
   this.flags_ = EnumSet.noneOf(WAbstractMedia.Options.class);
   this.preloadMode_ = WAbstractMedia.PreloadMode.PreloadAuto;
   this.alternative_ = null;
   this.flagsChanged_ = false;
   this.preloadChanged_ = false;
   this.sourcesChanged_ = false;
   this.playing_ = false;
   this.volume_ = -1;
   this.current_ = -1;
   this.duration_ = -1;
   this.ended_ = false;
   this.readyState_ = WAbstractMedia.ReadyState.HaveNothing;
   this.setInline(false);
   this.setFormObject(true);
   WApplication app = WApplication.getInstance();
   app.loadJavaScript("js/WAbstractMedia.js", wtjs1());
   this.setJavaScriptMember(
       " WAbstractMedia",
       "new Wt3_2_3.WAbstractMedia(" + app.getJavaScriptClass() + "," + this.getJsRef() + ");");
 }
コード例 #2
0
ファイル: OAuthProcess.java プロジェクト: clawplach/jwt
 private void handleRedirectPath(String internalPath) {
   if (internalPath.equals(this.service_.getRedirectInternalPath())) {
     WApplication app = WApplication.getInstance();
     WEnvironment env = app.getEnvironment();
     if (!env.hasAjax()) {
       String stateE = env.getParameter("state");
       if (!(stateE != null) || !stateE.equals(this.oAuthState_)) {
         this.setError(WString.tr("Wt.Auth.OAuthService.invalid-state"));
       } else {
         String errorE = env.getParameter("error");
         if (errorE != null) {
           this.setError(WString.tr("Wt.Auth.OAuthService." + errorE));
         } else {
           String codeE = env.getParameter("code");
           if (!(codeE != null)) {
             this.setError(WString.tr("Wt.Auth.OAuthService.missing-code"));
           } else {
             this.requestToken(codeE);
           }
         }
       }
       this.onOAuthDone();
     }
   }
 }
コード例 #3
0
ファイル: OAuthProcess.java プロジェクト: clawplach/jwt
 /**
  * Constructor.
  *
  * <p>
  *
  * @see OAuthService#createProcess(String scope)
  */
 protected OAuthProcess(OAuthService service, String scope) {
   super();
   this.service_ = service;
   this.scope_ = scope;
   this.authenticate_ = false;
   this.authorized_ = new Signal1<OAuthAccessToken>(this);
   this.authenticated_ = new Signal1<Identity>(this);
   this.redirected_ = new JSignal(this, "redirected");
   this.oAuthState_ = "";
   this.token_ = new OAuthAccessToken();
   this.error_ = new WString();
   this.startInternalPath_ = "";
   this.redirectEndpoint_ = new OAuthRedirectEndpoint(this);
   WApplication app = WApplication.getInstance();
   PopupWindow.loadJavaScript(app);
   String url = app.makeAbsoluteUrl(this.redirectEndpoint_.getUrl());
   this.oAuthState_ = this.service_.encodeState(url);
   this.redirected_.addListener(
       this,
       new Signal.Listener() {
         public void trigger() {
           OAuthProcess.this.onOAuthDone();
         }
       });
   if (!app.getEnvironment().hasJavaScript()) {
     app.internalPathChanged()
         .addListener(
             this,
             new Signal1.Listener<String>() {
               public void trigger(String e1) {
                 OAuthProcess.this.handleRedirectPath(e1);
               }
             });
   }
 }
コード例 #4
0
ファイル: OAuthProcess.java プロジェクト: clawplach/jwt
 /**
  * Starts an authorization process.
  *
  * <p>This starts an authorization process to request an accesstoken to access protected
  * information within the process scope.
  *
  * <p>The authorization process ends with the {@link OAuthProcess#authorized() authorized()}
  * signal which signals the obtained token.
  *
  * <p>
  *
  * <p><i><b>Note: </b>To be able to use a popup (instead of a page redirect), you should connect
  * this method directly to an, since popup windows are blocked in most web browsers unless they
  * are the direct consequence of an event. </i>
  */
 public void startAuthorize() {
   WApplication app = WApplication.getInstance();
   if (!app.getEnvironment().hasJavaScript()) {
     this.startInternalPath_ = app.getInternalPath();
     app.redirect(this.getAuthorizeUrl());
   } else {
     this.redirectEndpoint_.getUrl();
   }
 }
コード例 #5
0
ファイル: OAuthProcess.java プロジェクト: clawplach/jwt
 private void handleToken(Exception err, HttpMessage response) {
   if (err == null) {
     this.doParseTokenResponse(response);
   } else {
     logger.error(
         new StringWriter().append("handleToken(): ").append(err.getMessage()).toString());
     this.setError(new WString(err.getMessage()));
   }
   WApplication app = WApplication.getInstance();
   if (app.getEnvironment().hasAjax()) {
   } else {
     this.onOAuthDone();
     app.redirect(app.url(this.startInternalPath_));
   }
 }
コード例 #6
0
 /**
  * Makes the panel collapsible.
  *
  * <p>When <code>on</code> is <code>true</code>, a collapse/expand icon is added to the title bar.
  * This also calls setTitleBar(true) to enable the title bar.
  *
  * <p>The default value is <code>false</code>.
  *
  * <p>
  *
  * @see WPanel#setTitleBar(boolean enable)
  * @see WPanel#setCollapsed(boolean on)
  * @see WPanel#isCollapsed()
  */
 public void setCollapsible(boolean on) {
   if (on && !(this.collapseIcon_ != null)) {
     String resources = WApplication.getResourcesUrl();
     this.setTitleBar(true);
     this.collapseIcon_ = new WIconPair(resources + "collapse.gif", resources + "expand.gif");
     this.collapseIcon_.setInline(false);
     this.collapseIcon_.setFloatSide(Side.Left);
     this.getTitleBarWidget().insertWidget(0, this.collapseIcon_);
     this.collapseIcon_
         .icon1Clicked()
         .addListener(
             this,
             new Signal1.Listener<WMouseEvent>() {
               public void trigger(WMouseEvent e1) {
                 WPanel.this.doCollapse();
               }
             });
     this.collapseIcon_
         .icon1Clicked()
         .addListener(
             this,
             new Signal1.Listener<WMouseEvent>() {
               public void trigger(WMouseEvent e1) {
                 WPanel.this.onCollapse();
               }
             });
     this.collapseIcon_
         .icon2Clicked()
         .addListener(
             this,
             new Signal1.Listener<WMouseEvent>() {
               public void trigger(WMouseEvent e1) {
                 WPanel.this.doExpand();
               }
             });
     this.collapseIcon_
         .icon2Clicked()
         .addListener(
             this,
             new Signal1.Listener<WMouseEvent>() {
               public void trigger(WMouseEvent e1) {
                 WPanel.this.onExpand();
               }
             });
     this.collapseIcon_.setState(0);
   } else {
     if (!on && this.collapseIcon_ != null) {
       if (this.collapseIcon_ != null) this.collapseIcon_.remove();
       this.collapseIcon_ = null;
     }
   }
 }
コード例 #7
0
ファイル: WAbstractMedia.java プロジェクト: clawplach/jwt
 void updateMediaDom(DomElement element, boolean all) {
   if (all && this.alternative_ != null) {
     element.setAttribute(
         "onerror",
         "if(event.target.error && event.target.error.code==event.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED){while (this.hasChildNodes())if (Wt3_2_3.hasTag(this.firstChild,'SOURCE')){this.removeChild(this.firstChild);}else{this.parentNode.insertBefore(this.firstChild, this);}this.style.display= 'none';}");
   }
   if (all || this.flagsChanged_) {
     if (!all || !EnumUtils.mask(this.flags_, WAbstractMedia.Options.Controls).isEmpty()) {
       element.setAttribute(
           "controls",
           !EnumUtils.mask(this.flags_, WAbstractMedia.Options.Controls).isEmpty()
               ? "controls"
               : "");
     }
     if (!all || !EnumUtils.mask(this.flags_, WAbstractMedia.Options.Autoplay).isEmpty()) {
       element.setAttribute(
           "autoplay",
           !EnumUtils.mask(this.flags_, WAbstractMedia.Options.Autoplay).isEmpty()
               ? "autoplay"
               : "");
     }
     if (!all || !EnumUtils.mask(this.flags_, WAbstractMedia.Options.Loop).isEmpty()) {
       element.setAttribute(
           "loop",
           !EnumUtils.mask(this.flags_, WAbstractMedia.Options.Loop).isEmpty() ? "loop" : "");
     }
   }
   if (all || this.preloadChanged_) {
     switch (this.preloadMode_) {
       case PreloadNone:
         element.setAttribute("preload", "none");
         break;
       default:
       case PreloadAuto:
         element.setAttribute("preload", "auto");
         break;
       case PreloadMetadata:
         element.setAttribute("preload", "metadata");
         break;
     }
   }
   this.updateEventSignals(element, all);
   if (all) {
     if (this.alternative_ != null) {
       element.addChild(this.alternative_.createSDomElement(WApplication.getInstance()));
     }
   }
   this.flagsChanged_ = this.preloadChanged_ = false;
 }
コード例 #8
0
 DomElement createDomElement(WApplication app) {
   boolean withIds = !app.getEnvironment().agentIsSpiderBot();
   DomElement table = DomElement.createNew(this.getDomElementType());
   this.setId(table, app);
   DomElement thead = null;
   if (this.headerRowCount_ != 0) {
     thead = DomElement.createNew(DomElementType.DomElement_THEAD);
     if (withIds) {
       thead.setId(this.getId() + "th");
     }
   }
   DomElement tbody = DomElement.createNew(DomElementType.DomElement_TBODY);
   if (withIds) {
     tbody.setId(this.getId() + "tb");
   }
   for (int col = 0; col < this.columns_.size(); ++col) {
     DomElement c = DomElement.createNew(DomElementType.DomElement_COL);
     if (withIds) {
       c.setId(this.columns_.get(col).getId());
     }
     this.columns_.get(col).updateDom(c, true);
     table.addChild(c);
   }
   this.flags_.clear(BIT_COLUMNS_CHANGED);
   for (int row = 0; row < (int) this.getRowCount(); ++row) {
     for (int col = 0; col < (int) this.getColumnCount(); ++col) {
       this.itemAt(row, col).overSpanned = false;
     }
   }
   for (int row = 0; row < (int) this.getRowCount(); ++row) {
     DomElement tr = this.createRow(row, withIds, app);
     if (row < (int) this.headerRowCount_) {
       thead.addChild(tr);
     } else {
       tbody.addChild(tr);
     }
   }
   this.rowsAdded_ = 0;
   if (thead != null) {
     table.addChild(thead);
   }
   table.addChild(tbody);
   this.updateDom(table, true);
   this.flags_.clear(BIT_GRID_CHANGED);
   ;
   this.rowsChanged_ = null;
   return table;
 }
コード例 #9
0
ファイル: OAuthProcess.java プロジェクト: clawplach/jwt
 /**
  * Connects an implementation to start an authentication process to a signal.
  *
  * <p>If JavaScript is available, this method connects a JavaScript function to the <code>signal
  * </code>, otherwise {@link OAuthProcess#startAuthenticate() startAuthenticate()} is connected to
  * <code>signal</code>.
  */
 public void connectStartAuthenticate(AbstractEventSignal s) {
   if (WApplication.getInstance().getEnvironment().hasJavaScript()) {
     StringBuilder js = new StringBuilder();
     js.append("function(object, event) {")
         .append("Wt3_2_3.PopupWindow(Wt3_2_3")
         .append(",")
         .append(WWebWidget.jsStringLiteral(this.getAuthorizeUrl()))
         .append(", ")
         .append(this.service_.getPopupWidth())
         .append(", ")
         .append(this.service_.getPopupHeight())
         .append(");")
         .append("}");
     s.addListener(js.toString());
   }
   s.addListener(
       this,
       new Signal.Listener() {
         public void trigger() {
           OAuthProcess.this.startAuthenticate();
         }
       });
 }
コード例 #10
0
ファイル: WAbstractMedia.java プロジェクト: clawplach/jwt
 DomElement createDomElement(WApplication app) {
   DomElement result = null;
   if (this.isInLayout()) {
     this.setJavaScriptMember(WT_RESIZE_JS, "function() {}");
   }
   if (app.getEnvironment().agentIsIElt(9)
       || app.getEnvironment().getAgent() == WEnvironment.UserAgent.MobileWebKitAndroid) {
     result = DomElement.createNew(DomElementType.DomElement_DIV);
     if (this.alternative_ != null) {
       result.addChild(this.alternative_.createSDomElement(app));
     }
   } else {
     DomElement media = this.createMediaDomElement();
     DomElement wrap = null;
     if (this.isInLayout()) {
       media.setProperty(Property.PropertyStylePosition, "absolute");
       media.setProperty(Property.PropertyStyleLeft, "0");
       media.setProperty(Property.PropertyStyleRight, "0");
       wrap = DomElement.createNew(DomElementType.DomElement_DIV);
       wrap.setProperty(Property.PropertyStylePosition, "relative");
     }
     result = wrap != null ? wrap : media;
     if (wrap != null) {
       this.mediaId_ = this.getId() + "_media";
       media.setId(this.mediaId_);
     } else {
       this.mediaId_ = this.getId();
     }
     this.updateMediaDom(media, true);
     for (int i = 0; i < this.sources_.size(); ++i) {
       DomElement src = DomElement.createNew(DomElementType.DomElement_SOURCE);
       src.setId(this.mediaId_ + "s" + String.valueOf(i));
       this.renderSource(src, this.sources_.get(i), i + 1 >= this.sources_.size());
       media.addChild(src);
     }
     this.sourcesRendered_ = this.sources_.size();
     this.sourcesChanged_ = false;
     if (wrap != null) {
       wrap.addChild(media);
     }
   }
   if (this.isInLayout()) {
     StringWriter ss = new StringWriter();
     ss.append("function(self, w, h) {");
     if (this.mediaId_.length() != 0) {
       ss.append(
           "v="
               + this.getJsMediaRef()
               + ";if(v){v.setAttribute('width', w);v.setAttribute('height', h);}");
     }
     if (this.alternative_ != null) {
       ss.append("a=" + this.alternative_.getJsRef() + ";if(a && a.")
           .append(WT_RESIZE_JS)
           .append(")a.")
           .append(WT_RESIZE_JS)
           .append("(a, w, h);");
     }
     ss.append("}");
     this.setJavaScriptMember(WT_RESIZE_JS, ss.toString());
   }
   this.setId(result, app);
   this.updateDom(result, true);
   if (this.isInLayout()) {
     result.setEvent(PLAYBACKSTARTED_SIGNAL, "");
     result.setEvent(PLAYBACKPAUSED_SIGNAL, "");
     result.setEvent(ENDED_SIGNAL, "");
     result.setEvent(TIMEUPDATED_SIGNAL, "");
     result.setEvent(VOLUMECHANGED_SIGNAL, "");
   }
   this.setJavaScriptMember("mediaId", "'" + this.mediaId_ + "'");
   return result;
 }
コード例 #11
0
 private void mouseUp(WMouseEvent e) {
   this.internalScrollTo(
       this.currentX_ - e.getDragDelta().x,
       this.currentY_ - e.getDragDelta().y,
       !WApplication.getInstance().getEnvironment().hasAjax());
 }
コード例 #12
0
ファイル: WAxisSliderWidget.java プロジェクト: sebap/jwt
 protected void paintEvent(WPaintDevice paintDevice) {
   if (!(this.chart_ != null) || !this.chart_.cObjCreated_) {
     return;
   }
   if (this.chart_.getSeries(this.seriesColumn_).getType() != SeriesType.LineSeries
       && this.chart_.getSeries(this.seriesColumn_).getType() != SeriesType.CurveSeries) {
     if (this.getMethod() == WPaintedWidget.Method.HtmlCanvas) {
       StringBuilder ss = new StringBuilder();
       ss.append("jQuery.removeData(").append(this.getJsRef()).append(",'sobj');");
       ss.append("\nif (")
           .append(this.getObjJsRef())
           .append(") {")
           .append(this.getObjJsRef())
           .append(".canvas.style.cursor = 'auto';")
           .append("setTimeout(")
           .append(this.getObjJsRef())
           .append(".repaint,0);}\n");
       this.doJavaScript(ss.toString());
     }
     logger.error(
         new StringWriter()
             .append("WAxisSliderWidget is not associated with a line or curve series.")
             .toString());
     return;
   }
   WPainter painter = new WPainter(paintDevice);
   boolean horizontal = this.chart_.getOrientation() == Orientation.Vertical;
   double w = horizontal ? this.getWidth().getValue() : this.getHeight().getValue();
   double h = horizontal ? this.getHeight().getValue() : this.getWidth().getValue();
   boolean autoPadding = this.autoPadding_;
   if (autoPadding
       && EnumUtils.mask(paintDevice.getFeatures(), WPaintDevice.FeatureFlag.HasFontMetrics)
           .equals(0)
       && this.labelsEnabled_) {
     logger.error(
         new StringWriter()
             .append(
                 "setAutoLayout(): device does not have font metrics (not even server-side font metrics).")
             .toString());
     autoPadding = false;
   }
   if (autoPadding) {
     if (horizontal) {
       if (this.labelsEnabled_) {
         this.setSelectionAreaPadding(0, EnumSet.of(Side.Top));
         this.setSelectionAreaPadding(
             (int)
                 (this.chart_
                         .getAxis(Axis.XAxis)
                         .calcMaxTickLabelSize(paintDevice, Orientation.Vertical)
                     + 10),
             EnumSet.of(Side.Bottom));
         this.setSelectionAreaPadding(
             (int)
                 Math.max(
                     this.chart_
                             .getAxis(Axis.XAxis)
                             .calcMaxTickLabelSize(paintDevice, Orientation.Horizontal)
                         / 2,
                     10.0),
             EnumSet.of(Side.Left, Side.Right));
       } else {
         this.setSelectionAreaPadding(0, EnumSet.of(Side.Top));
         this.setSelectionAreaPadding(5, EnumSet.of(Side.Left, Side.Right, Side.Bottom));
       }
     } else {
       if (this.labelsEnabled_) {
         this.setSelectionAreaPadding(0, EnumSet.of(Side.Right));
         this.setSelectionAreaPadding(
             (int)
                 Math.max(
                     this.chart_
                             .getAxis(Axis.XAxis)
                             .calcMaxTickLabelSize(paintDevice, Orientation.Vertical)
                         / 2,
                     10.0),
             EnumSet.of(Side.Top, Side.Bottom));
         this.setSelectionAreaPadding(
             (int)
                 (this.chart_
                         .getAxis(Axis.XAxis)
                         .calcMaxTickLabelSize(paintDevice, Orientation.Horizontal)
                     + 10),
             EnumSet.of(Side.Left));
       } else {
         this.setSelectionAreaPadding(0, EnumSet.of(Side.Right));
         this.setSelectionAreaPadding(5, EnumSet.of(Side.Top, Side.Bottom, Side.Left));
       }
     }
   }
   double left =
       horizontal
           ? this.getSelectionAreaPadding(Side.Left)
           : this.getSelectionAreaPadding(Side.Top);
   double right =
       horizontal
           ? this.getSelectionAreaPadding(Side.Right)
           : this.getSelectionAreaPadding(Side.Bottom);
   double top =
       horizontal
           ? this.getSelectionAreaPadding(Side.Top)
           : this.getSelectionAreaPadding(Side.Right);
   double bottom =
       horizontal
           ? this.getSelectionAreaPadding(Side.Bottom)
           : this.getSelectionAreaPadding(Side.Left);
   double maxW = w - left - right;
   WRectF drawArea = new WRectF(left, 0, maxW, h);
   List<WAxis.Segment> segmentsBak =
       new ArrayList<WAxis.Segment>(this.chart_.getAxis(Axis.XAxis).segments_);
   double renderIntervalBak = this.chart_.getAxis(Axis.XAxis).renderInterval_;
   this.chart_
       .getAxis(Axis.XAxis)
       .prepareRender(
           horizontal ? Orientation.Horizontal : Orientation.Vertical, drawArea.getWidth());
   final WRectF chartArea = this.chart_.chartArea_;
   WRectF selectionRect = null;
   {
     double u =
         -this.chart_.xTransformHandle_.getValue().getDx()
             / (chartArea.getWidth() * this.chart_.xTransformHandle_.getValue().getM11());
     selectionRect = new WRectF(0, top, maxW, h - (top + bottom));
     this.transform_.setValue(
         new WTransform(
             1 / this.chart_.xTransformHandle_.getValue().getM11(), 0, 0, 1, u * maxW, 0));
   }
   WRectF seriesArea = new WRectF(left, top + 5, maxW, h - (top + bottom + 5));
   WTransform selectionTransform =
       this.hv(new WTransform(1, 0, 0, 1, left, 0).multiply(this.transform_.getValue()));
   WRectF rect = selectionTransform.map(this.hv(selectionRect));
   painter.fillRect(this.hv(new WRectF(left, top, maxW, h - top - bottom)), this.background_);
   painter.fillRect(rect, this.selectedAreaBrush_);
   final double TICK_LENGTH = 5;
   final double ANGLE1 = 15;
   final double ANGLE2 = 80;
   double tickStart = 0.0;
   double tickEnd = 0.0;
   double labelPos = 0.0;
   AlignmentFlag labelHFlag = AlignmentFlag.AlignCenter;
   AlignmentFlag labelVFlag = AlignmentFlag.AlignMiddle;
   final WAxis axis = this.chart_.getAxis(Axis.XAxis);
   if (horizontal) {
     tickStart = 0;
     tickEnd = TICK_LENGTH;
     labelPos = TICK_LENGTH;
     labelVFlag = AlignmentFlag.AlignTop;
   } else {
     tickStart = -TICK_LENGTH;
     tickEnd = 0;
     labelPos = -TICK_LENGTH;
     labelHFlag = AlignmentFlag.AlignRight;
   }
   if (horizontal) {
     if (axis.getLabelAngle() > ANGLE1) {
       labelHFlag = AlignmentFlag.AlignRight;
       if (axis.getLabelAngle() > ANGLE2) {
         labelVFlag = AlignmentFlag.AlignMiddle;
       }
     } else {
       if (axis.getLabelAngle() < -ANGLE1) {
         labelHFlag = AlignmentFlag.AlignLeft;
         if (axis.getLabelAngle() < -ANGLE2) {
           labelVFlag = AlignmentFlag.AlignMiddle;
         }
       }
     }
   } else {
     if (axis.getLabelAngle() > ANGLE1) {
       labelVFlag = AlignmentFlag.AlignBottom;
       if (axis.getLabelAngle() > ANGLE2) {
         labelHFlag = AlignmentFlag.AlignCenter;
       }
     } else {
       if (axis.getLabelAngle() < -ANGLE1) {
         labelVFlag = AlignmentFlag.AlignTop;
         if (axis.getLabelAngle() < -ANGLE2) {
           labelHFlag = AlignmentFlag.AlignCenter;
         }
       }
     }
   }
   EnumSet<AxisProperty> axisProperties = EnumSet.of(AxisProperty.Line);
   if (this.labelsEnabled_) {
     axisProperties.add(AxisProperty.Labels);
   }
   if (horizontal) {
     axis.render(
         painter,
         axisProperties,
         new WPointF(drawArea.getLeft(), h - bottom),
         new WPointF(drawArea.getRight(), h - bottom),
         tickStart,
         tickEnd,
         labelPos,
         EnumSet.of(labelHFlag, labelVFlag));
     WPainterPath line = new WPainterPath();
     line.moveTo(drawArea.getLeft() + 0.5, h - (bottom - 0.5));
     line.lineTo(drawArea.getRight(), h - (bottom - 0.5));
     painter.strokePath(line, this.chart_.getAxis(Axis.XAxis).getPen());
   } else {
     axis.render(
         painter,
         axisProperties,
         new WPointF(this.getSelectionAreaPadding(Side.Left) - 1, drawArea.getLeft()),
         new WPointF(this.getSelectionAreaPadding(Side.Left) - 1, drawArea.getRight()),
         tickStart,
         tickEnd,
         labelPos,
         EnumSet.of(labelHFlag, labelVFlag));
     WPainterPath line = new WPainterPath();
     line.moveTo(this.getSelectionAreaPadding(Side.Left) - 0.5, drawArea.getLeft() + 0.5);
     line.lineTo(this.getSelectionAreaPadding(Side.Left) - 0.5, drawArea.getRight());
     painter.strokePath(line, this.chart_.getAxis(Axis.XAxis).getPen());
   }
   WPainterPath curve = new WPainterPath();
   {
     WTransform t =
         new WTransform(1, 0, 0, 1, seriesArea.getLeft(), seriesArea.getTop())
             .multiply(
                 new WTransform(
                     seriesArea.getWidth() / chartArea.getWidth(),
                     0,
                     0,
                     seriesArea.getHeight() / chartArea.getHeight(),
                     0,
                     0))
             .multiply(new WTransform(1, 0, 0, 1, -chartArea.getLeft(), -chartArea.getTop()));
     if (!horizontal) {
       t.assign(
           new WTransform(
                   0,
                   1,
                   1,
                   0,
                   this.getSelectionAreaPadding(Side.Left)
                       - this.getSelectionAreaPadding(Side.Right)
                       - 5,
                   0)
               .multiply(t)
               .multiply(new WTransform(0, 1, 1, 0, 0, 0)));
     }
     curve.assign(t.map(this.chart_.pathForSeries(this.seriesColumn_)));
   }
   {
     WRectF leftHandle = this.hv(new WRectF(-5, top, 5, h - top - bottom));
     WTransform t =
         new WTransform(1, 0, 0, 1, left, -top)
             .multiply(
                 new WTransform()
                     .translate(this.transform_.getValue().map(selectionRect.getTopLeft())));
     painter.fillRect(this.hv(t).map(leftHandle), this.handleBrush_);
   }
   {
     WRectF rightHandle = this.hv(new WRectF(0, top, 5, h - top - bottom));
     WTransform t =
         new WTransform(1, 0, 0, 1, left, -top)
             .multiply(
                 new WTransform()
                     .translate(this.transform_.getValue().map(selectionRect.getTopRight())));
     painter.fillRect(this.hv(t).map(rightHandle), this.handleBrush_);
   }
   if (this.selectedSeriesPen_ != this.seriesPen_
       && !this.selectedSeriesPen_.equals(this.seriesPen_)) {
     WPainterPath clipPath = new WPainterPath();
     clipPath.addRect(this.hv(selectionRect));
     painter.setClipPath(selectionTransform.map(clipPath));
     painter.setClipping(true);
     painter.setPen(this.getSelectedSeriesPen());
     painter.drawPath(curve);
     WPainterPath leftClipPath = new WPainterPath();
     leftClipPath.addRect(
         this.hv(new WTransform(1, 0, 0, 1, -selectionRect.getWidth(), 0).map(selectionRect)));
     painter.setClipPath(
         this.hv(
                 new WTransform(1, 0, 0, 1, left, -top)
                     .multiply(
                         new WTransform()
                             .translate(
                                 this.transform_.getValue().map(selectionRect.getTopLeft()))))
             .map(leftClipPath));
     painter.setPen(this.getSeriesPen());
     painter.drawPath(curve);
     WPainterPath rightClipPath = new WPainterPath();
     rightClipPath.addRect(
         this.hv(new WTransform(1, 0, 0, 1, selectionRect.getWidth(), 0).map(selectionRect)));
     painter.setClipPath(
         this.hv(
                 new WTransform(1, 0, 0, 1, left - selectionRect.getRight(), -top)
                     .multiply(
                         new WTransform()
                             .translate(
                                 this.transform_.getValue().map(selectionRect.getTopRight()))))
             .map(rightClipPath));
     painter.drawPath(curve);
     painter.setClipping(false);
   } else {
     painter.setPen(this.getSeriesPen());
     painter.drawPath(curve);
   }
   if (this.getMethod() == WPaintedWidget.Method.HtmlCanvas) {
     WApplication app = WApplication.getInstance();
     StringBuilder ss = new StringBuilder();
     ss.append("new Wt3_3_5.WAxisSliderWidget(")
         .append(app.getJavaScriptClass())
         .append(",")
         .append(this.getJsRef())
         .append(",")
         .append(this.getObjJsRef())
         .append(",")
         .append("{chart:")
         .append(this.chart_.getCObjJsRef())
         .append(",transform:")
         .append(this.transform_.getJsRef())
         .append(",rect:function(){return ")
         .append(rect.getJsRef())
         .append("},drawArea:")
         .append(drawArea.getJsRef())
         .append(",series:")
         .append(this.seriesColumn_)
         .append("});");
     this.doJavaScript(ss.toString());
   }
   Utils.copyList(segmentsBak, this.chart_.getAxis(Axis.XAxis).segments_);
   this.chart_.getAxis(Axis.XAxis).renderInterval_ = renderIntervalBak;
 }
コード例 #13
0
ファイル: WAxisSliderWidget.java プロジェクト: sebap/jwt
 protected void render(EnumSet<RenderFlag> flags) {
   super.render(flags);
   WApplication app = WApplication.getInstance();
   app.loadJavaScript("js/WAxisSliderWidget.js", wtjs1());
 }