JList: how a set a "name" and "value" for a element
my JList
DefaultListModel listMBuddy;
JList listBuddy;
listMBuddy = new DefaultListModel();
listBuddy = new JList(listMBuddy);
listMBuddy.insertElementAt("buddy name 1", listMBuddy.size());
listMBuddy.insertElementAt("buddy name 2", listMBuddy.size());
listMBuddy.insertElementAt("buddy name 3", listMBuddy.size());a string "buddy name 1" will be show in JList, it is like a name of element.
how i set value for "buddy name 1"? like html
<select>
<option value="5">buddy name 1</option>
<option value="7">buddy name 2</option>
<option value="2">buddy name 3</option>
</select>
thanks
You have to write your own renderer.
example:
public class MyListsRenderer extends JPanel implements ListCellRenderer {
JTextArea t;
private LinkedHashMap<Integer, String> departmentsList;
private LinkedHashMap<Integer, Boolean> checkedList;
public MyListsRenderer(int tabSize) {
t = new JTextArea();
t.setTabSize(tabSize);
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
Integer id = (Integer) value;
// you need to create class that get an id (value) and return name
//this is my example:
String name = Contacts.getInstance().getContacts().get(
(Integer) value);
t.setText(name);//this is the text in the list row
add(t);
return this;
}
Similar Messages
-
How to set static name and id for IFRAME html generated
Hi,
The name and the id of the Iframe is generated dynamically as shown in this example (final html generated):
<IFRAME frameBorder=0 id="ivuFrm_page0ivu3" name="pb_837905732" title="Direccion Comunicaciones Integradas Home" src="home_direccion_comunicaciones_integradas.html" style="WIDTH:100%;HEIGHT:455px;" fixedHeight="455px" ></IFRAME>
However, we need to link to this iframe using the "target" property which has not been possible because we need static iframe name.
Anny suggestions?
THANKS.Hi,
first of all i think it is possible, you just need create a layout with nwds, Thats possible in a .Par project you need this referance in portalapp.xml ;
<property name="ClassName" value="com.sapportals.portal.pb.layout.PageLayout"/>
after creating this you need create a jsp file for coding, it is possible with writing this in portalappxml ;
<property name="com.sap.portal.reserved.layout.TemplateFile" value="example.jsp"/>
in this jsp page write this code:
<%@ taglib uri="prt:taglib:com.sap.portal.reserved.layout.TagLibLayout" prefix="lyt" %>
<%@ page import = "com.sapportals.portal.prt.pom.IPortalNode" %>
<%@ page import = "com.sapportals.portal.prt.connection.IPortalResponse" %>
<%@ page import = "com.sapportals.portal.prt.connection.PortalHtmlResponse" %>
<%@ page import = "com.sapportals.portal.prt.util.html.HtmlDocument" %>
<%@ page import = "com.sapportals.portal.prt.util.html.HtmlMeta" %>
<%@ page import = "com.sapportals.portal.prt.util.html.HtmlTitle" %>
<%@ page import = "com.sapportals.portal.prt.util.html.HtmlDocType" %>
<%
IPortalNode portalNode = componentRequest.getNode().getPortalNode();
IPortalResponse portalResponse =
(IPortalResponse) portalNode.getValue(
IPortalResponse.class.getName());
HtmlDocument htmlDocument = null;
if (portalResponse instanceof PortalHtmlResponse) {
PortalHtmlResponse htmlResponse =
(PortalHtmlResponse) portalResponse;
htmlDocument = htmlResponse.getHtmlDocument();
com.sapportals.portal.prt.util.html.Html htm = htmlDocument.getHtml();
com.sapportals.portal.prt.util.html.HtmlBody body = htmlDocument.getBody();
body.getElement("iframe name");
You can get elements and change, remove or add new elements to framework
%>
<table width ="100%" >
<lyt:template>
<tr>
<td width ="25%" align="center" valign="top">
<lyt:container id="column1" />
</td>
<td width ="50%" align="center" valign="top">
<lyt:container id="column2" />
</td>
<td>
<td width ="25%" align="center" valign="top">
<lyt:container id="column3" />
</td>
</tr>
</lyt:template>
</table>
After Deploying the layout, create a page with this layout and inculude the this empty page to framework.
İts should be work.
Best regards. -
How To Find Opening Stock And Value For a Material
Hi Experts,
How To Find Opening Stock And Value For a Material in Given Dates
Moderator Message: Search.
Edited by: kishan P on Sep 15, 2010 4:05 PMThanks For Answering.....
But I Need Any Function Module To Get Opening Stock And Value For Given Material With in Dates. -
How to get the name and value of an attribute on a node/element that is not a child
Hello,
Can someone shed some wisdom on how I can compare 2 xml nodes for differences.
My main challenge is I need to use the attributes/values of 'ProductDescription' and 'Features' as 'key' to identify the same node in
another doc with the same layout, but different content.
I am having trouble getting the name of the attribute on the node, 'ProductDescription' and 'Features'. I can only seem to get the node names, but not the attributes on the node. I need the name, because it can be different from doc to doc, so
I can't hardcode this.
Can someone please help with how to retrieve an attribute name/value on a node that is not a child. Here's an example of what
my xml looks like:
DECLARE
@myDoc1 xml
,@mydoc2 xml
DECLARE
@ProdID int
SET @myDoc1 ='<ProductDescription ProductID="1" ProductName="Road Bike">
<Features featureID = "1" featureName = "body">
<Warranty>1 year parts and labor</Warranty>
<Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
</Features>
<features featureID = "2" featureName = "seat">
<Warranty>1 year parts and labor</Warranty>
<Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
</Features>
</ProductDescription>
SET @myDoc2 ='<ProductDescription ProductID="1" ProductName="Road Bike">
<Features featureID = "1" featureName = "body">
<Warranty>2 year parts and labor</Warranty>
<Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
</Features>
<features featureID = "2" featureName = "wheel">
<Warranty>1 year parts and labor</Warranty>
<Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
</Features>
</ProductDescription>
I need to compare the attributes of 'ProductDescription' and 'Features' from @mydoc1 against @mydoc2 to see if they are the same based on those 2 nodes first. If they are, then i want to show the difference in the child elements.
This will eventually be an outer join to give me the differences betw the 2 docs based on those key values (node attributes).
I used node('//*') for the path, and value('local-name(../.)', 'varchar(50)') as element
,value('.[not(@xsi:nil = "true")]','VARCHAR(255)') AS new_value
...etc...
but that only gives me the node names, and the child elements. It does not give me back the attribute names and values from the node itself.
Thanks in advance for your help.
ceeAre you looking for something like this:
DECLARE @myDoc1 xml
SET @myDoc1 ='<ProductDescription ProductID="1" ProductName="Road Bike">
<Features featureID = "1" featureName = "body">
<Warranty>1 year parts and labor</Warranty>
<Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
</Features>
<Features featureID = "2" featureName = "seat">
<Warranty>1 year parts and labor</Warranty>
<Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
</Features>
</ProductDescription>'
SELECT T.c.value('local-name(.)', 'nvarchar(50)') AS name,
T.c.value('.', 'nvarchar(50)') AS value
FROM @myDoc1.nodes('ProductDescription/@*') AS T(c)
Erland Sommarskog, SQL Server MVP, [email protected] -
How to pass tag name and value dynamically in the output of PCo notification?
Hi,
I have a requirement to develop such a scenario where there can be multiple no of tags in PCo (Say 10) but there will be single notification to push the tag name when the value got changed and the changed value to MII. for any value change for any of the tag, the notification will be trigger. So As per my knowledge I have to pass the tag name and value dynamically in the "output" tab of the notification. But need your support to find out how to pass them dynamically.
Thanks in advance.
Regards,
SumanHi Suman/Jeedesh,
As per Pco notification, it will trigger whenever any of the tag value changes in Agent instance subscription items.
For above issue, My suggestion
1. Create DB table name TAGLIST with 200 tags as rows in columns (Tagname, TagValue)
2. Based on notification trigger, create a transaction and update values w.r.t TagNames in above table
3. Next time, when notification trigger with fresh value for any of the tag, cross check with existing TagName with Value and update in DB table.
4. And in the mean time, send those Tag details vie mail trigger or as per requirement
Instead of creating 200 notification, above is a just alternate way suggestion to achieve dynamic tag value change notification.
Hope it might solve your problem
Regards,
Praveen Reddy -
How to get Cookie Name and Value Using HttpGetterCallback - CE 7.3
Hi All,
We are migrating from Netweaver 7.0 to 7.3. We are facing a issue when migrating the custom login module from 7.0 to 7.3.
Since WebCallback is deprecated and not to be used in Netweaver 7.3, we are finding difficulties in getting the cookie name and value. Please find below our coding for getting the cookie value using HttpGetterCallback. We are not getting the cookie name and value, Kindly let us know if we are implementing the HttpGetterCallback correctly.
HttpGetterCallback httpGetCookieCallback = new HttpGetterCallback();
httpGetCookieCallback.setType(HttpCallback.COOKIE);
Callback] callbks = new Callback[ { httpGetUrlCallback, httpGetCookieCallback };
callbackHandler.handle(callbks);
requestUrl = (String) httpGetUrlCallback.getValue();
Cookie] cookies = (Cookie [) httpGetCookieCallback.getValue();
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
location.debugT("Cookies name " + cookies.getName()
+ " - value "
+ cookies.getValue());
Thanks and Regards,
SaravananTry This-
Cookie cookiesArray[] = request.getCookies();
Cookie currentCookie = null;
String currentCookieName = "";
String cookieValue = "dummycookie";
int cookieArrayLength = cookiesArray.length;
for (int i = 0; i < cookieArrayLength; i++) {
currentCookie = cookiesArray<i>;
currentCookieName = currentCookie.getName();
cookieValue = currentCookie.getValue();
Regards,
Atul -
Please help me :How to set the width and height for my View page "test.htm"
Hi,
I have controller class. When i call the view[test.htm]from this controller class ,i am getting the view with output tableview..it is fine.
My requirement:
the output view window is showing full browser window. I want the view output like showModeldialog. I want to set the width and height for the output view window. How is possible?
or
i want to call the test.view in the window.showModelDialog..
Please help me .. Urgent requirement.Yes you can set the width & Height of the view as follows..
<div style="width:580px; height:750px; margin-top:15px; overflow:auto;">
<htmb:form......>
</htmlb:form>
</div>
<i>*Reward each useful answer</i>
Raja T -
How to set file name and destination folder without user interaction
how can I set the file name and destination folder to generate a pdf file like "c:\myfolder\document.pdf" in this folder automatically.
Is there a tag in .joboptions ?
Goal: User click print button. In the background a pdf will be generated in e.g. "C:\myfolder\document.pdf".
that`s it.
I know that the query dialog for save as can be turned off. But the file name depends on the application.
Thanks for your help.
TKHello,
Please post this in PI forums
Regards, Anil -
How to set PropertyBag Key and value at farm and sitecollection via PowerShell
Hi,
how could i create PropertyBag Key and value at farm and sitecollection via PowerShell?
Best Regards
Bog
Developers Field Notes | www.bog1.deHey, you can do it as follows
asnp *sh*
$site = get-spsite "site url"
$web = $site.openweb()
$web.AllProperties["NEW KEY"] = "NEW VALUE"
$web.update()
$web.dispose()
Your new custom property will be present in the web Property bag.
and you can access it by $web.AllProperties["New Key"] or simply $web.Properties["New Key"]
get2pallav
Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you. -
How to set the parameter ID value for a range
I am trying to call transaction KSB1 (Display actual line items for cost center) by supplying all the default values for the selection options/parameters and skipping the selection screen from the calling program. However, for the cost center range, both HIGH and LOW field have the same PID (i.e. KOS). Same thing for the cost element range. When I set the value for PID "KOS", only the low value got populated.
I tried to pass a BDC table to the
CALL TRANSACTION 'KSB1' USING bdc_tab
, but the PID used before takes higher priority so the bdc_tab values got overwritten by the PID values for those fields.
Does anybody know how to find or set the PID for a selection range? I need PID for Cost center range, cost element range and the period (PID="VPE").
Any advice is appreicated. Thank you
Minamiotherwise try to make use of SUBMIT command.
<b>Hi Preetahm ,
KSB1 is a Report , not a Tcode to maintain master data or any thing like that ?, u can also cross check?</b>
by using SUBMIT command u have to <b>RKAEP000</b> this program along with the selection screen.
regards
Prabhu
Message was edited by: Prabhu Peram -
How to set the default context value for flexfield in OAFramework pages
Hi,
I have a page which contains a contexxt value field i.e Flexfields
To select the context value we have to select the value from drop down
So Here we want to display the context value immediately when the page is called
How to set the default valu in this case
Regards,
KrishnaYou can set the Attribute category view attribute to the Flexfield context value and call prepareforRendering in the flex bean. Check the dev guide for details.
Regards
Sumit -
How to set a 3 default values for a dependent key flexfield
hi,
I have an inquiry in oracle applications 11i - Oracle General Ledger module, Accounting Key flexfield structure.
we have an independent key segment PROJECT and a dependent key segment SUB-PROJECT.
Can we define 3 dependent value for the SUB-PROJECT to be the default for any new entered value in the PROJECT segment??
e.g creating 3 default SUB-PROJECT values: X, Y, and Z. Any new value entered to the PROJECT key segment will have X, Y and Z by default as it's SUB-PROJECTS.
If the above scenario is possible, please guide me to the best solution...
Thank you...I can find that the value set of any dependent value set has only one room for a default value.
What are the implications of creating a new Independent value set and assign it to the SubProject segment, on historical data and reports?
thank you... -
How to set default encoding and charsets for jsp and servlets.
Hi,
Is there any possibility to set default encoding or charset for jsps and servlest (for both request and response)?
For example in Weblogic such parameters can be set in weblogic specific configuration files (weblogic.xml).
Thanks in advance.Hi,
I created one request with logo in the header an page in the footer etc. and called StyleSheet. After you can import this formats by each request.
You can do this in compound layout.
Regards,
Stefan -
How to set physical min/max values for a scale in xy graph?
Hello,
I have troubles with the way LabView handles physical units in xy graphs. In particular, I use a time scale for the x axis.
The values are timestamps and have the unit [s]. Now I want to read write the min max values for this scale via
property nodes. It seems that the properties for min max do not support the use of the unit I use for the data for
that same axis. This is very inconvenient and I am not even sure which kind of data to use at all for this properties.
Is it simply converting to/from [s] using the unit converter?
(I am using LabView 7.1 for the programm in question).
Thanks,
OlafHi Olaf
"It seems that the properties for min max do not support the use of the unit I use for the data for that same axis."
What are the units you are using? can you make it a littlebit clear.
You can change the units also using Property node.
Just check the attachment once. If that is what you are looking for, then the problem is solved.
Regards
Anil
Message Edited by reddy on 05-23-2006 05:25 AM
Message Edited by reddy on 05-23-2006 05:27 AM
Attachments:
X-Scale.jpg 8 KB -
WD for Java: How to I retrieve key and value for DropDownbyKey selection
Dear All
I thought this was going to be straightfoward and am obviously missing something.
I have created a simple modifiable value set to create a dropdown list to select a country:
public void GetCountryDropDownValues( )
//@@begin GetCountryDropDownValues()
Y_Tf_Npf_Get_Countries_Input countriesInput = new Y_Tf_Npf_Get_Countries_Input();
wdContext.nodeY_Tf_Npf_Get_Countries_Input().bind(countriesInput);
try {
countriesInput.execute();
wdContext.nodeY_Tf_Npf_Get_Countries_Input().nodeOutput_countries().invalidate();
} catch (WDRFCException ex) {
// TODO: handle exception
IPrivateNonPersonalisedLearnAdminReq.IContextElement elem = wdContext.currentContextElement();
String strObjElem0 = elem.COUNTRY;
IWDAttributeInfo i_ObjType0 = wdContext.getNodeInfo().getAttribute(strObjElem0);
ISimpleTypeModifiable w_ObjType0 = i_ObjType0.getModifiableSimpleType();
IModifiableSimpleValueSet s_ObjType0 = w_ObjType0.getSVServices().getModifiableSimpleValueSet();
s_ObjType0.clear();
for(int i=0;i<wdContext.nodeEt_Countries().size();i++)
IPublicNonPersonalisedLearnAdminReq.IEt_CountriesElement elemOrg = wdContext.nodeEt_Countries().getEt_CountriesElementAt(i);
s_ObjType0.put(elemOrg.getLand1(),elemOrg.getLandx50());
//@@end
This is bound to a new context element attribute:
Country of type string
When value is selected from dropdown, it is stored in string
What I want to be able to do is to retrieve the text as well as the key from the selected object.
At the moment I can only return the key.
i.e. wdContext.currentContextElement().getCountry();
Any pointers will be greatfully received and maximum points awarded to the first complete
answer that works for me.
Many thanks in advance
MikeHi,
You can use the following code.
ISimpleValueSet valueset = attInfo.getModifiableSimpleType().getSVServices().getValues();
if(valueset.containsKey(key)){ // Give your key here, which you already know to retrieve
String value = valueset.getText(key); // Here you will get the value
Hope it helps.
Regards,
Manoj
Maybe you are looking for
-
Home and Jobs tab disappearing in Firefox but available on InternetExplorer
I can access iRectuitment page through this URL, http://servername:8000/OA_HTML/IrcVisitor.jsp On the first page there are two tabs HOME and JOBs, when I click on any of the tabs then suddenly the tabs are disappearing. NOTE: This is happening only o
-
Problem with a JDBC Adapter when connect to Instance on SQL Server
Hi, Currently I'm setting up a communication channel with the JDBC adapter to work on a SQL Server database. When I use a string without specifying the connection instance, the JDBC driver takes the default instance and connects to a database without
-
Can't scan (HP All in One) with my MacBook
My HP All in One scanner works fine with my iMac desktop, but I can't get it to work with my MacBook. The device scans (but says "Enter Fax Number") but won't transfer the scanned sheet to the desktop. Thanks for any suggestions!
-
Error : Document 6000019 saved (no accounting document generated)
Hi Friends, While Iam Releasing Billing Document To Accounting It Is Throwing Error Message " Document 6000019 saved (no accounting document generated) " Where Is The Problem Please Let Me Know Regards Udaya Bhasker Bandi
-
Hi When I open up a smart keyboard all I can see are the keys - I cannot see the area above the keys where in the manual it says you can tap to change instruments ie from the standard piano to organ synth etc. Any ideas? It looks like I'm zoomed in o