1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 package ohos.devtools.views.applicationtrace.bean; 17 18 import com.intellij.util.ui.JBUI; 19 import ohos.devtools.views.trace.AbstractNode; 20 import ohos.devtools.views.trace.DField; 21 import ohos.devtools.views.trace.util.Utils; 22 23 import java.awt.Graphics2D; 24 import java.util.Arrays; 25 import java.util.List; 26 27 /** 28 * VsyncAppBean 29 * 30 * @since 2021/5/26 15:38 31 */ 32 public class VsyncAppBean extends AbstractNode { 33 @DField(name = "id") 34 private Integer id; 35 @DField(name = "type") 36 private String type; 37 @DField(name = "track_id") 38 private Integer trackId; 39 @DField(name = "value") 40 private Double value; 41 @DField(name = "startTime") 42 private Long startTime; 43 private Long duration; 44 45 /** 46 * Gets the value of duration . 47 * 48 * @return the value of java.lang.Long 49 */ getDuration()50 public Long getDuration() { 51 return duration; 52 } 53 54 /** 55 * Sets the duration . 56 * <p>You can use getDuration() to get the value of duration</p> 57 * 58 * @param dur duration 59 */ setDuration(final Long dur)60 public void setDuration(final Long dur) { 61 this.duration = dur; 62 } 63 64 /** 65 * Gets the value of id . 66 * 67 * @return the value of java.lang.Integer 68 */ getId()69 public Integer getId() { 70 return id; 71 } 72 73 /** 74 * Sets the id . 75 * <p>You can use getId() to get the value of id</p> 76 * 77 * @param param id 78 */ setId(final Integer param)79 public void setId(final Integer param) { 80 this.id = param; 81 } 82 83 /** 84 * Gets the value of type . 85 * 86 * @return the value of java.lang.String 87 */ getType()88 public String getType() { 89 return type; 90 } 91 92 /** 93 * Sets the type . 94 * <p>You can use getType() to get the value of type</p> 95 * 96 * @param param type 97 */ setType(final String param)98 public void setType(final String param) { 99 this.type = param; 100 } 101 102 /** 103 * Gets the value of trackId . 104 * 105 * @return the value of java.lang.Integer 106 */ getTrackId()107 public Integer getTrackId() { 108 return trackId; 109 } 110 111 /** 112 * Sets the trackId . 113 * <p>You can use getTrackId() to get the value of trackId</p> 114 * 115 * @param param track id 116 */ setTrackId(final Integer param)117 public void setTrackId(final Integer param) { 118 this.trackId = param; 119 } 120 121 /** 122 * Gets the value of value . 123 * 124 * @return the value of java.lang.Double 125 */ getValue()126 public Double getValue() { 127 return value; 128 } 129 130 /** 131 * Sets the value . 132 * <p>You can use getValue() to get the value of value</p> 133 * 134 * @param param value 135 */ setValue(final Double param)136 public void setValue(final Double param) { 137 this.value = param; 138 } 139 140 /** 141 * Gets the value of startTime . 142 * 143 * @return the value of java.lang.Integer 144 */ getStartTime()145 public Long getStartTime() { 146 return startTime; 147 } 148 149 /** 150 * Sets the startTime . 151 * <p>You can use getStartTime() to get the value of startTime</p> 152 * 153 * @param param start time 154 */ setStartTime(final Long param)155 public void setStartTime(final Long param) { 156 this.startTime = param; 157 } 158 159 @Override draw(Graphics2D paint)160 public void draw(Graphics2D paint) { 161 paint.setColor(JBUI.CurrentTheme.Link.linkColor().brighter()); 162 if (value == 0) { 163 paint.drawLine(Utils.getX(rect), Utils.getY(rect) + rect.height - 1, Utils.getX(rect) + rect.width, 164 Utils.getY(rect) + rect.height - 1); 165 } else { 166 paint.drawLine(Utils.getX(rect), Utils.getY(rect), Utils.getX(rect), Utils.getY(rect) + rect.height - 1); 167 paint.drawLine(Utils.getX(rect), Utils.getY(rect), Utils.getX(rect) + rect.width, Utils.getY(rect)); 168 paint.drawLine(Utils.getX(rect) + rect.width, Utils.getY(rect), Utils.getX(rect) + rect.width, 169 Utils.getY(rect) + rect.height - 1); 170 } 171 } 172 173 @Override getStringList(String time)174 public List<String> getStringList(String time) { 175 return Arrays.asList(time, "Value: " + value.intValue()); 176 } 177 } 178