Can I have several XML layout files and only one main class? - android-studio

I'm wondering if it is possible to have a few different XML layout files without a separate class file for each? If so, how would I go about changing the layout file that the class is using on the fly?

You can have different .xml files. To get them you need to call in the specific method setContentView(R.layout.yourlayout1); I recommend to take a look at the android developer documentation to get a basic knowhow of what is a layout used for. Themes could be interesting for you also.

Related

XPages: Is there a way to copy/rename custom controls

In Lotuscript you can manipulate design elements - create them, change them, rename them, etc.
Are you able to do the same thing for Xpages and custom controls design elements?
====================================================================
My question should have been clearer. What I want to accomplish is to copy an existing cc and give it a new name, programatically. The app will then close and reopen (or refresh or get rebuilt) so that the app can "see" the new cc. If I copy the cc it will only have one field on it. I will add custom code later. I could just create a new cc with no code in it, that would work too.
I am not familiar with the DXL exporter but I can research it. Using that can I just export the design of the cc to an XML file in a temp directory, use the transform to change the name, and then import the control?
I think the XPage or Custom Control design elements are probably under MISC_CODE or MISC_FORMAT design elements in a NoteCollection.
However, accessing that design element is the easy part. Doing a create / rename / change etc is a much bigger task.
Remember that the XPage or Custom Control XML file is only a starting point:
XPages and Custom Controls also have a .xsp.metadata file, as you'll see with source control.
Custom Controls will also have (and need) a .xsp-config file.
There are corresponding .java files for every XPage and Custom Control in the Local source folder. They're created by a builder based on parsing the XML. I don't think you'll be able to create those programmatically. I'm not sure of the impact of renaming them.
For Custom Controls, even if you can rename the .java file, it's referenced in the .java files of relevant XPages. Updating those is goiong to be a significant task.
The XPages runtime doesn't even use those .java files. Instead it uses the .class files in WebContent\WEB-INF (you need to use Project Explorer view and modify the filter to see those files). This is compiled byte code, so you won't be able to update the .class files for XPages containing renamed Custom Controls, as far as I know.
Even if you can rename the .class files, the XPages runtime almost certainly won't use them until either a Clean (which will overwrite anything you've done) or an HTTP restart. As far as I can tell they're cached.
Depending on your use cases, it's possible not all these points will be an issue, e.g. if you're modifying the XML files and building with headless designer.
I suspect this is why nothing was added to the NoteCollection object or a specific NotesXPage / NotesCustomControl API class added.
In Lotuscript you can manipulate design elements - create them, change them, rename them, etc.
This is only partially true. There is a LS API to create/alter views and outlines. Good luck with other design elements - although they're standard "notes", so you can access their items, in most cases you won't compile them and there will be some problems with signatures (real experience with TeamStudio CIAO).
Your question has two points of view - do you want to alter design elements in design process or alter running application?
To help a designer you can go the way of Eclipse extensions and enrich tools in IBM Designer to help developer. Something like TeamStudio Designer. In this case you need to look for source design elements, mentioned by Paul.
To enrich application you don't need to alter source design elements. IBM Designer transforms XML in source code to a Java code (JSF framework) - so you can generate your Java code from anything you wish. Take a look inside Local\xsp folder of NSF in Package explorer. You will find Java sources made from your XPages and Custom Controls. So if you don't need to work with design elements, go for Java components - they can be built on the fly.
And of course, there is always the option of DXL framework - so you can clone/alter design of the application through XML transformations. Good starting point: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/ls-design-programming.htm

Alfresco node-browser.get.js webscript

