How to hide Text on overflow in JavaFX? - javafx-8

I am creating custom file chooser in JavaFX. Here is a button group for it:
And here is an fxml file content:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<GridPane hgap="5.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" xmlns:fx="http://javafx.com/fxml/1"
xmlns="http://javafx.com/javafx/8.0.131">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" minWidth="200.0"
prefWidth="200.0"/>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" minWidth="25.0"
prefWidth="25.0"/>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" minWidth="25.0"
prefWidth="25.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="25.0" prefWidth="200.0"
style="-fx-background-color: lightgrey;" GridPane.valignment="CENTER">
<GridPane.margin>
<Insets/>
</GridPane.margin>
<children>
<Text stroke="BLACK" strokeType="OUTSIDE" strokeWidth="0.0"
text="Chosen file name" StackPane.alignment="CENTER_LEFT">
<StackPane.margin>
<Insets left="5.0"/>
</StackPane.margin>
</Text>
</children>
</StackPane>
<StackPane maxHeight="-Infinity" minHeight="-Infinity" prefHeight="25.0"
style="-fx-background-color: lightgrey;" GridPane.columnIndex="1"
GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="x"/>
</children>
</StackPane>
<StackPane maxHeight="-Infinity" minHeight="-Infinity" prefHeight="25.0"
style="-fx-background-color: lightgrey;" GridPane.columnIndex="2"
GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="..."
StackPane.alignment="CENTER"/>
</children>
</StackPane>
</children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/>
</padding>
</GridPane>
When a user clicks on button (I am using Text as a button), it will show file chooser. After file chosen in should show file name. Everything works fine, but there is a problem when a file name is too long, the text is overflowing.
I want the text to be ended with "..." at the end instead of overflowing, and the size should not extend its parent size.
How to achieve this?

Use a Label instead. This automatically uses a ellipsis if the text gets too long for the available area. In contrast to Text it extends Region and therefore can be resized by the parent layout:
<?import javafx.scene.control.Label?>
...
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="25.0" prefWidth="200.0"
style="-fx-background-color: lightgrey;" GridPane.valignment="CENTER">
<GridPane.margin>
<Insets/>
</GridPane.margin>
<children>
<Label textFill="BLACK" text="Chosen file name" StackPane.alignment="CENTER_LEFT"
ellipsisString="..." textOverrun="ELLIPSIS" wrapText="false">
<StackPane.margin>
<Insets left="5.0"/>
</StackPane.margin>
</Label>
</children>
</StackPane>
...

Related

JavaFX FXML:How to create new instances of a self made fxml to VBox

