Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#5945 closed enhancement (fixed)

BorderContainer has hard coded class names

Reported by: dante Owned by: Adam Peller
Priority: high Milestone: 1.1
Component: Dijit Version: 1.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

refs #5941 - BorderContainer has fixed class dijit.layout._Splitter hard coded.

propose

splitterClass="dijit.layout._Splitter" 

and

var c = dojo.getObject(this.splitterClass);
new c({});

in _setupChild of BorderContainer

This allows the user to override the splitter to have things like a close button, or support closing on double-click, etc. Maybe more esoteric things like a setCenter() method that moves a splitter to the 50% point of the BorderContainer?.

Attachments (1)

borderContainer.patch (1.1 KB) - added by dante 11 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 11 years ago by bill

Description: modified (diff)
Owner: set to Adam Peller

Hmm, I guess this makes sense.

Changed 11 years ago by dante

Attachment: borderContainer.patch added

comment:2 Changed 11 years ago by Adam Peller

Milestone: 1.21.1

comment:3 Changed 11 years ago by dante

Resolution: fixed
Status: newclosed

(In [12891]) fixes #5945 - !strict - uber-safe bordercontainer patch to allow users to extend the splitter used without having to extended and subclass bordercontainer

comment:4 Changed 11 years ago by mjvestal

I do not understand how to set _splitterClass because it is private. I was hoping to be able to declare it like this:

<div id="main" persist="false" dojoType="dijit.layout.BorderContainer?" splitterClass="dijit.layout.MySplitter?">

However this does not work without changing _splitterClass to splitterClass and this._splitterClass to this.splitterClass.

comment:5 Changed 11 years ago by bill

Description: modified (diff)

Hmm yeah the checkin comment is inaccurate. Since the parser ignores private attributes the only way I see is to create your BorderContainer programatically, or to make a subclass. Still, creating a subclass is simple, you could even do it with dijit.Declaration.

comment:6 Changed 11 years ago by dante

yes I meant programatically. It was decided to make it private to not commit to the API (also using strings I'm not proud of, should accept direct class references and convert from string is found on the attribute by parser or something)

you could also delegate?

my.Thinger = dojo.delegate(dijit.layout.BorderContainer?, { _splitterClass:... }) new my.Thinger();

comment:7 Changed 11 years ago by mjvestal

I'm sorry if I'm being thick, but can I do it with dijit.Declaration declaratively?

I tried

var myThinger = {_splitterClass: "rajit.layout.SashSplitter"};

<div dojoType="dijit.Declaration" widgetClass="rajit.layout.BorderContainer" 
	mixins="dijit.layout.BorderContainer" attributeMap="myThinger"
></div>

<div id="pageContainer" dojoType="rajiit.layout.BorderContainer"....

I also tried using the "replaceVars" property instead of the "attributeMap" property.

comment:8 Changed 11 years ago by bill

I was thinking something like:

<div dojoType="dijit.Declaration" widgetClass="rajit.layout.BorderContainer" 
	mixins="dijit.layout.BorderContainer" 
        defaults="{ _splitterClass: 'rajit.layout.SashSplitter' }"
></div>
Note: See TracTickets for help on using tickets.