At this location in this jar file alfresco-remote-api-5.0.d.jar\alfresco\templates\webscripts\org\alfresco\slingshot\node-browser\ there is a webscript. But this webscript consist to 2 files (node-browser.get.desc.xml and node-browser.get.json.ftl ) There isn't the node-browser.get.js file.
I want to know what is done in this fil. I want to select categories and include certains aspects (i have added to categories) in the selection.
Thank you.
Javascript file is not mandatory while creating webscript.
Below is the URL of source file which is getting called on your specified webscript.
https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V5.0.d/root/projects/remote-api/source/java/org/alfresco/slingshot/web/scripts/NodeBrowserScript.java
Below is context file for java file.
https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V5.0.d/root/projects/remote-api/config/alfresco/web-scripts-application-context.xml
check bean with webscript.org.alfresco.slingshot.node-browser.node-browser.get
Id.
you need to change in that if you want to customize it.
Usually a webscript is made of 3 parts:
a description file (in your case node-browser.get.desc.xml) which
uses a description language to define many aspects of the
webscript, like security, transaction management and so on
a Server-Side Javascript js file that consists of the business logic that is performed by
the script. In your case you don't have the node-browser.get.js file
because this happens to be a Java backed webscript, that is a
webscript whose business logic is written in Java and not in
Server-Side Javascript.
a Freemarker Template file, node-browser.get.json.ftl, which contains
the presentation logic (view) that has to show the results of the invocation.
In order to achieve what you're looking for about selecting categories and include certains aspects, you'd better learn more about how webscripts work and moreover how to configure/customize Alfresco's interface.
You'd better look at these tutorials in order to get more info.

When generating SubSonic DAL, is it possible to have .gen.cs in the generated filenames?

When generating my DAL files with SubSonic, I'd like the names of the files to be .gen.cs. The main reason for this is that the files are partial classes, and I would like to add some additional implementation details into another source file for the table called .cs. This is somewhat the standard pattern for generated source files , and I'm wondering if its possible with SubSonic? I'm using SubSonic 2.2.
I thought you might be able to do this by using a set of custom templates, but the CS_ClassTemplate.aspx (or VB_ClassTemplate.aspx) doesn't control the file name of the class.
I don't think this is possible.
As an alternative, you can do what I do. I have a "generated" directory, such as \database\generated and then I put my partial classes at \database\custom. As long as the namespaces of the files in the two different directories match (like .database or whatever), then it works fine. By using two different directories, it's easier to find your custom files without looking at the generated ones.

Schema/DTD of PowerPoint

I am looking for a way to add some meta-infromation to PowerPoint files. Specifically, I want to add annotation to bullets and slides.
Are there any XML attributes which can be added to the elements (of the slideX.xml file) without invalidating it? In other words, where can I find the schema/DTD of the slideX.xml files?
"Best Practice" is to download the Open XML SDK 2.0 and use the tool DocumentReflector
Create the document you would like to have and then load that pptx into the DocumentReflector and check how to generate that code....
http://blogs.msdn.com/ericwhite/archive/2008/09/06/announcing-the-first-ctp-of-open-xml-sdk-v2.aspx
Annotations to slide is that Notes on the slide?!?! Then you need to create a NotesSlide
http://msdn.microsoft.com/en-us/library/documentformat.openxml.presentation.notesslide(office.14).aspx
Yeah, you can use ExtLst and Ext which is basically adding your own extension to PresentationML, to "tag" just about anything at all in SlideX.xml. You can read more about it here.

How can I customize the generated classes in SubSonic 2.2

I'm using SubSonic 2.2 for my DAL. To match the requirement, I need to customize some of classes which generated by SubSonic. For sample:
public partial class Category : ActiveRecord, IActiveRecord, IOtherInterface
Could you please give me some clues. Where I can modify the generated template? Thanks!
Jim is incorrect you can add an Interface via the partial class. I keep one folder with all of the Generated Files and another one with the Altered class files and I am adding an interface to the altered class files and it works just fine.
public partial class ContainerSearch : IContainerSearch
{
}
above is an example from my code I am using now
(edit: see runxc1's post for better answer)
You can modify the templates used to generate the class files to add in your other interface. You can't add an interface to the partial classes. The only trick is that this will add it to all generated classes. You can also just go into your automatically generated classes and add your interface manually after you generate the class files.
SubSonic 2.2 templates are a bit tricker to work with than the 3.0 templates, but it's still really easy to modify the templates.
See below links for info:
how to modify SubSonic 2.1 code generation
http://johnnycoder.com/blog/2008/06/09/custom-templates-with-subsonic/
Your options:
Modify templates used for generation to add in your interface (all classes), or
Modify templates used for generation to add in if/switches to only add interfaces to certain classes that match specific names, etc., or
Edit generated classes to add in your interface (must redo edits after each auto-generation)
After you modified those aspx files. Then you'll just need to update your .config file of your DAL to specify the new path to your customized aspx files and regen as usual.

Resources