|
@@ -8,34 +8,179 @@
|
|
|
*/
|
|
|
package com.github.aachartmodel.aainfographics.aaoptionsmodel
|
|
|
|
|
|
-import com.github.aachartmodel.aainfographics.aachartcreator.AAChartFontWeightType
|
|
|
-
|
|
|
|
|
|
class AAStyle {
|
|
|
+ var background: String? = null
|
|
|
+ var backgroundColor: String? = null
|
|
|
+ var border: String? = null
|
|
|
+ var borderRadius: String? = null
|
|
|
+ var color: String? = null
|
|
|
+ var cursor: String? = null
|
|
|
+ var fontFamily: String? = null
|
|
|
+ var fontSize: String? = null
|
|
|
+ var fontWeight: String? = null
|
|
|
+ var height: Number? = null
|
|
|
+ var lineWidth: Number? = null
|
|
|
+ var opacity: Number? = null
|
|
|
+ var padding: String? = null
|
|
|
+ var pointerEvents: String? = null
|
|
|
+ var position: String? = null
|
|
|
+ var textAlign: String? = null
|
|
|
+ var textDecoration: String? = null
|
|
|
+ var textOutline: String? = null
|
|
|
+ var textOverflow: String? = null
|
|
|
+ var top: String? = null
|
|
|
+ var transition: String? = null
|
|
|
+ var whiteSpace: String? = null
|
|
|
+ var width: Number? = null
|
|
|
+ fun background(prop: String?): AAStyle {
|
|
|
+ background = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun backgroundColor(prop: String?): AAStyle {
|
|
|
+ backgroundColor = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
|
|
|
- private var color: String? = null
|
|
|
- private var fontSize: String? = null
|
|
|
- private var fontWeight: String? = null
|
|
|
- private var textOutline: String? = null
|
|
|
+ fun border(prop: String?): AAStyle {
|
|
|
+ border = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun borderRadius(prop: Number?): AAStyle {
|
|
|
+ borderRadius = prop.toString() + "px"
|
|
|
+ return this
|
|
|
+ }
|
|
|
|
|
|
fun color(prop: String?): AAStyle {
|
|
|
color = prop
|
|
|
return this
|
|
|
}
|
|
|
|
|
|
- fun fontSize(prop: Float?): AAStyle {
|
|
|
- fontSize = "${prop}px"
|
|
|
+ fun cursor(prop: String?): AAStyle {
|
|
|
+ cursor = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun fontFamily(prop: String?): AAStyle {
|
|
|
+ fontFamily = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun fontSize(prop: Number?): AAStyle {
|
|
|
+ fontSize = prop.toString() + "px"
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun fontWeight(prop: String?): AAStyle {
|
|
|
+ fontWeight = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun height(prop: Number?): AAStyle {
|
|
|
+ height = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun lineWidth(prop: Number?): AAStyle {
|
|
|
+ lineWidth = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun opacity(prop: Number?): AAStyle {
|
|
|
+ opacity = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun padding(prop: String?): AAStyle {
|
|
|
+ padding = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun pointerEvents(prop: String?): AAStyle {
|
|
|
+ pointerEvents = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun position(prop: String?): AAStyle {
|
|
|
+ position = prop
|
|
|
return this
|
|
|
}
|
|
|
|
|
|
- fun fontWeight(prop: AAChartFontWeightType?): AAStyle {
|
|
|
- fontWeight = prop?.value
|
|
|
+ fun textAlign(prop: String?): AAStyle {
|
|
|
+ textAlign = prop
|
|
|
return this
|
|
|
}
|
|
|
|
|
|
- fun textOutline(prop: String): AAStyle {
|
|
|
+ fun textDecoration(prop: String?): AAStyle {
|
|
|
+ textDecoration = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun textOutline(prop: String?): AAStyle {
|
|
|
textOutline = prop
|
|
|
return this
|
|
|
}
|
|
|
|
|
|
+ fun textOverflow(prop: String?): AAStyle {
|
|
|
+ textOverflow = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun top(prop: String?): AAStyle {
|
|
|
+ top = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun transition(prop: String?): AAStyle {
|
|
|
+ transition = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun whiteSpace(prop: String?): AAStyle {
|
|
|
+ whiteSpace = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ fun width(prop: Number?): AAStyle {
|
|
|
+ width = prop
|
|
|
+ return this
|
|
|
+ }
|
|
|
+
|
|
|
+ companion object {
|
|
|
+ fun style(
|
|
|
+ color: String?
|
|
|
+ ): AAStyle {
|
|
|
+ return style(color, null)
|
|
|
+ }
|
|
|
+
|
|
|
+ fun style(
|
|
|
+ color: String?,
|
|
|
+ fontSize: Float?
|
|
|
+ ): AAStyle {
|
|
|
+ return style(color, fontSize, null)
|
|
|
+ }
|
|
|
+
|
|
|
+ fun style(
|
|
|
+ color: String?,
|
|
|
+ fontSize: Float?,
|
|
|
+ fontWeight: String?
|
|
|
+ ): AAStyle {
|
|
|
+ return style(color, fontSize, fontWeight, null)
|
|
|
+ }
|
|
|
+
|
|
|
+ fun style(
|
|
|
+ color: String?,
|
|
|
+ fontSize: Float?,
|
|
|
+ fontWeight: String?,
|
|
|
+ textOutline: String?
|
|
|
+ ): AAStyle {
|
|
|
+ return AAStyle()
|
|
|
+ .color(color)
|
|
|
+ .fontSize(fontSize)
|
|
|
+ .fontWeight(fontWeight)
|
|
|
+ .textOutline(textOutline)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|