I created a card like pane so that I can add data to it and create a page with many cards according to data (much like a card layout in mobile applications) however, I don't know how to add new instances of this to VBox. I tired with and without a loop and still didn't work. It Keeps Giving the Following Error:
javafx.fxml.LoadException:
/C:///////bin/application/HotelReservation.fxml
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at application.Main.start(Main.java:18)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Children: child node is null: parent = VBox[id=vboxData]
at javafx.scene.Parent$2.onProposedChange(Parent.java:435)
at com.sun.javafx.collections.VetoableListDecorator.add(VetoableListDecorator.java:206)
at application.HotelReservationController.initialize(HotelReservationController.java:45)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
... 17 more
Here is the FXML File For the Card like Pane:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<AnchorPane fx:id="cardAnchor" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<HBox fx:id="cardHBox" prefHeight="152.0" prefWidth="584.0">
<children>
<ImageView fx:id="cardPhoto" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
<VBox prefHeight="200.0" prefWidth="100.0">
<children>
<Text fx:id="cardTitle" strokeType="OUTSIDE" strokeWidth="0.0" text="Ttile:" wrappingWidth="385.9830722808838">
<font>
<Font name="System Bold" size="31.0" />
</font>
</Text>
<HBox prefHeight="18.0" prefWidth="386.0">
<children>
<Text fx:id="cardLocation" strokeType="OUTSIDE" strokeWidth="0.0" text="Location:" wrappingWidth="211.9830722808838">
<font>
<Font name="System Bold" size="15.0" />
</font>
</Text>
<Text fx:id="cardRating" strokeType="OUTSIDE" strokeWidth="0.0" text="Rating:" wrappingWidth="172.9830722808838">
<font>
<Font name="System Bold" size="15.0" />
</font>
</Text>
</children>
</HBox>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<Text fx:id="cardDescription" strokeType="OUTSIDE" strokeWidth="0.0" wrappingWidth="308.9830722808838" />
<Button fx:id="cardDetails" mnemonicParsing="false" prefHeight="89.0" prefWidth="79.0" text="Details" textAlignment="JUSTIFY" />
</children>
</HBox>
</children>
</VBox>
</children>
</HBox>
</children>
</AnchorPane>
and here is the FXML for where the VBox is located:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="700.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.HotelReservationController">
<children>
<SplitPane dividerPositions="0.14630681818181818" layoutX="-2.0" layoutY="-2.0" orientation="VERTICAL" prefHeight="706.0" prefWidth="708.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="85.0" prefWidth="162.0" style="-fx-background-color: brown;">
<children>
<HBox layoutX="2.0" prefHeight="100.0" prefWidth="248.0" spacing="2.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="75.0">
<children>
<Button mnemonicParsing="false" style="-fx-background-color: #EE854E;" text="Home" />
<Button mnemonicParsing="false" style="-fx-background-color: #EE854E;" text="Hotels" />
<Button mnemonicParsing="false" style="-fx-background-color: #EE854E;" text="Cars" />
<Button mnemonicParsing="false" style="-fx-background-color: #EE854E;" text="Trips" />
</children>
</HBox>
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="508.0" prefWidth="673.0" style="-fx-background-color: orange;">
<children>
<ScrollPane fx:id="scrollPaneContent" layoutX="-1.0" layoutY="-2.0" prefHeight="605.0" prefWidth="708.0" style="-fx-background-color: orange;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<content>
<VBox fx:id="vboxData" prefHeight="176.0" prefWidth="705.0" style="-fx-background-color: orange;" />
</content></ScrollPane>
</children></AnchorPane>
</items>
</SplitPane>
</children>
</AnchorPane>
and here is how I implemented it in java:
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
#Override
public void start(Stage primaryStage) {
try {
AnchorPane root =(AnchorPane) FXMLLoader.load(Main.class.getResource("/application/HotelReservation.fxml"));
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.setTitle("Hotel Reservation");
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
}
......
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
public class HotelReservationController implements Initializable{
#FXML
private ScrollPane scrollPaneContent;
#FXML
private VBox vboxData;
#FXML
private AnchorPane cardAnchor;
#FXML
private HBox cardHBox;
#Override
public void initialize(URL arg0, ResourceBundle arg1) {
// TODO Auto-generated method stub
vboxData.setSpacing(5);
vboxData.getChildren().add(cardAnchor);
// for (int j = 0; j < 100; j++) {
// vboxData.getChildren().add(cardAnchor);
// }
}
There is no element in HotelReservation.fxml with fx:id="cardAnchor", so cardAnchor is null in the controller, and you get the null pointer exception shown in your stack trace.
To "create instances of a FXML", you need to load the FXML. So I think what you are trying to do here is:
public class HotelReservationController implements Initializable{
#FXML
private ScrollPane scrollPaneContent;
#FXML
private VBox vboxData;
#FXML
private HBox cardHBox;
#Override
public void initialize(URL arg0, ResourceBundle arg1) {
// unclear why you wouldn't do this in the FXML
vboxData.setSpacing(5);
// guessing at the path, will need to be set appropriately:
URL cardURL = getClass().getResource("/application/Card.fxml");
try {
for (int j = 0; j < 100; j++) {
Parent cardAnchor = FXMLLoader.load(cardURL);
vboxData.getChildren().add(cardAnchor);
}
} catch (IOException exc) {
exc.printStackTrace();
System.exit(1);
}
}
}

Jfoenix JFXToggleButton does not provide switch appearance

I am learning how to use JFoenix with Java FX.
I am using it from SceneBuilder so the only code I can show is that one :
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXToggleButton?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<SplitPane id="sp_main" dividerPositions="0.29797979797979796" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.171">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<VBox layoutX="-1.0" prefHeight="398.0" prefWidth="174.0">
<children>
<Pane prefHeight="200.0" prefWidth="200.0" />
<Pane prefHeight="200.0" prefWidth="200.0" />
<Pane id="p_action" prefHeight="200.0" prefWidth="200.0">
<children>
<VBox prefHeight="200.0" prefWidth="100.0" />
<JFXToggleButton />
</children>
</Pane>
</children>
</VBox>
</children></AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
</items>
</SplitPane>
According to the documentation when we the componenet JFXToggleButton whe should have some sort of switch button like :
But this is not what I have on my side, all I can get is a simple Toggle Button like :
Is there something I am missing ? Thanks a lot.
Note :
JavaFX Scene Builder 8.5.0
JFoenix 8.0.7 added manually from Library Manager with Maven
Documentation : https://github.com/jfoenixadmin/JFoenix/wiki/Toggle-Button#JFXButton
I'll post this as an answer as this is definitely weird...
When I finally run my application it is giving the correct output, it seems that using preview option of scene builder does not render it.

Error opening a .fxml document in Scene Builder (Eclipse)

I'm creating a login app in JavaFX. I received this error while opening the scenebuilder: "Could not open Loggin.fxml. Open operation has failed. Make sure that the chosen file is a valid fxml document."
Clicking on "Show details", it shown me this error:
java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 7; The processing instruction target matching "[xX][mM][lL]" is not allowed.
at com.oracle.javafx.scenebuilder.kit.fxom.glue.GlueLoader.load(GlueLoader.java:93)
at com.oracle.javafx.scenebuilder.kit.fxom.glue.GlueLoader.load(GlueLoader.java:76)
at com.oracle.javafx.scenebuilder.kit.fxom.glue.GlueDocument.<init>(GlueDocument.java:54)
at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:74)
at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:95)
at com.oracle.javafx.scenebuilder.kit.editor.EditorController.updateFxomDocument(EditorController.java:2370)
at com.oracle.javafx.scenebuilder.kit.editor.EditorController.setFxmlTextAndLocation(EditorController.java:655)
at com.oracle.javafx.scenebuilder.app.DocumentWindowController.loadFromFile(DocumentWindowController.java:386)
at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.performOpenFiles(SceneBuilderApp.java:579)
at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.handleOpenFilesAction(SceneBuilderApp.java:447)
at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.handleLaunch(SceneBuilderApp.java:427)
at com.oracle.javafx.scenebuilder.app.AppPlatform.requestStartGeneric(AppPlatform.java:139)
at com.oracle.javafx.scenebuilder.app.AppPlatform.requestStart(AppPlatform.java:106)
at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.start(SceneBuilderApp.java:371)
at com.sun.javafx.application.LauncherImpl$8.run(LauncherImpl.java:837)
at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 7; The processing instruction target matching "[xX][mM][lL]" is not allowed.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPIData(XMLScanner.java:723)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanPIData(XMLDocumentFragmentScannerImpl.java:1018)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPI(XMLScanner.java:691)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:912)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.oracle.javafx.scenebuilder.kit.fxom.glue.GlueLoader.load(GlueLoader.java:91)
... 24 more
This is the fxml resource:
?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<TitledPane animated="false" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" text="WELCOME TO PAY-APP" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.Login">
<content>
<AnchorPane fx:id="arch" minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<Label fx:id="lblog" layoutX="43.0" layoutY="43.0" text="LOG IN " textAlignment="CENTER" />
<TextField fx:id="user" layoutX="103.0" layoutY="74.0" />
<PasswordField fx:id="paswd" layoutX="103.0" layoutY="131.0" />
<Button fx:id="logbt" layoutX="152.0" layoutY="197.0" mnemonicParsing="false" onAction="#log" text="LOG IN" />
<Label layoutX="26.0" layoutY="78.0" text="USERNAME:" />
<Label layoutX="25.0" layoutY="135.0" text="PASSWORD:" />
<Button fx:id="sgnbt" layoutX="377.0" layoutY="280.0" mnemonicParsing="false" text="SIGN UP!" />
<Label fx:id="lbmem" layoutX="285.0" layoutY="43.0" text="NOT A MEMBER? SIGN UP!" />
<Label layoutX="288.0" layoutY="78.0" text="NAME:" />
<Label layoutX="288.0" layoutY="111.0" text="LAST NAME:" />
<Label layoutX="288.0" layoutY="148.0" text="USERNAME:" />
<Label layoutX="287.0" layoutY="189.0" text="PASSWORD:" />
<Label layoutX="287.0" layoutY="231.0" text="PASSWORD AGAIN:" />
<TextField fx:id="name" layoutX="399.0" layoutY="66.0" />
<TextField fx:id="usersg" layoutX="399.0" layoutY="144.0" />
<TextField fx:id="lname" layoutX="399.0" layoutY="107.0" />
<PasswordField fx:id="paswdsg" layoutX="399.0" layoutY="185.0" />
<PasswordField fx:id="pswdsga" layoutX="399.0" layoutY="227.0" />
</children></AnchorPane>
</content>
</TitledPane>
The thing is I worked with this document before and it was compiling without problems and errors. Now I just want to add a new button to my app and it seems I can't open it... Thanks a lot for helping!

