Accessing custom class properties
Hello again! Too bad I understood the display list ordering
because this got me into even more trouble :)
I have several objects stacked upon each other (boxes) and
want to calculate the height of all underlying boxes for each box.
Each box is an instance of a custom "Kiste"-class which has a
"hoehe" (height) property. Usually I can access this property from
everywhere and it works fine. But in the following case it won't.
The alles.getChildAt(j-1) works just fine with every other
property, just not with the custom properties I defined in my
class?
Ok, got it myself.... Type Casting!
Similar Messages
-
Accessing custom classes from JSP
Hi Guys,
I am having some problems accessing my custom classes from my JSP.
1) I've created a very simple class, SimpleCountingBean that just has accessors for an int. The class is in the package "SimpleCountingBean". I compiled this class locally on my laptop and uploaded the *.class file to my ISP.
2) I've checked my classpath and yes, the file "SimpleCountingBean/SimpleCountingBean.class" is located off of one of the directories listed in the classpath.
3) When I attempt to use this class in my JSP, via the following import statement:
import "SimpleCountingBean.*"
I get the following compile error
java.lang.NoClassDefFoundError: SimpleCountingBean/SimpleCountingBean
I'm pretty sure that my classpath is properly setup because when I purposely garble the import statement, I get the "package not found" compile error.
Do I need to upload some other files in addition to the class file? Any suggestions would of course be appreciated.
Sonny.Trying to get some clearer view.. so don't mind..
So you uploaded all your .jsp files into your account which is:
home/sonny
and it compiles and work. But custom classes doesn't seems to be working, where did you place your classes?
From my knowledge of tomcat, classes are normally placed in, in this case:
home/sonny/web-inf/classes
Maybe it differs from windows enviroment to *nix enviroment.. well, I'm just saying out so if its not the case.. don't mind me. -
Access class' properties (in _root) from movieclip timeline?
I'm trying to follow the advice "class properties are better
then _global variables", but how could I access a class' properties
(imported in the main timeline) from a movie Clip timeline?
this code in the main timeline works (and trace the value of
lang):
import scripts.StartupSettings
trace (StartupSettings.lang);
but if I try to access the lang property from a movie clip
timeline, with the same:
trace (StartupSettings.lang);
I get traced "undefined".
The only workaround I have found is to import again the class
inside the clip, but I would like to avoid it in order to keep
dimensions small.
Any idea? thanksThe import statement doesn't really import anything. It's
used to not have to call a method using the fully qualified class
name. So, don't worry about 'dimensions'. And, the import statement
is only 'valid' on the frame it is defined on. On another frame,
you have to use the import statement again. -
How to access MC's textfield created in a custom class?
I have a custom class which creates a new MC using a library MC. The library MC contains a dynamic textfield called productName.
The custom class object gets created fine and is displaying on the stage. It's also holding custom properties I set as well.
How do I control the dynamic textfield inside the MC, which is inside the custom class object?
My Product.as:
package {
import flash.display.MovieClip;
public class Product extends MovieClip {
public var prodName:String;
public var prodCategory:String;
public var prodQuality:String;
public function Product():void {
var productMC:MovieClip = new cellMC();
addChild(productMC);
My .FLA first frame:
var myProd1:Product = new Product();
myProd1.prodCategory = "Heaters";
myProd1.x = 150;
myProd1.y = 140;
addChild(myProd1);
// THE FOLLOWING DOES NOT WORK
myProd1.productMC.productName.text = "ABC 123";
I figure something like this would work, but with lots of variations, still nothing works
I get errors telling me it can't find productMC.
UPDATE:
Using GetByChildName it seems I can access productMC. For example this works:
myProd1.getChildByName("productMC").visible = false;
But this does not work:
myProd1.getChildByName("productMC").getChildByName("productName").text = "dgdhdhdhrgh";
If I take the textfield out of the library MC, and create it in the class, then this works:
myProd1.getChildByName("productName").visible = false;
BUT this does not work:
myProd1.getChildByName("productName").text = "sdgsgdfsg";Hi Otto,
If I well understood your situation, the solution might be quite simple.
Since your Product class is a MovieClip (and not a Sprite), you could solve your problem many ways knowing that a MovieClip is a dynamic class.
But first, the thing is that you created your productMC object on the fly inside your Product class.
So either you correct it like this:
package {
import flash.display.MovieClip;
public class Product extends MovieClip {
public var prodName:String;
public var prodCategory:String;
public var prodQuality:String;
public var productMC:MovieClip; // *****
public function Product():void {
productMC = new cellMC(); // *********
addChild(productMC);
Or use this cheap trick (a MovieClip is a dynamic class):
package {
import flash.display.MovieClip;
public class Product extends MovieClip {
public var prodName:String;
public var prodCategory:String;
public var prodQuality:String;
public function Product():void {
var productMC:MovieClip = new cellMC();
this.productMC = productMC; // **************
addChild(productMC);
Although it is possible that, for this one, you need to reforce the dynamic property:
package {
import flash.display.MovieClip;
dynamic public class Product extends MovieClip {
I am not sure, but anyway, you will see for yourself.
Plus, you try to change text to a MovieClip object? Either there is already a TextField in you cellMC object and you are not targeting it, or productMC should be instanciated as a TextField and not a MovieClip. I think you know the answer to that.
Design Cyboïde
Designer web Montreal -
Access Custom Configuration Item Class property in Data Warehouse database
Is there a way to access properties on a custom 'Configuration Item Class' in the DW database?
When creating a new CI class eg. 'Monitors' and extending this with a property like 'Serial' is there a way to access this in the DW database?
I can find Displayname and AssetStatus in the ConfigItemDim table, but is there a way to get the other custom created properties?Ok !
Are you read this post ? :
http://social.technet.microsoft.com/Forums/systemcenter/en-US/8434e129-b969-451e-875c-f120d7b31d36/dw-reporting-on-custom-class?forum=systemcenterservicemanager
Remy BOVI -
Custom class loader and local class accessing local variable
I have written my own class loader to solve a specific problem. It
seemed to work very well, but then I started noticing strange errors in
the log output. Here is an example. Some of the names are in Norwegian,
but they are not important to this discussion. JavaNotis.Oppstart is the
name of my class loader class.
java.lang.ClassFormatError: JavaNotis/SendMeldingDialog$1 (Illegal
variable name " val$indeks")
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.lang.ClassLoader.defineClass(ClassLoader.java:431)
at JavaNotis.Oppstart.findClass(Oppstart.java:193)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at JavaNotis.SendMeldingDialog.init(SendMeldingDialog.java:78)
at JavaNotis.SendMeldingDialog.<init>(SendMeldingDialog.java:54)
at JavaNotis.Notistavle.sendMelding(Notistavle.java:542)
at JavaNotis.Notistavle.access$900(Notistavle.java:59)
at JavaNotis.Notistavle$27.actionPerformed(Notistavle.java:427)
JavaNotis/SendMeldingDialog$1 is a local class in the method
JavaNotis.SendMeldingDialog.init, and it's accessing a final local
variable named indeks. The compiler automatically turns this into a
variable in the inner class called val$indeks. But look at the error
message, there is an extra space in front of the variable name.
This error doesn't occur when I don't use my custom class loader and
instead load the classes through the default class loader in the JVM.
Here is my class loading code. Is there something wrong with it?
Again some Norwegian words, but it should still be understandable I hope.
protected Class findClass(String name) throws ClassNotFoundException
byte[] b = loadClassData(name);
return defineClass(name, b, 0, b.length);
private byte[] loadClassData(String name) throws ClassNotFoundException
ByteArrayOutputStream ut = null;
InputStream inn = null;
try
JarEntry klasse = arkiv.getJarEntry(name.replace('.', '/')
+ ".class");
if (klasse == null)
throw new ClassNotFoundException("Finner ikke klassen "
+ NOTISKLASSE);
inn = arkiv.getInputStream(klasse);
ut = new ByteArrayOutputStream(inn.available());
byte[] kode = new byte[4096];
int antall = inn.read(kode);
while (antall > 0)
ut.write(kode, 0, antall);
antall = inn.read(kode);
return ut.toByteArray();
catch (IOException ioe)
throw new RuntimeException(ioe.getMessage());
finally
try
if (inn != null)
inn.close();
if (ut != null)
ut.close();
catch (IOException ioe)
}I hope somebody can help. :-)
Regards,
Knut St�reI'm not quite sure how Java handles local classes defined within a method, but from this example it seems as if the local class isn't loaded until it is actually needed, that is when the method is called, which seems like a good thing to me.
The parent class is already loaded as you can see. It is the loading of the inner class that fails.
But maybe there is something I've forgotten in my loading code? I know in the "early days" you had to do a lot more to load a class, but I think all that is taken care of by the superclass of my classloader now. All I have to do is provide the raw data of the class. Isn't it so? -
Accessing custom java classes in Coldfusion
I have created some java classes (.class) to work as a model
in CF. I could instantiate this classes through the CreateObject()
function in CF but I was unable to reach them from Flex, I mean
when I use the [RemoteClass(alias="javapackage.javaclass")] to
create a mapping in Flex. When I try to send a Flex instance of
this class it’s throwing an error: “Could not find the
Cold Fusion Component javapackage.javaclass”. Coldfusion
doesnt expose any custom class?
Any Clue?Hi all,
I got further problem regarding this issu. Using Sun App Server 8.2, I've easily and succesfully had my custom classes loaded just by dropping them to the WEB-INF/classes directory. But when I move those classes to another IDM server on WebLogic 8.1 SP 4, it just won't load. The rule invoking the class gave this:
com.waveset.exception: class com.waveset.my.CustomClass not found.
I've tried to add the classpath to the Weblogic startup script, but still not working. Any ideas? -
Help understanding custom class to access local sqlite db
Hi;
I'm using FB 4.5.
I'm following a tutorial out of the Adobe Air 1.5 Cookbook. From Chapter 10 in case you're familiar. But I assume there is a common method without having to have the Cookbook in your possession.
The example employs a custom class, and button presses for all the processes involved in the example. I'm trying to figure out how I can modify this example for my purposes. Loading the dataprovider is the result of a button click.
I'm new to Flex and OOP is still not a clear picture in my mind, but I can sort of see how this project works, using getter/setter methods.
Using this custom class, how can I load existing data upon startup?
Thanks
KristinI posted this link http://forums.adobe.com/thread/890517?tstart=150
in this thread http://forums.adobe.com/thread/893508?tstart=30
which was then continued here http://forums.adobe.com/thread/894123?tstart=0 -
Label properties and custom class
I want to make the following persistent: <mx:Label useHandCursor="true" buttonMode="true" mouseChildren="false" />
I have tried to create a custom class that extends the Label class, but can't get the syntax right.
override protected ???
buttonMode=true;
I don't think that I want to override a function. It seems to me that I want to override a property or attribute of the Label class.
Can anyone give me any guidance?Hi
As you need Lable with default property { useHandCursor="true" buttonMode="true" mouseChildren="false" }
I have extend the Label you can do it in directly in constructor by setting the value
------------- Custom Label Class ----------------------------------
package
import mx.controls.Label;
public class CusLbl extends Label
public function CusLbl()
super();
super.buttonMode = true;
super.useHandCursor = true;
super.mouseChildren = false;
You can directly use in application or in any other container with default property;
Ckeck attached file if needed.
With Regards
Virat Patel -
I have a custom class that adds clips from the library to
another clip on the stage. The clips i am adding have a text field
and a bullet point inside and given the tempory name 'item'. After
the class adds a clip I can position the bullet point using
item.bullet._x and _y but when I try to use the following script i
get no result at all:
var newCol:Color = new Color(item.bullet);
newCol.setRGB(0xff0000);
If i swap item.bullet for a clip on the root level it works
but not for the bullet.
The movieclips i am adding are registered as instances of
another custom class. Could this have something to do with it?
Any thoughts welcome as the deadline is looming
Cheersa movieclip.
I can access its positional and scaling properties but nots
the setRGB method -
Vars within a subfunction in custom class...
Hey hey!
I have beeen a Flash coder for a long time, but just now I
decided to step in custom classes, and I confess that there is some
peculiar details that are driving me crazy. I am trying (with no
success) since yesterday to figure out for what reason I cannot
reach a class var from within a subfunction (it always return me
undefined).
Look below the simple example that shows that:
code:
class MyTest
private var testvar:Number;
private var KeyboardListener:Object;
function startVar ()
this["testvar"] = 1;
function startKeyboard ()
trace (this["testvar"]); // it works...
KeyboardListener = new Object();
KeyboardListener.onKeyDown = function ()
trace (this["testvar"]); // it DOESN'T works!
Key.addListener(KeyboardListener);
As you can see, the first trace (that is within the function
StartKeyboard works as is can see the var); but the second trace
(tha is within the onKeyDown event subfunction DOESN'T works!!
Well, the fact is that I NEED to have access to the vars
within it, and I cant see a way to figure out this.
Anybody out there already experienced this situation and know
hot to resolve that?
PS: Before someone there asks "Why this guy is using
this["testvar"] instead testvar?" The answer is: that's because I
will use vars with dynamic names, then I need to know how to make
it work THIS way...
Thanks a lot.I'm not sure wether it will be OK in your final design, nor
do I really
know wether it's proper OOP (probably not...) but this will
work:
//-------------- in class file:
class MyTest
private var testvar:Number;
public function MyTest(){
startVar();
startKeyboard();
private function startVar ()
testvar = 1;
private function startKeyboard ()
trace (testvar); // it works...
Key.addListener(this);
public function onKeyDown(){
trace (testvar)
//-------------- in Flash timeline:
import MyTest;
t = new MyTest();
Compared to your script, the main differences are that I
ditched the
KeyboardListener Object. The class itself will become the
listener.
Problem with your code was that when the onKeyDown
eventhandler fired,
it was in the context of the object 'KeyboardListener'. This
object had
no property (or variable) called 'testvar'. In other words:
'this'
pointed towards the variable 'KeyboardListener' instead of
the instance
of class MyTest.
If you would have written this:
KeyboardListener = new Object();
KeyboardListener.testvar = "I'm the property
KeyboardListener";
KeyboardListener.onKeyDown = function ()
the output window would have shown: I'm the property
KeyboardListener.
I added a constructor. This is needed for the instantiation I
used on
the Flash timeline script.
Next I removed the bracket access to the propertie (or
variables) of 'this':
trace(testvar);
instead of:
trace(this["testvar"]);
I assume the first method is faster but that's no more than,
I hope, an
educated guess.
Oh, read the rest of the post.... OK
hope this helps.
BRFlasher wrote:
> Hey hey!
>
> I have beeen a Flash coder for a long time, but just now
I decided to step in
> custom classes, and I confess that there is some
peculiar details that are
> driving me crazy. I am trying (with no success) since
yesterday to figure out
> for what reason I cannot reach a class var from within a
subfunction (it always
> return me undefined).
>
> Look below the simple example that shows that:
>
>
> code:
>
>
>
>
> class MyTest
> {
> private var testvar:Number;
> private var KeyboardListener:Object;
>
> function startVar ()
> {
> this["testvar"] = 1;
> }
>
> function startKeyboard ()
> {
> trace (this["testvar"]); // it works...
> KeyboardListener = new Object();
> KeyboardListener.onKeyDown = function ()
> {
> trace (this["testvar"]); // it DOESN'T works!
> }
> Key.addListener(KeyboardListener);
> }
> }
>
>
>
>
> As you can see, the first trace (that is within the
function StartKeyboard
> works as is can see the var); but the second trace (tha
is within the onKeyDown
> event subfunction DOESN'T works!!
>
> Well, the fact is that I NEED to have access to the vars
within it, and I cant
> see a way to figure out this.
>
> Anybody out there already experienced this situation and
know hot to resolve
> that?
>
> PS: Before someone there asks "Why this guy is using
this["testvar"] instead
> testvar?" The answer is: that's because I will use vars
with dynamic names,
> then I need to know how to make it work THIS way...
>
> Thanks a lot.
>
aloft
Hoge der A 20a
9712AD Groningen
The Netherlands
[email protected]
http://www.aloft.nl
tel: 06-22360652
KVK: 02094451
Bnk: 21.23.89.408 -
Change UIComponent to extend a custome class?
hello,
I was hoping to shed some light of extending core classes. I
added some properties in FlexSprite.as, in a custom class called
ModFlexSprite.as, and had the core UIComponent extend
ModFlexSprite.as. However, these properties cannot be accessed vis
the ItemListRenderer (which extends UIComponent->which extends
FlexSprite).
I realized that it's because of this code in the ListBase
class:
protected function moveRowVertically(i:int, numCols:int,
moveBlockDistance:Number):void
var r:IListItemRenderer;
for (var j:int = 0; j < numCols; j++)
r = listItems
[j];
r.move(r.x, r.y + moveBlockDistance);
rowInfo.y += moveBlockDistance;
i wanted to add properties to the var listItems via the new
ModFlexSprite. so if i try to use my new ModFlexSprite properties,
flex throws an error, saying 'undefined property'. Now, as you see,
the var r casts as a IListItemRenderer, which is an interface, that
never touches ModFlexSprite. Does this mean i have to create a
custom Interface as well and implement it in the IListItemRenderer
for my ModFlexSprite properties to work?
thank you in advance! -brandoni didn't change the code in the FlexSprite class. Rather I
created a class called ModFlexSprite that extended the FlexSprite
class, and in UIComponent.as i changed the class to extend
ModFlexSprite instead of FlexSprite. How would I recompile the
entire flex framework in flex 3?
What I want to ultimately do is to create a list that has a
tweened scrolling effect. I thought the first step would be to
extend the List class and override the moveRowVertically method
(from ListBase.as, see first post in thread) and change the line:
r.move(r.x, r.y + moveBlockDistance);
to:
TweenMax.to(r,1,{y:r.y}); //using TweenMax Class
This works as expected when you click the scroll arrow and
wait for the tween to finish, then click the arrow again. But if
you scroll the thumb or click the scroll arrow before the tween
ends, then unexpected tween issues occur.
You
can see the example here. this is because the r.y value is
being calculated in a number of places in the ListBase class-
before the tween is finished, and moving the listItem(s) into
unexpected y positions.
So, to fix that issue, i wanted to extend FlexSprite so that
in the get y method, it would check to see if an "end_y" property
was set first, and return the end_y value instead of the y value:
//in ModFlexSprite:
override public function get y():Number{
return = (end_y)? end_y : _y;
So then i could do something like this:
r.end_y = r.y + moveBlockDistance;
TweenMax.to(r,1,{y:r.y, onComplete:r.remove_end_y})
the r.remove_end_y method would remove the end_y value when
the tween completes. This should take care of the scrolling of
items that are already on screen.
I haven't figured out a way to animate the ListItems that are
added to the list (as you can see in the example in the link above,
the ones that "appear" if you click the scroll arrow). If you have
any suggestions i would be greatful! Thank you. -b -
Unit testing: Mocking custom classes with null
Hi,
I was trying to save time on testing the usual hashCode() and equals() methods so I got this class: http://www.cornetdesign.com/files/BeanTestCase.java.txt
I altered it a bit as it wasn't handling standard classes only primitives.
Anyway, I got to the point to include my own custom classes.
I have to create a 'mock' object for my class properties, e.g. field.getType().newInstance()
Fine, but there are some tricky instances. E.g. when I'd like to create an instance of java.net.URL which takes a URL as String in the constructor.
This is almost impossible to automate as it has to be a valid URL format not just a random String.
So, I thought I set them to null, e.g.
assertTrue(o1.equals(o2))
as both properties are null.
Is this the right approach you think?
I welcome any suggestions.
My initial idea was to save enormous amount of time automating the hashCode() and equals() method tests as they took so long to write.
ThanksTrouble would be that you are only testing the null branch of the equals or hashCode, which typically have to check for null, then if not null do an actual comparison.
It's worth the effort of learning to use a package such as EasyMock to create and program mock objects. It's tidiier if you are progamming to interfaces, however, but it will mock ordinary objects, though probably not if they are final.
What you could do is to define a factory interface, and have a table of anonymous classes wich generate various types. In effect create a library of dumy object factories.
Something like:
private interface DummyGenerator {
Object generate(int idx);
Class<?> getType();
private final static DummyGenerator[] generatorsTable {
new DummyGenerator() {
public Object generate(int idx) {
return new URL("http://nowhere.com/" + idx);
public Class<?> getType() { return URL.class; }
.. generators for other classes
private final static Map<Class<?>, DummyGenerator> genMap = new HashMap<Class<?>, DummyGenerator>(generatiorsTable.length);
static {
for(DummyGenerator gen : generatorsTable)
genMap.put(gen.getType(), gen);
} -
How can I access another class in a MembershipRule's Expression
Hello,
I want to create an InstanceGroup using Module Microsoft.SystemCenter.GroupPopulator.
I need to collect all Logical Disks which contain an MS SQL DB Log File.
I would start as follows:
<DataSource ID="DS" TypeID="SC!Microsoft.SystemCenter.GroupPopulator">
<RuleId>$MPElement$</RuleId>
<GroupInstanceId>$Target/Id$</GroupInstanceId>
<MembershipRules>
<MembershipRule>
<MonitoringClass>$MPElement[Name="Windows!Microsoft.Windows.LogicalDisk"]$</MonitoringClass>
<RelationshipClass>$MPElement[Name="MSIL!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass>
<Expression>
<And>
<!--
First Expression
-->
<Expression>
<SimpleExpression>
<ValueExpression>
<Property>$MPElement[Name="Windows!Microsoft.Windows.LogicalDevice"]/Name$</Property>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<!--
How can I access another class's properties ?
-->
<GenericProperty>$MPElement[Name="SQL!Microsoft.SQLServer.2008.DBLogFile"]/Drive$</GenericProperty>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<HostProperty>
<MonitoringClass>$MPElement[Name="Windows!Microsoft.Windows.Computer"]</MonitoringClass>
<Property>PrincipalName</Property>
</HostProperty>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<GenericProperty>$MPElement[Name="SQL!Microsoft.SQLServer.2008.DBLogFile"]/Drive$</GenericProperty>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</MembershipRule>
</MembershipRules>
</DataSource>
In the first expression you "see" my question:
I want to compare the LogicalDisk's Name Property with the DB Log File's Drive property.
But how can I access the DB Log File's Drive property in this MembershipRule ?
Furthermore LogicalDisk and DB Log File must be hosted on the same Windows Computer.
Would be great if somebody could help.
Thanks
SebastianHi Niki,
thanks for the idea, but that will not work. $Target/Id$ refers always to the group to be discovered.
On last week end I was given following idea, hope it will work:
Step 1
Collect all the DB SQL Logfile Objects and write computername (PrincipalName?) and Driveletter into a textfile, line by line. Shouldn't be a problem, PowerShell is your friend.
Step 2
Read the file from Step 1, build discovery data for each disk drive as object of class "Logical Disk (Server)",
and then discover the containment-relationships from those Logical Drive(Server) Objects to the InstanceGroup.
Perhaps I must do it for the OS-Version related Disks, because I need the target classes of the Logical Disk Freespace monitors. Some more work. "Risks": I donot know the discovery algorithm for the Logical Disk(Server) Objects, but a "deep
dive" into the MPs should help.
Thanks to all, who have read.
I will inform you about progress and success
sebastian -
Reproducing Incident Form Elements in a Custom Class
Hello again everyone,
I am trying to rollout a completely separate module in SCSM to record MACD (Move/Add/Change/Delete) requests. I decided to use the OOB incident module as my base class as it already contained many fields I require (I inherited the properties
and relationships) and created a new form assembly in Visual Studio to wire the properties to.
After created the form and labels, I imported the .dll into the Authoring Tool so I can just drag out each property from the MP explorer onto the form. Everything works except for the last few fields which are a bit more complex than a standard list or textbox.
I cannot seem to add the controls for the more complicated items like "Affected Services" or "Affected Items", when I try to drag them out to the form I get an error saying cardinality is not set to 1... I am guessing this is because
its trying to map a relationship between a workitem and a service instead of my custom class and a service...
So I went back into Visual Studio and added a ListView to the form, thinking I will have to wire the data bindings inside the form itself. However, I am stuck as I am not sure where "Services" are being written to, as I will need this location
to reference in my empty ListView. I have provided my code and commented where I believe I am missing logic. Thank you in advance for any help!
Note: "servicerelatestoworkitem" is not actually an object, my logic is conceptual and I still have not found which class/object the list of services is being written to.
C# Code containing button logic (an add button to add a service to the ListView, and a delete button to remove a service from the ListView.
private void add_services_button_Click(object sender, RoutedEventArgs e)
// Open list of Services here, allow user to pick a service, then add selected service to "servicerelatestoworkitem"
// AffectedServicesListView is populated from servicerelatestoworkitem
private void del_services_button_Click(object sender, RoutedEventArgs e)
// Test to see if item is being selected and display selected item to confirm ability to manipulate variable
try
var itemSelected = ListView.GetIsSelected(AffectedServicesListView);
MessageBox.Show(itemSelected.ToString());
catch (Exception ex)
MessageBox.Show(ex.Message);
// Remove selected item from servicerelatestoworkitem and refresh AffectedServicesListView
XAML Code containing the list view and two buttons: (Note: The binding is most likely incorrect, I was just experimenting with it)
<ListView x:Name="AffectedServicesListView" HorizontalAlignment="Left" Height="95" Margin="10,414.6,0,0" VerticalAlignment="Top" Width="521" ItemsSource="{Binding Path=AffectedServicesListView, Mode=Default, UpdateSourceTrigger=PropertyChanged}">
<ListView.View>
<GridView>
<GridViewColumn/>
</GridView>
</ListView.View>
</ListView>
<Button x:Name="add_services_button" Content="" HorizontalAlignment="Left" Margin="470.55,382.749,0,0" VerticalAlignment="Top" Width="27.674" Height="26.851" Click="add_services_button_Click" BorderBrush="{x:Null}">
<Button.Background>
<ImageBrush ImageSource="add.png"/>
</Button.Background>
</Button>
<Button x:Name="del_services_button" Content="" HorizontalAlignment="Left" Margin="503.224,382.749,0,0" VerticalAlignment="Top" Width="27.776" Height="26.851" Click="del_services_button_Click" BorderBrush="{x:Null}">
<Button.Background>
<ImageBrush ImageSource="delete.png"/>
</Button.Background>
</Button>Cardinality is a property of relationships classes, not a property of specific relationships. each type of relationship has it's own cardinality values, but the engine only really recognizes "one" and "many". it makes sense to say that
the "affected user" relationship is many to one, because Each work item can have one and only one affected user, but each users may be the affected user of many work items. The Related work items relationship is a many to many, because each workitem
may be related to many other work items. it doesn't make sense to say this specific relationship between this IR and that user is "many to one", because each instance is only between one specific object and another specific objects. the cardinality
just controls how many of those specific relationships instances can exist for each type of relationship.
There are no out of the box controls for many to many relationships. the Instance Picker control is designed to support one to one and many to one relationships. you'd have to write your own controls for support many to one relationships. Consider Travis
Wright's SR Example for 2010, since most of this code should execute in 2012 and 2012r2 with only minor modifications.
You'd have to either find the control that defines it, like with the history tab, or recreate it using the
authoring tool or
Visual Studio.
Maybe you are looking for
-
I got a big Problem. i lost my iphone 3g a half year ago and bought myself a iphone 4s. Now my 3g found its way back to me and i need to get the messages from the 3g to my 4s. I didnt start the 4s with the backup. i made a new iphone so i dont have t
-
Hi All, this is my first message in this Forum.. In my project I created a UI with 10 Jtextfields two Tabs in JtabbedPane and a Jtable. Now my PL suddenly gave me a additional task to include 5 more Jtextfiled and another Tab. 1. I have to modify the
-
Which is better Ipod Shuffle or Ipod Touch in terms of everything.
-
Path Free Calls to Forms / Reports from Menu
Hello all, My query is HOW CAN I CALL my forms , reports,graphics without mentioning the path of the drive where the form/report is saved in its executable state.....its quick and urgent ....thx in advance Rgds Imran
-
Can a stateless session EJB register itself to receive notifications from a JMX MBean? What are the pros/cons of doing this? Thanks Raja