/*
* MainContent.java
*
* Created on 23. März 2007, 16:03
*/
package gui.content;
import gui.frame.ConfigFrame;
import gui.content.*;
import functions.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import java.util.Random;
public class MainContent extends javax.swing.JPanel{
private ProgressMonitor pm;
private File file;
private String siteMapPath = "";
private String siteMapName = "";
private String sizex = "";
private String sizey = "";
private String backColorValue = "";
private String backPath = "";
private String headerTextValue = "";
private String headerPathValue = "";
private String footerTextValue = "";
private String footerPathValue = "";
private String sizeValue = "";
private Thread thread;
private RandomAccessFile tempFile;
private GlobalVar gv = new GlobalVar();
private ConfigFrame cf = new ConfigFrame();
private MakeDir md;
/** Creates new form MainContent */
public MainContent() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
cc = new javax.swing.JColorChooser();
fc = new javax.swing.JFileChooser();
jop = new javax.swing.JOptionPane();
jLabel3 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
headerPath = new javax.swing.JTextField();
btn_siteS3 = new javax.swing.JButton();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
backColor = new javax.swing.JTextField();
btn_choose = new javax.swing.JButton();
jLabel10 = new javax.swing.JLabel();
picPath = new javax.swing.JTextField();
btn_siteS2 = new javax.swing.JButton();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jTextField7 = new javax.swing.JTextField();
jLabel13 = new javax.swing.JLabel();
footerPath = new javax.swing.JTextField();
btn_siteS4 = new javax.swing.JButton();
jLabel14 = new javax.swing.JLabel();
siteMapDir = new javax.swing.JTextField();
jLabel15 = new javax.swing.JLabel();
siteName = new javax.swing.JTextField();
btn_close = new javax.swing.JButton();
btn_save = new javax.swing.JButton();
jLabel16 = new javax.swing.JLabel();
jComboBox2 = new javax.swing.JComboBox();
size = new javax.swing.JComboBox();
cc.setBackground(new java.awt.Color(110, 150, 222));
cc.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
ccPropertyChange(evt);
}
});
fc.setBackground(java.awt.Color.white);
fc.setCurrentDirectory(null);
fc.setBorder(null);
setBackground(new java.awt.Color(110, 150, 222));
jLabel3.setText("Site Gr\u00f6\u00dfe");
jLabel2.setText("Header");
jLabel6.setText("Text");
jLabel7.setText("Bild");
headerPath.setEditable(false);
btn_siteS3.setText("Durchsuchen");
btn_siteS3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_siteS3ActionPerformed(evt);
}
});
jLabel8.setText("Background");
jLabel9.setText("Farbe");
backColor.setEditable(false);
btn_choose.setText("Ausw\u00e4hlen");
btn_choose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_chooseActionPerformed(evt);
jButton2ActionPerformed(evt);
}
});
jLabel10.setText("Bild");
picPath.setEditable(false);
btn_siteS2.setText("Durchsuchen");
btn_siteS2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_siteS2ActionPerformed(evt);
}
});
jLabel11.setText("Footer");
jLabel12.setText("Text");
jLabel13.setText("Bild");
footerPath.setEditable(false);
btn_siteS4.setText("Durchsuchen");
btn_siteS4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_siteS4ActionPerformed(evt);
jButton4ActionPerformed(evt);
}
});
jLabel14.setText("Site Map");
siteMapDir.setEditable(false);
siteMapDir.setText("site/");
jLabel15.setText("Site Name");
siteName.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
siteNameFocusLost(evt);
}
});
btn_close.setText("Beenden");
btn_close.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_closeActionPerformed(evt);
}
});
btn_save.setText("Speichern");
btn_save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_saveActionPerformed(evt);
}
});
jLabel16.setText("Schema");
jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Header, Navi Links, Content", "Header, Navi Rechts, Content", "Header, Navi Link, Content, Footer", "Header, Navi Rechts, Content, Footer" }));
size.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "640 x 480", "800 x 600", "1024 x 768" }));
size.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
sizeItemStateChanged(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(btn_save)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn_close)
.addContainerGap())
.addComponent(jLabel14)
.addComponent(jLabel15)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(siteMapDir, javax.swing.GroupLayout.PREFERRED_SIZE, 673, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(siteName, javax.swing.GroupLayout.PREFERRED_SIZE, 673, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jLabel8)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel10)
.addComponent(jLabel9))
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(backColor, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(picPath, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btn_choose, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn_siteS2)))
.addComponent(jLabel3)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 382, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(headerPath, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel12)
.addComponent(jLabel13))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(footerPath, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btn_siteS4)
.addComponent(btn_siteS3))))
.addComponent(jLabel16))
.addGap(176, 176, 176))
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(size, javax.swing.GroupLayout.PREFERRED_SIZE, 673, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 673, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel14)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(siteMapDir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(siteName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(7, 7, 7)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(size, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(4, 4, 4)
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(btn_choose)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn_siteS2))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(backColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(picPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(headerPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn_siteS3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel12)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel13)
.addComponent(footerPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn_siteS4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel16)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 158, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn_close)
.addComponent(btn_save))
.addContainerGap())
);
}// </editor-fold>
private void ccPropertyChange(java.beans.PropertyChangeEvent evt) {
// TODO add your handling code here:
}
private void sizeItemStateChanged(java.awt.event.ItemEvent evt) {
// TODO add your handling code here:
Object select = evt.getSource();
Object sizeSel = size.getSelectedItem();
}
private void siteNameFocusLost(java.awt.event.FocusEvent evt) {
// TODO add your handling code here:
String tmp = siteMapDir.getText();
System.out.println("Temp = " + tmp);
String name = siteName.getText();
System.out.println("Site Name = " + name);
siteMapDir.setText(tmp + name);
String path;
path = siteMapDir.getText();
gv.getSitePath(path);
md = new MakeDir(path);
siteName.setEditable(false);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void btn_chooseActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
cc = new JColorChooser();
System.out.println("INIT Listener");
cc.showDialog(null, "Hintergrundfarbe Wählen...", Color.WHITE);
Object color = cc.getColor().getRGB();
backColorValue = color.toString();
backColor.setText(backColorValue);
System.out.println("Object: " + color);
System.out.println("Hintergrundfarbe:" + backColorValue);
}
private void btn_siteS2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
fc = new JFileChooser();
fc.setDialogTitle("Hintergrund Bild Wählen...");
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.showOpenDialog(this);
backPath = fc.getSelectedFile().getAbsolutePath().toString();
picPath.setText(backPath);
}
private void btn_siteS3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
fc = new JFileChooser();
fc.setDialogTitle("Header Bild Wählen...");
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.showOpenDialog(this);
headerPathValue = fc.getSelectedFile().getAbsolutePath().toString();
headerPath.setText(headerPathValue);
}
private void btn_siteS4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
fc = new JFileChooser();
fc.setDialogTitle("Footer Bild Wählen...");
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.showOpenDialog(this);
footerPathValue = fc.getSelectedFile().getAbsolutePath().toString();
footerPath.setText(footerPathValue);
}
private void btn_saveActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void btn_closeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
this.removeAll();
this.validate();
this.repaint();
}
public void saveConfig(){
}
public void makeFolderStrukture(){
file.mkdir();
}
public void writeConfigFile(){
}
// Variables declaration - do not modify
private javax.swing.JTextField backColor;
private javax.swing.JButton btn_choose;
private javax.swing.JButton btn_close;
private javax.swing.JButton btn_save;
private javax.swing.JButton btn_siteS2;
private javax.swing.JButton btn_siteS3;
private javax.swing.JButton btn_siteS4;
private javax.swing.JColorChooser cc;
private javax.swing.JFileChooser fc;
private javax.swing.JTextField footerPath;
private javax.swing.JTextField headerPath;
private javax.swing.JComboBox jComboBox2;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField7;
private javax.swing.JOptionPane jop;
private javax.swing.JTextField picPath;
private javax.swing.JTextField siteMapDir;
private javax.swing.JTextField siteName;
private javax.swing.JComboBox size;
// End of variables declaration
}