how to re-position the child nodes when the screen size is increased

I have an anchor panel wrapped in a Border panel (anchor panel positioned at the top ) .Anchor panel has a Menu bar to the top left and set of buttons aligned to the top right of the anchor panel. When is maximize the screen to full screen the buttons do not hold the position according to the increased screen size. I there a way to set the button co-ordinates relatively to the parent size ?
here is the code of the anchor panel.
<AnchorPane xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="application.views.MenuControls">
<children>
<MenuBar prefHeight="20.0" prefWidth="181.0">
<menus>
<Menu mnemonicParsing="false" text="First Menu">
<items>
<MenuItem fx:id="displayOne" mnemonicParsing="false"
onAction="#switchToOne" text="Display Anchor Pane One" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Second Menu">
<items>
<MenuItem fx:id="displayTwo" mnemonicParsing="false"
onAction="#switchToTwo" text="Display Anchor Pane Two" />
</items>
</Menu>
</menus>
</MenuBar>
<Button layoutX="590.0" mnemonicParsing="false" prefHeight="15.0" text="Close"
prefWidth="30.0" onAction="#closeApplication" managed="true" >
<!-- <graphic>
<ImageView fitHeight="17.0" fitWidth="17.0" layoutX="539.0"
layoutY="4.0">
<Image url="#close.png" />
</ImageView>
</graphic> -->
</Button>
<Button layoutX="560.0" mnemonicParsing="false" prefHeight="15.0"
prefWidth="30.0" onAction="#minimizeApplication" text="Min" managed="true">
<!-- <graphic>
<ImageView fitHeight="17.0" fitWidth="17.0" layoutX="577.0"
layoutY="4.0">
<Image url="#close.png" />
</ImageView>
</graphic> -->
</Button>
<Button layoutX="530.0" mnemonicParsing="false" prefHeight="15.0"
prefWidth="30.0" onAction="#maximizeApplication" text="Max" managed="true">
<!-- <graphic>
<ImageView fitHeight="15.0" fitWidth="17.0" >
<Image url="#close.png" />
</ImageView>
</graphic> -->
</Button>
</children>
</AnchorPane>

