I tried set fullScreenMode(false) for my app (LWUIT). But can not get Canvas.
1 way: com.nokia.mid.ui.LCDUIUtil.setObjectTrait(javax.microedition.lcdui.Display.getDisplay(this).getCurrent(), "nokia.ui.canvas.status_zone", Boolean.FALSE);
2 way: javax.microedition.lcdui.Display.getDisplay(this).getCurrent().setFullScreenMode(false);
But I have error. Method getCurrent() return class Displayable which don't have method setFullScreenMode().
Also I tried javax.microedition.lcdui.Canvas)javax.microedition.lcdui.Display.getDisplay(this).getCurrent() but it return null.
What is way for resolved this problem?
The last way is correct, you need to use it AFTER invoking form.show() for it to actually work.
Related
I am working on laravel 5 project. I have stuck on pagination thing. I am trying to access paginate() method, but it says this method is not defined. This is my code where i have used paginate() method
public function show($id){
$codes = DB::table('soada1s')->where('couponcodefile_id','=', $id)->get()->paginate(10);
return view('admin',compact('codes'));
}
I have also included below class in my controller
use Illuminate\Pagination\Paginator;
Please tell me what is wrong?
thanks.
What is the exact error message you're getting?
I think you need to use the paginate function just after your where function.
DB::table('soada1s')->where('couponcodefile_id','=', $id)->paginate(10);
The get() function will return a collection object, and I don't think you can call the paginate function on a collection object.
I need to run some code whenever a property value is retrieved, so naturally it made sense to define the getProperty method in my class. This method will get automatically called whenever a property value is retrieved. Here's roughly what I have in my class:
class MyClass
{
def getProperty(String name)
{
// Run some code ...
return this.#"${name}"
}
}
The problem with the above method occurs when someone tries to make the following call somewhere:
MyClass.class
This call ends up in the getProperty method looking for a property named "class", however, there is not actual property named "class" so we get a MissingFieldException.
What would be the correct way to implement running code whenever a property value is retrieved and deal with these kind of situtations.
Best is not to have a getProperty method if not needed. If you need one and you want to fall back on standard Groovy logic, then you can use return getMetaClass().getProperty(this, property), as can be found in GroovyObjectSupport. This will cover more than just fields.
This seems to be a common problem with this method. Map has the same issue. The developers of groovy got around the problem with Map by saying you need to use getClass() directly.
So, I am working on a class called DMFWriteExportData and trying to get it run in Batch.
I am at a point where I need to figure out a way to get rid of fieldControl and the reason being it does not let me Run the class on the server and throws an error because it is not supposed to be running on server? (not sure)
Error: "The method Dialog Control.control cannot be called from the server; use methods on the Dialog Field class instead."
-
public Object dialog()
{
DialogRunbase dialog = new DialogRunbase("#DMF372", this);
FormStringControl control;
dialogExecution = dialog.addFieldValue(extendedTypeStr(dMFExecutionId), executionId);
control = dialogExecution.fieldControl();
control.mandatory(true);
control.displayLength(24);
control.registerOverrideMethod(methodstr(FormStringControl, lookup), methodstr(DMFWriteExecutionParameters, executionIdLookup), this);
control.registerOverrideMethod(methodstr(FormStringControl, modified), methodstr(DMFWriteExecutionParameters, executionIdModified), this);
dialogdescription=dialog.addFieldValue(extendedTypeStr(description),DMFExecution::find(executionId).Description);
dialogdescription.enabled(false);
return dialog;
}
I am wondering:
If it is actually true that this class cannot be set to server
when using control.registerOverrideMethod
If yes, what would be the ideal solution to overcome this situation,
is there any way I can create custom lookups? I see there is method
called registerOverrideMethod in the DialogField class.
Any help would be appreciated.
Thanks,
Khosla
The reason why you cannot (and should) run the code above in batch is because it uses dialog controls that only exist on the client side. You should never run this kind of code on server. Please check runon property of your class and set it to called from.
However, I assume you are using RunBaseBatch. If you are on AX 2012, you should use the SysOperation framework instead.
When using RunBaseBatch, all code is on the same class. This way, you are mixing client side code (main method, dialog method etc) with the code that should run on server (run method). For this reason you should set the "runon" property of the class to CalledFrom, not Server.
You can solve this by using SysOperation which applies the Model View Controller (MVC) pattern that neatly sepperates the two.
For an introduction to SysOperation, check my blog here:
AX2012: SysOperation introduction
import com.sun.lwuit.Command;
import javax.microedition.midlet.;
import javax.microedition.lcdui.;
in my code but still the following errors are coming...
exitCommand = new Command("Exit", Command.EXIT, 2); //line 1
textbox.addCommand(exitCommand); //line 2
Command.EXIT cannot be resolved..
The method addCommand(Command) in the type Displayable is not applicable for the arguments (Command)
There is no constructor to pass like this. Try to learn LWUIT and see this linkfor your reference. You can't use LWUIT command for J2me textbox.
You are importing LWUIT Commands, but using the LCUID Command methods. Your code would be right if you were importing javax.microedition.lcdui.Command;. But if you want to use LWUIT components, you have to forget about Items and moreover Item Commands.
I don't know if it's agood idea to mix LCUID and LWUIT, but well, I haven't used it, so I can't really say.
I've been starting to learn Groovy and am currently looking at the metaclass functionality. I have seen the examples of adding a new method, and removing all methods, but nothing about removing a single method. For example:
String.metaClass.foo = {delegate.toUpperCase()}
String.metaClass.bar = {delegate.toLowerCase()}
with the obvious side-effects. Now I have seen that you can say
String.metaClass = null
To remove all of the methods. I would expect one could say something along the lines of
String.metaClass.foo = null
to remove String.foo(), but have String.bar() remain, however this statement does not seem to have any effect. Is there a way to say method foo() should no longer be defined, without effecting bar() or any other added methods?
If you search this webpage for "remove method" it says that you should be able to remove a method using the exact syntax you've proposed above. But I tested it, and you're right, it doesn't seem to work.
A workaround is to assign a closure that throws MissingMethodException, which is what happens by default when you call a method that doesn't exist, e.g.
// Add method
String.metaClass.foo = {delegate.toUpperCase()}
// Remove method
def removeMethod = {throw new MissingMethodException()}
String.metaClass.foo = removeMethod
Admittedly, this is not the most pleasing solution.
As a followup, I posted a bug report here:
https://issues.apache.org/jira/browse/GROOVY-4189
And the documentation has been changed now
See the bug report for the reason this was never implemented
Don's answer is the best way around this