How to add elements to a list of Long Serializable
I am currently writing a set of generic DAOs with generic signatures such as DAO<PK extends Serializable> (you've all seen the pattern).
I am using Hibernate to persist to the database whose method is;
public Serializable save(Object object)
However, I am working in batches to save groups of Objects at a time & would like to save the returned Serializable types from this method to a list.
List< ? extends Serializable> someList = new ArrayList< Long >
for ( loop 0..n ) {
someList.add( save( objectToPersist ) );
This will not even compile as the IDE gives the error;
The method add(capture-of ? extends Serializable) in the type List<capture-of ? extends Serializable> is not applicable for the arguments (Serializable)
Ive obviously got the wrong end of the stick somewhere but I thought List<? extends Serializable> was a subclass of Collection<?> etc.
Or am I trying to subclass a super type...
Apologies for a stupid question as Ive just started using Generics & I've got the Tiger 5 book to read this weekend so Im sure itll make sense by then, but this is confusing me.
Thanks
As a side note
List<? extends Serializable> someList = new ArrayList< Long >();
someList.add(null); //works
someList.add(new Long(21)); //wont compilehttp://www.javabeat.net/articles/33-generics-in-java-50-3.html
http://www.javabeat.net/articles/33-generics-in-java-50-4.html
Came across these links discussing why the above wont compile
Similar Messages
-
How to add a video play list on palm pre
Does anybody knows how to add a video play list in palm pre?
I did try to add video in different folders but in the palm device are loaded in the same playlist. Is there a way to organize video files?
tks
Post relates to: Pre p100ueu (O2)QuickTime requires player and plugins that most people don't have. You'll reach a much wider audience if you use HTML5 <video> with mp4, webm and ogg files.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 with Video</title>
<!--help for older IE browsers-->
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<style>
video {
max-width:100%;
display:block;
margin:0 auto;
</style>
<body>
<h2>Use 3 File Types to support all browsers & mobile devices: MP4, WEBM and OGV.</h2>
<h3>Online Video Converter
http://video.online-convert.com/</h3>
<!--begin video-->
<video controls poster="Your_poster_image.jpg">
<!--these are 6 sec sample videos for testing purposes. Replace sample-videos with your own files-->
<source src="http://techslides.com/demos/sample-videos/small.webm" type="video/webm">
<source src="http://techslides.com/demos/sample-videos/small.ogv" type="video/ogg">
<source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4">
If you're seeing this, you're using an
outdated browser that doesn't support
the video tag. </video>
<!--end video-->
</body>
</html>
Nancy O. -
How to add Gap between dropdown List Items - ComboBox in MFC VC++
How to add Gap between dropdown List Items - ComboBox in MFC VC++
Did you tried SetItemHeight() inside your App .
Thanks
Rupesh Shukla -
How to add elements into Object[][] type of list, in runtime?
I have Object list, ie.
final Object[][] data = {
{"January", new Integer(150) },
{"February", new Integer(500) },
{"March", new Integer(54) },
{"April", new Integer(-50) }
};How can I dynamicly add new elements in it, at the runtime?
Thank you in advance!Do I have to remove 'final' for that, and then add
elements?
No. you can't change an array's size.
You can do this
Object[][] arr = new Object[numRows][numCols];But once you've created it, its size can't change.*
I don't know what you're doing, though, and what actual data you're putting in, but Object[][] holding rows of [String, Integer] is almost certainly a poor data structure. Think about creating a class the represents one "row" here and then create a 1D array of that class.
* Okay, you can kinda sorta effectively "change" the size of second and subsequent dimensions, since a multidimensional array is an array of arrays. I wouldn't recommend it though: int[][] arr = new int[3][2]; // a 3 x 2 rectangular array of int--it's an array of array of int, with 3 "rows", each of which is an array of int with 2 elements.
arr[0] = new int[10]; // now it's a jagged array whose first row has 10 elments instead of 2Here we haven't changed an array's size, just replaced one of its elements, which is also an array, with a new, larger array. -
Add element in dropdown list dynamically
Hi All,
I am facing a problem in adding item in a dropdown list dynamically.
When i get dropdown list through IgetElementById get null.
var list = document.getElementById("targetgroupname");
here list comes as null. Now I've to fill this list. I am using below code -
for(var j=0;j< com.length;j++){
iist.options[j]= new Option(com[j],com[j]);
But it is not working. My list is not getting filled with these values.
I doubt due to var list -> null it does not allow to add element.
But I am not getting any clue, how to initialize it.
Please suggest, I am new to javascript.
Thanks & Regards,
Sneha.Hi,
Thanks for the reply, yes the select box has that id - targetgroupname.
actually there are 2 dropdown lists, Based on the selection of first dropdown list another list shd be filled.
So I've written a script at "onchange" of first dropdown list. It works fine when a value gets changed at first dropdown list.
In some cases I've to display a preselected value at first list ( which comes from previous page as parameter), in that cases there will be no onchange on first list, so I've called the script function manually after creating the first list,like below :
<SCRIPT> checkSource();</SCRIPT>
and in this case it does not work & I get a null when i try to read the 2nd list.
But I am not sure why it is happening.. may be it is not loaded /created on page when i am calling it.
If yes, what shd I do ?
Thanks for your time.
Regards,
Sneha -
How to add item to a List with a bounded wildcard
Hi,
Is there a way to add a subtype instance to a List with a bounded wildcard? For example, say I have an
abstract class called Car. Then I have 2 concrete subclasses--Ford and Toyota. Now say I have another
class that contains a prepopulated list and is wildcard bounded like this: List<? extends Car> carList. I
want to add a method where I pass in a Car subtype as a parameter and then add it into this list, e.g:
public void addCar(Car car) {
carList.add(car);
Trying this, I keep getting "cannot find symbol" compilation errors. When I went back to read the Generics
tutorial by Bracha, he mentions that explicitly adding a subtype, e.g. carList.add(new Ford()), can not be
done. But here I'm adding the "upper bound" of the wildcard, i.e. the Car type. Therefore there should be no
discrepancy between supertype and subtype an thus the carList.add(car) should be ok, IMO.
Am I misunderstanding something with this logic? Also, if carList.add(car) can not be done, then how can
I go about doing something similar which will allow me to add subtypes to a "generic" list?
Thanks in advanced!
-losI get a compilation error expecting an Object instead of a Car. Of course you did. List<? super Car> is a list into which you can put cars -- and possibly other stuff. List<? extends Car> is a list out of which you can get cars (possibly of different makes).
Do you need a list that you can put cars in and get cars out? That's List<Car>
This isn't a linguistic problem you are having; this is a design problem. If you have a function that takes an argument which is a list that you can put any kind of car into and be sure of getting a car out of, it isn't reasonable to pass in a List<Ford> (because the function might put in a Chevy) or a List<Object> (but there might be motorcycles already in there). By the requirements you have, you need a List<Car> and nothing else.
Yes, you could use a cast, but all you are doing is circumventing the type system by saying "I know this List<Object> only has Cars in it." -
How to add an SAP distribution list to transport?
Hi All,
I have created a shared distribution list in SAP using SO15. Can anyone suggest me how to add this list to a transport? or I need to create this in each environment.
Please suggest on this issue.
Thanks in advance
PradyWhat does that mean? So I have to create it in each environment(i.e. Development/Quality/Production) explicitly. By no means I can transport this list then?
Thanks for your quick response.
With regards
Prady -
How to add data into a List box
CS3 SDk:Windows<br /><br />Hi all,<br />I am trying to add data into a basic List box in CS3??<br /><br />// .fr<br />GenericPanelWidget<br /> (<br /> // CControlView properties<br /> kInvalidWidgetID, // widget ID<br /> kPMRsrcID_None, // PMRsrc ID<br /> kBindNone, // frame binding<br /> Frame(0,0,250,90) // left, top, right, bottom<br /> kTrue, // visible<br /> kTrue, // enabled<br /> // GroupPanelAttributes properties<br /> "", // header widget ID<br /> { <br /> <br /> WidgetListBoxWidgetN<br /> (<br /> kWFPListBoxWidgetID, kSysListBoxPMRsrcId, // WidgetId,RsrcId<br /> kBindAll, // Frame binding<br /> Frame(0,0,250,90) // Frame<br /> kTrue, kTrue, // Visible, Enabled<br /> 1,0, // List dimensions<br /> 19, // Cell height<br /> 1, // Border width<br /> kFalse,kTrue, // Has scroll bar (h,v)<br /> kTrue, // Multiselection<br /> kTrue, // List items can be reordered<br /> kTrue, // Draggable to new/delete buttons<br /> kFalse, // Drag/Dropable to other windows<br /> kTrue, // An item always has to be selected<br /> kFalse,// Don't notify on reselect<br /> kFalse, <br /> { <br /> } <br /> <br />),<br />},<br />),<br /><br />//-------ID.h--------<br />DECLARE_PMID(kWidgetIDSpace, kWFPListBoxWidgetID, kWFPPrefix + 2)<br /><br />//observer.cpp-----------WFPDialogObserver::Update<br /><br />//get currently selected/active widget <br />WidgetID theSelectedWidget = controlView->GetWidgetID();<br /><br />// ist it the text edit field? <br />if (theSelectedWidget == kWFPInsertButtonWidgetID && theChange == kTrueStateMessage) <br />{ <br /><br />IControlView* listBox = panelControlData->FindWidget(kWFPListBoxWidgetID);<br /><br />InterfacePtr<IListControlData> listControlData(listBox, UseDefaultIID()); <br /><br />//Insert the string into listbox <br />PMString strText = dialogCtrl->GetTextControlData(kWFPTextEditBoxWidgetID); <br /><br />// obviously there can't be a translation for text entered by user <br />strText.SetTranslatable(kFalse);<br />listControlData->Add(strText,kWFPTextEditBoxWidgetID); <br />dialogCtrl->SetTextControlData(kWFPTextEditBoxWidgetID, ""); <br />break; <br /><br />I am not able to Add items into list box.<br /><br />I tried based on Discussion <br />http://www.adobeforums.com/webx/.3bc43877<br /><br />but not able to locate SDKListBoxHelper file .it is not available in SDK.<br /><br />Please ,<br />Tell me Where I am going wrong.<br /><br />Thanks,<br />Adil
resource VSPDialogWidget (kSDKDefDialogResourceID + index_enUS)
__FILE__,
__LINE__,
kVSPDialogWidgetID, // WidgetID
kPMRsrcID_None, // RsrcID
kBindNone, // Binding
Frame(5,0,491,266) // Frame (l,t,r,b)
kTrue,
kTrue, // Visible, Enabled
kVSPDialogTitleKey, // Dialog name
DefaultButtonWidget
kOKButtonWidgetID, // WidgetID
kSysButtonPMRsrcId, // RsrcID
kBindNone, // Binding
Frame(9,234,89,254) // Frame (l,t,r,b)
kTrue,
kTrue, // Visible, Enabled
kSDKDefOKButtonApplicationKey, // Button text
CancelButtonWidget
kCancelButton_WidgetID, // WidgetID
kSysButtonPMRsrcId, // RsrcID
kBindNone, // Binding
Frame(394,234,474,254) // Frame (l,t,r,b)
kTrue,
kTrue, // Visible, Enabled
kSDKDefCancelButtonApplicationKey, // Button name
kTrue, // Change to Reset on option-click.
WLBCmpListBox //Tree view
kWLBCmpListBoxWidgetID, kPMRsrcID_None, // WidgetId, RsrcId
kBindAll, // Frame binding
Frame(299,49,475,170) // Frame
kTrue, kTrue, // Visible, Enabled
kTrue, // EraseBeforeDraw
kInterfacePaletteFill, // InterfaceColor
kHideRootNode | kDrawEndLine, // Options. Display root node
kFalse, // Use H Scroll bar
kTrue, // Use V scroll bar
20, // fVScrollButtonIncrement
20, // fVThumbScrollIncrement
0, // fHScrollButtonIncrement
0, // fHThumbScrollIncrement
2, // Items selectable, 0 = No Selection, 1 = Single Selection, 2 = Multiple Selection
kFalse, // Allow children from multiple parents to be selected
kTrue, // Allow discontiguous selection
//The tree view is dynamically created.
// added to support the list elements in the list box
resource LocaleIndex (kWLBCmpListElementRsrcID)
kViewRsrcType,
kWildFS, k_Wild, kWLBCmpListElementRsrcID + index_enUS
resource WLBCmpNodeWidget (kWLBCmpListElementRsrcID + index_enUS)
__FILE__, __LINE__,
kWLBCmpListParentWidgetId, kPMRsrcID_None, // WidgetId, RsrcId
kBindLeft | kBindRight, // Frame binding
Frame(0, 0, 194, 20), // Frame
kTrue, kTrue, // Visible, Enabled
"", // Panel name
// Just a info-static text widget with about-box text view to get white bg.
WLBCmpTextWidget
kWLBCmpTextWidgetID, kPMRsrcID_None, // WidgetId, RsrcId
kBindLeft | kBindRight, // Frame binding
Frame(45,1,194,18) // Frame
kTrue, kTrue, kAlignLeft,kEllipsizeEnd // Visible, Enabled, Ellipsize style
"", // Initial text
0, // Associated widget for focus
kPaletteWindowSystemScriptFontId, // default font
kPaletteWindowSystemScriptHiliteFontId, // for highlight state.
If you still got problems, post you email here - I'll send you the complete project/code then.
-Marc -
SharePoint 2010 Rest API: How to add attachment to a list item via ListData.svc
Hi
I have set up a project using the REST API in c# Visual Studio 2010.
I have added a service reference to the URL //site/_vti_bin/listdata.svc/
I can query the list and get back data, but I can't retrieve the attachments.
I can write data to the list, but I can't add attachments.
Are there any examples of how to add or retrieve attachments using the REST API services.
Thanks
MikeHi,
If you want to work with list attachments using REST API, here are some links will show how to do this using Javascript:
http://msdn.microsoft.com/en-us/library/office/dn292553.aspx#FileAttachments
http://chuvash.eu/2013/02/20/rest-api-add-a-plain-text-file-as-an-attachment-to-a-list-item/
http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2013/06/27/how-to-get-list-item-attachments-using-rest-and-javascript-in-sharepoint-2013.aspx
Best regards
Patrick Liang
TechNet Community Support -
How To Add scrollbar in Spark list which will work on mouse movement ?
Hi,
I want to add scrollbar in Spark list which will work on mouse movement, i.e instead scrolling down it will sense mouse position and scroll automatically. I could not find a way to handle this with horizontalLayout.
I tried hovering on list and setting ensureIndexIsVisible(index) but hovering element index is not present in the Spark List.
Any idea on this will be highly appreciated.
Thanks in advance
AvishekHi,
I want to add scrollbar in Spark list which will work on mouse movement, i.e instead scrolling down it will sense mouse position and scroll automatically. I could not find a way to handle this with horizontalLayout.
I tried hovering on list and setting ensureIndexIsVisible(index) but hovering element index is not present in the Spark List.
Any idea on this will be highly appreciated.
Thanks in advance
Avishek -
REG: How to add elements onto htmlb table cell.. URGENT PLZ HELP
Hi all,
I have created a htmlb table. And the jsp code is as follows
<%@ taglib uri="tagLib" prefix="hbj" %>
<jsp:useBean id="myBean" scope="application" class="com.linde.myaccounts.util.TableBean" />
<hbj:content id="myContext">
<hbj:page title="PageTitle">
<hbj:form id="myFormId" >
<hbj:tableView id="myTableView1"
model="myBean.model"
design="ALTERNATING"
headerVisible="false"
footerVisible="false"
fillUpEmptyRows="true"
visibleFirstRow="1"
visibleRowCount="5"
</hbj:form>
</hbj:page>
</hbj:content>
width="500 px" >
</hbj:tableView>
I have used a table bean by which I am getting the column header names. I have 5 columns, I have to add input field in the first column, checkbox in the second column, leave the third column blank, checkbox in the fourth column and again a input field in the fifth column. I am not understanding on how to add this elements onto the table. Will I add it from the JSP using <hbj:tableViewColumns> tag or I have add them in the bean or in the dynpage. Kindly someone give me the code for this...
This is very urgent..Kindly help...
Thanks in advance,
PriyankaHi,
Have you tried looking at the examples that come with the PDK for all of the HTMLB elements? From memory, there should be a small table example or 2 that have different types of columns shown similar to what you want - they have the full source code with them for you to look at.
If you are working in a portal, go to the Java Developer tab and I "think" there should be a tab linking to HTMLB documentation and examples - sorry I can't be more specific but I don't have access to a portal at the moment so am trying to remember.
Gareth. -
How to add appointment in calendar list view
How do I add an appointment to my calendar list view now? I used it constantly and I know to touch the magnifying glass to find the list view, but I need to be able to add my appointments too. Is there a setting to change? Thank you.
Hi Karim,
When you create a mobile project un Eclipse using the wizard, you have something like this:
createContent : function(oController) {
return new sap.m.Page({
title: "Title",
content: [
Now you can add your button in two ways:
createContent : function(oController) {
return new sap.m.Page({
title: "Title",
content: [new sap.m.Button("myButton", {
text:"my button"})
Or:
createContent : function(oController) {
var page = new sap.m.Page({
title: "Title"
page.addContent(new sap.m.Button("myButton", {
text:"my button"}));
return page;
And if you want to run the same application on mobile and desktop, you should use the sap.m library. It's responsive and works really well in both devices.
Regards -
How to add check box to list screen in SYCLO Agentry?
Hi,
How can I add a check box to the list screen. I want to add a new column which allows the user to select the check box.
I have tried with "Allow Multi-Row Select" option. When I selected this option I am getting an error
"The For Object defined for the "Transmit" action is invalid. 'None' is not a valid choice since the Multi-Row Selection option for the list screen is enabled."
-ShyamIs the list screen in transaction screenset or Object?
You can't use the field type button in a list screen. But what you can do is take a 16 x 16 image, with a checked box not checked.
Users will not be able just to check the box to enable it or not. You need to have an action linked to a button to the selected row, or you can have an action fire if the user double checks the row.
Stephen -
How to add fields to output list of BP search
Hi,
We have MDM 3.0. Currently we use the standard SAP-MDM Business Partner search functionality for searching a business partner. In the output list/result list of a search currently the fields street2/street4 are not shown. Can anybody tell me if it is possible to add those fields to the output list/result list? If yes how.
regardsInformation on that has been provided in the Help Portal:
http://help.sap.com/saphelp_mdm300/helpdata/EN/af/2a679db94f11458e3ccabe47a14d47/frameset.htm
Navigate further:
-> Search
-> For Administrators
-> Enhancement of the Search with New Attributes
Hope this helps.
Best regards,
Markus -
How to add a drop down list to a TextBox
Hi all,
can anyone please tell me how can i add a dropdown list to TextBox which is similar to the search engine suggestions box
it is required to display some list of items
here is [Search engine screenshot|http://lh6.ggpht.com/_XZ5lTObJ3ZY/TBovcy_4fWI/AAAAAAAADdU/eUJXCG0P8MA/s720/screenshot.jpg] for reference
Thanks in advance
DharmaPhilippe sir wrote:
It can be a ListView you add dynamically to the scene, or a PopupMenui think you are right sir
can you provide some code for displaying PopupMenu
and one more clarification needed in case of ListView that when i added 3 items to ListBox it is showing some extra grids(but they are not selectable)
if possible provide some link to tutorial which explain ListView in detail
Maybe you are looking for
-
Calling a method in an owning object
I have an application that involves an object (B) that is a member (not a sub-class) of another object (A). Within the owned object (B) I want to call up a method from the owning object A. E.g I would like to do something like this: class A object B;
-
After I've generated a DVD the video is inversed
I've made all the footage and previewed it and all was ok. After I've generated the DVD, when I took a look of the final render, the video plays upside down. If I take a look to the project again, It showing me the video upside down too... I've made
-
Upgrade from 10.7.5 ?
Can I upgrade to Mavericks from 10.7.5 or do I need 10.8 before ? Thanks.
-
Kramer switcher effects playback of video in Pro Presenter
I am using a Kramer switcher/scaler (vp719DS) to display video through two LCD projectors. I am also using a program called Pro Presenter (www.renewedvision.com) which utilizes Quicktime to play back video in the presention. When I plug in my MBP to
-
Why can't I update iPhoto on my new Airbook?
My new Macbook Air with Lion came with iPhoto 9.2.1. Now 9.2.3 is available. The AppStore icon in doc shows 2 things that need updating: iPhoto and also Garage Band. A new software search did not reveal this, only the AppStore icon and I am bloc