text
stringlengths
0
234
begin
return new Tag_UIInput;
end Create_Tag;
-- ------------------------------
-- Create an Tag_UICloud component
-- ------------------------------
function Create_Cloud return ASF.Components.Base.UIComponent_Access is
begin
return new Tag_UICloud;
end Create_Cloud;
URI : aliased constant String := "http://code.google.com/p/ada-awa/jsf";
TAG_LIST_TAG : aliased constant String := "tagList";
TAG_CLOUD_TAG : aliased constant String := "tagCloud";
AWA_Bindings : aliased constant ASF.Factory.Binding_Array
:= (1 => (Name => TAG_CLOUD_TAG'Access,
Component => Create_Cloud'Access,
Tag => ASF.Views.Nodes.Create_Component_Node'Access),
2 => (Name => TAG_LIST_TAG'Access,
Component => Create_Tag'Access,
Tag => ASF.Views.Nodes.Create_Component_Node'Access)
);
AWA_Factory : aliased constant ASF.Factory.Factory_Bindings
:= (URI => URI'Access, Bindings => AWA_Bindings'Access);
-- ------------------------------
-- Get the Tags component factory.
-- ------------------------------
function Definition return ASF.Factory.Factory_Bindings_Access is
begin
return AWA_Factory'Access;
end Definition;
-- ------------------------------
-- Returns True if the tag component must be rendered as readonly.
-- ------------------------------
function Is_Readonly (UI : in Tag_UIInput;
Context : in ASF.Contexts.Faces.Faces_Context'Class) return Boolean is
pragma Unreferenced (Context);
use type ASF.Components.Html.Forms.UIForm_Access;
begin
return UI.Get_Form = null;
end Is_Readonly;
-- ------------------------------
-- Render the javascript to enable the tag edition.
-- ------------------------------
procedure Render_Script (UI : in Tag_UIInput;
Id : in String;
Writer : in Response_Writer_Access;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
Auto_Complete : constant String := UI.Get_Attribute ("autoCompleteUrl", Context);
Allow_Edit : constant Boolean := UI.Get_Attribute ("allowEdit", Context);
begin
Writer.Queue_Script ("$('#");
Writer.Queue_Script (Id);
Writer.Queue_Script (" input').tagedit({");
Writer.Queue_Script ("allowEdit: ");
if Allow_Edit then
Writer.Queue_Script ("true");
else
Writer.Queue_Script ("false");
end if;
if Auto_Complete'Length > 0 then
Writer.Queue_Script (", autocompleteURL: '");
Writer.Queue_Script (Auto_Complete);
Writer.Queue_Script ("'");
end if;
Writer.Queue_Script ("});");
end Render_Script;
-- ------------------------------
-- Get the tag after convertion with the optional converter.
-- ------------------------------
function Get_Tag (UI : in Tag_UIInput;
Tag : in Util.Beans.Objects.Object;
Context : in ASF.Contexts.Faces.Faces_Context'Class) return String is
begin
if not Util.Beans.Objects.Is_Null (Tag) then
declare
Convert : constant access ASF.Converters.Converter'Class
:= Tag_UIInput'Class (UI).Get_Converter;
begin
if Convert /= null then
return Convert.To_String (Value => Tag,
Component => UI,
Context => Context);
else
return Util.Beans.Objects.To_String (Value => Tag);
end if;
Function Definition: procedure Dispatch (List : in out Tag_Info_Array) is
Function Body: Middle : constant Natural := List'First + List'Length / 2;
Quarter : Natural := List'Length / 4;
Target : Natural := Middle;
Pos : Natural := 0;
begin