Skip to content

Commit

Permalink
Updating examples for Ext JS 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wanderlan.anjos@gmail.com committed Mar 30, 2013
1 parent d3a8290 commit 4697fe0
Show file tree
Hide file tree
Showing 9 changed files with 20,058 additions and 18,741 deletions.
38,143 changes: 19,702 additions & 18,441 deletions ExtJSWrapper/Ext.pas

Large diffs are not rendered by default.

66 changes: 65 additions & 1 deletion ExtJSWrapper/ExtFixes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* For Ext JS 3.0 and later
* For Ext JS 4.0 and later
* USED FORMATS in ExtFixes.txt
*
* Adding new classes:
Expand All @@ -10,6 +10,12 @@
* Changing a property type to enumeration
<class name>,<JavaScript property name>,<(enumerated list)>
*
* Changing a type to enumeration
<type name>,<(enumerated list)>
*
* Aliasing a type
<type name>,<alias>
*
* Adding and updating methods:
<class name>,<JavaScript method name>,<return type or void>,<if is a static method>,<if is a overload method>
*
Expand All @@ -22,9 +28,67 @@
* For each event parameter:
<parameter name>,<type>
*
ExtComponent, split, Boolean, false, true,
ExtComponent, cmargins, string, false, true,
ExtComponent, minSize, Integer, false, true,
ExtComponent, maxSize, Integer, false, true,
ExtComponent, anchor, string, false, true,
ExtDataRecord, TExtDataModel
ExtDataModel, Create,, true, false, Data, ExtObjectList, false

ExtEnumsLayout, (laAbsolute, laAccordion, laAnchor, laAutocomponent, laAutocontainer, laBorder, laBox, laCard, laCheckboxgroup, laColumn, laContainer, laFit, laForm, laHbox, laTable, laVbox)
ExtMessageBox, ExtWindowMessageBox, singleton, Ext.MessageBox

ExtWindowMessageBox, show, ExtFunction, false, false, Config, ExtShowConfig, false

ExtMessageBoxSingleton, ERROR, string, true, false, 'ext-mb-error'
ExtMessageBoxSingleton, INFO, string, true, false, 'ext-mb-info'
ExtMessageBoxSingleton, QUESTION, string, true, false, 'ext-mb-question'
ExtMessageBoxSingleton, WARNING, string, true, false, 'ext-mb-warning'
ExtMessageBoxSingleton, OK, Integer, true, false, 1
ExtMessageBoxSingleton, YES, Integer, true, false, 2
ExtMessageBoxSingleton, NO, Integer, true, false, 4
ExtMessageBoxSingleton, CANCEL, Integer, true, false, 8
ExtMessageBoxSingleton, OKCANCEL, Integer, true, false, 9
ExtMessageBoxSingleton, YESNO, Integer, true, false, 6
ExtMessageBoxSingleton, YESNOCANCEL, Integer, true, false, 14

ExtShowConfig,, Ext, Object
ExtShowConfig, animTarget, string, false, true,
ExtShowConfig, buttons, Integer, false, true,
ExtShowConfig, closable, Boolean, false, true, true
ExtShowConfig, cls, string, false, true,
ExtShowConfig, defaultTextHeight, Integer, false, true, 75
ExtShowConfig, fn, ExtFunction, false, true,
ExtShowConfig, scope, ExtObject, false, true,
ExtShowConfig, icon, string, false, true,
ExtShowConfig, iconCls, string, false, true,
ExtShowConfig, defaultFocus, string, false, true,
ExtShowConfig, maxWidth, Integer, false, true, 600
ExtShowConfig, minWidth, Integer, false, true, 100
ExtShowConfig, modal, Boolean, false, true, true
ExtShowConfig, msg, string, false, true,
ExtShowConfig, multiline, Boolean, false, true,
ExtShowConfig, progress, Boolean, false, true,
ExtShowConfig, progressText, string, false, true,
ExtShowConfig, prompt, Boolean, false, true,
ExtShowConfig, proxyDrag, Boolean, false, true,
ExtShowConfig, title, string, false, true,
ExtShowConfig, value, string, false, true,
ExtShowConfig, wait, Boolean, false, true,
ExtShowConfig, waitConfig, ExtProgressWaitConfig, false, true,
ExtShowConfig, width, Integer, false, true,
ExtProgressWaitConfig,, Ext, Object
ExtProgressWaitConfig, duration, Integer, false, true,
ExtProgressWaitConfig, interval, Integer, false, true, 1000
ExtProgressWaitConfig, animate, Boolean, false, true,
ExtProgressWaitConfig, increment, Integer, false, true, 10
ExtProgressWaitConfig, text, string, false, true,
ExtProgressWaitConfig, fn, ExtFunction, false, true,
ExtProgressWaitConfig, scope, ExtObject, false, true,



