I am trying to load the following fxml file. I simply get an exception thrown pointing to line 19. I can load this in scenebuilder just fine, via Show preview in window menu item. At first I thought one couldn't have rectangles be children of a stackpane but that is the very example Oracle uses for javadoc and StackPane. Is there a known best practice to debug failures to load and fxml file? It flags the first child under reticlefilter stackpane.
The two children in question are the light blue rectangle with the yellow reticle.
<?xml version="1.0" encoding="UTF-8"?>
<?import org.cornova.javafx.*?>
<?import javafx.scene.shape.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<VBox fx:id="sliceRealEstate" alignment="TOP_CENTER" onMouseDragged="#onMouseDragged" onMousePressed="#onMousePressed" onScroll="#onScroll" onScrollStarted="#onScrollStarted" pickOnBounds="false" stylesheets="#org/cornova/javafx/xpssdr.css" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.cornova.xpssdr.controllers.SliceController">
<children>
<HBox fx:id="flagPole" pickOnBounds="false">
<children>
<Pane fx:id="flagPane" pickOnBounds="false" stylesheets="#org/cornova/javafx/xpssdr.css">
<children>
<StackPane fx:id="reticleFilter" alignment="BOTTOM_LEFT" pickOnBounds="false">
<children>
***<Rectangle fx:id="filter" fill="#3670ad" height="40.0" opacity="0.38" width="30.0" StackPane.alignment="CENTER" />***
<Rectangle fx:id="reticle" fill="#e8e82f" height="40.0" width="2.0" StackPane.alignment="CENTER" />
</children>
</StackPane>
<HBox fx:id="flag">
<children>
<VBox alignment="TOP_CENTER" spacing="10.0" style="-fx-background-color: black;" HBox.hgrow="NEVER">
<children>
<Button fx:id="close" mnemonicParsing="false" onAction="#close" text="cls">
<font>
<Font size="10.0" />
</font>
</Button>
<Button fx:id="lock" layoutX="10.0" layoutY="10.0" mnemonicParsing="false" onAction="#lock" text="lck">
<font>
<Font size="10.0" />
</font>
</Button>
<Button fx:id="record" layoutX="10.0" layoutY="29.0" mnemonicParsing="false" onAction="#record" text="rec">
<font>
<Font size="10.0" />
</font>
</Button>
<Button fx:id="play" layoutX="10.0" layoutY="48.0" mnemonicParsing="false" onAction="#play" text="play">
<font>
<Font size="10.0" />
</font>
</Button>
</children>
</VBox>
<VBox alignment="CENTER" style="-fx-background-color: black;" HBox.hgrow="NEVER">
<children>
<HBox alignment="CENTER" VBox.vgrow="ALWAYS">
<children>
<VBox alignment="CENTER" HBox.hgrow="NEVER">
<children>
<HBox alignment="CENTER" VBox.vgrow="NEVER">
<children>
<VBox alignment="TOP_CENTER">
<children>
<ComboBox fx:id="rcvsrc" prefWidth="65.0" />
<ComboBox fx:id="txsrc" prefWidth="65.0" />
</children>
</VBox>
<Label fx:id="filterwidth" text="200" HBox.hgrow="NEVER" />
</children>
</HBox>
<HBox alignment="CENTER_LEFT" fillHeight="false" VBox.vgrow="NEVER">
<children>
<Label fx:id="nbon" text="nb" />
<Label fx:id="apfon" text="nr" />
<Label fx:id="nron" text="apf" />
<Label fx:id="qskon" text="qsk" />
</children>
</HBox>
</children>
</VBox>
<HBox HBox.hgrow="ALWAYS">
<children>
<Label fx:id="txindicator" alignment="CENTER" contentDisplay="CENTER" graphicTextGap="0.0" styleClass="largeindicators" text="TX" textAlignment="CENTER" textFill="RED">
<font>
<Font size="28.0" />
</font>
</Label>
<Label fx:id="sliceind" alignment="CENTER" contentDisplay="CENTER" styleClass="largeindicators" text="A" textAlignment="CENTER">
<font>
<Font size="27.0" />
</font>
</Label>
</children>
</HBox>
</children>
</HBox>
<VBox VBox.vgrow="NEVER">
<children>
<HBox alignment="CENTER" VBox.vgrow="NEVER">
<children>
<Label fx:id="signalLevel" alignment="CENTER" styleClass="mediumindicators" text="S9" HBox.hgrow="NEVER">
<opaqueInsets>
<Insets />
</opaqueInsets>
</Label>
<Label fx:id="signalplus" text="+20" />
<TextField fx:id="frequency" maxHeight="-Infinity" maxWidth="161.0" onAction="#onFrequencyChange" onMouseEntered="#scale" prefHeight="40.0" prefWidth="144.0" promptText="144.123456" styleClass="mediumindicators" />
</children>
</HBox>
</children>
</VBox>
<HBox VBox.vgrow="NEVER">
<children>
<ButtonBar buttonMinWidth="30.0" HBox.hgrow="NEVER">
<buttons>
<Button fx:id="spkr" mnemonicParsing="false" onAction="#displaySpkrSubmenu" text="spkr">
<font>
<Font size="10.0" />
</font>
</Button>
<Button fx:id="dsp" mnemonicParsing="false" onAction="#displayDSPSubmenu" text="dsp">
<font>
<Font size="10.0" />
</font>
</Button>
<Button fx:id="mode" layoutX="125.0" layoutY="17.0" mnemonicParsing="false" onAction="#displayModeSubmenu" text="rtty">
<font>
<Font size="10.0" />
</font>
</Button>
<Button layoutX="220.0" layoutY="17.0" mnemonicParsing="false" onAction="#displayXRITSubmenu" text="x/rit" fx:id="xrit">
<font>
<Font size="10.0" />
</font>
</Button>
<Button fx:id="dax" layoutX="315.0" layoutY="17.0" mnemonicParsing="false" onAction="#displayDAXSubmenu" text="dax">
<font>
<Font size="10.0" />
</font>
</Button>
</buttons>
<padding>
<Insets bottom="5.0" right="5.0" top="5.0" />
</padding>
</ButtonBar>
</children>
</HBox>
</children>
</VBox>
</children>
</HBox>
</children>
</Pane>
</children>
</HBox>
</children>
</VBox>
Additional information:
Exact text from exception
11:11:24.191 [nioEventLoopGroup-2-3] DEBUG org.cornova.xpssdr.views.SliceView - javafx.fxml.LoadException:
file:/home/walt/NetBeansProjects/XPSSDR/dist/run293699722/XPSSDR.jar!/SliceFlag.fxml:19
Code that does the load.
public VBox create() throws IOException {
VBox pane = null;
try {
pane = sliceLoader.load();
controller = sliceLoader.getController();
controller.setRadio(radio);
controller.setPan(pan);
controller = sliceLoader.getController();
controller.setPanadapter(pan);
controller.setParent(this);
controller.setSlice(slice);
wire();
Platform.runLater(() -> {
controller.wire();
});
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug(e.getLocalizedMessage());
log.debug(e.getMessage());
log.debug(e.toString());
}
}
return pane;
}
The error was actually in the constructor to the controller. Late last night I, in an attempt to get the reticle displayed, when it was a ResizableCanvas I decided to change it to Rectangle such that it would simply take a fill(). As this was an existing app and existing controller that worked, such as it was, I didn't create it from SceneBuilder's View sample controller and had inadvertantly not changed the #FXML in the constructor of the controller. In FXMLLoader.java I was eventually able to trace it to the point it was trying to invoke something, the controller. Oddly though, it was pointing at the wrong controller, which I did verify was correct in the fxml. A puzzlement but not the current one. To you comment James about there is always a stack trace. No, many times there is not. It just strikes me perhaps I am missing some best practice on debugging these (JavaFX fxml loader issues which I've had several of these last couple of days.
Related
I have a page with an ObjectHeader and 4 panels. All the panels have a table with a horizontal scrollbar. I want to freeze the object header at the top whenever the page is scrolled. I tried the sticky property but it is not applicable for ObjectHeader but it is applicable to IconTab Bar. But in my case, I can't use IconTab Bar. I also tried some CSS but failed Please help. Below is my XML code.
XML Code :
<mvc:View xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns:t="sap.ui.table" xmlns="sap.m"
controllerName="sap.hmel.pymt.adv.controller.PaymentAdviceApp" displayBlock="true">
<App>
<pages>
<Page showHeader="false" showNavButton="true" navButtonPress="onCallPayAdvice">
<ObjectHeader title="" fullScreenOptimized="true" >
<attributes>
<ObjectAttribute title="Total Credit Values" text="+ ₹ {credModel>/header/TotalCreditItem}"/>
<ObjectAttribute title="Total Debit Values" text="- ₹ {credModel>/header/TotalDebitItem}"/>
<ObjectAttribute title="Balance" text=" ₹ {credModel>/header/TotalBalance}"/>
</attributes>
<statuses>
<ObjectStatus title="Selected Credit Values" text="+ ₹ {detail>/crdTotal}" state="{detail>/utrState}"/>
<ObjectStatus title="Selected Debit Values" text="- ₹ {detail>/invTotal}" state="{detail>/totalState}"/>
<ObjectStatus title="Balance" text=" ₹ {detail>/balance} {detail>/Waers}" state="{detail>/balState}"/>
</statuses>
</ObjectHeader>
<Panel expandable="true" headerText="Payment Document ( Subtotal : + ₹ {credModel>/header/PaymentSum})" class="sapUiMediumMarginBegin"
id="paymentPanel">
<ScrollContainer vertical="true">
<Table class="sapUiLargeMarginBottom" items="{credModel>/Payment}" growingThreshold="5" fixedLayout="false" id="paymentDocument"
growing="true" growingScrollToLoad="true" inset="false" mode="MultiSelect" selectionChange="onRowSelectionChangePayment">
<columns>
</columns>
<items>
<ColumnListItem id="columnTempId">
<cells>
</cells>
</ColumnListItem>
</items>
</Table>
</ScrollContainer>
</Panel>
<Panel expandable="true" headerText="Credit Note (Subtotal : + ₹ {credModel>/header/CreditSum})" class="sapUiMediumMarginBegin">
<ScrollContainer vertical="true">
<Table sticky="HeaderToolbar,ColumnHeaders" class="sapUiLargeMarginBottom" items="{credModel>/Credit}" id="creditNote" growing="true"
growingScrollToLoad="true" growingThreshold="5" mode="MultiSelect" selectionChange="onRowSelectionChangeCredit">
<columns>
</columns>
<items>
<ColumnListItem id="column">
<cells>
</cells>
</ColumnListItem>
</items>
</Table>
</ScrollContainer>
</Panel>
<Panel expandable="true" headerText="Invoice (Subtotal : - ₹ {credModel>/header/InvoiceSum})" class="sapUiMediumMarginBegin">
<ScrollContainer vertical="true">
<Table class="sapUiLargeMarginBottom" items="{credModel>/Invoice}" fixedLayout="false" id="invoice" growingThreshold="5" growing="true"
growingScrollToLoad="true" inset="false" mode="MultiSelect" selectionChange="onRowSelectionChange">
<columns>
</columns>
<items>
<ColumnListItem id="columnTemp">
<cells>
</cells>
</ColumnListItem>
</items>
</Table>
</ScrollContainer>
</Panel>
<Panel expandable="true" headerText="Debit Note (Subtotal : - ₹ {credModel>/header/DebitSum})" class="sapUiMediumMarginBegin">
<ScrollContainer vertical="true">
<Table class="sapUiLargeMarginBottom" items="{credModel>/Debit}" growingThreshold="5" fixedLayout="false" id="debitNote" growing="true"
growingScrollToLoad="true" inset="false" mode="MultiSelect" selectionChange="onRowSelectionChangeDebit">
<columns>
</columns>
<items>
<ColumnListItem id="columnId">
<cells>
</cells>
</ColumnListItem>
</items>
</Table>
</ScrollContainer>
</Panel>
<footer>
<Bar>
<contentRight>
<Button text="Create" type="Accept" id="btnCreateId" press="onCreate"/>
<Button text="Cancel" type="Reject" icon="sap-icon://decline" press="onCancel"/></contentRight>
</Bar>
</footer>
</Page>
</pages>
</App>
On these days i am refactoring java swing code to javafx.
And about some jpanels, i just refactored as JFXPanel and that JFXPanels` root is VBOX. the structure of JFXPanel is VBOX -> BorderPane -> TitledPane -> AnchorPane.
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="93.0" prefWidth="295.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<BorderPane prefHeight="259.0" prefWidth="309.0">
<top>
<TitledPane animated="false" prefHeight="93.0" prefWidth="297.0" style="-fx-background-color: #eeeeee;" text="Compensation Options" textFill="#1b75bc">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="295.0" prefWidth="267.0">
<children>
<Button fx:id="mResetCountButton" layoutX="25.0" layoutY="5.0" mnemonicParsing="false" text="Reset Counts" textAlignment="CENTER" />
<Button fx:id="plotStatsButton" layoutX="123.0" layoutY="5.0" mnemonicParsing="false" text="Stats Panel" textAlignment="CENTER" />
<Button fx:id="gateStatsButton" layoutX="208.0" layoutY="5.0" mnemonicParsing="false" text="Gate State" textAlignment="CENTER" />
<Button fx:id="mLoadMatrixButton" layoutX="28.0" layoutY="37.0" mnemonicParsing="false" text="Load Matrix" textAlignment="CENTER" />
<Button fx:id="viewCompMatrix" layoutX="119.0" layoutY="37.0" mnemonicParsing="false" text="View Matrix" textAlignment="CENTER" />
<Label fx:id="mJCompMatrixCombo" layoutX="208.0" layoutY="41.0" text="Matrix Name" />
</children>
</AnchorPane>
</content>
</TitledPane>
</top>
</BorderPane>
</children>
</VBox>
And now i want to make JFXPanels as Accordion. When i searched in google i just saw some code which use and when i make Accordion tag, i just can use TitledPane below tag.
Is there any other way to make JFXPanels as Accordion reusing my code?...
And actually using Tag, i just can expand one titledPane at once.
How can i make JavaFX application with Accordion which can expand many titledPanes at once?
I just tried as make titledPanesclicklistener and resizing VBox which is wrapping titledPane and titledpanes size and some panes which in inside of titledpane.
such as
boolean titledPaneClicked = false;
TiteldPane.setOnAction((e)->{
if(titledPaneClicked){
TitledPane.setHeight(0);
Vbox.setHeight(0);
soemotherPanes.setHeight(0);
titledPaneClicked = !titledPaneClicked;
}else{
TitledPane.setHeight(previousSize);
Vbox.setHeight(previousSize);
soemotherPanes.setHeight(previousSize);
titledPaneClicked = !titledPaneClicked;
}
});
And it did not work. Plz help me :)
If your question is about how you can open close 2 TitledPanes at once, you can do so programmatically, for example by using a button :
Main.fxml (to make your code mcve always post the fxml name and imports)
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<VBox minWidth="-Infinity" prefHeight="200.0" prefWidth="200.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="tests.xml.Controller">
<children>
<BorderPane>
<top>
<TitledPane fx:id="aTitledPane" animated="false" style="-fx-background-color: #eeeeee;" text="Compensation Options" textFill="#1b75bc">
<content>
<AnchorPane>
<children>
<Label text="Top pane expanded" />
</children>
</AnchorPane>
</content>
</TitledPane>
</top>
<center>
<TitledPane fx:id="bTitledPane" animated="false" style="-fx-background-color: #eeeeee;" text="Other Options" textFill="#1b75bc">
<content>
<AnchorPane>
<children>
<Label text="Bottom pane expanded" />
</children>
</AnchorPane>
</content>
</TitledPane>
</center>
<bottom>
<Button fx:id="openCloseButton" onAction="#openClose" text="Close" textAlignment="CENTER" />
</bottom>
</BorderPane>
</children>
</VBox>
And it controller:
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TitledPane;
public class Controller {
#FXML
private TitledPane aTitledPane, bTitledPane;
#FXML
private Button openCloseButton;
private final static String OPEN = "Open", CLOSE = "Close";
#FXML
void initialize(){
openCloseButton.setText(OPEN);
aTitledPane.setExpanded(false);
bTitledPane.setExpanded(false);
}
#FXML
private void openClose(){
System.out.println(openCloseButton.getText());
if(openCloseButton.getText().equals(OPEN)){
openCloseButton.setText(CLOSE);
aTitledPane.setExpanded(true);
bTitledPane.setExpanded(true);
}else{
openCloseButton.setText(OPEN);
aTitledPane.setExpanded(false);
bTitledPane.setExpanded(false);
}
}
}
Test it using :
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class FXMLTest extends Application {
#Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("xml/Main.fxml"));
primaryStage.setTitle("Hello World");
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(null);
}
}
If you want that opening / closing one TitledPane will open / close the other without using a button, remove the button from the fxml, and bind TitledPane.expandedProperty() of the two TitledPanes in the controller:
import javafx.fxml.FXML;
import javafx.scene.control.TitledPane;
public class Controller {
#FXML
private TitledPane aTitledPane, bTitledPane;
#FXML
void initialize(){
aTitledPane.expandedProperty().bindBidirectional(bTitledPane.expandedProperty());
}
}
I solved this problem just using VBox.
I made VBox, titledPane and VBox which contains some Btns, Labels, and so on.
VBox mainBox = new VBox();
TitledPane T1 = new TitledPane();
VBox content1 = new VBox();
T1.setContent(content1);
TitledPane T2 = new TitledPane();
VBox content2 = new VBox();
T2.setContent(content2);
mainBox.getChildren().addAll(T1, T2);
and then in MainVBox, titledPanes are shown like accordion.
i want to build a new module for Magento 1.9.4 that will be shown in the Admin area (catalog).
I programmed the following code, but i dont know how to show this module in the backend (including form tags). I just get a 404 error.
Here is my code with which i started my first module:
config.xml
<?xml version="1.0"?>
<config>
<modules>
<Eron_ChangePricesPerCategory>
<version>0.1.0</version>
</Eron_ChangePricesPerCategory>
</modules>
<frontend>
<routers>
<changepricespercategory>
<use>standard</use>
<args>
<module>Eron_ChangePricesPerCategory</module>
<frontName>changepricespercategory</frontName>
</args>
</changepricespercategory>
</routers>
</frontend>
<admin>
<routers>
<changepricespercategory>
<use>admin</use>
<args>
<module>Eron_ChangePricesPerCategory</module>
<frontName>admin_changepricespercategory</frontName>
</args>
</changepricespercategory>
</routers>
</admin>
<global>
<helpers>
<changepricespercategory>
<class>Eron_ChangePricesPerCategory_Helper</class>
</changepricespercategory>
</helpers>
</global>
<adminhtml>
<layout>
<updates>
<eron_changepricespercategory>
<file>eron_changepricespercategory.xml</file>
</eron_changepricespercategory>
</updates>
</layout>
</adminhtml>
</config>
adminhtml.xml
<?xml version="1.0"?>
<config>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<changepricespercategory_settings translate="title">
<title>Extra Fee Settings</title>
<sort_order>55</sort_order>
</changepricespercategory_settings>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
system.xml
<?xml version="1.0"?>
<config>
<sections>
<changepricespercategory translate="label" module="changepricespercategory">
<label>Artikelpreise pro Kategorie ändern</label>
<tab>catalog</tab>
<frontend_type>text</frontend_type>
<sort_order>999</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<active translate="label">
<label>Aktiviert</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</active>
<title translate="label">
<label>Title</label>
<frontend_type>text</frontend_type>
<sort_order>20</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</title>
<name translate="label">
<label>Name</label>
<frontend_type>text</frontend_type>
<sort_order>30</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</name>
<showmethod translate="label">
<label>Versandart zeigen, auch wenn nicht möglich</label>
<frontend_type>select</frontend_type>
<sort_order>50</sort_order>
<source_model>adminhtml/system_config_source_yesno</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</showmethod>
<specificerrmsg translate="label">
<label>Angezeigte Fehlermeldung</label>
<frontend_type>textarea</frontend_type>
<sort_order>60</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</specificerrmsg>
<sort_order translate="label">
<label>Reihenfolge</label>
<frontend_type>text</frontend_type>
<sort_order>70</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</sort_order>
</fields>
</changepricespercategory>
</sections>
</config>
IndexController.php (in controllers/Adminhtml)
<?php
class Eron_ChangePricesPerCategory_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action {
/**
* Admin controller index action
*
* #access public
* #return void
*/
public function indexAction() {
$Block = $this->getLayout()->createBlock('changepricespercategory/Adminhtml_changepricespercategory');
$this->loadLayout()
->_addContent($Block)
->renderLayout();
}
}
The Module is shown in the backend... But i when i click on it, I get a 404. Can anybody help me? Maybe there is a good documentation - im new to magento module developement.
More Information: I want to build a module for changing all prices of a category by a percentage (e.g 2% increase).
You can get started from this toturial:
https://bsscommerce.com/confluence/3-simple-steps-to-create-admin-grid-in-magento-1/
If you want to try more features check this one:
https://www.codealist.com/magento-1-9-x-create-an-adminhtml-controller/
So i'm able to get sql query to run and update the data in my database but i can't get my textfield to update with the calculation. I figured it would be as easy as selecting the new database amount and injecting it into the textfield but i have a feeling i'm failing to do that correctly. I can load the database table in my application and then get the new result but i'd prefer it to automatically show up.
The controller code below
#FXML
private TextField orderBox;
#FXML
private TextField totalBox;
public void calculateOrder(ActionEvent event){
String total = totalBox.getText();
String product = productBox.getText();
String queryUpdate="UPDATE ordertable o JOIN product p ON p.productID = o.productID set o.total = o.amount * p.cost";
String updateBox="SELECT total FROM ordertable WHERE productID = ?";
try{
query=c.prepareStatement(queryUpdate);
update=c.prepareStatement(updateBox);
update.setString(1, total);
query.execute();
update.execute();
//usetString(2, productID);
query.close();
update.close();
rs.close();
Alert confirmation = new Alert(Alert.AlertType.CONFIRMATION, "Calculated");
confirmation.show();
}
catch(SQLException e){
System.out.println(e);
}
The FXML class.
<AnchorPane prefHeight="420.0" prefWidth="627.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.OrderController">
<children>
<AnchorPane layoutX="14.0" layoutY="14.0" prefHeight="331.0" prefWidth="419.0">
<children>
<Label layoutX="164.0" layoutY="38.0" text="Order" />
<Label layoutX="14.0" layoutY="86.0" text="orderID" />
<Label layoutX="13.0" layoutY="128.0" text="productID" />
<Label layoutX="3.0" layoutY="167.0" text="CustomerID" />
<Label layoutX="28.0" layoutY="233.0" text="Date" />
<TextField id="orderIDBox" fx:id="orderBox" layoutX="67.0" layoutY="82.0" prefHeight="25.0" prefWidth="90.0" promptText="Enter OrderID" />
<TextField fx:id="productBox" layoutX="67.0" layoutY="124.0" prefHeight="25.0" prefWidth="90.0" />
<TextField fx:id="customerBox" layoutX="67.0" layoutY="163.0" prefHeight="25.0" prefWidth="90.0" />
<TextField fx:id="dateBox" layoutX="67.0" layoutY="229.0" prefHeight="25.0" prefWidth="90.0" />
<TextField id="totalBox" fx:id="totalBox" layoutX="89.0" layoutY="330.0" prefHeight="25.0" prefWidth="90.0" />
<TableView fx:id="orderUser" layoutX="164.0" layoutY="74.0" onMouseClicked="#showOnClick" prefHeight="248.0" prefWidth="447.0">
<columns>
<TableColumn fx:id="columnOrder" prefWidth="75.0" text="orderID" />
<TableColumn fx:id="columnProduct" prefWidth="75.0" text="productID" />
<TableColumn fx:id="columnCustomer" prefWidth="75.0" text="customerID" />
<TableColumn fx:id="columnDate" prefWidth="75.0" text="Date" />
<TableColumn fx:id="columnAmount" prefWidth="62.0" text="Amount" />
<TableColumn fx:id="columnTotal" prefWidth="75.0" text="total" />
</columns>
</TableView>
<Button id="loadButton" layoutX="518.0" layoutY="43.0" mnemonicParsing="false" onAction="#loadDataFromDatabase" text="Load" />
<Button id="editButton" fx:id="editButton" layoutX="94.0" layoutY="293.0" mnemonicParsing="false" onAction="#updateOrder" text="Edit" />
<Button id="deleteButton" fx:id="deleteButton" layoutX="15.0" layoutY="293.0" mnemonicParsing="false" onAction="#deleteOrder" text="Delete" />
<Button id="calculateButton" fx:id="calculateButton" layoutX="20.0" layoutY="330.0" mnemonicParsing="false" onAction="#calculateOrder" text="Calculate" />
<Label layoutX="19.0" layoutY="200.0" text="Amount" />
<TextField fx:id="amountBox" layoutX="67.0" layoutY="196.0" prefHeight="25.0" prefWidth="90.0" />
</children>
</AnchorPane>
<Button fx:id="addButton" layoutX="220.0" layoutY="363.0" mnemonicParsing="false" onAction="#AddOrder" text="Add" />
</children>
</AnchorPane>
As far as I can see (since I don´t see all the code) You´re just executing the query. You´re not assigning it the result to nothing.
Your update will work fine and your query too, but since you´re not assigning it to nothing you will not see changes.
Try to assign the query result to your textfield (I don´t know which is the textfield since you don´t say which one you want to update, I guess is total.) and then you´ll be able to see the update in your textfield
I have made a query extension where you can ask your query, and then get a reply from admin. And I have already managed to get the extension setting tab added as a tab in the admin configuration area, and created "Product Query" menu also.
successfully created this tab
Here are all of my files :)
app/code/local/Vlabs/Productquery/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Vlabs_Productquery>
<version>0.1.0</version>
</Vlabs_Productquery>
</modules>
<frontend>
<routers>
<productquery>
<use>standard</use>
<args>
<module>Vlabs_Productquery</module>
<frontName>productquery</frontName>
</args>
</productquery>
</routers>
<layout>
<updates>
<productquery module="Vlabs_Productquery">
<file>productquery.xml</file>
</productquery>
</updates>
</layout>
</frontend>
<global>
<blocks>
<productquery>
<class>Vlabs_Productquery_Block</class>
</productquery>
</blocks>
<models>
<productquery>
<class>Vlabs_Productquery_Model</class>
<resourceModel>productquery_Resource</resourceModel>
</productquery>
<productquery_Resource>
<class>Vlabs_Productquery_Model_Resource</class>
<entities>
<querybox>
<table>Vlabs_queryBox</table>
</querybox>
</entities>
</productquery_Resource>
</models>
<helpers>
<productquery>
<class>Vlabs_Productquery_Helper</class>
</productquery>
</helpers>
<resources>
<form_setup>
<setup>
<module>Vlabs_Productquery</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</form_setup>
<form_write>
<connection>
<use>core_write</use>
</connection>
</form_write>
<form_read>
<connection>
<use>core_read</use>
</connection>
</form_read>
</resources>
<template>
<email>
<vlabs_query_email_template translate="label">
<label>Recurring order email</label>
<file>vlabs_querybox_email.html</file>
<type>html</type>
</vlabs_query_email_template>
</email>
</template>
</global>
<admin>
<routers>
<adminhtml>
<use>admin</use>
<args>
<modules>
<Vlabs_Productquery before="Mage_Adminhtml">Vlabs_Productquery_Adminhtml</Vlabs_Productquery>
</modules>
<frontname>productquery</frontname>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<layout>
<updates>
<productquery>
<file>productquery.xml</file>
</productquery>
</updates>
</layout>
</adminhtml>
</config>
app/code/local/Vlabs/Productquery/etc/adminhtml.xml
<config>
<menu>
<productquery>
<title>Product Query</title>
<sort_order>50</sort_order>
<children>
<query>
<title>Query</title>
<sort_order>1</sort_order>
<action>adminhtml/index/</action>
</query>
<settings>
<title>Settings</title>
<sort_order>2</sort_order>
<action>adminhtml/index/settings</action>
</settings>
</children>
</productquery>
</menu>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<productquery>
<title>Beckin Drop Down Shipping Extension</title>
</productquery>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
app/code/local/Vlabs/Productquery/etc/system.xml
<?xml version="1.0"?>
<config>
<tabs>
<productquery translate="label">
<label>Vyrazu Query Extension</label>
<sort_order>100</sort_order>
</productquery>
</tabs>
<sections>
<productquery translate="label" module="productquery">
<label>Query</label>
<tab>productquery</tab>
<frontend_type>text</frontend_type>
<sort_order>1000</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<groups>
<settings translate="label" module="productquery">
<label>Settings</label>
<frontend_type>text</frontend_type>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<enable translate="label">
<label>Enable</label>
<comment>
<![CDATA[Enable or Disable this extension.]]>
</comment>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</enable>
</fields>
</settings>
</groups>
</productquery>
</sections>
</config>
Please guide me, where I should write those code,by this i can disable or enable this extension with this disable/enable dropdown.
I solved the issue.May be someone will be helpfull by this answer. That's why I update my answer.
So,at first write this anywhere to check it is working or not
$enableorDisable = Mage::getStoreConfig('productquery/settings/enable',Mage::app()->getStore());
print_r($enableorDisable); die();
if answer is 0 when your module is disable and answer is 1, when your module is enable. then it is working fine.. And you have to add following line in your block.
<action method="setTitle" translate="value" ifconfig="productquery/settings/enable"><value>Product Query</value></action>
add ifconfig="modulename/group name/field name"
Thank You..