How to add components in to an existing GUI created by guide? - user-interface

I just created a GUI using guide in MATLAB for a small project I'm working on. I have amongst other things two text fields for from and to dates. Now I'd like to get rid of them and use a Java date select tool. Of course this is not possible using guide so I need to add them manually.
I've managed to get them to show up by putting this code into my Opening_Fcn,
uicomponent(handles, 'style','com.jidesoft.combobox.DateChooserPanel','tag','til2');
using UICOMPONENT.
But even though it shows up I can't access the date select's attributes, for example
get(handles.til2)
returns
??? Reference to non-existent field 'til2'.
How can I fix this?

Unless you edit the saved GUI figure, the basic handles structure will not include your new component by default.
One way to access you component is to store the handle via guidata, by adding the following to your opening function:
handles.til2 = uicomponent(handles, 'style','com.jidesoft.combobox.DateChooserPanel','tag','til2');
guidata(hObject,handles)
Functions that need to access the handle need the line
handles = guidata(hObject)
to return the full handles structure that includes the filed til2

Related

How to get the actual Hyperlink element inside the main document part using docx4j

So I have a case where I need to be able to work on the actual Hyperlink element inside the body of the docx, not just the target URL or the internal/externality of the link.
As a possible additional wrinkle this hyperlink wasn't present in the docx when it was opened but instead was added by the docx4j-xhtmlImporter.
I've iterated the list of relationships here: wordMLPackage.getMainDocumentPart().getRelationshipsPart().getRelationships().getRelationship()
And found the relationship ID of the hyperlink I want. I'm trying to use an XPath query: List<Object> results = wordMLPackage.getMainDocumentPart().getJAXBNodesViaXPath("//w:hyperlink[#r:id='rId11']", false);
But the list is empty. I also thought that it might need a refresh because I added the hyperlink at runtime so I tried with the refreshXMLFirst parameter set to true. On the off chance it wasn't a real node because it's an inner class of P, I also tried getJAXBAssociationsForXPath with the same parameters as above and that doesn't return anything.
Additionally, even XPath like "//w:hyperlink" fails to match anything.
I can see the hyperlinks in the XML if I unzip it after saving to a file, so I know the ID is right: <w:hyperlink r:id="rId11">
Is XPath the right way to find this? If it is, what am I doing wrong? If it's not, what should I be doing?
Thanks
XPathHyperlinkTest.java is a simple test case which works for me
You might be having problems because of JAXB, or possibly because of the specific way in which the binder is being set up in your case (do you start by opening an existing docx, or creating a new one?). Which docx4j version are you using?
Which JAXB implementation are you using? If its the Sun/Oracle implementation (the reference implementation, or the one included in their JDK/JRE), it might be this which is causing the problem, in which case you might try using MOXy instead.
An alternative to using XPath is to traverse the docx; see finders/ClassFinder.java
Try without namespace binding
List<Object> results = wordMLPackage.getMainDocumentPart().getJAXBNodesViaXPath("//*:hyperlink[#*:id='rId11']", false);

Epi server - make content area specific for block

I would like to achieve the following thing-
Build a pagetype which has 3 different ContentArea's and that the user can put only a specific block type in each of these areas.
For example - ContentArea1 can only accept block type of "BlockType1", ContentArea2 can only accept "BlockType2" and so on. (It doesn't need to be generic, I can specify hard coded which type should fit in each Content Area.
Is it possible to achieve?
Maybe there is another way?
(I know you can create a property with the block type, but I want to use the same block in different places)
ps: using EPI-SERVER 8
From version 8.0 of EPiServer there is better support for AllowedTypes.
The feature was also available before version 8, but was more limited.
In short, you decorate your ContentArea property with the AllowedTypes attribute and EPiServer takes care of the rest.
Read more about it here:
http://world.episerver.com/blogs/Ben-McKernan/Dates/2015/2/the-new-and-improved-allowed-types/

vb.net data set not working

I am using two different datasets to populate datagridview my project using visual studio using vb.net. It is windows forms application which is used to display information from the database based on user inputs. Once the information is displayed the user can save the information into a table specifically created to store the report information in order for it to be recalled at a later date. I am now trying to recall this information so have created my dataset in the same way as before and am now trying to invoke a new occurrence of it and this is where the probelm begins. The code is below.
Dim dv2 As New System.Data.DataView
dv2 = New System.Data.DataView(DataSet2.Tables(0), "Status <> ''", "",
DataViewRowState.CurrentRows)
DataTable2TableAdapter.fill(DataSet2.DataTable2, f5.ComboBox2.SelectedValue)
I am getting two issues.
For DataSet2.Tables(0): Reference to a non-shared member requires an object reference
For DataTable2TableAdapter: ’DataTable2TableAdapter’ is not declared. It may be inaccessible due to its protection level.
I dont know why this is happening as I have written the same code here as for my previous data set other than changing the SQL statement behind the dataset at set up. Any thoughts would be welcome as I am totally out of ideas. All questions are welcomed.
Thanks
Try the following code to fix your error number 1....
Dim tablezero as System.Data.DataTable
'
tablezero = DataSet2.Tables(0)
The reason your getting the error is because you are trying to access an object (Table(0)) and it is not visible to the code that is trying to access it, if it was SHARED then it would be visible.
So you can resolve it by defining and object instance/reference to it and then accessing that reference, which in this case i have called "tablezero" (or by making table(0) SHARED - usually not the best bet unlessits neccesary - no point in having something accessible to the whole class it is declared in unless absolutelty neccessary)
It is quite possible the second error may dissapear after just fixing above, then again its difficult to tell without your code for Dataset2
Hope it helps.

distinguish use cases in NSAutosaveElsewhereOperation

I try to add AutoSave support to the Core Data File Wrapper example
Now if i have a new/untitled document writeSafelyToURL is called with the NSAutosaveElsewhereOperation type.
The bad thing is, I get this type in both typical use cases
- new file: which store a complete new document by creating the file wrapper and the persistent store file
- save diff: where the file wrapper already exists and only an update is required.
Does somebody else already handled this topic or did somebody already migrated this?
The original sample use the originalStoreURL to distinguish those two use cases, which solution worked best for you?
Thanks

MVC3 localization code generator

I am trying to add two localization resource files into my MVC3 App_GlobalResources.
I add Global.resx and then Gloabl.fr.resx. However, only the first one generates code in .designer.cs. The second one just generate an empty file.
Can anybody help me out?
Thanks a lot.
That is how its supposed to work. The .designer.cs class is a strongly typed class so that you can type.
#Global.mystring and it will return a localised (depending on the UICulture) string.
The designer file doesn't actually contain the localised strings, it just contains a bunch of properties which (in turn) return the localised string.. this is why you wouldn't need more than one class.
Perhaps you are trying to find a way of retrieving the resources for different cultures e.g. fr?
You need to set the UICulture to "fr". Either manually or by setting the following element in the web config:
<globalization culture="auto" uiCulture="auto"/>
This would do it automatically based on your browser settings

Resources