00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __JUCER_HEADER_ERRORLOGCOMPONENT_ERRORLOGCOMPONENT_3D4FCE4B__
00021 #define __JUCER_HEADER_ERRORLOGCOMPONENT_ERRORLOGCOMPONENT_3D4FCE4B__
00022
00023
00024 #include "../UZIBase.hpp"
00025
00026 #include "../../HTMLParser/Parser.hpp"
00027
00028
00029
00030 namespace juce
00031 {
00032
00033 struct HTMLErrorModel : public ListBoxModel
00034 {
00035
00036 public:
00037 virtual void paintListBoxItem (int rowNumber, Graphics &g, int width, int height, bool rowIsSelected)
00038 {
00039 if (rowIsSelected)
00040 {
00041 Colour oldClr = g.getCurrentColour();
00042 g.setColour(Colours::grey);
00043 g.fillRect(Rectangle(width, height));
00044 g.setColour(oldClr);
00045 }
00046 if (!parser) { g.drawText("No HTML document parsed", 0, 0, width, (int)g.getCurrentFont().getHeight(), Justification::centred, true); }
00047 else
00048 {
00049
00050 const HTML::Parser::ParsingError * currentError = &parser->getLastParsingError();
00051 for (int i = 1; i < rowNumber && currentError; i++)
00052 currentError = currentError->nextError;
00053
00054
00055 String errorText = currentError->isError() ? "[ Error ] " : (currentError->isWarning() ? "[Warning] " : "");
00056 errorText += currentError->getErrorString();
00057 errorText<< " (Position : " << currentError->errorPosition << " / Length : " << currentError->errorLength << ")";
00058
00059 g.drawText(errorText, 0, 0, width, (int)g.getCurrentFont().getHeight(), Justification::centred, true);
00060 }
00061 }
00062 virtual int getNumRows () { return parser ? parser->getLastParsingError().chainedErrorCount() : 0;}
00063
00064
00065 public:
00066 HTMLErrorModel(HTML::Parser * _parser) : parser(_parser) {}
00067
00068 protected:
00070 HTML::Parser * parser;
00071
00072 };
00073
00074
00082 class ErrorLogComponent : public Component, public HTMLErrorModel
00083 {
00084 public:
00085
00086 ErrorLogComponent (HTML::Parser * parser, const String & communicationError);
00087 ~ErrorLogComponent();
00088
00089
00090
00091 virtual void listBoxItemClicked (int row, const MouseEvent &e);
00092
00093
00094 void paint (Graphics& g);
00095 void resized();
00096
00097
00098
00099 juce_UseDebuggingNewOperator
00100
00101 private:
00102
00103
00104
00105
00106 TextEditor* HTTPHeaderLog;
00107 Label* Headerlabel;
00108 ListBox* HTMLParsingList;
00109
00110 Label* HTMLPE;
00111 TextEditor* textEditor;
00112 Label* Details;
00113
00114
00115
00116 ErrorLogComponent (const ErrorLogComponent&);
00117 const ErrorLogComponent& operator= (const ErrorLogComponent&);
00118 };
00119
00120 }
00121
00122
00123 #endif // __JUCER_HEADER_ERRORLOGCOMPONENT_ERRORLOGCOMPONENT_3D4FCE4B__