*ExtBoxComponent, region, (rgCenter, rgNorth, rgEast, rgSouth, rgWest)
*ExtComponent, xtype, (xtBox, xtButton, xtButtonGroup, xtColorPalette, xtComponent, xtContainer, xtCycle, xtDataView, xtDatePicker, xtEditor, xtEditorGrid, xtFlash, xtGrid, xtListView, xtPaging, xtPanel, xtProgress, xtPropertyGrid, xtSlider, xtSpacer, xtSplitButton, xtStatusBar, xtTabPanel, xtTreePanel, xtViewPort, xtWindow, xtToolbar, xtTBButton, xtTBFill, xtTBItem, xtTBSeparator, xtTBSpacer, xtTBSplit, xtTBText, xtMenu, xtColorMenu, xtDateMenu, xtMenuBaseItem, xtMenuCheckItem, xtMenuItem, xtMenuSeparator, xtMenuTextItem, xtForm, xtCheckBox, xtCheckBoxGroup, xtCombo, xtDateField, xtDisplayField, xtField, xtFieldSet, xtHidden, xtHTMLEditor, xtLabel, xtNumberField, xtRadio, xtRadioGroup, xtTextArea, xtTextField, xtTimeField, xtTrigger, xtChart, xtBarChart, xtCartesianChart, xtColumnChart, xtLineChart, xtPieChart)
*ExtContainer, defaultType, (ExtComponentXType)
Expand Down
41 changes: 28 additions & 13 deletions ExtJSWrapper/ExtToPascal.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ program ExtToPascal;

uses
SysUtils, StrUtils, Classes, ExtPascalUtils
, Ext
//, Ext
;

