author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 05 Feb 2012 01:49:41 +0000 | |
branch | jv |
changeset 12144 | 18c25ec50d96 |
parent 12128 | a7ff7d66ee85 |
child 12205 | f210b6224ef0 |
permissions | -rw-r--r-- |
" Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague Copyright (c) 2009-2010 eXept Software AG Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " "{ Package: 'stx:libtool' }" "{ NameSpace: Tools }" ApplicationModel subclass:#LintRuleDetail instanceVariableNames:'ruleHolder rationaleVisibleHolder rationalView' classVariableNames:'' poolDictionaries:'' category:'Interface-Lint' ! !LintRuleDetail class methodsFor:'documentation'! copyright " Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague Copyright (c) 2009-2010 eXept Software AG Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " ! ! !LintRuleDetail class methodsFor:'help specs'! flyByHelpSpec "This resource specification was automatically generated by the UIHelpTool of ST/X." "Do not manually edit this!! If it is corrupted, the UIHelpTool may not be able to read the specification." " UIHelpTool openOnClass:Tools::LintRuleDetail " <resource: #help> ^ super flyByHelpSpec addPairsFrom:#( #ruleName 'Click to browse the lint rule' ) "Created: / 07-09-2011 / 04:08:11 / cg" ! ! !LintRuleDetail class methodsFor:'interface specs'! windowSpec "This resource specification was automatically generated by the UIPainter of ST/X." "Do not manually edit this!! If it is corrupted, the UIPainter may not be able to read the specification." " UIPainter new openOnClass:Tools::LintRuleDetail andSelector:#windowSpec Tools::LintRuleDetail new openInterface:#windowSpec Tools::LintRuleDetail open " <resource: #canvas> ^ #(FullSpec name: windowSpec window: (WindowSpec label: 'SmalllintRuleDetail' name: 'SmalllintRuleDetail' min: (Point 10 10) bounds: (Rectangle 0 0 560 300) ) component: (SpecCollection collection: ( (VerticalPanelViewSpec name: 'Panel' layout: (LayoutFrame 0 0 0 0 0 1 0 1) horizontalLayout: fit verticalLayout: topSpaceFit horizontalSpace: 0 verticalSpace: 0 ignoreInvisibleComponents: false component: (SpecCollection collection: ( (ViewSpec name: 'Label' component: (SpecCollection collection: ( (LinkButtonSpec name: 'Button1' layout: (LayoutFrame 0 0 0 0 -150 1 30 0) activeHelpKey: ruleName translateLabel: true labelChannel: ruleNameAspect adjust: left model: browseLintRule ) (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 backgroundColor: (Color 86.9993133440146 86.9993133440146 86.9993133440146) htmlText: ruleRationaleAspect extent: (Point 560 270) postBuildCallback: setupHTMLView: ) ) ) ) ) ) ) ! ! !LintRuleDetail class methodsFor:'plugIn spec'! aspectSelectors "This resource specification was automatically generated by the UIPainter of ST/X." "Do not manually edit this. If it is corrupted, the UIPainter may not be able to read the specification." "Return a description of exported aspects; these can be connected to aspects of an embedding application (if this app is embedded in a subCanvas)." ^ #( #ruleHolder ). ! ! !LintRuleDetail methodsFor:'actions'! browseLintRule |rule ruleClass sel| rule := self ruleHolder value. rule isNil ifTrue:[^ self]. ruleClass := rule class. (ruleClass implements:#rationale) ifTrue:[ sel := #rationale. ]. UserPreferences current systemBrowserClass openInClass:ruleClass selector:sel "Created: / 07-09-2011 / 04:09:38 / cg" ! ! !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 <jan.vrany@fit.cvut.cz>" ! 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)" ruleHolder isNil ifTrue:[ ruleHolder := ValueHolder new. ]. ^ ruleHolder ! ruleHolder:something "set the 'ruleHolder' value holder (automatically generated)" |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 <resource: #uiAspect> |holder| (holder := builder bindingAt:#ruleNameAspect) isNil ifTrue:[ holder := BlockValue with:[:h | "/ h displayString , ' ' , (('[browse]' actionForAll:[ self browseLintRule]) colorizeAllWith:Color blue) h displayString actionForAll:[ self browseLintRule] ] argument: self ruleHolder. builder aspectAt:#ruleNameAspect put:holder. ]. ^ holder. "Modified: / 05-02-2010 / 12:51:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" "Modified: / 07-09-2011 / 04:54:24 / cg" ! ruleRationaleAspect <resource: #uiAspect> |holder| (holder := builder bindingAt:#ruleRationaleAspect) isNil ifTrue:[ holder := (AspectAdaptor forAspect: #rationale) subjectChannel: self ruleHolder. builder aspectAt:#ruleRationaleAspect put:holder. ]. ^ holder. "Modified: / 05-02-2010 / 12:51:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" "Modified (comment): / 07-09-2011 / 04:12:16 / cg" ! ! !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 <jan.vrany@fit.cvut.cz>" ! updateVisibility self ruleHolder value notNil ifTrue:[self show] ifFalse:[self hide]. "Created: / 04-08-2011 / 16:39:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" "Modified: / 04-09-2011 / 20:18:48 / cg" ! ! !LintRuleDetail methodsFor:'initialization'! setupHTMLView:aView rationalView := aView. aView painter leftMargin:20; topMargin:5. "Created: / 04-08-2011 / 18:00:36 / cg" ! ! !LintRuleDetail methodsFor:'private'! heightWhenNotShowingRationale ^ 30 "Created: / 07-09-2011 / 04:02:34 / cg" ! heightWhenShowingRationale ^ 100 "Created: / 07-09-2011 / 04:02:24 / cg" ! hide self visibility: false height: 0 "Created: / 11-03-2010 / 09:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" ! show self visibility: true height: (self rationaleVisibleHolder value ifTrue:[ self heightWhenShowingRationale ] ifFalse:[ self heightWhenNotShowingRationale ]) "Created: / 11-03-2010 / 09:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" "Modified: / 07-09-2011 / 04:03:07 / cg" ! visibility: visibility height: height | container list detail h | (container := self window container) isNil ifTrue:[^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 <jan.vrany@fit.cvut.cz>" "Modified: / 04-09-2011 / 20:15:40 / cg" ! ! !LintRuleDetail class methodsFor:'documentation'! version ^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleDetail.st,v 1.10 2011/09/07 02:54:47 cg Exp $' ! version_CVS ^ '§Header: /cvs/stx/stx/libtool/Tools__LintRuleDetail.st,v 1.10 2011/09/07 02:54:47 cg Exp §' ! version_SVN ^ '$Id: Tools__LintRuleDetail.st 7854 2012-01-30 17:49:41Z vranyj1 $' ! !