How do convert selected item in JComboBox to String?
I'm trying to get an option from a JComboBox to print in a JTextArea upon click.
I've tried many ways, including converting to String, String array, and using textArea.append which doesn't seem to work either. .
can anyone help?
toString and actionlistener, bah. figured it out, sorry to trouble you :)
Similar Messages
-
How to convert select-options into parameters
hi Abapers,
i have an urgent requirement, iwant to know how to convert select-options into parameters
on selection screen,is it possible to do.TABLES: spfli.
SELECTION-SCREEN BEGIN OF BLOCK test.
SELECT-OPTIONS:
s_carrid FOR spfli-carrid NO INTERVALS NO-EXTENSION.
SELECTION-SCREEN END OF BLOCK test.
Greetings,
Blag. -
How to get selected items from a tree in backing bean without adfbc
Hi ADF Experts,
Below is my code for af:tree. My question is how can I get selected Items from the selectionListener (without adf bc) this uses formation of tree from backing bean.
Using Jdev 11.1.1.7.0
<af:tree var="node" value="#{pageFlowScope.MerchandizeBean.model}"
binding="#{pageFlowScope.MerchandizeBean.treeModel}" id="tree" immediate="true" autoHeightRows="0"
styleClass="AFStretchWidth" rowSelection="multiple"
selectionListener="#{pageFlowScope.MerchandizeBean.treeNodeSelection}">
<f:facet name="nodeStamp">
<af:commandLink text="#{node.classDescription}"
actionListener="#{pageFlowScope.MerchandizeBean.createListManyItemForMerchandise}" id="displayTable" partialSubmit="true">
</af:commandLink>
</f:facet>
</af:tree>
public void treeNodeSelection(SelectionEvent selectionEvent) {
// Add event code here...
RichTree tree = (RichTree)selectionEvent.getSource();
TreeModel model = (TreeModel)tree.getValue();
//get selected value
Thanks
RoyHi,
in a multi select case, try
RowKeySet rks = tree.getSelectedRowKeys();
Iterator iter = rks.iterator();
while(iterator.hasNext()){
Object aKey = iterator.next();
tree. setRowKey(aKey);
Object rowData ? tree.getRowData();
.... do something with the data here ...
Frank -
How to get selected item value and display text in selectOneChoice ?
Hi
Thank you for reading my post
I bind the a selectOneChoice component to my backing bean so i have an object which represent this component in the backing bean.
now i need to find which item is selected by use , i know that i can use
getSelect_service().getValue.toString() , but it will return the value of the selected item, how about its display text ?
I should say that i create an static list for selectOneChoice items.
thanksUsing JDeveloper 10.1.3.1, freshly downloaded off OTN. I used the following code to try and identify the problem you are encountering. I attempted to use a valueChangeListener in combination with af:selectOneChoice components that use SelectItems and the singular SelectItem. I could not reproduce the error in either case. Please post more information about your development environment.
<af:selectOneChoice label="Label 1"
binding="#{backing_test.selectOneChoice1}"
id="selectOneChoice1"
valueChangeListener="#{backing_test.valueChangeListener}"
autoSubmit="true" immediate="true">
<af:selectItem label="1" value="1"
binding="#{backing_test.selectItem1}"
id="selectItem1"/>
<af:selectItem label="2" value="2"
binding="#{backing_test.selectItem2}"
id="selectItem2"/>
<af:selectItem label="3" value="3"
binding="#{backing_test.selectItem3}"
id="selectItem3"/>
</af:selectOneChoice>
<af:selectOneChoice label="Label 2"
binding="#{backing_test.selectOneChoice2}"
id="selectOneChoice2" valueChangeListener="#{backing_test.valueChangeListener}"
autoSubmit="true" immediate="true">
<f:selectItems value="#{backing_test.items}"
binding="#{backing_test.selectItems1}"
id="selectItems1"/>
</af:selectOneChoice>
public void valueChangeListener(ValueChangeEvent evt){
// returns a UISelectOneChoice object
System.out.println(evt.getSource().getClass().getName());
// returns a string
System.out.println(evt.getNewValue().getClass().getName());
public Map getItems(){
items = new HashMap();
items.put("11","11");
items.put("12","12");
items.put("13","13");
return items;
} -
ADF Tree with Boolean Check Box: How to find selected items
Hi Experts,
ADF: 11.1.1.5.0
WLS: 10.3.6
I am using an ADF Tree which contains elements at two levels (say Departments and Employees). My requirement is to give provision for user to select Departments and Employees using the check boxes. User should be able to select what ever Departments he/she likes and what ever employees he/she likes. There should not be a provision to select Employee with out selecting the corresponding Department (root node in the tree).
I am facing the below issues while trying to implement this use case:
1. Always, only the first master record will be expanded by default (I am using "Display Row" property value as "default" and "ExpandAllEnabled" as "true"). My need is to expand all the master records by default. So that user need not explicitly expand each master record node and then select the associated child records.
2. Currently, I am using value change listener associated to af:selectBooleanCheckBox to identify the Departments and Employee records that have been selected. Since not all departments (masters) are expanded by default, if user selects the check box of department (master) and then expands the department node, automatically all the employees of that department are selected. But, this event is not triggering the value change listener for the employee records. Because of this, after a department node is selected and then expanded, all the child elements' check boxes are selected but the events are not generated. Hence, I am not able to capture the selection of employee records.
To summarize,
1. Please let me know how to expand all master nodes in af:Tree by default.
2. Please let me know the best approach to identify the selected items (both master and detail items) in the af:Tree component using af:selectBooleanCheckBox.
Thanks in advance,
RathnamHi,
Can you please elaborate the solution? I have a similar problem in
https://forums.oracle.com/thread/2579664 -
Changing background of selected item in JComboBox when Uneditable
I need to change the color of the items in a JComboBox list based on the values that change at runtime. I have accomplished this by creating and using a class extended from DefaultListCellRenderer.
The combobox is enabled and uneditable. The problem is that in 1.5 the behavior changed and now the selected item gets a white background that is set by the UI or DefaultJComboBox. I can no longer set the background for the selected item.
I have tried using the ComBox Editor. Also, the universal option of UIManager.put("ComboBox.background", Color.xxx) will not work since I have multiple boxes with different backgrounds.
Does anyone no a work around?Unless I misread your problem you may find that your use of DefaultListCellRenderer is incorrect. The following snippet of code (using Java 1.5.0_07) will make the combo box red. The unselected items in the dropdown will be magenta and the selected item orange.
combo.setBackground(Color.red);
combo.setRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if(isSelected)
c.setBackground(Color.ORANGE);
else
c.setBackground(Color.MAGENTA);
return c;
}); -
How to set selected item of SelectOneMenu
HI,
I want to manually set the selected item of SelectOneMenu, can anyone tell me how can I do?
Below is my code:
<h:selectOneMenu binding="#{Monitor.dropdown1}" id="dropdown1" onchange="submit();" valueChangeListener="#{Monitor.pageItemsValueChange}">
<f:selectItems binding="#{Monitor.dropdown1SelectItems}" id="dropdown1SelectItems" value="#{Monitor.pageItems}"/>
</h:selectOneMenu>I tried to use dropdown1.setValue to set it, but I wonder which class type I can use.Initialize the value to the value you want to select:
<h:selectOneMenu id="model" value="#{SearchVehicle.modelField}">
<f:selectItems value="#{SearchVehicle.models}"></f:selectItems>
</h:selectOneMenu>public class SearchVehicle{
private String modelField = "XYZ";
} -
How to read selected item value from DropDownList?
Hi,
The DropDownList component has a selectedItem property that is supposed to return a ListBase.
But what I want is just the "String" that is supposed to be the selected Item in the DropDownList.
How can I read this value?
thanks
-MalenaThank, yes, I realized that right after I posted my question -:)
I casted the selectedItem property to String and voila.
Best
-Malena -
Shuttle: How to reference selected items on the right side
This seems so easy so why am I struggling so much.
I have a simple shuttle:
1 Adam
2 Baker
3 Charlie
4 Delta
5 Echo
6 Foxtrot
Select Name D, UserID R from UserTable
The values are stored in a VARCHAR2 field MULTI_USER (for example 1:2:4:6)
When I want to get the names back from the selected item, how do I reference the colon-separated items?
For example:
Select Name from UserTable
where UserID in (select MULTI_USER from MULTI_USER where MULTI_USER_ID = 1)
should return:
Adam
Baker
Delta
Foxtrot
Why is this so difficult for me to figure out?
Thank you in advanceHi,
This might help
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/bldapp_item.htm#sthref908
Regards,
Jari
My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
Twitter: http://www.twitter.com/jariolai -
SRM 7 SOCO enhancement - from step1 to step2, how to get selected items?
Hi all gurus,
I'm enhancing the WD /SAPSRM/WDC_DO_SOCO_GAF_1, specifically my requirement is to block FPM navigation if certain conditions based on the selection are met.
Example:
An user searches for some PR in sourcing cockpit's step 1, select just a subset from the search result (say, he selects item 1 and item 3, leaving item 2 unselected).
Then press the NEXT STEP button (which is, as far as I understood, an element managed by the COMPONENTCONTROLLER)..
Let's suppose the condition we talked about is that each position of a specific PR should be selected; the example above does not meet that condition (only positions 1 and 3 are selected).
What I'd like to implement is as follows:
- if the user presses the NEXT_STEP, navigation to the newt WD is cancelled (user remains in STEP 1) and an explicative error message is raised in the message area (e.g. "all positions must be selected").
Looking for the best, effective way to do this... In particular, I have to:
-1- identify which positions have been selected when the NEXT_STEP button is pressed;
-2- implement the check based on positions (that's the easy job);
-3- raise a message into the messagearea (easy one) and STOP the process so that the user still remains into STEP 1 view (obviously, until his selection meets the specifics).
I actually overwrote via enhancement the standard PROCESS_EVENT method in the COMPONENTCONTROLLER of that Webdynpro (/SAPSRM/WDC_DO_SOCO_GAF_1), and I'm trying to get the selected lines.
IF io_event->mv_event_id = 'FPM_NEXT_STEP'.
DATA: test TYPE REF TO /sapsrm/cl_ch_wd_ao_soco.
DATA: gaf1 TYPE REF TO /sapsrm/if_cll_dom_soco_gaf1.
DATA: selected_items TYPE WDR_CONTEXT_ELEMENT_SET.
DATA: selected_item TYPE /sapsrm/s_cll_wd_soco_workarea.
test ?= wd_this->ig_componentcontroller~mo_aom_soco.
CALL METHOD test->/sapsrm/if_cll_ao_soco~get_dom_soco_gaf1
* EXPORTING
* ion_wd_set =
* io_wd_view_controller =
* io_wd_component_controller =
RECEIVING
ro_dom_soco_gaf1 = gaf1.
DATA: tabselected TYPE /SAPSRM/T_CLL_WD_SOCO_SEARCH.
CALL METHOD gaf1->ZR7_IF_CLL_DOM_SOCO_GAF1~GET_SELECTED_ITEMS
IMPORTING
SELECTED_ITEMS = tabselected.
where ZR7_IF_CLL_DOM_SOCO_GAF1~GET_SELECTED_ITEMS returns the SEARCH_RESULT node of the view GAF1. This however returns the SEARCH_RESULTS table which contains ALL the positions in the Search table and not just the selected ones... I basically have to modify the get_selected_items, in order to get the selected lines, but actually don't know how and if it's possible; as far as I've seen in debug, there's no way to get the selection ... maybe it has already been cleared at this point?
Any help provided on these 3 task is highly appreciated and welcomeSolved! Quite a tricky solution, but it works.
-
How to retrieve selected item details (Product Id, Quantity) in Action clas
Hi
I want to retrieve the selected item details (Product Id, Quantity) in my custom action class .I am calling custom action event after u2018add to cartu2019 button clicked. I basically need these details to pass to custom BAPI. I can able to retrieve User Name and itemkey successfully. I Tried to retrieve the product , productID using WebCatItem but I was getting run time error and when I debug the code I can see webCatItem coming as null. Below is my code.
public class Z_AddToBasketAction extends BaseAction {
/* (non-Javadoc)
@see com.sap.isa.core.BaseAction#doPerform(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
public ActionForward doPerform(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
//Cache.Access access = null;
Map returnValues = null;
UserSessionData userSessionData =
UserSessionData.getUserSessionData(request.getSession());
BusinessObjectManager bom =
(BusinessObjectManager) userSessionData.
getBOM(BusinessObjectManager.ISACORE_BOM);
String selectedPartnerID = bom.getUser().getUserId();
String strItemkey=request.getParameter("itemkey");
WebCatItem webCatItem = (WebCatItem) request.getAttribute(
com.sap.isa.catalog.actions.ActionConstants.RA_WEBCATITEM);
//If you are looking at Product attributes.
String att = webCatItem.getProduct()", "webCatItem.getProductID();
ZBOM mybom = (ZBOM) userSessionData.getBOM(ZBOM.ZCUSTOM_BOM);
return mapping.findForward("success");
Please help
Thanks
Aravind
Edited by: Aravinda Boyapati on Nov 30, 2010 10:21 PMHi Arvinda,
From which page you are trying to add products in cart? Are you selecting only 1 item at a time and then click on Add to cart button or you select more then 1 items to add into cart.
You can ceate hidden input filed and set their value through java script when you select any item. If more then 1 items then you can create an arry and set in the request parameter and then retrieve it in your custome class.
Regards.
eCommerce Developer. -
How to convert select-options table into single field internal table
Hi,
My requirement is to convert select-options table into single internal table which has one field.
e.g. select-options: s_matnr for mara-matnr.
select-options table can have options 'BT',"EQ", "NE", "GE", "GT", "LE", "LT", "CP" etc. select-options table
have Sign:I ,Option:BT, Low: 1, High.10.The new internal table records should be 1,2,3,4,5,6,7,8,9,10.
Please suggest any function module available for this scenario in SAP.
Thanks,
Somi.
Edited by: somi reddy satti on Sep 15, 2009 3:18 PMHi Sowmya,
Here is the answer if I understand well of your question.
Data: begin of gt_mon OCCURS 0,
mon(2) TYPE n,
end of gt_mon.
Data: begin of gt_year OCCURS 0,
year(4) TYPE n,
end of gt_year.
Select-options: s_period FOR ptdw_pws_db-kmonth NO-EXTENSION
DEFAULT sy-datum(6)
TO sy-datum(6).
For example according to above statement period is 201110 is 201201.
Period field does n't exists in SAP for selection. If your selection is on date based on period which is given on the selection-screen then you need to convert the period to date by concatenating ( or using FM to convert )01 at the end of each period . You need to declare one range table for date to select the data from table.
loop at s_period.
gr_date-sign = s_period-sign.
gr_date-option = s_period-option.
COncatenate s_period-low
'01'
into gr_date-high.
COncatenate s_period-high
'01'
into gr_date-low
append gr_date.
ENDloop.
Thanks,
Satheesh -
How to change selected item color and the selected area size of listview
What i really need to do is change the following things in XMAL.
1. Changing the selection color
2. Size of selected area
Thanks in advance.
Dileepa S. Rajapaksa
Trainee Developer
Microsoft, Sri Lanka
Twitter : @dsrajapaksa
Blog : http://www.dileepatech.netHi Dileepa,
It is possible by customize the control by its template, see this for more information:
ListViewItem styles and templates.
By changing the selected visual state, you can change the color of the ListView item background, also the size of the selected item.
--James
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to get selected item page number?
I am developing the plug-in for moving page item from one page to another page,for that i need selected item page number.i.e. i need the page number
which the item is selected.Just access the 'currentCountry' property in the action method.
public void submit() {
System.out.println("JSF has already set the property: " + currentCountry);
// Now do your thing with it. E.g. saving it or so.
countryDAO.save(currentCountry);
} -
How to print selected item of list?
Hello everybody!
I'm new to Sharepoint, I just installed an entire environment to test it. I installed Windows Server 2012 R2, SQL Server 2012 and Sharepoint 2010 (my customer's version).
What I'm trying to do is have a easy way that my customer will select an item on a list and then print it. As they have a lot of list, they want to create the layout of the printing themselves. They want the company logo on the page, they also want to customize
the background of some items like color, fonts, etc.
Please, I don't want to seem like asking for the solution out of the box. I just need to know if this is possible, and how.
I've been searching and found SQL Reporting services, or even printing from Access. Is it the way to go?
Any help will be much appreciated.
Thanks.there are different ways to get it done.
export the files to excel and print from there
use the 3rd party tools to get this done. Free from Code Plex, which use the Print List.
SharePoint 2010 Sandboxed Solutions
see these blogs for helpful script.
http://www.coolwriteups.com/print-a-list-item-in-sharepoint-2010/
http://sharepointdragons.com/2012/05/05/print-friendly-list-items/
Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog
Maybe you are looking for
-
How can I return my new tab to the default blank page?
My brother did something which made the new tab page a Yahoo search page. I'd much rather it be the blank page, selecting the address bar. I downloaded the newtabURL add-on and selected the option blank page, highlighting the URL, along with some oth
-
I have created several folders under the Places on the sidebar, but they are all dead now. I cannt click them, remove them, or look the files under them. Please help!
-
The symbol "/" in properties file is platform independent ?
Hi! In my properties file I set many patha to my any resources(path to my icons, path to my user XML file and so on): # content of my properties file userSettingsPath=config/usersettings.xml baseNameImages=/resources/images/ # end As you see in path
-
Error Message from DWCS4: Error in line 27 of form.js.php
Hi I did a seach of the forum for this and came up blank, so here goes although I am sure I am not alone with this one... This week I installed CS4 and get an error reported whenever I open up an ADDT Dynamic Form: "There is a syntax error on line 27
-
Delete just three items from the right clic menu of a waveform graph
I would like to delete some fonctionnalities from the right click menu of my waveform graph. If i use the specific function "delete menu", it works only if I want to delete all the right clic menu. But if I write the name of the specific item that i