Lively Kernel canvas
// general spec of location?
if (submorph.isEpimorph) return;
this.layout(supermorph);
this.adjustShapeBoundsToSubmorphBounds(supermorph)
},
afterRemoveMorph: function($super, supermorph, submorph) {
if (submorph.isEpimorph) return;
this.layout(supermorph);
this.adjustShapeBoundsToSubmorphBounds(supermorph)
supermorph.layoutChanged();
},
submorphExtentChanged: function(supermorph, submorph) {
if (submorph.isEpimorph) return;
var newExtent = submorph.getExtent();
var cachedExtent = this.getCachedExtent(supermorph, submorph)
if (!cachedExtent || !(cachedExtent.eqPt(newExtent))) {
this.setCachedExtent(supermorph, submorph, newExtent)
this.layout(supermorph);
this.adjustShapeBoundsToSubmorphBounds(supermorph);
}
},
layout: function($super, supermorph, submorph) {
// console.log('full layout ' + supermorph.id());
// logStack();
$super(supermorph, submorph)
}
}
VerticalLayout.subclass('VerticalShrinkLayout', ShrinkTrait);
Object.extend(VerticalShrinkLayout, {
fromLiteral: function(literal) { return new this() }
})
HorizontalLayout.subclass('HorizontalShrinkLayout', ShrinkTrait)
Object.extend(HorizontalShrinkLayout, {
fromLiteral: function(literal) { return new this() }
})
// splitArrayIntoPiecesOfLength([1,2,3,4,5,6,7], 3) -> [[1, 2, 3], [4, 5, 6], [7]]
splitArrayIntoPiecesOfLength = function(array, n) {
return array.inject([[]], function(a, ea) {
var last = a.last()
if(last.length == n) {
last = [];
a.push(last)
}
last.push(ea)
return a
})
}
BoxMorph.subclass("ShrinkBoxMorph", {
layoutManager: new HorizontalShrinkLayout(),
style: {fill: Color.white, fillOpacity: 0},
layoutChanged: function($super) {
$super();
if (this.owner && this.owner.submorphExtentChanged)
this.owner.submorphExtentChanged(this);
},
submorphExtentChanged: function(submorph) {
if (this.layoutManager && this.layoutManager.submorphExtentChanged)
this.layoutManager.submorphExtentChanged(this, submorph)
},
})
ShrinkBoxMorph.subclass("ResourceNodeMorph", {
defaultExtent: pt(120,40),
padding: new Rectangle(5,5,0,0),
margin: new Rectangle(5,3,0,0),
style: {fill: Color.blue.darker(), borderColor: null, borderWidth: 0, fillOpacity: 0.3, borderRadius: 10},
dirsInRow: 4,
filesInRow: 8,
initialize: function($super, url, optPosition, optLevel) {
var pos = optPosition || pt(0,0);
$super(pos.extent(this.defaultExtent))
this.label = new TextMorph(new Rectangle(0,0,100,20)).beLabel();
this.addMorph(this.label)
this.url = url
this.setupConnections()
this.layoutManager = new VerticalShrinkLayout();
this.helpText = url.toString()
},
setupConnections: function() {
connect(this, "url", this.label, 'setTextString', {converter: function(value) {
if (value instanceof URL)
return value.filename()
else
return "no valid url"
}}).update(this.url)
},
expand: function(depth, level) {
if (depth === 0)
return;
if (depth === undefined)
depth = 1;
if (!this.url) return;
var childDirs = new WebResource(this.url).getSubElements(1).subCollections
splitArrayIntoPiecesOfLength(childDirs, this.dirsInRow).each(function(children) {
var rowMorph = new ShrinkBoxMorph();
children.each(function(ea) {
var m = new ResourceNodeMorph(ea.getURL(), undefined ,this.level + 1);
m.expand(depth - 1)
rowMorph.addMorph(m)
}, this)
this.addMorph(rowMorph)
}, this)
var leafChildren = new WebResource(this.url).getSubElements(1).subDocuments
var leafChildrenRows = splitArrayIntoPiecesOfLength(leafChildren, this.filesInRow);
leafChildrenRows.each(function(eaRow) {
var rowMorph = new ShrinkBoxMorph();
eaRow.each(function(ea) {
var m = new ResourceNodeMorph(ea.getURL(), undefined , this.level + 1);
m.submorphExtentChanged(m.label)
rowMorph.addMorph(m)
}, this);
this.addMorph(rowMorph)
}, this);
},
getHelpText: function() {
return this.helpText
}
})
]]>
AlternativeWikiVisualization40
Wikicontroltruetrue
webwerkstatt/falsenulltrue51.23296650118333
media/falsenulltrue17.451858789480823
contextjs/falsenulltrue25.499048351651325
papers/6falsenulltrue-Infinity
robert/falsenulltrue40.13572066704308
fabrik/falsenulltrue20.91759469228055
draft/falsenulltrue44.33467673805228
LivelyHPImgzn/falsenulltrue21.806000578467813
apps/falsenulltrue19.479184330021646
lively/falsenulltrue37.84425189170974
BWINF/falsenulltrue35.08366141256163
demos/falsenulltrue33.08078579849177
AgileSoftwareentwicklung/falsenulltrue35.40022280963326
bin/3falsenulltrue-Infinity
benchmarks/falsenulltrue23.871936349478183
cop/falsenulltrue13.986122886681098
roadmap/falsenulltrue26.502401828962082
ProjectSeminar2010/falsenulltrue38.74172871950034
projects/falsenulltrue40.42184321643065
swa/falsenulltrue8.49306144334055
sandbox/falsenulltrue19.479184330021646
jens/falsenulltrue35.97890256980656
Tests/falsenulltrue28.019731529727295
ometa/falsenulltrue3
issues/falsenulltrue19.83647914993237
webcollab-integration/falsenulltrue22.944920232821374
MediaUpload.xhtmlfalsenulltrue13.986122886681098
webwerkstatt.xhtmlfalsenulltrue21.05458956322112
runTests.xhtmlfalsenulltrue22.250738008550293
blank.xhtmlfalsenulltrue13.986122886681098
migration.xhtmlfalsenulltrue22.56011502714073
authfalsenulltrue16.19528664807629
update.xhtmlfalsenulltrue24.452297205741957
Makefilefalsenulltrue13.39720770839918
diff.shfalsenulltrue3
changes.xhtmlfalsenulltrue8.49306144334055
nulltrue//META:developedclassandexampleinoneplacetoincreasedevelopmentroundtripevenfurther//pressingalt+s,createsnewcodeandrecreatesexampleResourceNodeMorph.addMethods({padding:newRectangle(5,5,0,0),margin:newRectangle(5,3,0,0),style:{fill:Color.blue.darker(),borderColor:null,borderWidth:0,fillOpacity:0.3,borderRadius:10},dirsInRow:6,filesInRow:8,})if($morph('treeWikiViz'))$morph('treeWikiViz').remove()varurl=newURL('http://lively-kernel.org/repository/webwerkstatt/')m=newResourceNodeMorph(url,pt(50,100));m.name='treeWikiViz';m.expand(1);//depth....m.openInWorld()//andstartcoloring....m.withAllSubmorphsDo(function(){varea=this;if(!(ea.urlinstanceofURL))return;varr=newWebResource(ea.url).beAsync();connect(r,'versions',ea,'versions');connect(ea,'versions',ea,'helpText',{converter:function(value){varlast=value[0];if(!last)return"noversionsfor"+this.getTargetObj().url.toString();returnthis.getTargetObj().url.toString()+'\n'+value.length+"versions\n"+last.date+'\n'+last.author}});connect(ea,'versions',ea,'lastVersion',{converter:function(value){returnvalue[0]}});connect(ea,'lastVersion',ea,'setFill',{converter:function(value){vardays=(Date.now()-value.date)/1000/3600/24returnColor.rgb(155-(days*10),0,(days*10)-100)}});connect(ea,'versions',ea.label,'nothing',{updater:function($proceed,value){this.getTargetObj().setFontSize(3+(Math.log(value.length)*5))this.getSourceObj().submorphExtentChanged(this.getTargetObj())}});r.getVersions()})truetruefalsetruetrue
false00.11truefalsetruetrue
nullfalsetruenull
Codefalsenulltruefalse
false
false
falsenullfalsefalsenullnullnullnullfalse
dismissallfalsenulltruefalsetrue
Xfalsenulltruefalsetrue
serializing....16nullnull82