In Acumatica 5.1 is it possible to add new ImageSets and Images for buttons?
For example, in the custom application I'm working on I'd like to create a new image for a few of the buttons that show above the grids.
The documentation/information references ImageSets and ImageID's w/in the set but there isn't a reference on how to create new ones (if possible)
Thank you
I propose you to try the following within declaration of your button:
public PXAction<PMTask> SyncPMTaskWithJira;
[PXButton(CommitChanges = true,
ImageUrl = "http://i.stack.imgur.com/uIcP0.jpg?s=64&g=1",
DisabledImageUrl =
"https://www.gravatar.com/avatar/1d02905a73147ffff3eb0e953a609abd?s=328&d=identicon&r=PG",
HoverImageUrl = "http://i.stack.imgur.com/uIcP0.jpg?s=64&g=1")]
[PXUIField(DisplayName = "Sync With Jira")]
protected void syncPMTaskWithJira()
{}
Related
Is there any way to completely copy a slide from one slideshow to another slideshow including all of the box locations, colors, fonts, etc.?
Referencing the cookbook I have the below
private void copySlides(XMLSlideShow fromPptx, XMLSlideShow toPptx) {
for(XSLFSlide fromSlide : fromPptx.getSlides()){
toPptx.createSlide().importContent(fromSlide);
}
}
However the background doesn't match the 'from' pptx and the a number of the text boxes are shifted. I'm guessing the colors are due to me not modifying the master and the shift is because something related to the anchors. I have also tried what I thought would force the master of one slide onto the other, but it does the same thing as above.
private void copySlides(XMLSlideShow fromPptx, XMLSlideShow toPptx) {
for(XSLFSlide fromSlide : fromPptx.getSlides()){
XSLFSlide toSlide = toPptx.createSlide();
copySlide(fromSlide, toSlide);
toSlide.importContent(fromSlide);
}
}
private static void copySlide(
final XSLFSlide fromSlide, final XSLFSlide toSlide) {
XSLFSlideLayout fromLayout = fromSlide.getSlideLayout();
XSLFSlideMaster fromMaster = fromSlide.getSlideMaster();
XSLFSlideLayout toLayout = toSlide.getSlideLayout();
XSLFSlideMaster toMaster = toSlide.getSlideMaster();
toLayout.importContent(fromLayout);
toMaster.importContent(fromMaster);
}
If I set either toSlide.setFollowMasterGraphics(false); or toSlide.setFollowMasterObjects(false); I can set the background color.
For the boxes not being in the correct location it seems that the boxes were in the correct location, but the slides were different sizes. In my case I'm fine with using whatever is the 'final' slide size, and if multiple sizes show up someone will have to deal with it.
private void copySlides(XMLSlideShow fromPptx, XMLSlideShow toPptx) {
for(XSLFSlide fromSlide : fromPptx.getSlides()){
XSLFSlide toSlide = toPptx.createSlide();
copySlide(fromSlide, toSlide);
toSlide.importContent(fromSlide);
}
toPptx.setPageSize(fromPptx.getPageSize());
}
private static void copySlide(
final XSLFSlide fromSlide, final XSLFSlide toSlide) {
toSlide.setFollowMasterGraphics(false);
toSlide.setFollowMasterObjects(false);
XSLFSlideLayout fromLayout = fromSlide.getSlideLayout();
XSLFSlideMaster fromMaster = fromSlide.getSlideMaster();
XSLFBackground fromBackground = fromSlide.getBackground();
XSLFSlideLayout toLayout = toSlide.getSlideLayout();
XSLFSlideMaster toMaster = toSlide.getSlideMaster();
XSLFBackground toBackground = toSlide.getBackground();
toLayout.importContent(fromLayout);
toMaster.importContent(fromMaster);
toBackground.setFillColor(fromBackground.getFillColor());
}
This does not fully answer my question (which may be unobtainable based on some forum comments I read) but this solves the problem I was up against.
For anyone else that comes across this I also played with getting all of the shapes in the 'from' and 'to' slides and trying to copy things from one to the other, but was not necessary for me.
According to the docu of LayeredLayout here (JavaDoc), there is an inset method that can be used for relative positioning. I created a bare pones CN1 project and added this piece, also from the docu:
Container cnt = new Container(new LayeredLayout());
LayeredLayout ll = (LayeredLayout)cnt.getLayout();
TextField searchField = new TextField();
Button btn = new Button("Search");
cnt.add(searchField).add(btn);
ll
.setInsets(searchField, "1mm auto auto auto")
.setInsets(btn, "0 auto auto 0")
.setReferenceComponentLeft(btn, searchField, 1f)
.setReferenceComponentTop(btn, searchField, 0);
However, I am getting an error that the setInset Method is not found. Looking at the source of LayeredLayout class reveals that it indeed does not have this method.
The method setInsets(TextField, String) is undefined for the type LayeredLayout
I just updated CN1 lib to the latest version as of today.
Any idea?
I suggest updating your plugin.
In Codename One Settings select Basic and click Update Client Libs.
Below is my code I used to create a custom UITextField in code behind.
UITextField usernameField;
usernameField = new UITextField
{
Placeholder = "Enter your username",
BorderStyle = UITextBorderStyle.RoundedRect,
Frame = new RectangleF(10, 32, 50, 30)
};
View.AddSubview(usernameField);
But when I run my app, I dont see this anywhere. Not only this control but all the controls that I create in code behind.
If I drag the controls from toolbox onto my View it's working very fine.
What might be the cause?
Make sure that Container View is not transparent so Alpha = 1 and set background colors for appropriate controlls. Because by default its set to ClearYou can use this method to easly set background and rounded corners like in older versions of iOS
public static void MakeViewRounded(UIView view,float cornerRadius, MonoTouch.CoreGraphics.CGColor backgroundColor)
{
view.Layer.CornerRadius = cornerRadius;
view.Layer.BackgroundColor = backgroundColor;
}
Also make sure that you adding your custom controll to ViewController/View
I'm developing an app on android and I am generating UI elements in a loop. But I need these elements to have an id with letters and numbers, for example "rl1" or "rl2". I was trying to use the method RelativeLayout.setId() but, that method only accepts int. Is there a way I can set an ID as I want without being limited to numbers?
Thanks.
Here is the code I am trying to make work.
for (int i=1; i < 10; i++)
{
//gets the frameview where the elements will be created.
String LinearLayoutId = "frameview1";
int resID = getResources().getIdentifier(LinearLayoutId, "id", "com.myapp.ERS");
LinearLayout linearLayout = (LinearLayout)findViewById(resID);
//creates the RelativeLayout that will hold the ImageIcon and the TextView
RelativeLayout rl = new RelativeLayout(this);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,40 );
rl.setLayoutParams(lp);
rl.setId("rl"); /// >>>> I would like here to set and ID of "rl1" for example.
rl.setBackgroundDrawable(getResources().getDrawable(R.drawable.bk36));
//creates the image icon within the layout at the left side
ImageView image = new ImageView(this);
lp = new RelativeLayout.LayoutParams(
40,RelativeLayout.LayoutParams.MATCH_PARENT );
image.setLayoutParams(lp);
String imageicon = "icon_"+i;
resID = getResources().getIdentifier(imageicon, "drawable", "com.myapp.ERS");
image.setImageDrawable(getResources().getDrawable(resID)); //sets the icon
rl.addView(image); //adds the ImageView to the relative layout
//creates the TextView within the layout with a 40 margin to the left
TextView tv = new TextView(this);
lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.MATCH_PARENT );
lp.setMargins(40, 0, 0, 0);
tv.setLayoutParams(lp);
String textViewID = "tv"+i;
resID = getResources().getIdentifier(textViewID, "string", "com.myapp.ERS");
tv.setText(getResources().getString(resID));
tv.setTextColor(Color.BLACK);
tv.setTextSize(25);
rl.addView(tv);//adds the TextView to the relative layout
rl.setOnClickListener(mAddListener);
linearLayout.addView(rl);//adds the RelativeLayout to the LinearLayout
}
and then I have the OnCLickListener like this...
private OnClickListener mAddListener = new OnClickListener()
{
public void onClick(View v){
Intent intent;
Bundle bundle;
String id = getResources().getResourceEntryName(v.getId());
id = id.replaceAll("\\D+","");
int value = Integer.parseInt(id);
intent = new Intent(ERS.this, ShowInfo.class);
bundle = new Bundle();
bundle.putInt("key", value);
System.out.println(v.getId());
intent.putExtras(bundle);
startActivity(intent);
}
};
I have tried to set up numeric IDs, but then when I Look for them with:
String id = getResources().getResourceEntryName(v.getId());
It can't find them.
I had all of this in an xml file to begin with, but it was really long because there are about forty items in the list, and it was complicated for me to go and change a letter for example in all of them. I came up with this idea to generate them at runtime in a for loop. I am testing in the meantime with ten, but I can't get it to work.
If I am doing something incorrect, then pardon me, but I am new to this.
You may still find it easier to go back to XML layouts and use the R class to generate meaningful IDs. Although as you haven't included the original xml file you refer to at the end of the question, so I can only guess at the problem you had with it. It does seem to fit the bill though, and would allow you to create something along the lines of:
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:id="#+id/hellotextview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Hi there"/>
The android:id="#+id/hellotextview" generates an id that can be used elsewhere in your project. In your java code you could access that specific TextView with something similar to:
TextView helloText = (TextView) findViewById(R.id.hellotextview);
The R.id.hellotextview is a int automatically generated when the project is built (in gen/R.java), but as you get to pick the name you can assign them something relevant to you and your project. So instead of trying to use strings values such as "rl1" and "rl2" that you mentioned, you could use R.id.rl1 and R.id.rl2.
As well as individual UI elements, you can also use the same technique for strings (in res/values/strings.xml), and other resources stored under the project's res/ folder, such as icons, media files, etc. In the case of strings you would access them getString(R.string.some_name_given_by_you);
See Accessing Resources at the Android Developers site for more info.
Why dont you try using SharedPreferences as an alternative in case you want to access the elements which you give some ID elsewhere in some other activity.
I am implementing a user interface using gxt. I have mainForm class with TabPanel.
TabPanel has few TabItems. On orderManagmentTabItem I have a ContentPanel.
TabPanel mainFormTab = new TabPanel ();
mainFormTab.setAutoHeight(true);
mainFormTab.setAutoWidth(true);
TabItem orderManagmentTabItem = new TabItem("TabItem 1");
orderManagmentTabItem.setAutoWidth(true);
orderManagmentTabItem.setAutoHeight(true);
OrderManagmentTabPanel orderManagmentTabPanel = new OrderManagmentTabPanel(); //contentpanel
orderManagmentTabItem.add(orderManagmentTabPanel);
TabItem warehouseManagmentTabItem = new TabItem("TabItem 2");
warehouseManagmentTabItem.setAutoWidth(true);
warehouseManagmentTabItem.setAutoHeight(true);
So I want to set Autozise to orderManagmentTabPanel, but can't do this. I write setAutoHeight(true) and setAutoWidth(true) in orderManagmentTabPanel class, but whet I run my app orderManagmentTabPanel is empty.
Than I tried to set autosize after creating OrderManagmentTabPanel copy
TabItem orderManagmentTabItem = new TabItem("TabItem 1");
orderManagmentTabItem.setAutoWidth(true);
orderManagmentTabItem.setAutoHeight(true);
OrderManagmentTabPanel orderManagmentTabPanel = new OrderManagmentTabPanel(); //contentpanel
orderManagmentTabPanel.setAutoWidth(true);
orderManagmentTabPanel.setAutoHeight(true);
orderManagmentTabItem.add(orderManagmentTabPanel);
But didn't help also
Also tried to implement TabItem class without ContenPanel and add it to mainFormTab, but also didn't work.
How can I make my TabItem to be autosized?
Thx
OK so I believe you mean (correct me if I am are wrong) you have a panel on a tab item and are trying to ensure it takes 100% of the space?
try setting a layout for example
orderManagmentTabItem.setLayout(new FillLayout()); //Sounds like what your after