How to localize a dynamic menu using PrimeFaces? - jsf

I'm trying to build an international application that can change locale dynamically on the page. I'm also trying to build a dynamic menu with labels and values that will change when the locale changes dynamically. This is what I tried:
menuModel = new DynamicMenuModel();
DefaultSubMenu inOfficeMailbox = new DefaultSubMenu("#{msg['inofficemailbox']}");
DefaultMenuItem activeItem = new DefaultMenuItem( "#{msg['activeissues']}");
activeItem.setCommand("#{mainMenuMB.loadContent('activeissues')}");
inOfficeMailbox.addElement(activeItem);
DefaultMenuItem resolvedItem = new DefaultMenuItem("#{msg['resolvedissues']}");
resolvedItem.setCommand("#{mainMenuMB.loadContent('resolvedissues')}");
inOfficeMailbox.addElement(resolvedItem);
menuModel.addElement(inOfficeMailbox);
but the menu item just come out with the literals "#{msg['blahblah']}". Where msg is the localization variable. Obviously the EL is not evaluated so the localization doesn't work. What should I do instead?

Related

Docusign Radio group pre-fill issues using api

I am trying to pre-select a radio button group using api. however the generated document doesn't seem to have any radio button selected.
Sample:
Radio radVal1 = new Radio();
radVal1.setSelected("True");
radVal1.setValue("ChoiceYes");
Radio radVal2 = new Radio();
radVal2.setSelected("False");
radVal2.setValue("ChoiceNo");
List<Radio> radioVals = new ArrayList<Radio>();
radioVals.add(radVal1);
radioVals.add(radVal2);
RadioGroup rgrp = new RadioGroup();
rgrp.setGroupName("RadioGroup4");
rgrp.setRadios(radioVals);
List<RadioGroup> radioGroupTabs= new ArrayList<RadioGroup>();
radioGroupTabs.add(rgrp);
Tabs entityTabs = new Tabs();
entityTabs.setRadioGroupTabs(radioGroupTabs);
I am using a template with radio buttons with
Group Label : RadioGroup4
Button Values:
ChoiceYes
ChoiceNo
No other conditional logic.
Looks like you've resolved your own issue, to make clear for the community the groupName string must exactly match the name you pass through the API, otherwise it will not be able to match to the radios.

Dynamically Adding Tab At Specific Position to TabView Primefaces

How do we dynamically (from java program) add a tab to existing TabView primefaces component.
My situation is something like this,
There is a drop down with some values,
whenever user selects some value from drop down,
We need to add a tab dynamically at specific position to TabView.
I know we can get existing TabView component, and add a tab,
But if we want add a tab at particular position , how ?
public void addTab(){
FacesContext fc = FacesContext.getCurrentInstance();
TabView tabView = (TabView) fc.getApplication().createComponent(
"org.primefaces.component.TabView");
Tab tab1 = new Tab();
tab1.setTitle("Dynamic Tab-1");
tabView.getChildren().add(index,tab1);
}
You should update the view to reflect the new tab. Use RequestContext for ajax update.
RequestContext context = RequestContext.getCurrentInstance();
context.update("tabview");

ContentPanel AutoSize gxt

I am implementing a user interface using gxt. I have mainForm class with TabPanel.
TabPanel has few TabItems. On orderManagmentTabItem I have a ContentPanel.
TabPanel mainFormTab = new TabPanel ();
mainFormTab.setAutoHeight(true);
mainFormTab.setAutoWidth(true);
TabItem orderManagmentTabItem = new TabItem("TabItem 1");
orderManagmentTabItem.setAutoWidth(true);
orderManagmentTabItem.setAutoHeight(true);
OrderManagmentTabPanel orderManagmentTabPanel = new OrderManagmentTabPanel(); //contentpanel
orderManagmentTabItem.add(orderManagmentTabPanel);
TabItem warehouseManagmentTabItem = new TabItem("TabItem 2");
warehouseManagmentTabItem.setAutoWidth(true);
warehouseManagmentTabItem.setAutoHeight(true);
So I want to set Autozise to orderManagmentTabPanel, but can't do this. I write setAutoHeight(true) and setAutoWidth(true) in orderManagmentTabPanel class, but whet I run my app orderManagmentTabPanel is empty.
Than I tried to set autosize after creating OrderManagmentTabPanel copy
TabItem orderManagmentTabItem = new TabItem("TabItem 1");
orderManagmentTabItem.setAutoWidth(true);
orderManagmentTabItem.setAutoHeight(true);
OrderManagmentTabPanel orderManagmentTabPanel = new OrderManagmentTabPanel(); //contentpanel
orderManagmentTabPanel.setAutoWidth(true);
orderManagmentTabPanel.setAutoHeight(true);
orderManagmentTabItem.add(orderManagmentTabPanel);
But didn't help also
Also tried to implement TabItem class without ContenPanel and add it to mainFormTab, but also didn't work.
How can I make my TabItem to be autosized?
Thx
OK so I believe you mean (correct me if I am are wrong) you have a panel on a tab item and are trying to ensure it takes 100% of the space?
try setting a layout for example
orderManagmentTabItem.setLayout(new FillLayout()); //Sounds like what your after

Grouping custom tool parts in with other custom properties

I have a webpart. I have a list of items (schools) that I must pick from. This list comes from another Sharepoint list. I made a tool part. This tool part creates a drop down list and populates it with the correct data. When I went to edit the web part properties, the drop down list is sitting outside of any other group. I want to add that drop down list into the "Miscellaneous" group. If I can't put it there, I want to create a custom group.
How do I do this?
To add other groups, you will need some client manipulations (jquery).
Or you can just create extra groups:
protected override void CreateChildControls() {
Panel panel = new Panel();
panel.CssClass = "ms-ToolPartSpacing";
Table table = new Table();
table.CellPadding = 0;
table.CellSpacing = 0;
table.Style["border-collapse"] = "collapse";
table.Attributes.Add("width", "100%");
TableRow row = new TableRow();
TableCell cell = new TableCell();
cell.Controls.Add(new LiteralControl("<div class=\"UserSectionHead\"><b>Your Other Group:</b></div>"));
cell.Controls.Add(new LiteralControl("<div class=\"UserSectionBody\"><div class=\"UserControlGroup\">"));
Table innertable = new Table();
//build your innertable
cell.Controls.Add(innertable);
cell.Controls.Add(new LiteralControl("</div></div>"));
cell.Controls.Add(new LiteralControl("<div style='width:100%' class='UserDottedLine'></div>"));
row.Cells.Add(cell);
table.Rows.Add(row);
panel.Controls.Add(table);
this.Controls.Add(panel);
base.CreateChildControls();
}

How to set heading or field label for list view in GXT.?

I'm new to GXT, I'm developing a project by using GXT 2.0.1. I want to set field label for a list view. How to set field label.?
ListView<Stock> list2 = new ListView<Stock>();
list2.setDisplayProperty("name");
store = new ListStore<Stock>();
store.setStoreSorter(new StoreSorter<Stock>());
list2.setStore(store);
You can wrap the ListView in a ContentPanel and then set the heading:
ContentPanel cp = new ContentPanel();
cp.setHeading("Stocks");
cp.setLayout(new FitLayout());
cp.add(list2);
add(cp);
Use ListField
Call setFieldLabel("name") on your field.
Make sure you add it to a container with a FormLayout.

Resources