/* Copyright (C) 2000-2005 SKYRIX Software AG This file is part of SOPE. SOPE is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. SOPE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SOPE; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include /* This builder builds various elements from the WOExtensions library. All tags are mapped into the namespace (XMLNS_OD_BIND). Supported tags: maps to JSAlertPanel maps to JSConfirmPanel maps to JSImageFlyover maps to JSTextFlyover maps to JSModalWindow maps to JSValidatedField maps to WOThresholdColoredNumber maps to WOCollapsibleComponentContent maps to WOCheckBoxMatrix maps to WORadioButtonMatrix maps to WODictionaryRepetition maps to WOKeyValueConditional maps to WOTabPanel maps to WOTable maps to WOTableHeader maps to WOTableContent maps to WOTableContextKey //JSKeyHandler : WODynamicElement */ @interface WOxExtElemBuilder : WOxTagClassElemBuilder { } @end #include #include "common.h" @implementation WOxExtElemBuilder - (Class)classForElement:(id)_element { NSString *tagName; unsigned tl; unichar c1; if (![[_element namespaceURI] isEqualToString:XMLNS_OD_BIND]) return Nil; tagName = [_element tagName]; if ((tl = [tagName length]) < 3) return Nil; c1 = [tagName characterAtIndex:0]; switch (c1) { case 'c': if (tl > 10) { if ([tagName isEqualToString:@"collapsible"]) return NSClassFromString(@"WOCollapsibleComponentContent"); if ([tagName isEqualToString:@"checkbox-matrix"]) return NSClassFromString(@"WOCheckBoxMatrix"); } break; case 'f': if (tl > 10) { if ([tagName isEqualToString:@"foreach-key"]) return NSClassFromString(@"WODictionaryRepetition"); } break; case 'i': if (tl == 6) { if ([tagName isEqualToString:@"if-key"]) return NSClassFromString(@"WOKeyValueConditional"); } break; case 'j': if (tl > 13 && [tagName hasPrefix:@"js-"]) { if ([tagName isEqualToString:@"js-alert-panel"]) return NSClassFromString(@"JSAlertPanel"); if ([tagName isEqualToString:@"js-confirm-panel"]) return NSClassFromString(@"JSConfirmPanel"); if ([tagName isEqualToString:@"js-img-flyover"]) return NSClassFromString(@"JSImageFlyover"); if ([tagName isEqualToString:@"js-text-flyover"]) return NSClassFromString(@"JSTextFlyover"); if ([tagName isEqualToString:@"js-modal-window"]) return NSClassFromString(@"JSModalWindow"); if ([tagName isEqualToString:@"js-validated-field"]) return NSClassFromString(@"JSValidatedField"); } break; case 'r': if (tl > 10) { if ([tagName isEqualToString:@"radio-matrix"]) return NSClassFromString(@"WORadioButtonMatrix"); } break; case 't': if (tl > 20) { if ([tagName isEqualToString:@"threshold-colored-number"]) return NSClassFromString(@"WOThresholdColoredNumber"); } if (tl > 8) { if ([tagName isEqualToString:@"tab-panel"]) return NSClassFromString(@"WOTabPanel"); } if (tl > 4) { if ([tagName hasPrefix:@"table"]) { if (tl == 5) return NSClassFromString(@"WOTable"); if (tl > 11) { if ([tagName isEqualToString:@"table-content"]) return NSClassFromString(@"WOTableContent"); if ([tagName isEqualToString:@"table-header"]) return NSClassFromString(@"WOTableHeader"); if ([tagName isEqualToString:@"table-ctx-key"]) return NSClassFromString(@"WOTableContextKey"); } } } break; } return Nil; } @end /* WOxExtElemBuilder */