List menu by Parse XML in J2ME - java-me

I want to create menu from XMLFile. My xml is like this
<?xml version="1.0" encoding="UTF-8"?>
<root>
<parent title="Layanan Anda">
<menu title="Info Kartu">
<submenu title="Informasi Saldo">
<input type="numberpassword" length="4">Kode </input>
</submenu>
<submenu title="Mutasi Kartu Utama">
<input type="numberpassword" length="4">Kode </input>
</submenu>
<submenu title="Mutasi Kartu Lain">
<input type="number" length="10">Kartu</input>
<input type="numberpassword" length="4">Kode </input>
</submenu>
<submenu title="Deposito">
<input type="number" length="10">Bilyet</input>
<input type="numberpassword" length="4">Kode </input>
</submenu>
</menu>
<menu title="Kartu Anda">
</menu>
<menu title="Other Info">
</menu>
<menu title="Isi">
</menu>
</parent>
<parent title="Menu Favorit">
</parent>
<parent title="Recent Menu">
</parent>
<parent title="Setting">
</parent>
</root>
In HomeScreen, list menu parent will show first. And when I click parent menu, application will show list menu from "menu" tag. When I click menu again, application will show list menu from submenu. And vice versa when I want to back to parent menu.
How can I implement this in J2ME?

Parse your XML file and create a tree structure to hold the menu/submenu items. Each node should hold the items of a single level. For example:
root: Layanan Anda, Menu Favorit, Recent Menu, Setting
menu: Info Kartu, Kartu Anda, Other Info, Isi
submenu: Informasi Saldo, Mutasi Kartu Utama, Mutasi Kartu Lain, Deposito
Then use a graphical List to show the items of a node.

Related

Create a multilevel submenu in Visual Studio Tools menu

Create a multilevel submenu in Visual Studio Tools menu
I am looking to create a multilevel menu within the Visual Studio Tools menu.
I would want the structure as seen to be something like below.
Tools
|->GC
|->Licenses--------------------------->|
|->Samples |-> Activate
|-> Deactivate
From the below code in the .vsct file, I am able to get to the structure as below
Tools|
|->GC->|
|->Licenses
|->Samples.
How would I be able to add a submenu "Licenses" into the GC menu and add the Activate/Deactivate buttons to it?
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<Extern href="stdidcmd.h"/>
<Extern href="vsshlids.h"/>
<Commands package="guidComponentOneMenuPackage">
<Menus>
<Menu guid="guidComponentOneMenuPackageCmdSet" id="TopLevelMenu" priority="0x700" type="Menu">
<Parent guid="guidSHLMainMenu" id="IDG_VS_TOOLS_EXT_TOOLS" />
<Strings>
<ButtonText>GC</ButtonText>
<CommandName>GC</CommandName>
</Strings>
</Menu>
</Menus>
<Groups>
<Group guid="guidComponentOneMenuPackageCmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="TopLevelMenu"/>
</Group>
</Groups>
<Buttons>
<Button guid="guidComponentOneMenuPackageCmdSet" id="LicenseManagerId" priority="0x0100" type="Button">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="MyMenuGroup" />
<Icon guid="guidImages" id="bmpPic1" />
<Strings>
<ButtonText>Licenses</ButtonText>
</Strings>
</Button>
<Button guid="guidComponentOneMenuPackageCmdSet" id="SamplesExplorerId" priority="0x0101" type="Button">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="MyMenuGroup" />
<Icon guid="guidImages" id="bmpPic1" />
<Strings>
<ButtonText>Samples</ButtonText>
</Strings>
</Button>
</Buttons>
<Bitmaps>
<Bitmap guid="guidImages" href="Resources\GC.png" usedList="bmpPic1"/>
</Bitmaps>
</Commands>
<Symbols>
<GuidSymbol name="guidComponentOneMenuPackage" value="{458b53ac-7a4e-440d-aebf-d3eec4fd24e2}" />
<GuidSymbol name="guidComponentOneMenuPackageCmdSet" value="{d2b0b608-ab47-47c6-a9a3-d0cf3b64157b}">
<IDSymbol name="MyMenuGroup" value="0x1020" />
<IDSymbol name="LicenseManagerId" value="0x0100" />
<IDSymbol name="SamplesExplorerId" value="0x0101" />
<IDSymbol name="TopLevelMenu" value="0x1021"/>
</GuidSymbol>
<GuidSymbol name="guidImages" value="{6e5edeb3-274c-4147-a06d-7f50f10160b9}" >
<IDSymbol name="bmpPic1" value="1" />
</GuidSymbol>
</Symbols>
</CommandTable>
We will be able to create multilevel menus by merely adding more groups and setting their priority as below.
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18 /CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<Extern href="stdidcmd.h"/>
<Extern href="vsshlids.h"/>
<Commands package="guidComponentOneMenuPackage">
<Menus>
<Menu guid="guidComponentOneMenuPackageCmdSet" id="TopLevelMenu" priority="0x700" type="Menu">
<Parent guid="guidSHLMainMenu" id="IDG_VS_TOOLS_EXT_TOOLS" />
<Strings>
<ButtonText>GC</ButtonText>
<CommandName>GC</CommandName>
</Strings>
</Menu>
<Menu guid="guidComponentOneMenuPackageCmdSet" id="GCMenu" priority="0x0200" type="Menu">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="MyMenuGroup" />
<Strings>
<ButtonText>Main</ButtonText>
<CommandName>Main</CommandName>
</Strings>
</Menu>
</Menus>
<Groups>
<Group guid="guidComponentOneMenuPackageCmdSet" id="GCGroup" priority="0x0600">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="GCMenu"/>
</Group>
<Group guid="guidComponentOneMenuPackageCmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="TopLevelMenu"/>
</Group>
</Groups>
<Buttons>
<Button guid="guidComponentOneMenuPackageCmdSet" id="LicenseManagerId" priority="0x0201" type="Button">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="GCGroup" />
<Icon guid="guidImages" id="bmpPic1" />
<Strings>
<ButtonText>Licenses</ButtonText>
</Strings>
</Button>
<Button guid="guidComponentOneMenuPackageCmdSet" id="SamplesExplorerId" priority="0x0202" type="Button">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="GCGroup" />
<Icon guid="guidImages" id="bmpPic1" />
<Strings>
<ButtonText>Samples</ButtonText>
</Strings>
</Button>
</Buttons>
<Bitmaps>
</Bitmaps>
</Commands>
<Symbols>
<IDSymbol name="MyMenuGroup" value="0x1020" />
<IDSymbol name="GCGroup" value="0x0202" />
<IDSymbol name="LicenseManagerId" value="0x0100" />
<IDSymbol name="SamplesExplorerId" value="0x0101" />
<IDSymbol name="TopLevelMenu" value="0x1021"/>
<IDSymbol name="GCMenu" value="0x1022"/>
</GuidSymbol>
</Symbols>
</CommandTable>