Magento Observer Event not firing in server but working in local

I am facing the issue when i move the code to server.It is working fine in my local system.
when i searched about the issue i found i have to use capital letters in config file.
I have updated the config file to caps but still the issue exist.
Please suggest.
Config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mdl_Ajaxcheckout>
<version>0.1.0</version>
<depends>
<Mage_Customer />
<Mage_Checkout />
</depends>
</Mdl_Ajaxcheckout>
</modules>
<global>
<models>
<mdlajaxcheckout>
<class>Mdl_Ajaxcheckout_Model</class>
</mdlajaxcheckout>
</models>
<events>
<checkout_cart_product_add_after>
<observers>
<mdl_ajaxcheckout_model_observer>
<class>Mdl_Ajaxcheckout_Model_Observer</class>
<method>modifyPrice</method>
</mdl_ajaxcheckout_model_observer>
</observers>
</checkout_cart_product_add_after>
</events>
<blocks>
<mdlajaxcheckout>
<class>Mdl_Ajaxcheckout_Block</class>
</mdlajaxcheckout>
</blocks>
<helpers>
<mdlajaxcheckout>
<class>Mdl_Ajaxcheckout_Helper</class>
</mdlajaxcheckout>
</helpers>
</global>
<frontend>
<layout>
<updates>
<mdlajaxcheckout>
<file>mdlajaxcheckout.xml</file>
</mdlajaxcheckout>
</updates>
</layout>
<translate>
<modules>
<Mdl_Ajaxcheckout>
<files>
<default>mdl_ajaxcheckout.csv</default>
</files>
</Mdl_Ajaxcheckout>
</modules>
</translate>
</frontend>
<frontend>
<routers>
<mdlajaxcheckout>
<use>standard</use>
<args>
<module>Mdl_Ajaxcheckout</module>
<frontName>mdlajaxcheckout</frontName>
</args>
</mdlajaxcheckout>
</routers>
</frontend>
<adminhtml>
<acl>
<resources>
<admin>
<children>
<catalog>
<children>
<mdlajaxcheckout_adminform>
<title>Configuration</title>
</mdlajaxcheckout_adminform>
</children>
</catalog>
</children>
</admin>
</resources>
</acl>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<mdlajaxcheckout>
<title>Mdl Ajax Cart</title>
</mdlajaxcheckout>
</children>
</config>
</children>
</system>
<customer>
<children>
<mdlajaxcheckout translate="title">
<title>Mdl Ajax Cart</title>
<sort_order>45</sort_order>
</mdlajaxcheckout>
</children>
</customer>
</children>
</admin>
</resources>
</acl>
</adminhtml>
<default>
<mdlajaxcheckout>
<default>
<mdl_ajax_cart_loading_size>260x50</mdl_ajax_cart_loading_size>
<mdl_ajax_cart_confirm_size>320x134</mdl_ajax_cart_confirm_size>
<mdl_ajax_cart_image_size>55x55</mdl_ajax_cart_image_size>
<mdl_ajax_cart_show_popup>1</mdl_ajax_cart_show_popup>
</default>
</mdlajaxcheckout>
</default>
<global>
</global>
</config>
Observer.php
<?php
class Mdl_Ajaxcheckout_Model_Observer
{
public function modifyPrice(Varien_Event_Observer $obs)
{
// Get the quote item
$item = $obs->getQuoteItem();
// Ensure we have the parent item, if it has one
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
//$demo=new Mdl_Ajaxcheckout_IndexController();
// Load the custom price
$price ="20";
// Set the custom price
$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);
// Enable super mode on the product.
$item->getProduct()->setIsSuperMode(true);
Mage::getSingleton('core/session')->setWelcomeMessage();
}
}
?>
code for enabling the module.
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Mdl_Ajaxcheckout>
<!-- Whether our module is active: true or false -->
<active>true</active>
<!-- Which code pool to use: core, community or local -->
<codePool>community</codePool>
</Mdl_Ajaxcheckout>
</modules>
</config>
Finally I got the solution for above thread.
We need to disable the compiler status in admin.
system->tools->compilation->click disable.
Now your observer event will work.