Changeset 78:4ac9946b9fb5

Show
Ignore:
Timestamp:
05/24/08 02:33:56 (6 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Forms work with first test

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwtx/jface/fieldassist/FieldDecorationRegistry.d

    r42 r78  
    106106     * Declare images and decorations immediately. 
    107107     */ 
    108     static this() { 
     108    private static void static_this(FieldDecorationRegistry reg) { 
    109109        ImageRegistry imageRegistry = JFaceResources.getImageRegistry(); 
    110110 
     
    129129        // Define the standard decorations. Some do not have standard 
    130130        // descriptions. Use null in these cases. 
    131         getDefault() 
     131        reg 
    132132                .registerFieldDecoration( 
    133133                        DEC_CONTENT_PROPOSAL, 
     
    136136                        IMG_DEC_FIELD_CONTENT_PROPOSAL, imageRegistry); 
    137137 
    138         getDefault().registerFieldDecoration( 
     138        reg.registerFieldDecoration( 
    139139                DEC_ERROR, 
    140140                JFaceResources 
     
    142142                IMG_DEC_FIELD_ERROR, imageRegistry); 
    143143 
    144         getDefault().registerFieldDecoration( 
     144        reg.registerFieldDecoration( 
    145145                DEC_ERROR_QUICKFIX, 
    146146                JFaceResources 
     
    148148                IMG_DEC_FIELD_ERROR_QUICKFIX, imageRegistry); 
    149149 
    150         getDefault().registerFieldDecoration(DEC_WARNING, null, 
     150        reg.registerFieldDecoration(DEC_WARNING, null, 
    151151                IMG_DEC_FIELD_WARNING, imageRegistry); 
    152152 
    153         getDefault().registerFieldDecoration(DEC_INFORMATION, null, 
     153        reg.registerFieldDecoration(DEC_INFORMATION, null, 
    154154                IMG_DEC_FIELD_INFO, imageRegistry); 
    155155 
    156         getDefault() 
     156        reg 
    157157                .registerFieldDecoration( 
    158158                        DEC_REQUIRED, 
     
    233233    public static FieldDecorationRegistry getDefault() { 
    234234        if (defaultInstance is null) { 
    235             defaultInstance = new FieldDecorationRegistry(); 
     235            synchronized(FieldDecorationRegistry.classinfo){ 
     236                if (defaultInstance is null) { 
     237                    defaultInstance = new FieldDecorationRegistry(); 
     238                    static_this(defaultInstance); 
     239                } 
     240            } 
    236241        } 
    237242        return defaultInstance; 
  • dwtx/jface/resource/ColorRegistry.d

    r72 r78  
    183183 
    184184        Assert.isNotNull(symbolicName); 
    185         auto result1 = stringToColor.get(symbolicName); 
     185        auto result1 = ( stringToColor.containsKey(symbolicName) ? stringToColor.get(symbolicName) : null ); 
    186186        if (result1 !is null) { 
    187187            return result1; 
     
    190190        Color color = null; 
    191191 
    192         auto result = stringToRGB.get(symbolicName); 
     192        auto result = ( stringToRGB.containsKey(symbolicName) ? stringToRGB.get(symbolicName) : null ); 
    193193        if (result is null) { 
    194194            return null; 
  • dwtx/jface/resource/JFaceResources.d

    r72 r78  
    3838import dwt.dwthelper.ResourceBundle; 
    3939import tango.text.convert.Format; 
     40import tango.util.log.Trace; 
    4041/** 
    4142 * Utility methods to access JFace-specific resources. 
     
    228229                    reg = mgr; 
    229230                    toQuery_ = d; 
     231                    Trace.formatln( " {} {}", d, reg ); 
    230232                    registries.add(d, reg); 
    231233                } 
  • dwtx/ui/forms/FormColors.d

    r75 r78  
    259259    public Color createColor(String key, int r, int g, int b) { 
    260260        Color c = new Color(display, r, g, b); 
    261         Color prevC = cast(Color) colorRegistry.get(key); 
     261        Color prevC = cast(Color) (colorRegistry.containsKey(key) ? colorRegistry.get(key) : null ); 
    262262        if (prevC !is null) 
    263263            prevC.dispose(); 
  • dwtx/ui/forms/widgets/SharedScrolledComposite.d

    r75 r78  
    231231    } 
    232232 
     233    private void handleScheduleReflow(bool flushCache) { 
     234        if (!isDisposed()) 
     235            reflow(flushCache); 
     236        reflowPending = false; 
     237    } 
    233238    private void scheduleReflow(bool flushCache) { 
    234239        if (delayedReflow) { 
     
    237242                return; 
    238243            } 
    239             getDisplay().asyncExec( dgRunnable( (bool flushCache) { 
    240                 if (!isDisposed()) 
    241                     reflow(flushCache); 
    242                 reflowPending = false; 
    243             }, flushCache)); 
     244            getDisplay().asyncExec( dgRunnable( &handleScheduleReflow, flushCache)); 
    244245            reflowPending = true; 
    245246        } else 
  • dwtx/ui/internal/forms/MessageManager.d

    r76 r78  
    101101    } 
    102102 
    103     private static String[] SINGLE_MESSAGE_SUMMARY_KEYS; 
    104     private static String[] MULTIPLE_MESSAGE_SUMMARY_KEYS; 
    105  
    106     static this(){ 
    107         SINGLE_MESSAGE_SUMMARY_KEYS = [ 
    108             Messages.MessageManager_sMessageSummary, 
    109             Messages.MessageManager_sMessageSummary, 
    110             Messages.MessageManager_sWarningSummary, 
    111             Messages.MessageManager_sErrorSummary ]; 
    112  
    113         MULTIPLE_MESSAGE_SUMMARY_KEYS = [ 
    114             Messages.MessageManager_pMessageSummary, 
    115             Messages.MessageManager_pMessageSummary, 
    116             Messages.MessageManager_pWarningSummary, 
    117             Messages.MessageManager_pErrorSummary ]; 
     103    private static String[] SINGLE_MESSAGE_SUMMARY_KEYS_; 
     104    private static String[] SINGLE_MESSAGE_SUMMARY_KEYS(){ 
     105        if( SINGLE_MESSAGE_SUMMARY_KEYS_ is null ){ 
     106            synchronized(MessageManager.classinfo){ 
     107                if( SINGLE_MESSAGE_SUMMARY_KEYS_ is null ){ 
     108                    SINGLE_MESSAGE_SUMMARY_KEYS_ = [ 
     109                        Messages.MessageManager_sMessageSummary, 
     110                        Messages.MessageManager_sMessageSummary, 
     111                        Messages.MessageManager_sWarningSummary, 
     112                        Messages.MessageManager_sErrorSummary ]; 
     113                } 
     114            } 
     115        } 
     116        return SINGLE_MESSAGE_SUMMARY_KEYS_; 
     117    } 
     118 
     119    private static String[] MULTIPLE_MESSAGE_SUMMARY_KEYS_; 
     120    private static String[] MULTIPLE_MESSAGE_SUMMARY_KEYS(){ 
     121        if( MULTIPLE_MESSAGE_SUMMARY_KEYS_ is null ){ 
     122            synchronized(MessageManager.classinfo){ 
     123                if( MULTIPLE_MESSAGE_SUMMARY_KEYS_ is null ){ 
     124                    MULTIPLE_MESSAGE_SUMMARY_KEYS_ = [ 
     125                        Messages.MessageManager_pMessageSummary, 
     126                        Messages.MessageManager_pMessageSummary, 
     127                        Messages.MessageManager_pWarningSummary, 
     128                        Messages.MessageManager_pErrorSummary ]; 
     129                } 
     130            } 
     131        } 
     132        return MULTIPLE_MESSAGE_SUMMARY_KEYS_; 
    118133    } 
    119134 
  • dwtx/ui/internal/forms/widgets/FormTextModel.d

    r75 r78  
    2020import dwtx.ui.internal.forms.widgets.ImageSegment; 
    2121import dwtx.ui.internal.forms.widgets.ObjectSegment; 
     22import dwtx.ui.internal.forms.widgets.SWTUtil; 
    2223 
    2324import dwt.DWT; 
     
    2627import dwt.dwthelper.utils; 
    2728import dwt.dwthelper.InputStream; 
    28 pragma(msg,"FIXME temp type "~__FILE__); 
    29 public class FormTextModel { 
    30     public static const String BOLD_FONT_ID = "f.____bold"; //$NON-NLS-1$ 
    31     public this() ; 
    32     public Paragraph[] getParagraphs() ; 
    33     public String getAccessibleText() ; 
    34     public void parseTaggedText(String taggedText, bool expandURLs) ; 
    35     public void parseInputStream(InputStream is_, bool expandURLs) ; 
    36     public void parseRegularText(String regularText, bool convertURLs) ; 
    37     public HyperlinkSettings getHyperlinkSettings() ; 
    38     public void setHyperlinkSettings(HyperlinkSettings settings) ; 
    39     IFocusSelectable[] getFocusSelectableSegments() ; 
    40     public IHyperlinkSegment getHyperlink(int index) ; 
    41     public IHyperlinkSegment findHyperlinkAt(int x, int y) ; 
    42     public int getHyperlinkCount() ; 
    43     public int indexOf(IHyperlinkSegment link) ; 
    44     public ParagraphSegment findSegmentAt(int x, int y) ; 
    45     public void clearCache(String fontId) ; 
    46     public IFocusSelectable getSelectedSegment() ; 
    47     public int getSelectedSegmentIndex() ; 
    48     public bool linkExists(IHyperlinkSegment link) ; 
    49     public bool traverseFocusSelectableObjects(bool next) ; 
    50     public IFocusSelectable getNextFocusSegment(bool next) ; 
    51     public bool restoreSavedLink() ; 
    52     public void selectLink(IHyperlinkSegment link) ; 
    53     public void select(IFocusSelectable selectable) ; 
    54     public bool hasFocusSegments() ; 
    55     public void dispose() ; 
    56     public bool isWhitespaceNormalized() ; 
    57     public void setWhitespaceNormalized(bool whitespaceNormalized) ; 
    58 
    59  
    60 /++ 
     29 
    6130static import tango.text.xml.Document; 
    6231import tango.util.collection.ArraySeq; 
     
    11483        return sbuf.toString(); 
    11584    } 
    116  
     85    public void parseTaggedText(String taggedText, bool expandURLs) { 
     86        implMissing(__FILE__,__LINE__); 
     87    } 
     88    public void parseInputStream(InputStream is_, bool expandURLs) { 
     89        implMissing(__FILE__,__LINE__); 
     90    } 
     91/++ 
    11792    /* 
    11893     * @see ITextModel#parse(String) 
     
    367342        } 
    368343    } 
    369  
     344++/ 
    370345    private void appendText(String value, StringBuffer buf, int[] spaceCounter) { 
    371346        if (!whitespaceNormalized) 
    372347            buf.append(value); 
    373348        else { 
    374             for (int j = 0; j < value.length(); j++) { 
     349            for (int j = 0; j < value.length; j++) { 
    375350                char c = value.charAt(j); 
    376351                if (c is ' ' || c is '\t') { 
     
    402377        return buf.toString(); 
    403378    } 
    404  
     379/++ 
    405380    private String getSingleNodeText(Node node) { 
    406381        return getNormalizedText(node.getNodeValue()); 
     
    546521                colorId); 
    547522    } 
    548  
     523++/ 
    549524    public void parseRegularText(String regularText, bool convertURLs) { 
    550525        reset(); 
     
    559534        int pstart = 0; 
    560535 
    561         for (int i = 0; i < regularText.length(); i++) { 
     536        for (int i = 0; i < regularText.length; i++) { 
    562537            char c = regularText.charAt(i); 
    563538            if (p is null) { 
     
    582557    public HyperlinkSettings getHyperlinkSettings() { 
    583558        // #132723 cannot have null settings 
    584         if (hyperlinkSettingsisnull) 
     559        if (hyperlinkSettings is null) 
    585560            hyperlinkSettings = new HyperlinkSettings(SWTUtil.getStandardDisplay()); 
    586561        return hyperlinkSettings; 
     
    609584            for (int j = 0; j < segments.length; j++) { 
    610585                if (null !is cast(IFocusSelectable)segments[j] ) 
    611                     result ~= segments[j]; 
     586                    result ~= cast(IFocusSelectable)segments[j]; 
    612587            } 
    613588        } 
     
    682657 
    683658    public bool linkExists(IHyperlinkSegment link) { 
    684         if (selectableSegmentsisnull) 
     659        if (selectableSegments is null) 
    685660            return false; 
    686661        for (int i=0; i<selectableSegments.length; i++) { 
     
    744719            return; 
    745720        for (int i = 0; i < selectables.length; i++) { 
    746             if (selectables[i].equals(selectable)) { 
     721            if ((cast(Object)selectables[i]).opEquals(cast(Object)selectable)) { 
    747722                selectedSegmentIndex = i; 
    748723                break; 
     
    780755    } 
    781756} 
    782 ++/ 
  • dwtx/ui/internal/forms/widgets/FormUtil.d

    r77 r78  
    4848 
    4949        public static const int DONE = 0; 
    50  
     50        char[] text; 
     51        static BreakIterator inst; 
    5152        public static BreakIterator getWordInstance() { 
    52             // TODO Auto-generated method stub 
    53             return null; 
    54         } 
     53            if( inst is null ){ 
     54                inst = new BreakIterator; 
     55            } 
     56            return inst; 
     57        } 
     58        uint last = 0; 
    5559 
    5660        public void setText(String text) { 
    57             // TODO Auto-generated method stub 
    58  
    59         } 
    60  
     61            this.text = text; 
     62            last = 0; 
     63        } 
    6164        public int first() { 
    6265            // TODO Auto-generated method stub 
    63             return 0; 
     66            return text.length > 0 ? 1 : 0; 
    6467        } 
    6568 
    6669        public int next() { 
    6770            // TODO Auto-generated method stub 
    68             return 0; 
     71            last++; 
     72            if( last >= text.length ){ 
     73                return DONE; 
     74            } 
     75            return last; 
    6976        } 
    7077 
     
    431438                FormUtil.scrollPage(scomp, false); 
    432439                break; 
     440            default: 
    433441            } 
    434442        }