SharePoint - Ribbon Button showing wrong LabelText

I have a Ribbon Button with the following XML:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="Ribbon.Library.Actions.AddAButton"
Location="CommandUI.Ribbon"
RegistrationId="171"
RegistrationType="List"
Title="Change Email Ribbon Button">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.ListForm.Edit.Commit.Controls._children">
<Button Id="Ribbon.ListForm.Edit.Commit.NewRibbonButton"
Command="ChangeEmailButtonCommand"
Image16by16="/_layouts/15/$Resources:core,Language;/images/formatmap16x16.png?rev=23" Image16by16Top="-127" Image16by16Left="-91"
Image32by32="/_layouts/15/$Resources:core,Language;/images/formatmap32x32.png?rev=23" Image32by32Top="-477" Image32by32Left="-307"
LabelText="$Resources:Toolkit,ChangeEmailButtonLabel"
TemplateAlias="o2" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="ChangeEmailButtonCommand"
CommandAction="javascript:
ChangeEmailAction();
" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
<CustomAction Id="Ribbon.ListForm.Edit.Commit.Scripts" Location="ScriptLink" ScriptSrc="/_layouts/15/GOToolkit/JS/loadJsOrCssFile.js?version=1.7.3" />
</Elements>
Now, the LabelText on my button, shows the exact same text, as it does in the XML: "$Resources:Toolkit,ChangeemailButtonLabel", where I'd expect it to show the text that I have defined in the 'ChangeEmailButtonLabel', which looks like this:
<data name="ChangeEmailButtonLabel" xml:space="preserve">
<value>Change email</value>
</data>
Am I missing something here?
Check that your resources file is stored in the SharePoint Resources folder.
Also, don't know if it's a game changer but you can add ";" at the end of your syntax.

Excel/RibbonUI menu disabled

