# HG changeset patch # User vrany # Date 1312494051 -7200 # Node ID 4201cd16dc0b61f75a4b6e6c20534990f44048a5 # Parent 832d4efd0e92d44e53dde675f8a0227a3f975c1f Improvements in SmallLint UI diff -r 832d4efd0e92 -r 4201cd16dc0b Tools__LintRuleDetail.st --- a/Tools__LintRuleDetail.st Thu Aug 04 23:36:21 2011 +0200 +++ b/Tools__LintRuleDetail.st Thu Aug 04 23:40:51 2011 +0200 @@ -28,10 +28,10 @@ "{ NameSpace: Tools }" ApplicationModel subclass:#LintRuleDetail - instanceVariableNames:'ruleHolder' - classVariableNames:'' - poolDictionaries:'' - category:'Interface-Lint' + instanceVariableNames:'ruleHolder rationaleVisibleHolder' + classVariableNames:'' + poolDictionaries:'' + category:'Interface-Lint' ! !LintRuleDetail class methodsFor:'documentation'! @@ -89,26 +89,14 @@ label: 'SmalllintRuleDetail' name: 'SmalllintRuleDetail' min: (Point 10 10) - bounds: (Rectangle 0 0 300 300) + bounds: (Rectangle 0 0 560 300) ) component: (SpecCollection collection: ( - (LabelSpec - label: 'Name...' - name: 'Name' - layout: (LayoutFrame 0 0 0 0 0 1 30 0) - translateLabel: true - labelChannel: ruleNameAspect - adjust: left - ) - (DividerSpec - name: 'Separator1' - layout: (LayoutFrame 0 0 30 0 0 1 31 0) - ) (VerticalPanelViewSpec name: 'Panel' - layout: (LayoutFrame 0 0 32 0 0 1 0 1) + layout: (LayoutFrame 0 0 0 0 0 1 0 1) horizontalLayout: fit verticalLayout: topSpaceFit horizontalSpace: 0 @@ -116,9 +104,35 @@ component: (SpecCollection collection: ( + (ViewSpec + name: 'Label' + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Name...' + name: 'Name' + layout: (LayoutFrame 20 0 0 0 -150 1 30 0) + translateLabel: true + labelChannel: ruleNameAspect + adjust: left + ) + (CheckBoxSpec + label: 'Show Rationale' + name: 'CheckBox1' + layout: (LayoutFrame -150 1 0 0 0 1 30 0) + model: rationaleVisibleHolder + translateLabel: true + ) + ) + + ) + extent: (Point 560 30) + ) (HTMLViewSpec name: 'Rationale' level: 0 + visibilityChannel: rationaleVisibleHolder hasHorizontalScrollBar: true hasVerticalScrollBar: true htmlText: ruleRationaleAspect @@ -156,6 +170,37 @@ !LintRuleDetail methodsFor:'aspects'! +rationaleVisibleHolder + "return/create the 'rationaleVisibleHolder' value holder (automatically generated)" + + rationaleVisibleHolder isNil ifTrue:[ + rationaleVisibleHolder := ValueHolder with: false. + rationaleVisibleHolder addDependent:self. + ]. + ^ rationaleVisibleHolder + + "Modified: / 04-08-2011 / 21:39:51 / Jan Vrany " +! + +rationaleVisibleHolder:something + "set the 'rationaleVisibleHolder' value holder (automatically generated)" + + |oldValue newValue| + + rationaleVisibleHolder notNil ifTrue:[ + oldValue := rationaleVisibleHolder value. + rationaleVisibleHolder removeDependent:self. + ]. + rationaleVisibleHolder := something. + rationaleVisibleHolder notNil ifTrue:[ + rationaleVisibleHolder addDependent:self. + ]. + newValue := rationaleVisibleHolder value. + oldValue ~~ newValue ifTrue:[ + self update:#value with:newValue from:rationaleVisibleHolder. + ]. +! + ruleHolder "return/create the 'ruleHolder' value holder (automatically generated)" @@ -165,10 +210,23 @@ ^ ruleHolder ! -ruleHolder:aValueModel +ruleHolder:something "set the 'ruleHolder' value holder (automatically generated)" - ruleHolder := aValueModel. + |oldValue newValue| + + ruleHolder notNil ifTrue:[ + oldValue := ruleHolder value. + ruleHolder removeDependent:self. + ]. + ruleHolder := something. + ruleHolder notNil ifTrue:[ + ruleHolder addDependent:self. + ]. + newValue := ruleHolder value. + oldValue ~~ newValue ifTrue:[ + self update:#value with:newValue from:ruleHolder. + ]. ! ruleNameAspect @@ -203,20 +261,85 @@ "Modified: / 05-02-2010 / 12:51:42 / Jan Vrany " ! ! +!LintRuleDetail methodsFor:'change & update'! + +update:something with:aParameter from:changedObject + "Invoked when an object that I depend upon sends a change notification." + + changedObject == ruleHolder ifTrue:[ + self updateVisibility. + ^ self. + ]. + changedObject == rationaleVisibleHolder ifTrue:[ + self updateVisibility. + ^ self. + ]. + super update:something with:aParameter from:changedObject + + "Modified: / 04-08-2011 / 21:31:13 / Jan Vrany " +! + +updateVisibility + + self ruleHolder value notNil + ifTrue:[self show] + ifFalse:[self hide] + + "Created: / 04-08-2011 / 16:39:09 / Jan Vrany " +! ! + +!LintRuleDetail methodsFor:'private'! + +hide + + self visibility: false height: 0 + + "Created: / 11-03-2010 / 09:07:24 / Jan Vrany " +! + +show + + self visibility: true height: (self rationaleVisibleHolder value ifTrue:[130] ifFalse:[30]) + + "Created: / 11-03-2010 / 09:07:24 / Jan Vrany " +! + +visibility: visibility height: height + | container list detail h | + (container := self window container) ifNil:[^self]. + h := visibility ifFalse:[0] ifTrue:[height]. + + container isVisible == visibility ifFalse: + [container isVisible: visibility]. + + + list := container container subViews first. + detail := container container subViews second. + + (list layout bottomOffset ~= height negated) ifTrue: + [list layout: + (list layout bottomOffset: height negated; yourself)]. + (detail layout topOffset ~= height negated) ifTrue: + [detail layout: + (detail layout topOffset: height negated; yourself)]. + + "Created: / 11-03-2010 / 09:51:26 / Jan Vrany " + !LintRuleDetail methodsFor:'initialization'! setupHTMLView:aView aView painter - leftMargin:5; + leftMargin:20; topMargin:5. "Created: / 04-08-2011 / 18:00:36 / cg" + ! ! !LintRuleDetail class methodsFor:'documentation'! version_CVS - ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleDetail.st,v 1.3 2011-08-04 19:20:24 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleDetail.st,v 1.4 2011-08-04 21:40:51 vrany Exp $' ! version_SVN