-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
384 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
Source/superhuman/components/serviceType/ServiceTypeGrid.hx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
package superhuman.components.serviceType; | ||
|
||
import feathers.skins.RectangleSkin; | ||
import feathers.layout.HorizontalLayoutData; | ||
import feathers.layout.HorizontalLayout; | ||
import feathers.data.GridViewCellState; | ||
import feathers.data.GridViewHeaderState; | ||
import feathers.layout.AnchorLayoutData; | ||
import feathers.utils.DisplayObjectRecycler; | ||
import superhuman.server.data.ServiceTypeData; | ||
import feathers.data.IFlatCollection; | ||
import genesis.application.theme.GenesisApplicationTheme; | ||
import feathers.controls.Label; | ||
import feathers.controls.dataRenderers.LayoutGroupItemRenderer; | ||
import feathers.controls.GridView; | ||
import superhuman.theme.SuperHumanInstallerTheme; | ||
|
||
class ServiceTypeGrid extends GridView | ||
{ | ||
public function new(?dataProvider:IFlatCollection<ServiceTypeData>) | ||
{ | ||
super(dataProvider); | ||
|
||
this.variant = GridView.VARIANT_BORDERLESS; | ||
this.layoutData = AnchorLayoutData.fill(); | ||
|
||
var backgroundSkin = new RectangleSkin(); | ||
backgroundSkin.fill = SolidColor(0x222222); | ||
backgroundSkin.width = 16.0; | ||
backgroundSkin.height = 16.0; | ||
this.backgroundSkin = backgroundSkin; | ||
|
||
this.headerRendererRecycler = DisplayObjectRecycler.withFunction(() -> { | ||
return (new GridViewHeader()); | ||
}, (itemRenderer:GridViewHeader, state:GridViewHeaderState) -> { | ||
itemRenderer.label.text = state.text; | ||
}, | ||
(itemRenderer:GridViewHeader, state:GridViewHeaderState) -> { | ||
itemRenderer.label.text = ""; | ||
}); | ||
|
||
this.cellRendererRecycler = DisplayObjectRecycler.withFunction(() -> { | ||
return (new GridViewColumnMultiline()); | ||
}, (itemRenderer:GridViewColumnMultiline, state:GridViewCellState) -> { | ||
itemRenderer.label.text = state.text; | ||
itemRenderer.label.enabled = state.data.isEnabled; | ||
itemRenderer.enabled = state.data.isEnabled; | ||
state.enabled = state.data.isEnabled; | ||
}, | ||
(itemRenderer:GridViewColumnMultiline, state:GridViewCellState) -> { | ||
itemRenderer.label.text = ""; | ||
}); | ||
} | ||
} | ||
|
||
@:styleContext | ||
class GridViewHeader extends LayoutGroupItemRenderer | ||
{ | ||
private var _label:Label; | ||
public var label(get, never):Label; | ||
private function get_label():Label | ||
{ | ||
return this._label; | ||
} | ||
|
||
override private function initialize():Void | ||
{ | ||
this.variant = SuperHumanInstallerTheme.GRID_VIEW_HEADER_VARIANT; | ||
|
||
var layout = new HorizontalLayout(); | ||
layout.gap = 6.0; | ||
layout.paddingTop = 2.0; | ||
layout.paddingBottom = 4.0; | ||
layout.paddingLeft = 8.0; | ||
layout.paddingRight = 8.0; | ||
layout.verticalAlign = MIDDLE; | ||
this.layout = layout; | ||
|
||
this._label = new Label(); | ||
this._label.variant = GenesisApplicationTheme.LABEL_DEFAULT; | ||
this._label.wordWrap = true; | ||
this._label.layoutData = new HorizontalLayoutData(100, null); | ||
this.addChild(_label); | ||
|
||
super.initialize(); | ||
} | ||
} | ||
|
||
@:styleContext | ||
class GridViewColumnMultiline extends LayoutGroupItemRenderer | ||
{ | ||
private var _label:Label; | ||
public var label(get, never):Label; | ||
private function get_label():Label | ||
{ | ||
return this._label; | ||
} | ||
|
||
override private function initialize():Void | ||
{ | ||
this.variant = SuperHumanInstallerTheme.GRID_VIEW_COLUMN_VARIANT; | ||
|
||
var layout = new HorizontalLayout(); | ||
layout.gap = 6.0; | ||
layout.paddingTop = 2.0; | ||
layout.paddingBottom = 4.0; | ||
layout.paddingLeft = 8.0; | ||
layout.paddingRight = 8.0; | ||
layout.verticalAlign = MIDDLE; | ||
this.layout = layout; | ||
|
||
this._label = new Label(); | ||
this._label.variant = GenesisApplicationTheme.LABEL_DEFAULT; | ||
this._label.wordWrap = true; | ||
this._label.layoutData = new HorizontalLayoutData(100, null); | ||
this.addChild(_label); | ||
|
||
super.initialize(); | ||
} | ||
} |
Oops, something went wrong.