public VLayout createSldEditorLayout ( ) { final VLayout vLayout = new VLayout ( ) ; toolStrip = new ToolStrip ( ) ; toolStrip . setWidth100 ( ) ; codeMirrorPanel = new CodeMirrorPanel ( ) ; WidgetCanvas canvas = new WidgetCanvas ( codeMirrorPanel ) ; canvas . setWidth100 ( ) ; canvas . setHeight100 ( ) ; vLayout . addMember ( toolStrip ) ; vLayout . addMember ( canvas ) ; ToolStripButton saveButton = new ToolStripButton ( ) ; saveButton . setIcon ( "[ISOMORPHIC]/" + "icons/silk/disk.png" ) ; saveButton . setTitle ( msg . saveButtonTitle ( ) ) ; saveButton . setTooltip ( msg . saveButtonTooltip ( ) ) ; saveButton . addClickHandler ( new ClickHandler ( ) { @ Override public void onClick ( ClickEvent clickEvent ) { presenter . onSaveButton ( ) ; } } ) ; ToolStripButton cancelButton = new ToolStripButton ( ) ; cancelButton . setIcon ( "[ISOMORPHIC]/" + "icons/silk/cancel.png" ) ; cancelButton . setTitle ( msg . cancelButtonTitle ( ) ) ; cancelButton . addClickHandler ( new ClickHandler ( ) { @ Override public void onClick ( ClickEvent clickEvent ) { presenter . onCancelButton ( ) ; } } ) ; ToolStripButton validateButton = new ToolStripButton ( ) ; validateButton . setIcon ( "[ISOMORPHIC]/" + "icons/silk/tick.png" ) ; validateButton . setTitle ( msg . validateButtonTitle ( ) ) ; validateButton . setTooltip ( msg . validateButtonTooltip ( ) ) ; validateButton . addClickHandler ( new ClickHandler ( ) { @ Override public void onClick ( ClickEvent clickEvent ) { presenter . onValidateButton ( ) ; } } ) ; ToolStripButton formatBtn = new ToolStripButton ( ) ; formatBtn . setIcon ( "[ISOMORPHIC]/" + "icons/silk/text_align_left.png" ) ; formatBtn . setTitle ( msg . formatButtonTitle ( ) ) ; formatBtn . setTooltip ( msg . formatButtonTooltip ( ) ) ; formatBtn . addClickHandler ( new ClickHandler ( ) { public void onClick ( ClickEvent event ) { presenter . onFormatButton ( ) ; } } ) ; selectTemplate = new SelectItem ( ) ; selectTemplate . setTitle ( msg . templateSelectTitle ( ) ) ; selectTemplate . setTooltip ( msg . templateSelectTooltip ( ) ) ; selectTemplate . setWidth ( 200 ) ; selectTemplate . addChangeHandler ( new ChangeHandler ( ) { @ Override public void onChange ( ChangeEvent changeEvent ) { presenter . onTemplateSelect ( ( String ) changeEvent . getValue ( ) ) ; } } ) ; toolStrip . addFormItem ( selectTemplate ) ; toolStrip . addButton ( saveButton ) ; toolStrip . addButton ( validateButton ) ; toolStrip . addButton ( formatBtn ) ; /* * toolStrip.addSeparator(); toolStrip.addButton(saveButton); */ toolStrip . addFill ( ) ; toolStrip . addButton ( cancelButton ) ; return vLayout ; }
Create the Sld Editor layout and attach handlers to the actions .