{.$DEFINE USES_PUBLISHED}
Expand Down Expand Up @@ -426,17 +426,17 @@ var
IsEvent, Optional, Static, Singleton: boolean;
I, Ci : integer;
begin
if Before('@protected', '*/', Line, false) or
Before('@ignore', '*/', Line, false) or
Before('@deprecated','*/', Line, false) or
Before('@abstract', '*/', Line, false) then exit;
if Before('@protected', '*/', Line) or
Before('@ignore', '*/', Line) or
Before('@deprecated','*/', Line) or
Before('@abstract', '*/', Line) then exit;
State := Initial;
Matches := TStringList.Create;
while true do begin
case State of
Initial : begin
JSName := '';
Singleton := Before('@singleton', 'Ext.define(', Line, false);
Singleton := Before('@singleton', 'Ext.define(', Line);
Extract(['/**', '*/'], Line, Matches);
if (JSName <> '') or
Extract(['Ext.define(' + AP, AP], Line, Matches) or
Expand All @@ -449,7 +449,7 @@ begin
else
CurClass := TClass(AllClasses.Objects[Ci]);
State := InClass;
if not Singleton then Singleton := Before('singleton:', '}', Line, false);
if not Singleton then Singleton := Before('singleton:', '}', Line);
if Singleton then CurClass.Name := CurClass.Name + 'Singleton';
CurClass.Singleton := Singleton;
continue;
Expand All @@ -474,7 +474,10 @@ begin
Between('@deprecated','/**', '*/', Line) or
Between('@protected', '/**', '*/', Line) then continue;
begin
Config := Extract(['@cfg {', '} ', ' '], Line, Matches);
if Before('@cfg {', '@property {', Line) then
Config := Extract(['@cfg {', '} ', ' '], Line, Matches)
else
Config := False;
// To do Extract(['@property ', ' ', '@type ', ' '], Line, Matches) PropName = Matches[0]; PropType = Matches[2]
if Config or Extract(['@property {', '} ', ' '], Line, Matches) then begin
PropName := Matches[1];
Expand All @@ -483,7 +486,7 @@ begin
if I <> 0 then
PropName := copy(PropName, 1, I-1); // Default value ****
if FixIdent(PropName) = '' then continue; // Discard properties nameless
if Before('@static', '*/', Line, false) then Static := true;
if Before('@static', '*/', Line) then Static := true;
if IsUppercase(PropName) then Static := true;
PropName := Unique(FixIdent(PropName), CurClass.Properties);
if not Static then PropName[1] := LowerCase(PropName)[1];
Expand All @@ -492,6 +495,7 @@ begin
continue; // Discard duplicates
end;
Matches[0] := ReplaceStr(Matches[0], 'Object/Object[]', 'Object[]');
Matches[0] := ReplaceStr(Matches[0], 'String/Number', 'Number/String');
PropTypes := Explode('/', Matches[0]);
if (pos('"', Matches[0]) <> 0) and (PropTypes.Count <> 0) then begin // Enumeration
CurProp := TProp.Create(PropName, PropName, 'string', Static, Config);
Expand All @@ -510,8 +514,8 @@ begin
CurClass.Properties.AddObject(FixIdent(PropName + Sufix(FixType(PropTypes[I]))),
TProp.Create(PropName + Sufix(FixType(PropTypes[I])), PropName, PropTypes[I], Static, Config));
//if Extract([PropName, ':', ','], Line, Matches) then begin
if (Before('Default to', '*/', Line, false) and Extract(['Default to', '.'], Line, Matches)) or
(Before('Defaults to', '*/', Line, false) and Extract(['Defaults to', '.'], Line, Matches)) then begin
if (Before('Default to', '*/', Line) and Extract(['Default to', '.'], Line, Matches)) or
(Before('Defaults to', '*/', Line) and Extract(['Defaults to', '.'], Line, Matches)) then begin
SetDefault(CurProp, Matches[0], Matches);
if (CurProp.Default <> '') and not CurClass.Defaults then begin
CurClass.Defaults := true;
Expand Down Expand Up @@ -543,7 +547,13 @@ begin
Between('@protected', '/**', '*/', Line) or
Between('@deprecated', '/**', '*/', Line) or
Between('@template', '/**', '*/', Line) then continue;
IsEvent := Extract(['@event ', ' ', '*/'], Line, Matches);
if Before('@event ', ': function', Line) then
IsEvent := Extract(['@event ', ' ', '*/'], Line, Matches)
else
if Before('/**', ': function', Line) then
IsEvent := False
else
IsEvent := Extract(['@event ', ' ', '*/'], Line, Matches);
if IsEvent or Extract(['/**', '*/', ': function'], Line, Matches) then begin
JSName := IfThen(IsEvent, Matches[0], Matches[1]);
if (length(JSName) > 30) or (FixIdent(JSName) = '') or // Doc fault
Expand Down Expand Up @@ -730,6 +740,12 @@ begin
if NewClass.Singleton then NewClass.Name := NewClass.Name + 'Singleton';
AllClasses.AddObject(NewClass.Name, NewClass);
end
else
if Fields.Count = 2 then begin // Aliasing a type
Fields[0] := 'T' + Fields[0];
if Unresolved.IndexOfName(Fields[0]) = -1 then
Unresolved.Add(Fields[0] + '=' + Fields[1]);
end
else
writeln(^M^J'*** WARNING: Class ', Fields[0], ' does not exist. ***'^M^J);
finally
Expand Down Expand Up @@ -1193,7 +1209,6 @@ begin
writeln(Pas, 'type');
for J := 0 to AllClasses.Count-1 do // forward classes
writeln(Pas, Tab, TClass(AllClasses.Objects[J]).Name, ' = class;');
// writeln(Pas, Tab, 'TExtDataRecord = TExtDataModel;');
WriteUnresolvedClasses;
writeln(Pas);
AllClasses.Sorted := false;
Expand Down
Loading

0 comments on commit 4697fe0

Please sign in to comment.