Note The following problem was solved by creating a new workbook copying all the data, macros and other code across. Any insight into what causes a workbook to "break" would be welcome!
I have an excel file with a custom ribbonui. I've recently added a new group with a new menu, it (was) copied from the first group and certain items were removed.
The first group "library" and all its controls work as expected. The "documentmenu" menu in the "document" group however is grayed out and I cannot figure out why!
I've tried adding in a getEnabled and plain enabled attribute to the menu but it wont fire, neither will any of the getEnabled events for the menu's contained buttons.
When I open the ribbon for the first time the getLabel event does fire and sets the label correctly.
I've tried re-naming the group and all the controls to something without "document" in-case it's conflicting somehow, but again no go.
Does anyone know what might be causing this to happen?
Below is the entire customui xml file.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI
onLoad="CustomUI.Ribbon_onLoad"
xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab
id="Main"
label="Initech">
<group
id="Library"
label="Library"
tag="Library"
centerVertically="true">
<menu
id="LibraryMenu"
tag="Library"
image="gear"
getLabel="CustomUI.Menu_getLabel">
<button
id="LibraryMenu_Open"
tag="Library"
label="Open Library"
imageMso="FileOpen"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<button
id="LibraryMenu_New"
tag="Library"
label="New Library"
imageMso="FileNew"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<menuSeparator
id="LibraryMenu_Separator0" />
<button
id="LibraryMenu_Save"
tag="Library"
label="Save"
imageMso="FileSave"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<button
id="LibraryMenu_Close"
tag="Library"
label="Close"
imageMso="FileClose"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<button
id="LibraryMenu_Default"
tag="Library"
label="Set as Default"
imageMso="AcceptInvitation"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<menuSeparator
id="LibraryMenu_Separator1" />
<button
id="LibraryMenu_Add"
tag="Library"
label="Add Component"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<button
id="LibraryMenu_Editor"
tag="Library"
label="Edit Menu"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
</menu>
<dynamicMenu
id="LibraryComponents"
tag="Library"
image="book_stack"
getLabel="CustomUI.Menu_getLabel"
getEnabled="CustomUI.Menu_getEnabled"
getContent="CustomUI.Menu_getContent" />
</group>
<group
id="Document"
label="Document"
tag="Document"
centerVertically="true">
<menu
id="DocumentMenu"
tag="Document"
imageMso="FileOpen"
getLabel="CustomUI.Menu_getLabel">
<button
id="DocumentMenu_Open"
tag="Document"
label="Open Document"
imageMso="FileOpen"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<button
id="DocumentMenu_New"
tag="Document"
label="New Document"
imageMso="FileNew"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<menuSeparator
id="DocumentMenu_Separator0" />
<button
id="DocumentMenu_Save"
tag="Document"
label="Save"
imageMso="FileSave"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
<button
id="DocumentMenu_Close"
tag="Document"
label="Close"
imageMso="FileClose"
getEnabled="CustomUI.Button_getEnabled"
onAction="CustomUI.Button_onAction" />
</menu>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Update after hours of playing about trying to figure out whats going on, turns out my workbook is damaged some how. The code works fine if I put it into a new workbook.
centerVertically is not a valid property.
Kindly refer this link
getEnabled="CustomUI.Button_getEnabled" & onAction="CustomUI.Button_onAction"
Avoid period . in name of callback function as we cannot define a sub/function like CustomUI.Button_getEnabled.
3 when using getEnabled attribute for a button a callback function is to be called when the application needs to determine the enabled state of the button.
sample code - getEnabled for ribbion

How to add editor to the textarea in my custom component in joomla 2.5?

I have created a custom component in joomla 2.5 where the fields are creating in an xml file.
Here is the code.
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset>
<field
name="id"
type="hidden"
/>
<field
name="title"
type="text"
label="Title"
description="This is the title"
size="40"
class="inputbox"
default=""
style="width:294px;height:135px;"
/>
<field
name="description"
type="textarea"
label="Description"
description="This is the description"
rows="20"
cols="10"
class="inputbox"
default=""
/>
</fieldset>
</form>
I want to the description text area to be an editor just like in the new article form.
How will I do this?
I solved my problem.
Just change the type of the description field.
<field
name="description"
type="editor"
label="Description"
description="This is the description"
filter="safehtml"
class="inputbox"
default=""
/>

Add Change Item order ribbon in Sharepoint 2010

I want to add Change item order ribbon into ribbon panel. I have created feature and activated, however i still cant see the item order ribbon. Can anyone help me with this?
below is my code
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!--Change Item order Ribbon-->
<CustomAction
Id="SPChangeItemOrder"
Location="CommandUI.Ribbon.ListItem"
RegistrationId="101"
RegistrationType="List"
Title="List View Ribbon Customization"
>
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.ListItem.Actions.Controls._children">
<!--Get Details from CMDUI.XML-->
<Button
Id="Ribbon.ListItem.Actions.ChangeItemOrder"
Alt="Change the order of the items in this list."
Sequence="20"
Command="ChangeLinkOrder"
LabelText="$Resources:core,cui_ButChangeItemOrder;"
ToolTipTitle="$Resources:core,cui_ButChangeItemOrder;"
ToolTipDescription="$Resources:core,cui_STT_ButChangeItemOrder;"
TemplateAlias="o2"
Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-192" Image16by16Left="-144"
Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-192" Image32by32Left="-288"
/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="ChangeLinkOrder" CommandAction="javascript:alert('Please check Change Item Order');"></CommandUIHandler>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
Try something like this where RegistrationID is the Type value of a list definition. You don't need the CommandUIHandler if you want to use SharePoint's OOB Change Item Order command.
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!--Change Item order Ribbon-->
<CustomAction
Id="XYZ.Webpart.Links.XYZLinksListDefinition.RibbonSortOrderButton"
Location="CommandUI.Ribbon"
RegistrationId="30099"
RegistrationType="List"
Title="List View Ribbon Customization" >
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.ListItem.Actions.Controls._children">
<Button
Id="Ribbon.ListItem.Actions.RibbonSortOrderButton"
Sequence="25"
Command="ChangeLinkOrder"
Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-192" Image16by16Left="-144"
Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-192" Image32by32Left="-288"
LabelText="$Resources:core,cui_ButChangeItemOrder;"
ToolTipTitle="$Resources:core,cui_ButChangeItemOrder;"
ToolTipDescription="$Resources:core,cui_STT_ButChangeItemOrder;"
TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions>
</CommandUIExtension>
</CustomAction>
</Elements>
Invalid value for attribute location in customaction element, choose right location value from here http://msdn.microsoft.com/en-us/library/bb802730.aspx

Resources