repo_name
stringlengths
6
101
path
stringlengths
4
300
text
stringlengths
7
1.31M
htools/htools
src/main/java/io/github/htools/hbase/TableF.java
package io.github.htools.hbase; import io.github.htools.lib.Log; import org.apache.hadoop.conf.Configuration; import java.io.IOException; /** * * @author Jeroen */ public abstract class TableF extends Table { public static Log log = new Log(TableF.class); public TableF(Configuration conf, String tablename, String[] regions) throws IOException { super(conf, tablename, regions); addColumnFamily("f"); } public void add(byte[] column, byte[] value) { add(columnFamilies.get(0).getName(), column, value); } }
sanarea/pdfium
xfa/fxfa/cxfa_readynodeiterator.h
// Copyright 2017 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #ifndef XFA_FXFA_CXFA_READYNODEITERATOR_H_ #define XFA_FXFA_CXFA_READYNODEITERATOR_H_ #include "core/fxcrt/unowned_ptr.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h" class CXFA_Node; class CXFA_ReadyNodeIterator { public: explicit CXFA_ReadyNodeIterator(CXFA_Node* pTravelRoot); ~CXFA_ReadyNodeIterator(); CXFA_Node* MoveToNext(); void SkipTree(); private: CXFA_ContainerIterator m_ContentIterator; UnownedPtr<CXFA_Node> m_pCurNode; }; #endif // XFA_FXFA_CXFA_READYNODEITERATOR_H_
agpartha/interview
src/com/iv/multiarray/MatrixCalculation.java
<gh_stars>0 package com.iv.multiarray; public class MatrixCalculation { private int r = 0; public String[][] crossMultiply(String[][] str){ int cols = 1; for(int i=1; i < str.length; i++){ cols = cols*str[i].length; } String[][] result = new String[str[0].length][cols]; for(int i=0; i < str[0].length ; i++){ StringBuffer buffer = new StringBuffer(); r=0; buffer.append(str[0][i]); recur(buffer,result,str,1,i); } return result; } private void recur(StringBuffer buffer,String[][] result,String[][] str,int currentRow,int mainCol){ if(currentRow == str.length){ result[mainCol][r++] = buffer.toString(); return; } for(int i=0; i < str[currentRow].length; i++){ StringBuffer tempBuffer = new StringBuffer(buffer); buffer.append(str[currentRow][i]); recur(buffer,result,str,currentRow+1,mainCol); buffer = tempBuffer; } } public static void main(String args[]){ MatrixCalculation mc = new MatrixCalculation(); String[][] str = {{"abc","def","gh"},{"l","m"},{"p","q","r"},{"x","y"}}; String[][] result = mc.crossMultiply(str); for(int i=0; i < result.length; i++){ for(int j=0; j < result[i].length; j++){ System.out.print(result[i][j] + " "); } System.out.println(); } } }
trentford/iem
htdocs/plotting/auto/scripts100/p174.py
"""comparison""" import datetime from pandas.io.sql import read_sql import matplotlib.dates as mdates from pyiem.network import Table as NetworkTable from pyiem.plot.use_agg import plt from pyiem.util import get_autoplot_context, get_dbconn def get_description(): """ Return a dict describing how to call this plotter """ desc = dict() desc['data'] = True desc['cache'] = 86400 desc['description'] = """This application generates a comparison of daily high and low temperatures between two automated ASOS sites of your choosing.""" edate = datetime.date.today() sdate = edate - datetime.timedelta(days=90) desc['arguments'] = [ dict(type='zstation', name='zstation1', default='DSM', network='IA_ASOS', label='Select Station 1:'), dict(type='zstation', name='zstation2', default='IKV', network='AWOS', label='Select Station 2:'), dict(type='date', name='sdate', default=sdate.strftime("%Y/%m/%d"), label='Start Date:'), dict(type='date', name='edate', default=edate.strftime("%Y/%m/%d"), label='End Date:'), ] return desc def plotter(fdict): """ Go """ pgconn = get_dbconn('iem') ctx = get_autoplot_context(fdict, get_description()) station1 = ctx['zstation1'] network1 = ctx['network1'] station2 = ctx['zstation2'] network2 = ctx['network2'] sdate = ctx['sdate'] edate = ctx['edate'] nt1 = NetworkTable(network1) nt2 = NetworkTable(network2) df = read_sql(""" WITH one as ( SELECT day, max_tmpf, min_tmpf from summary s JOIN stations t on (s.iemid = t.iemid) WHERE t.id = %s and t.network = %s and s.day >= %s and s.day <= %s), two as ( SELECT day, max_tmpf, min_tmpf from summary s JOIN stations t on (s.iemid = t.iemid) WHERE t.id = %s and t.network = %s and s.day >= %s and s.day <= %s) SELECT one.day as day, one.max_tmpf as one_high, one.min_tmpf as one_low, two.max_tmpf as two_high, two.min_tmpf as two_low from one JOIN two on (one.day = two.day) ORDER by day ASC """, pgconn, params=(station1, network1, sdate, edate, station2, network2, sdate, edate), index_col='day') if df.empty: raise ValueError("No data found for this comparison") df['high_diff'] = df['one_high'] - df['two_high'] df['low_diff'] = df['one_low'] - df['two_low'] (fig, ax) = plt.subplots(2, 1, sharex=True) ax[0].set_title(("[%s] %s minus [%s] %s\n" "Temperature Difference Period: %s - %s" ) % ( station1, nt1.sts[station1]['name'], station2, nt2.sts[station2]['name'], sdate.strftime("%-d %b %Y"), edate.strftime("%-d %b %Y"))) for i, varname in enumerate(['high', 'low']): col = '%s_diff' % (varname,) df2 = df[df[col] > 0] if df2.empty: continue freq1 = len(df2.index) / float(len(df.index)) * 100. ax[i].bar(df2.index.values, df2[col].values, fc='r', ec='r') df2 = df[df[col] < 0] freq2 = len(df2.index) / float(len(df.index)) * 100. ax[i].bar(df2.index.values, df2[col].values, fc='b', ec='b') ax[i].xaxis.set_major_formatter(mdates.DateFormatter('%-d %b\n%Y')) ax[i].grid(True) ax[i].text(0.5, 0.95, "%s Warmer (%.1f%%)" % (station1, freq1), transform=ax[i].transAxes, va='top', ha='center', color='r', fontsize=8) ax[i].text(0.5, 0.01, "%s Warmer (%.1f%%)" % (station2, freq2), transform=ax[i].transAxes, va='bottom', ha='center', color='b', fontsize=8) ax[i].text(0.95, 0.99, "Bias: %.2f" % (df[col].mean(),), transform=ax[i].transAxes, va='top', ha='right', color='k', fontsize=8) ax[i].set_ylabel(("%s Temp Difference $^\circ$F" ) % (varname.capitalize(),)) y0 = min([df[col].min(), -1]) y1 = max([df[col].max(), 1]) ax[i].set_ylim(y0 * 1.2, y1 * 1.2) return fig, df if __name__ == '__main__': plotter(dict())
WizardIke/SpectralEngine
DX12Engine/AsynchronousFileManager.h
#pragma once #include <unordered_map> #include <cstdint> #include "File.h" #include "IOCompletionQueue.h" #include "SinglyLinked.h" #include <Windows.h> #undef min #undef max class AsynchronousFileManager { private: struct ResourceId { unsigned long long start; unsigned long long end; bool operator==(const ResourceId& other) const { return start == other.start && end == other.end; } }; struct Hasher { std::size_t operator()(const ResourceId& key) const { if constexpr (sizeof(std::size_t) <= 4u) { unsigned long result = static_cast<unsigned long>(key.start); result = result * 31ul + static_cast<unsigned long>(key.start >> 32ull); result = result * 31ul + static_cast<unsigned long>(key.end); result = result * 31ul + static_cast<unsigned long>(key.end >> 32ull); return static_cast<std::size_t>(result); } else { unsigned long long result = key.start; result = result * 31ull + key.end; return static_cast<std::size_t>(result); } } }; public: class ReadRequest : public OVERLAPPED, public SinglyLinked, public ResourceId { public: AsynchronousFileManager* asynchronousFileManager; //location to put the result unsigned char* buffer; //amount read unsigned long long accumulatedSize; //what to do with the result void(*fileLoadedCallback)(ReadRequest& request, AsynchronousFileManager& asynchronousFileManager, void* tr, const unsigned char* data); void(*deleteReadRequest)(ReadRequest& request, void* tr); ReadRequest() {} ReadRequest(unsigned long long start, unsigned long long end, void(*fileLoadedCallback)(ReadRequest& request, AsynchronousFileManager& asynchronousFileManager, void* tr, const unsigned char* data), void(*deleteRequest)(ReadRequest& request, void* tr)) : fileLoadedCallback(fileLoadedCallback), deleteReadRequest(deleteRequest) { this->start = start; this->end = end; } ReadRequest(unsigned long long start, unsigned long long end, void(*fileLoadedCallback)(ReadRequest& request, AsynchronousFileManager& asynchronousFileManager, void* tr, const unsigned char* data)) : fileLoadedCallback(fileLoadedCallback) { this->start = start; this->end = end; } }; private: struct FileData { unsigned char* allocation; unsigned int userCount; ReadRequest* requests; }; File file; std::unordered_map<ResourceId, FileData, Hasher> resources; IOCompletionQueue& ioCompletionQueue; unsigned long long pageSize; static bool processIOCompletion(void* tr, DWORD numberOfBytes, LPOVERLAPPED overlapped); static bool readFileHelper(void* tr, DWORD, LPOVERLAPPED overlapped); static bool discardHelper(void* tr, DWORD, LPOVERLAPPED overlapped); static File openFileForReading(const wchar_t* name, IOCompletionQueue& ioCompletionQueue) { File file(name, File::accessRight::genericRead, File::shareMode::readMode, File::creationMode::openExisting, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING); ioCompletionQueue.associateFile(file.native_handle(), (ULONG_PTR)(processIOCompletion)); return file; } public: AsynchronousFileManager(IOCompletionQueue& ioCompletionQueue, const wchar_t* fileName); ~AsynchronousFileManager(); IOCompletionQueue& getIoCompletionQueue() { return ioCompletionQueue; } void read(ReadRequest& request); void discard(ReadRequest& request); };
kinshuk4/leetcode-solutions
java/leetcode/src/main/java/com/vaani/leetcode/string/CheckIfTwoStringArraysAreEquivalent.java
<filename>java/leetcode/src/main/java/com/vaani/leetcode/string/CheckIfTwoStringArraysAreEquivalent.java package com.vaani.leetcode.string; /** * https://leetcode.com/problems/check-if-two-string-arrays-are-equivalent/ * 1662. Check If Two String Arrays are Equivalent * Easy * <p> * Given two string arrays word1 and word2, return true if the two arrays represent the same string, and false otherwise. * <p> * A string is represented by an array if the array elements concatenated in order forms the string. * <p> * <p> * <p> * Example 1: * <p> * Input: word1 = ["ab", "c"], word2 = ["a", "bc"] * Output: true * Explanation: * word1 represents string "ab" + "c" -> "abc" * word2 represents string "a" + "bc" -> "abc" * The strings are the same, so return true. * Example 2: * <p> * Input: word1 = ["a", "cb"], word2 = ["ab", "c"] * Output: false * Example 3: * <p> * Input: word1 = ["abc", "d", "defg"], word2 = ["abcddefg"] * Output: true * <p> * <p> * Constraints: * <p> * 1 <= word1.length, word2.length <= 10^3 * 1 <= word1[i].length, word2[i].length <= 10^3 * 1 <= sum(word1[i].length), sum(word2[i].length) <= 10^3 * word1[i] and word2[i] consist of lowercase letters. */ public class CheckIfTwoStringArraysAreEquivalent { public boolean arrayStringsAreEqual(String[] word1, String[] word2) { String s1 = String.join("",word1); String s2 = String.join("",word2); return s1.equals(s2); // one liner = String.join("", word1).equals(String.join("", word2)); } }
shoukaiseki/sksweb
src/weblogicmaximo/hello/src_bak/javasqlDrive/hello.java
package javasqlDrive; /*javac -d . hello.java *java javasqlDrive.hello */ public class hello { public static void main(String args[]) { System.out.println("Hello World!!!!"); } }
Kazuki-Takeuchi/schedule_adjustment
db/migrate/20180204122600_add_column_sub_event_informations.rb
<reponame>Kazuki-Takeuchi/schedule_adjustment<gh_stars>0 class AddColumnSubEventInformations < ActiveRecord::Migration[5.1] def change add_column :sub_event_informations, :event_information_id, :integer end end
chanzuckerberg/czid-web
app/mailers/user_mailer.rb
class UserMailer < ApplicationMailer # See: app/views/user_mailer/added_to_projects_email.html.erb. def added_to_projects_email(new_user_id, email_arguments) @new_user_email = User.find(new_user_id).email @sharing_user = User.find(email_arguments[:sharing_user_id]) @shared_project_name = Project.find(email_arguments[:shared_project_id]).name @shared_project_id = email_arguments[:shared_project_id] mail(to: @new_user_email, subject: email_arguments[:email_subject]) rescue StandardError LogUtil.log_error( "added_to_projects_email(#{email_arguments}) failed", new_user_id: new_user_id, new_user_email: new_user_email, sharing_user_id: sharing_user, shared_project_name: shared_project_name, shared_project_id: shared_project_id ) end def landing_sign_up_email(body) account_email = "<EMAIL>" mail(to: account_email, subject: "New sign up from landing page", body: body) end # See: app/views/user_mailer/account_request_reply.html.erb. def account_request_reply(request_email) mail( to: request_email, subject: "Thank you for contacting The CZ ID Team" ) end # See: app/views/user_mailer/new_auth0_user_new_project.html.erb. def new_auth0_user_new_project(sharing_user, new_user_email, shared_project_id, reset_password_url) @reset_password_url = reset_password_url @shared_project_id = shared_project_id @shared_project_name = Project.find(shared_project_id).name @sharing_user_email = sharing_user.email @sharing_user_name = sharing_user.name mail( to: new_user_email, subject: "You have been invited to CZ ID" ) end # See: app/views/user_mailer/account_activation.html.erb. def account_activation(new_user_email, reset_password_url) @reset_password_url = reset_password_url mail( to: new_user_email, subject: "You have been invited to CZ ID" ) end # See: app/views/user_mailer/no_account_found.html.erb. def no_account_found(email) mail( to: email, subject: "CZ ID | Could not locate an account with this email" ) end # See: app/views/user_mailer/sample_visibility_reminder.html.erb. def sample_visibility_reminder( email:, name:, period_name:, projects:, samples_by_project_id:, total_count: ) @name = name @period_name = period_name @projects = projects @samples_by_project_id = samples_by_project_id mail( to: email, subject: "Reminder: #{total_count} CZ ID samples will soon be visible to other users!" ) end end
kpagacz/software-engineering
algorytmy-i-zlozonosc/dodatkowe-2/dodatkowe-2/limuzyna-sultana.cpp
#include <iostream> #include <vector> #include <algorithm> int main(int, char* []) { int stages_no; stages_no = 3; int* l1_stage_times = new int [] { 8, 5, 10 }; int* l2_stage_times = new int [] { 5, 10, 1}; int* move_times = new int [] { 0, 2, 3 }; // l1_summ_time, l2_summ_time: // best times of finishing previous stages of construction // using line 1 and 2 for the previous stage // l1_summ_time - best time of finishing previous stages, if the last stage was done on line 1 // l2_summ_time - best time of finishing previous stages, if the last stage was done on line 2 int l1_summ_time, l2_summ_time; l1_summ_time = l2_summ_time = 0; int temp = 0; // paths contain information about which stages to complete on which line // ith position of the path indicates: complete a stage on line 1 (0), complete a stage on line 2 (1) int* l1_path = new int [stages_no] {0}; int* l2_path = new int [stages_no] {0}; int* temp_path = new int [stages_no] {0}; for (int i = 0; i < stages_no; i++) { temp = l1_summ_time; std::memcpy(temp_path, l1_path, i); // update l1_summ_time and l1_path if (l1_summ_time + l1_stage_times[i] < l2_summ_time + move_times[i] + l1_stage_times[i]) { l1_summ_time += l1_stage_times[i]; l1_path[i] = 0; } else { l1_summ_time = l2_summ_time + move_times[i] + l1_stage_times[i]; std::memcpy(l1_path, l2_path, i); l1_path[i] = 1; } // update l2_summ_time and l2_path if (l2_summ_time + l2_stage_times[i] < temp + move_times[i] + l2_stage_times[i]) { l2_summ_time += l2_stage_times[i]; l2_path[i] = 1; } else { l2_summ_time = temp + move_times[i] + l2_stage_times[i]; std::memcpy(l2_path, temp_path, i); l2_path[i] = 0; } } // output if (l1_summ_time < l2_summ_time) { std::cout << "Minimal time: " << l1_summ_time << "\n"; std::cout << "Complete stages on lines: "; for (int i = 0; i < stages_no; i++) std::cout << l1_path[i] << " "; } else { std::cout << "Minimal time: " << l2_summ_time << "\n"; std::cout << "Complete stages on lines: "; for (int i = 0; i < stages_no; i++) std::cout << l2_path[i] << " "; } std::cout << "\n"; return 0; }
AlloSphere-Research-Group/AlloSystem
allocore/examples/system/thread.cpp
/* AlloCore Example: Thread Description: Demonstration of basic usage of the Thread class. Author: <NAME>, 10/2012 */ #include <stdio.h> #include "allocore/system/al_Thread.hpp" using namespace al; int main(){ // The main purpose of threads is to run complex operations in parallel // rather than sequentially. { Thread thread1, thread2; // Start both threads passing in functions that print a message. // The thread functions may begin now and the program continues without // waiting for the functions to return. thread1.start([](){ printf("Hello from thread 1!\n"); }); thread2.start([](){ printf("Hello from thread 2!\n"); }); // Print message from main thread; this waits until the function returns printf("Hello from main thread!\n"); // Call 'join' to wait until the thread functions finish thread1.join(); thread2.join(); } // We may also pass a functor (function with persistant data) to a thread, // but must be a bit careful... { struct Functor{ int i; void operator()(){ ++i; } }; Functor functor{1}; { // The wrong way (passes copy of functor data) Thread thread(functor); thread.join(); printf("functor.i is %d\n", functor.i); // a copy was incremented } { // The right way (passes reference to functor data) Thread thread(std::ref(functor)); thread.join(); printf("functor.i is %d\n", functor.i); // actual object was incremented } } }
blackout-games/rugby
app/leagues/nav-button/component.js
<filename>app/leagues/nav-button/component.js import Ember from 'ember'; export default Ember.Component.extend({ tagName: 'button', classNames: ['btn','btn-circle','btn-appear','menu-link','custom'], classNameBindings: ['isDisabled:disabled'], attributeBindings: ['id'], click(e){ /*let leagueId = this.get('leagueId'); if(leagueId){ Ember.Blackout.transitionTo('leagues.league',leagueId); }*/ // This happens in components/sub-nav e.preventDefault(); }, id: Ember.computed('league',function(){ return 'sub-menu-link-' + this.get('leagueId'); }), leagueId: Ember.computed('league',function(){ let direction = this.get('direction'); let leagueId; if(direction==='left'){ leagueId = this.get('league.navLeft'); } else if(direction==='up'){ leagueId = this.get('league.navAbove'); } else if(direction==='down'){ leagueId = this.get('league.navBelow'); } else { // Right leagueId = this.get('league.navRight'); } return leagueId; }), isDisabled: Ember.computed('league',function(){ let leagueId = this.get('leagueId'); let isDisabled = Ember.isEmpty(leagueId); return isDisabled; }), onInsert: Ember.on('didInsertElement',function(){ this.updateDisabled(); }), onReceive: Ember.on('didUpdateAttrs',function(attrs){ if(this.attrChanged(attrs,'league')){ this.updateDisabled(); } }), updateDisabled(){ let isDisabled = this.get('isDisabled'); if(isDisabled){ this.$().prop('disabled','disabled'); } else { this.$().prop('disabled',false); } }, });
Eclo/TivaWare-C-Series
third_party/windows/fltk-1.1.10/src/Fl_Gl_Choice.cxx
<reponame>Eclo/TivaWare-C-Series // // "$Id: Fl_Gl_Choice.cxx 6811 2009-06-30 19:05:09Z matt $" // // OpenGL visual selection code for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2005 by <NAME> and others. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Library General Public License for more details. // // You should have received a copy of the GNU Library General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA. // // Please report all bugs and problems on the following page: // // http://www.fltk.org/str.php // #include <config.h> #if HAVE_GL # include <FL/Fl.H> # include <FL/x.H> # include <stdlib.h> # include "Fl_Gl_Choice.H" # include <FL/gl_draw.H> # include "flstring.h" # ifdef __APPLE__ # include <FL/Fl_Window.H> # endif # ifdef WIN32 void fl_save_dc(HWND, HDC); # endif static Fl_Gl_Choice *first; // this assummes one of the two arguments is zero: // We keep the list system in Win32 to stay compatible and interpret // the list later... Fl_Gl_Choice *Fl_Gl_Choice::find(int m, const int *alistp) { Fl_Gl_Choice *g; for (g = first; g; g = g->next) if (g->mode == m && g->alist == alistp) return g; # ifdef __APPLE_QD__ const int *blist; int list[32]; if (alistp) blist = alistp; else { int n = 0; if (m & FL_INDEX) { list[n++] = AGL_BUFFER_SIZE; list[n++] = 8; // glut tries many sizes, but this should work... } else { list[n++] = AGL_RGBA; list[n++] = AGL_GREEN_SIZE; list[n++] = (m & FL_RGB8) ? 8 : 1; if (m & FL_ALPHA) { list[n++] = AGL_ALPHA_SIZE; list[n++] = (m & FL_RGB8) ? 8 : 1; } if (m & FL_ACCUM) { list[n++] = AGL_ACCUM_GREEN_SIZE; list[n++] = 1; if (m & FL_ALPHA) { list[n++] = AGL_ACCUM_ALPHA_SIZE; list[n++] = 1; } } } if (m & FL_DOUBLE) { list[n++] = AGL_DOUBLEBUFFER; } if (m & FL_DEPTH) { list[n++] = AGL_DEPTH_SIZE; list[n++] = 24; } if (m & FL_STENCIL) { list[n++] = AGL_STENCIL_SIZE; list[n++] = 1; } # ifdef AGL_STEREO if (m & FL_STEREO) { list[n++] = AGL_STEREO; } # endif list[n] = AGL_NONE; blist = list; } fl_open_display(); AGLPixelFormat fmt = aglChoosePixelFormat(NULL, 0, (GLint*)blist); if (!fmt) return 0; #elif defined(__APPLE_QUARTZ__) // warning: the Quartz version should probably use Core GL (CGL) instead of AGL const int *blist; int list[32]; if (alistp) blist = alistp; else { int n = 0; if (m & FL_INDEX) { list[n++] = AGL_BUFFER_SIZE; list[n++] = 8; // glut tries many sizes, but this should work... } else { list[n++] = AGL_RGBA; list[n++] = AGL_GREEN_SIZE; list[n++] = (m & FL_RGB8) ? 8 : 1; if (m & FL_ALPHA) { list[n++] = AGL_ALPHA_SIZE; list[n++] = (m & FL_RGB8) ? 8 : 1; } if (m & FL_ACCUM) { list[n++] = AGL_ACCUM_GREEN_SIZE; list[n++] = 1; if (m & FL_ALPHA) { list[n++] = AGL_ACCUM_ALPHA_SIZE; list[n++] = 1; } } } if (m & FL_DOUBLE) { list[n++] = AGL_DOUBLEBUFFER; } if (m & FL_DEPTH) { list[n++] = AGL_DEPTH_SIZE; list[n++] = 24; } if (m & FL_STENCIL) { list[n++] = AGL_STENCIL_SIZE; list[n++] = 1; } # ifdef AGL_STEREO if (m & FL_STEREO) { list[n++] = AGL_STEREO; } # endif list[n] = AGL_NONE; blist = list; } fl_open_display(); AGLPixelFormat fmt = aglChoosePixelFormat(NULL, 0, (GLint*)blist); if (!fmt) return 0; # elif !defined(WIN32) const int *blist; int list[32]; if (alistp) blist = alistp; else { int n = 0; if (m & FL_INDEX) { list[n++] = GLX_BUFFER_SIZE; list[n++] = 8; // glut tries many sizes, but this should work... } else { list[n++] = GLX_RGBA; list[n++] = GLX_GREEN_SIZE; list[n++] = (m & FL_RGB8) ? 8 : 1; if (m & FL_ALPHA) { list[n++] = GLX_ALPHA_SIZE; list[n++] = (m & FL_RGB8) ? 8 : 1; } if (m & FL_ACCUM) { list[n++] = GLX_ACCUM_GREEN_SIZE; list[n++] = 1; if (m & FL_ALPHA) { list[n++] = GLX_ACCUM_ALPHA_SIZE; list[n++] = 1; } } } if (m & FL_DOUBLE) { list[n++] = GLX_DOUBLEBUFFER; } if (m & FL_DEPTH) { list[n++] = GLX_DEPTH_SIZE; list[n++] = 1; } if (m & FL_STENCIL) { list[n++] = GLX_STENCIL_SIZE; list[n++] = 1; } if (m & FL_STEREO) { list[n++] = GLX_STEREO; } # if defined(GLX_VERSION_1_1) && defined(GLX_SGIS_multisample) if (m & FL_MULTISAMPLE) { list[n++] = GLX_SAMPLES_SGIS; list[n++] = 4; // value Glut uses } # endif list[n] = 0; blist = list; } fl_open_display(); XVisualInfo *visp = glXChooseVisual(fl_display, fl_screen, (int *)blist); if (!visp) { # if defined(GLX_VERSION_1_1) && defined(GLX_SGIS_multisample) if (m&FL_MULTISAMPLE) return find(m&~FL_MULTISAMPLE,0); # endif return 0; } # else // Replacement for ChoosePixelFormat() that finds one with an overlay // if possible: if (!fl_gc) fl_GetDC(0); int pixelformat = 0; PIXELFORMATDESCRIPTOR chosen_pfd; for (int i = 1; ; i++) { PIXELFORMATDESCRIPTOR pfd; if (!DescribePixelFormat(fl_gc, i, sizeof(pfd), &pfd)) break; // continue if it does not satisfy our requirements: if (~pfd.dwFlags & (PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL)) continue; if (pfd.iPixelType != ((m&FL_INDEX)?PFD_TYPE_COLORINDEX:PFD_TYPE_RGBA)) continue; if ((m & FL_ALPHA) && !pfd.cAlphaBits) continue; if ((m & FL_ACCUM) && !pfd.cAccumBits) continue; if ((!(m & FL_DOUBLE)) != (!(pfd.dwFlags & PFD_DOUBLEBUFFER))) continue; if ((!(m & FL_STEREO)) != (!(pfd.dwFlags & PFD_STEREO))) continue; if ((m & FL_DEPTH) && !pfd.cDepthBits) continue; if ((m & FL_STENCIL) && !pfd.cStencilBits) continue; // see if better than the one we have already: if (pixelformat) { // offering non-generic rendering is better (read: hardware accelleration) if (!(chosen_pfd.dwFlags & PFD_GENERIC_FORMAT) && (pfd.dwFlags & PFD_GENERIC_FORMAT)) continue; // offering overlay is better: else if (!(chosen_pfd.bReserved & 15) && (pfd.bReserved & 15)) {} // otherwise more bit planes is better: else if (chosen_pfd.cColorBits > pfd.cColorBits) continue; else if (chosen_pfd.cDepthBits > pfd.cDepthBits) continue; } pixelformat = i; chosen_pfd = pfd; } //printf("Chosen pixel format is %d\n", pixelformat); if (!pixelformat) return 0; # endif g = new Fl_Gl_Choice; g->mode = m; g->alist = alistp; g->next = first; first = g; # ifdef WIN32 g->pixelformat = pixelformat; g->pfd = chosen_pfd; # elif defined(__APPLE_QD__) g->pixelformat = fmt; # elif defined(__APPLE_QUARTZ__) // warning: the Quartz version should probably use Core GL (CGL) instead of AGL g->pixelformat = fmt; # else g->vis = visp; if (/*MaxCmapsOfScreen(ScreenOfDisplay(fl_display,fl_screen))==1 && */ visp->visualid == fl_visual->visualid && !getenv("MESA_PRIVATE_CMAP")) g->colormap = fl_colormap; else g->colormap = XCreateColormap(fl_display, RootWindow(fl_display,fl_screen), visp->visual, AllocNone); # endif return g; } static GLContext *context_list = 0; static int nContext = 0, NContext = 0; static void add_context(GLContext ctx) { if (!ctx) return; if (nContext==NContext) { if (!NContext) NContext = 8; NContext *= 2; context_list = (GLContext*)realloc( context_list, NContext*sizeof(GLContext)); } context_list[nContext++] = ctx; } static void del_context(GLContext ctx) { int i; for (i=0; i<nContext; i++) { if (context_list[i]==ctx) { memmove(context_list+i, context_list+i+1, (nContext-i-1) * sizeof(GLContext)); context_list[--nContext] = 0; break; } } if (!nContext) gl_remove_displaylist_fonts(); } # ifdef WIN32 GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) { Fl_X* i = Fl_X::i(window); HDC hdc = i->private_dc; if (!hdc) { hdc = i->private_dc = GetDCEx(i->xid, 0, DCX_CACHE); fl_save_dc(i->xid, hdc); SetPixelFormat(hdc, g->pixelformat, (PIXELFORMATDESCRIPTOR*)(&g->pfd)); # if USE_COLORMAP if (fl_palette) SelectPalette(hdc, fl_palette, FALSE); # endif } GLContext context = layer ? wglCreateLayerContext(hdc, layer) : wglCreateContext(hdc); if (context) { if (context_list && nContext) wglShareLists(context_list[0], context); add_context(context); } return context; } # elif defined(__APPLE_QD__) GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) { GLContext context, shared_ctx = 0; if (context_list && nContext) shared_ctx = context_list[0]; context = aglCreateContext( g->pixelformat, shared_ctx); if (!context) return 0; add_context((GLContext)context); if ( window->parent() ) { Rect wrect; GetWindowPortBounds( fl_xid(window), &wrect ); GLint rect[] = { window->x(), wrect.bottom-window->h()-window->y(), window->w(), window->h() }; aglSetInteger( (GLContext)context, AGL_BUFFER_RECT, rect ); aglEnable( (GLContext)context, AGL_BUFFER_RECT ); } aglSetDrawable( context, GetWindowPort( fl_xid(window) ) ); return (context); } # elif defined(__APPLE_QUARTZ__) // warning: the Quartz version should probably use Core GL (CGL) instead of AGL GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) { GLContext context, shared_ctx = 0; if (context_list && nContext) shared_ctx = context_list[0]; context = aglCreateContext( g->pixelformat, shared_ctx); if (!context) return 0; add_context((GLContext)context); if ( window->parent() ) { Rect wrect; GetWindowPortBounds( fl_xid(window), &wrect ); GLint rect[] = { window->x(), wrect.bottom-window->h()-window->y(), window->w(), window->h() }; aglSetInteger( (GLContext)context, AGL_BUFFER_RECT, rect ); aglEnable( (GLContext)context, AGL_BUFFER_RECT ); } aglSetDrawable( context, GetWindowPort( fl_xid(window) ) ); return (context); } # else GLContext fl_create_gl_context(XVisualInfo* vis) { GLContext shared_ctx = 0; if (context_list && nContext) shared_ctx = context_list[0]; GLContext context = glXCreateContext(fl_display, vis, shared_ctx, 1); if (context) add_context(context); return context; } # endif static GLContext cached_context; static Fl_Window* cached_window; void fl_set_gl_context(Fl_Window* w, GLContext context) { if (context != cached_context || w != cached_window) { cached_context = context; cached_window = w; # ifdef WIN32 wglMakeCurrent(Fl_X::i(w)->private_dc, context); # elif defined(__APPLE_QD__) if ( w->parent() ) { //: resize our GL buffer rectangle Rect wrect; GetWindowPortBounds( fl_xid(w), &wrect ); GLint rect[] = { w->x(), wrect.bottom-w->h()-w->y(), w->w(), w->h() }; aglSetInteger( context, AGL_BUFFER_RECT, rect ); aglEnable( context, AGL_BUFFER_RECT ); } aglSetDrawable(context, GetWindowPort( fl_xid(w) ) ); aglSetCurrentContext(context); # elif defined(__APPLE_QUARTZ__) // warning: the Quartz version should probably use Core GL (CGL) instead of AGL if ( w->parent() ) { //: resize our GL buffer rectangle Rect wrect; GetWindowPortBounds( fl_xid(w), &wrect ); GLint rect[] = { w->x(), wrect.bottom-w->h()-w->y(), w->w(), w->h() }; aglSetInteger( context, AGL_BUFFER_RECT, rect ); aglEnable( context, AGL_BUFFER_RECT ); } aglSetDrawable(context, GetWindowPort( fl_xid(w) ) ); aglSetCurrentContext(context); # else glXMakeCurrent(fl_display, fl_xid(w), context); # endif } } void fl_no_gl_context() { cached_context = 0; cached_window = 0; # ifdef WIN32 wglMakeCurrent(0, 0); # elif defined(__APPLE_QD__) AGLContext ctx = aglGetCurrentContext(); if (ctx) aglSetDrawable(ctx, NULL); aglSetCurrentContext(0); # elif defined(__APPLE_QUARTZ__) // warning: the Quartz version should probably use Core GL (CGL) instead of AGL AGLContext ctx = aglGetCurrentContext(); if (ctx) aglSetDrawable(ctx, NULL); aglSetCurrentContext(0); # else glXMakeCurrent(fl_display, 0, 0); # endif } void fl_delete_gl_context(GLContext context) { if (cached_context == context) fl_no_gl_context(); # ifdef WIN32 wglDeleteContext(context); # elif defined(__APPLE_QD__) aglDestroyContext( context ); # elif defined(__APPLE_QUARTZ__) // warning: the Quartz version should probably use Core GL (CGL) instead of AGL aglDestroyContext( context ); # else glXDestroyContext(fl_display, context); # endif del_context(context); } #endif // HAVE_GL // // End of "$Id: Fl_Gl_Choice.cxx 6811 2009-06-30 19:05:09Z matt $". //
journeymidnight/themis
mail/smtp.go
<reponame>journeymidnight/themis package mail import ( "net/smtp" "net" "fmt" "github.com/ljjjustin/themis/config" "github.com/ljjjustin/themis/database" "github.com/coreos/pkg/capnslog" "crypto/tls" "errors" "strings" ) var plog = capnslog.NewPackageLogger("github.com/ljjjustin/themis", "mail") func SendAlert(config *config.ThemisConfig, host *database.Host) { host.Notified = true host.FencedTimes += 1 saveHost(host) plog.Debugf("SendAlert set host notified true.") subject := "[warning]节点" + host.Name + "down, 请及时处理" body := "host HA 检测到 节点 " + host.Name + " down,请及时处理。" to := config.Mail.SendTo plog.Info("begin send notification mail to ", to) err := sendMail(config.Mail.SmtpUser, config.Mail.SmtpPassword, config.Mail.SmtpHost, subject, body, to) if err != nil { plog.Warningf("send notification mail to %s failed : %s", to, err) return } plog.Info("send notification mail to ", to, " success.") return } func saveHost(host *database.Host) { database.HostUpdateFields(host, "notified", "fenced_times") } func sendMail(from, password, host, subject, body string, to []string) error { split := strings.Split(from, "@") user := split[0] auth := NewLoginAuth(user, password) err := SendToMail(host, auth, from, to, body, subject) return err } func SendToMail(addr string, a smtp.Auth, from string, to []string, msg string, subject string) error { c, err := smtp.Dial(addr) host, _, _ := net.SplitHostPort(addr) if err != nil { plog.Debug("call dial") return err } defer c.Close() if ok, _ := c.Extension("STARTTLS"); ok { config := &tls.Config{ServerName: host, InsecureSkipVerify: true} if err = c.StartTLS(config); err != nil { plog.Debug("call start tls") return err } } if a != nil { if ok, _ := c.Extension("AUTH"); ok { if err = c.Auth(a); err != nil { plog.Debugf("check auth with err:", err) return err } } } if err = c.Mail(from); err != nil { return err } for _, addr := range to { if err = c.Rcpt(addr); err != nil { return err } } w, err := c.Data() if err != nil { return err } tostr := to[0] for i := 1; i < len(to); i ++ { tostr = tostr + ";" + to[i] } header := make(map[string]string) header["To"] = tostr header["From"] = from header["Subject"] = subject header["MIME-Version"] = "1.0" header["Content-Type"] = "text/plain; charset=\"utf-8\"" //header["Content-Transfer-Encoding"] = "base64" message := "" for k, v := range header { message += fmt.Sprintf("%s: %s\r\n", k, v) } //message += "\r\n" + base64.StdEncoding.EncodeToString(msg) message += "\r\n" + msg _, err = w.Write([]byte(message)) if err != nil { return err } err = w.Close() if err != nil { return err } return c.Quit() } type LoginAuth struct { username, password string } func NewLoginAuth(username, password string) smtp.Auth { return &LoginAuth{username, password} } func (a *LoginAuth) Start(server *smtp.ServerInfo) (string, []byte, error) { return "LOGIN", []byte{}, nil } func (a *LoginAuth) Next(fromServer []byte, more bool) ([]byte, error) { if more { switch string(fromServer) { case "Username:": return []byte(a.username), nil case "Password:": return []byte(a.password), nil default: return nil, errors.New("Unknown fromServer") } } return nil, nil }
free1978/mapbox-gl-native
src/text/placement.cpp
<reponame>free1978/mapbox-gl-native #include <mbgl/text/placement.hpp> #include <mbgl/geometry/anchor.hpp> #include <mbgl/text/glyph.hpp> #include <mbgl/text/placement.hpp> #include <mbgl/text/glyph_store.hpp> #include <mbgl/style/style_bucket.hpp> #include <mbgl/util/math.hpp> namespace mbgl { const float Placement::globalMinScale = 0.5; // underscale by 1 zoom level struct GlyphInstance { explicit GlyphInstance(const vec2<float> &anchor) : anchor(anchor) {} explicit GlyphInstance(const vec2<float> &anchor, float offset, float minScale, float maxScale, float angle) : anchor(anchor), offset(offset), minScale(minScale), maxScale(maxScale), angle(angle) {} const vec2<float> anchor; const float offset = 0.0f; const float minScale = Placement::globalMinScale; const float maxScale = std::numeric_limits<float>::infinity(); const float angle = 0.0f; }; typedef std::vector<GlyphInstance> GlyphInstances; void getSegmentGlyphs(std::back_insert_iterator<GlyphInstances> glyphs, Anchor &anchor, float offset, const std::vector<Coordinate> &line, int segment, int8_t direction, float maxAngle) { const bool upsideDown = direction < 0; if (offset < 0) direction *= -1; if (direction > 0) segment++; vec2<float> newAnchor = anchor; if ((int)line.size() <= segment) { return; } vec2<float> end = line[segment]; float prevscale = std::numeric_limits<float>::infinity(); float prevAngle = 0.0f; offset = std::fabs(offset); const float placementScale = anchor.scale; while (true) { const float dist = util::dist<float>(newAnchor, end); const float scale = offset / dist; float angle = -std::atan2(end.x - newAnchor.x, end.y - newAnchor.y) + direction * M_PI / 2.0f; if (upsideDown) angle += M_PI; // Don't place around sharp corners float angleDiff = std::fmod((angle - prevAngle), (2.0f * M_PI)); if (prevAngle && std::fabs(angleDiff) > maxAngle) { anchor.scale = prevscale; break; } glyphs = GlyphInstance{ /* anchor */ newAnchor, /* offset */ static_cast<float>(upsideDown ? M_PI : 0.0), /* minScale */ scale, /* maxScale */ prevscale, /* angle */ static_cast<float>(std::fmod((angle + 2.0 * M_PI), (2.0 * M_PI)))}; if (scale <= placementScale) break; newAnchor = end; // skip duplicate nodes while (newAnchor == end) { segment += direction; if ((int)line.size() <= segment || segment < 0) { anchor.scale = scale; return; } end = line[segment]; } vec2<float> normal = util::normal<float>(newAnchor, end) * dist; newAnchor = newAnchor - normal; prevscale = scale; prevAngle = angle; } } GlyphBox getMergedBoxes(const GlyphBoxes &glyphs, const Anchor &anchor) { // Collision checks between rotating and fixed labels are relatively expensive, // so we use one box per label, not per glyph for horizontal labels. const float inf = std::numeric_limits<float>::infinity(); GlyphBox mergedglyphs{/* box */ CollisionRect{inf, inf, -inf, -inf}, /* anchor */ anchor, /* minScale */ 0, /* maxScale */ inf, /* padding */ -inf}; CollisionRect &box = mergedglyphs.box; for (const GlyphBox &glyph : glyphs) { const CollisionRect &gbox = glyph.box; box.tl.x = util::min(box.tl.x, gbox.tl.x); box.tl.y = util::min(box.tl.y, gbox.tl.y); box.br.x = util::max(box.br.x, gbox.br.x); box.br.y = util::max(box.br.y, gbox.br.y); mergedglyphs.minScale = util::max(mergedglyphs.minScale, glyph.minScale); mergedglyphs.padding = util::max(mergedglyphs.padding, glyph.padding); } // for all horizontal labels, calculate bbox covering all rotated positions float x12 = box.tl.x * box.tl.x, y12 = box.tl.y * box.tl.y, x22 = box.br.x * box.br.x, y22 = box.br.y * box.br.y, diag = std::sqrt(util::max(x12 + y12, x12 + y22, x22 + y12, x22 + y22)); mergedglyphs.hBox = CollisionRect{-diag, -diag, diag, diag}; return mergedglyphs; } Placement Placement::getIcon(Anchor &anchor, const Rect<uint16_t> &image, float boxScale, const std::vector<Coordinate> &line, const StyleBucketSymbol &props) { const float x = image.w / 2.0f; // No need to divide by image.pixelRatio here? const float y = image.h / 2.0f; // image.pixelRatio; const float dx = props.icon.offset.x; const float dy = props.icon.offset.y; float x1 = (dx - x); float x2 = (dx + x); float y1 = (dy - y); float y2 = (dy + y); vec2<float> tl{x1, y1}; vec2<float> tr{x2, y1}; vec2<float> br{x2, y2}; vec2<float> bl{x1, y2}; float angle = props.icon.rotate * M_PI / 180.0f; if (anchor.segment >= 0 && props.icon.rotation_alignment != RotationAlignmentType::Viewport) { const Coordinate &next = line[anchor.segment]; angle += -std::atan2(next.x - anchor.x, next.y - anchor.y) + M_PI / 2; } if (angle) { // Compute the transformation matrix. float angle_sin = std::sin(angle); float angle_cos = std::cos(angle); std::array<float, 4> matrix = {{angle_cos, -angle_sin, angle_sin, angle_cos}}; tl = tl.matMul(matrix); tr = tr.matMul(matrix); bl = bl.matMul(matrix); br = br.matMul(matrix); x1 = util::min(tl.x, tr.x, bl.x, br.x); x2 = util::max(tl.x, tr.x, bl.x, br.x); y1 = util::min(tl.y, tr.y, bl.y, br.y); y2 = util::max(tl.y, tr.y, bl.y, br.y); } const CollisionRect box{/* x1 */ x1 * boxScale, /* y1 */ y1 * boxScale, /* x2 */ x2 * boxScale, /* y2 */ y2 * boxScale}; Placement placement; placement.boxes.emplace_back( /* box */ box, /* anchor */ anchor, /* minScale */ Placement::globalMinScale, /* maxScale */ std::numeric_limits<float>::infinity(), /* padding */ props.icon.padding); placement.shapes.emplace_back( /* tl */ tl, /* tr */ tr, /* bl */ bl, /* br */ br, /* image */ image, /* angle */ 0, /* anchors */ anchor, /* minScale */ Placement::globalMinScale, /* maxScale */ std::numeric_limits<float>::infinity()); placement.minScale = anchor.scale; return placement; } Placement Placement::getGlyphs(Anchor &anchor, const vec2<float> &origin, const Shaping &shaping, const GlyphPositions &face, float boxScale, bool horizontal, const std::vector<Coordinate> &line, const StyleBucketSymbol &props) { const float maxAngle = props.text.max_angle * M_PI / 180; const float rotate = props.text.rotate * M_PI / 180; const float padding = props.text.padding; const bool alongLine = props.text.rotation_alignment != RotationAlignmentType::Viewport; const bool keepUpright = props.text.keep_upright; Placement placement; const uint32_t buffer = 3; for (const PositionedGlyph &shape : shaping) { auto face_it = face.find(shape.glyph); if (face_it == face.end()) continue; const Glyph &glyph = face_it->second; const Rect<uint16_t> &rect = glyph.rect; if (!glyph) continue; if (!rect) continue; const float x = (origin.x + shape.x + glyph.metrics.left - buffer + rect.w / 2) * boxScale; GlyphInstances glyphInstances; if (anchor.segment >= 0 && alongLine) { getSegmentGlyphs(std::back_inserter(glyphInstances), anchor, x, line, anchor.segment, 1, maxAngle); if (keepUpright) getSegmentGlyphs(std::back_inserter(glyphInstances), anchor, x, line, anchor.segment, -1, maxAngle); } else { glyphInstances.emplace_back(GlyphInstance{anchor}); } const float x1 = origin.x + shape.x + glyph.metrics.left - buffer; const float y1 = origin.y + shape.y - glyph.metrics.top - buffer; const float x2 = x1 + glyph.rect.w; const float y2 = y1 + glyph.rect.h; const vec2<float> otl{x1, y1}; const vec2<float> otr{x2, y1}; const vec2<float> obl{x1, y2}; const vec2<float> obr{x2, y2}; const CollisionRect obox{boxScale * x1, boxScale * y1, boxScale * x2, boxScale * y2}; for (const GlyphInstance &instance : glyphInstances) { vec2<float> tl = otl; vec2<float> tr = otr; vec2<float> bl = obl; vec2<float> br = obr; CollisionRect box = obox; // Clamp to -90/+90 degrees const float angle = instance.angle + rotate; if (angle) { // Compute the transformation matrix. float angle_sin = std::sin(angle); float angle_cos = std::cos(angle); std::array<float, 4> matrix = {{angle_cos, -angle_sin, angle_sin, angle_cos}}; tl = tl.matMul(matrix); tr = tr.matMul(matrix); bl = bl.matMul(matrix); br = br.matMul(matrix); } // Prevent label from extending past the end of the line const float glyphMinScale = std::max(instance.minScale, anchor.scale); // Remember the glyph for later insertion. placement.shapes.emplace_back( tl, tr, bl, br, rect, float(std::fmod((anchor.angle + rotate + instance.offset + 2 * M_PI), (2 * M_PI))), instance.anchor, glyphMinScale, instance.maxScale); if (!instance.offset) { // not a flipped glyph if (angle) { // Calculate the rotated glyph's bounding box offsets from the anchor point. box = CollisionRect{boxScale * util::min(tl.x, tr.x, bl.x, br.x), boxScale * util::min(tl.y, tr.y, bl.y, br.y), boxScale * util::max(tl.x, tr.x, bl.x, br.x), boxScale * util::max(tl.y, tr.y, bl.y, br.y)}; } placement.boxes.emplace_back(box, instance.anchor, glyphMinScale, instance.maxScale, padding); } } } // TODO avoid creating the boxes in the first place? if (horizontal) placement.boxes = {getMergedBoxes(placement.boxes, anchor)}; const float minPlacementScale = anchor.scale; placement.minScale = std::numeric_limits<float>::infinity(); for (const GlyphBox &box : placement.boxes) { placement.minScale = util::min(placement.minScale, box.minScale); } placement.minScale = util::max(minPlacementScale, Placement::globalMinScale); return placement; } }
blinken/amz_sp_api
lib/vendor-direct-fulfillment-orders-api-model/spec/models/order_details_spec.rb
=begin #Selling Partner API for Direct Fulfillment Orders #The Selling Partner API for Direct Fulfillment Orders provides programmatic access to a direct fulfillment vendor's order data. OpenAPI spec version: v1 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.26 =end require 'spec_helper' require 'json' require 'date' # Unit tests for AmzSpApi::VendorDirectFulfillmentOrdersApiModel::OrderDetails # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) # Please update as you see appropriate describe 'OrderDetails' do before do # run before each test @instance = AmzSpApi::VendorDirectFulfillmentOrdersApiModel::OrderDetails.new end after do # run after each test end describe 'test an instance of OrderDetails' do it 'should create an instance of OrderDetails' do expect(@instance).to be_instance_of(AmzSpApi::VendorDirectFulfillmentOrdersApiModel::OrderDetails) end end describe 'test attribute "customer_order_number"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "order_date"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "order_status"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["NEW", "SHIPPED", "ACCEPTED", "CANCELLED"]) # validator.allowable_values.each do |value| # expect { @instance.order_status = value }.not_to raise_error # end end end describe 'test attribute "shipment_details"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "tax_total"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "selling_party"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "ship_from_party"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "ship_to_party"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "bill_to_party"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "items"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end end
codeteapot/ironhoist-container
ironhoist-container-core/src/main/java/com/github/codeteapot/ironhoist/container/MachineSessionStateLoggedOut.java
<filename>ironhoist-container-core/src/main/java/com/github/codeteapot/ironhoist/container/MachineSessionStateLoggedOut.java<gh_stars>0 package com.github.codeteapot.ironhoist.container; import com.github.codeteapot.ironhoist.plugin.MachineCommand; import com.github.codeteapot.ironhoist.plugin.MachineSessionException; import java.util.concurrent.Future; class MachineSessionStateLoggedOut extends MachineSessionState { MachineSessionStateLoggedOut(MachineSessionStateChanger stateChanger) { super(stateChanger); } @Override <R> Future<R> execute(MachineCommand<R> command) throws MachineSessionException { throw new MachineSessionException(new IllegalStateException("Logged out")); } @Override void logout() { // Nothing to be done } }
ashwinimore/chpl-api
chpl/chpl-service/src/main/java/gov/healthit/chpl/dto/NonconformityTypeStatisticsDTO.java
package gov.healthit.chpl.dto; import java.util.Date; import gov.healthit.chpl.entity.surveillance.NonconformityTypeStatisticsEntity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @NoArgsConstructor @AllArgsConstructor public @Data class NonconformityTypeStatisticsDTO { private Long id; private Long nonconformityCount; private String nonconformityType; private CertificationCriterionDTO criterion; private Date creationDate; private Boolean deleted; private Date lastModifiedDate; private Long lastModifiedUser; public NonconformityTypeStatisticsDTO(NonconformityTypeStatisticsEntity entity) { this.nonconformityCount = entity.getNonconformityCount(); this.nonconformityType = entity.getNonconformityType(); if (entity.getCertificationCriterionEntity() != null) { this.criterion = new CertificationCriterionDTO(entity.getCertificationCriterionEntity()); } this.id = entity.getId(); this.setCreationDate(entity.getCreationDate()); this.setDeleted(entity.getDeleted()); this.setLastModifiedUser(entity.getLastModifiedUser()); this.setLastModifiedDate(entity.getLastModifiedDate()); } }
Neversee-Productions/Space-Station-Rescue-Souls
docs/search/files_4.js
<reponame>Neversee-Productions/Space-Station-Rescue-Souls var searchData= [ ['health_2ecpp',['Health.cpp',['../_health_8cpp.html',1,'']]], ['health_2eh',['Health.h',['../_health_8h.html',1,'']]] ];
msmygit/nosqlbench
virtdata-lib-basics/src/main/java/io/nosqlbench/virtdata/library/basics/shared/unary_string/URLEncode.java
<gh_stars>100-1000 package io.nosqlbench.virtdata.library.basics.shared.unary_string; import io.nosqlbench.virtdata.api.annotations.Categories; import io.nosqlbench.virtdata.api.annotations.Category; import io.nosqlbench.virtdata.api.annotations.Example; import io.nosqlbench.virtdata.api.annotations.ThreadSafeMapper; import java.net.URLEncoder; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.function.Function; /** * URLEncode string data */ @ThreadSafeMapper @Categories({Category.conversion}) public class URLEncode implements Function<String, String> { private final Charset charset; /** * UrlEncode any incoming string using the specified charset. * * @param charset A valid character set name from {@link Charset} */ @Example({"URLEncode('UTF-16')", "URLEncode using the UTF-16 charset."}) public URLEncode(String charset) { this.charset = Charset.forName(charset); } @Example({"URLEncode()", "URLEncode using the default UTF-8 charset."}) public URLEncode() { this.charset = StandardCharsets.UTF_8; } @Override public String apply(String s) { return URLEncoder.encode(s, charset); } }
VRAM-Software/prediction_configuration_utility
src/tests/model/algorithm/RlTrainer.test.js
const Trainer = require("../../../model/algorithm/RlTrainer"); const Regression = require("../../../model/algorithm/lib/regression.module.js"); jest.mock("../../../model/algorithm/lib/regression.module.js"); describe("test for training RL algorithm's wrapper class", () => { let trainer; beforeEach(() => { trainer = new Trainer(); trainer.setOptions({ numX: 3, numY: 1 }); trainer.setParams(["x1", "x2", "y"]); }); test("insertData should insert in the field data, the expected array with number of params >= 3", () => { const data = [ { x1: 1, x2: 2, y: 2 }, { x1: 9, x2: 9, y: 9 }, ]; expect(trainer.options).toEqual({ numX: 3, numY: 1 }); expect(trainer.translateData(data)).toEqual([ { x: [1, 1, 2], y: [2] }, { x: [1, 9, 9], y: [9] }, ]); }); test("insertData should insert in the field data, the expected array with number of params < 3", () => { const data = [ { x1: 1, y: 2 }, { x1: 9, y: 9 }, ]; trainer.setParams(["x1", "y"]); trainer.setOptions({ numX: 2, numY: 1 }); expect(trainer.options).toEqual({ numX: 2, numY: 1 }); expect(trainer.translateData(data)).toEqual([ { x: [1, 1], y: [2] }, { x: [1, 9], y: [9] }, ]); }); test("train method should call train method from regression.module", () => { const data = [ { x1: 1, x2: 2, y: 2 }, { x1: 9, x2: 9, y: 9 }, ]; const res = trainer.train(data); expect(Regression.prototype.insertData).toHaveBeenCalled(); expect(Regression.prototype.calculateCoefficients).toHaveBeenCalled(); expect(res).toEqual(trainer.buildTrainedObject(trainer.trainedJson)); }); test("buildTrainedObject should return a js Object with correct parameters", () => { let trainedObj = trainer.buildTrainedObject([[2.1013431013431014]]); let result = Object.keys(trainedObj); expect(result.includes("author")).toBeTruthy(); expect(result.includes("version")).toBeTruthy(); expect(result.includes("date")).toBeTruthy(); expect(result.includes("time")).toBeTruthy(); expect(result.includes("pluginAim")).toBeTruthy(); expect(result.includes("predictors")).toBeTruthy(); expect(result.includes("result")).toBeTruthy(); }); test("setParams should set parameters correctly on RlTrainer", () => { expect(trainer.params).toEqual(["x1", "x2", "y"]); }); test("setOptions should set options correctly on RlTrainer", () => { expect(trainer.options).toEqual({ numX: 3, numY: 1 }); }); test("getQualityIndex should return qualityIndex value", () => { expect(trainer.getQualityIndex()).toEqual(trainer.qualityIndex); }); });
Oscar-B-Liang/main
src/test/java/seedu/flashcard/logic/parser/QuizCommandParserTest.java
package seedu.flashcard.logic.parser; import static seedu.flashcard.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.flashcard.logic.parser.CommandParserTestUtil.assertParseFailure; import static seedu.flashcard.logic.parser.CommandParserTestUtil.assertParseSuccess; import static seedu.flashcard.testutil.TypicalIndexes.INDEX_FIRST_FLASHCARD; import org.junit.jupiter.api.Test; import seedu.flashcard.logic.commands.QuizCommand; public class QuizCommandParserTest { private QuizCommandParser parser = new QuizCommandParser(); @Test public void parse_validArgs_returnsQuizCommand() { assertParseSuccess(parser, "1", new QuizCommand(INDEX_FIRST_FLASHCARD, 1)); } @Test public void parse_invalidArgs_throwsParseException() { assertParseFailure(parser, "a", String.format(MESSAGE_INVALID_COMMAND_FORMAT + QuizCommand.MESSAGE_USAGE)); } }
xmapst/imail
internal/app/form/install.go
package form import () type Install struct { DbType string `binding:"Required"` DbHost string DbUser string DbPasswd string DbName string SslMode string DbPath string AppName string `binding:"Required" locale:"install.app_name"` RepoRootPath string `binding:"Required"` RunUser string `binding:"Required"` Domain string `binding:"Required"` HttpPort string `binding:"Required"` LogRootPath string `binding:"Required"` MailSaveMode string `binding:"Required"` EnableConsoleMode bool OfflineMode bool DisableGravatar bool EnableFederatedAvatar bool DisableRegistration bool EnableCaptcha bool RequireSignInView bool AdminName string `binding:"OmitEmpty;AlphaDashDot;MaxSize(30)" locale:"install.admin_name"` AdminPassword string `binding:"OmitEmpty;MaxSize(255)" locale:"install.admin_password"` AdminConfirmPassword string AdminEmail string `binding:"OmitEmpty;MinSize(3);MaxSize(254);Include(@)" locale:"install.admin_email"` } type SignIn struct { UserName string `binding:"Required;MaxSize(254)"` Password string `binding:"Required;MaxSize(255)"` LoginSource int64 Remember bool }
farajilab/gifs_release
gromacs-4.6.5/include/thread_mpi/atomic.h
<filename>gromacs-4.6.5/include/thread_mpi/atomic.h /* This source code file is part of thread_mpi. Written by <NAME>, <NAME>, and possibly others. Copyright (c) 2009, <NAME>, <NAME>. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3) Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY US ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you want to redistribute modifications, please consider that scientific software is very special. Version control is crucial - bugs must be traceable. We will be happy to consider code for inclusion in the official distribution, but derived work should not be called official thread_mpi. Details are found in the README & COPYING files. */ #ifndef TMPI_ATOMIC_H_ #define TMPI_ATOMIC_H_ /*! \file atomic.h * * \brief Atomic operations for fast SMP synchronization * * This file defines atomic integer operations and spinlocks for * fast synchronization in performance-critical regions. * * In general, the best option is to use functions without explicit * locking, e.g. tMPI_Atomic_fetch_add() or tMPI_Atomic_cas(). * * Depending on the architecture/compiler, these operations may either * be provided as functions or macros; be aware that those macros may * reference their arguments repeatedly, possibly leading to multiply * evaluated code with side effects: be careful with what you use as * arguments. * * Not all architectures support atomic operations though inline assembly, * and even if they do it might not be implemented here. In that case * we use a fallback mutex implementation, so you can always count on * the function interfaces working. * * Don't use spinlocks in non-performance-critical regions like file I/O. * Since they always spin busy they would waste CPU cycles instead of * properly yielding to a computation thread while waiting for the disk. * * Finally, note that all our spinlock operations are defined to return * 0 if initialization or locking completes successfully. * This is the opposite of some other implementations, but the same standard * as used for pthread mutexes. So, if e.g. are trying to lock a spinlock, * you will have gotten the lock if the return value is 0. * * tMPI_Spinlock_islocked(x) obviously still returns 1 if the lock is locked, * and 0 if it is available, though... */ /* Se the comments on the non-atomic versions for explanations */ #include <stdio.h> #include "visibility.h" #ifdef __cplusplus extern "C" { #endif #if 0 } /* Avoids screwing up auto-indentation */ #endif /* first check for gcc/icc platforms. Some compatible compilers, like icc on linux+mac will take this path, too */ #if ( (defined(__GNUC__) || defined(__PATHSCALE__) || defined(__PGI)) && \ (!defined(__xlc__)) && (!defined(TMPI_TEST_NO_ATOMICS)) ) #ifdef __GNUC__ #define TMPI_GCC_VERSION (__GNUC__ * 10000 \ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__) #endif /* now check specifically for several architectures: */ #if ((defined(i386) || defined(__x86_64__)) && !defined(__OPEN64__)) /* first x86: */ #include "atomic/gcc_x86.h" #elif (defined(__ia64__)) /* then ia64: */ #include "atomic/gcc_ia64.h" /* for now we use gcc intrinsics on gcc: */ /*#elif (defined(__powerpc__) || (defined(__ppc__)) )*/ /*#include "atomic/gcc_ppc.h"*/ #elif defined(__FUJITSU) && ( defined(__sparc_v9__) || defined (__sparcv9) ) /* Fujitsu FX10 SPARC compiler */ #include "atomic/fujitsu_sparc64.h" #else /* otherwise, there's a generic gcc intrinsics version: */ #include "atomic/gcc.h" #endif /* end of check for gcc specific architectures */ /* not gcc: */ #elif (defined(_MSC_VER) && (_MSC_VER >= 1200) && \ (!defined(TMPI_TEST_NO_ATOMICS)) ) /* Microsoft Visual C on x86, define taken from FFTW who got it from <NAME>. icc on windows will take this path. */ #include "atomic/msvc.h" #elif ( (defined(__IBM_GCC_ASM) || defined(__IBM_STDCPP_ASM)) && \ (defined(__powerpc__) || defined(__ppc__)) && \ (!defined(TMPI_TEST_NO_ATOMICS)) ) /* PowerPC using xlC intrinsics. */ #include "atomic/xlc_ppc.h" #elif ( ( defined(__xlC__) || defined(__xlc__) ) && \ (!defined(TMPI_TEST_NO_ATOMICS)) ) /* IBM xlC compiler */ #include "atomic/xlc_ppc.h" #elif (defined (__sun) && (defined(__sparcv9) || defined(__sparc)) && \ (!defined(TMPI_TEST_NO_ATOMICS)) ) /* Solaris on SPARC (Sun C Compiler, Solaris Studio) */ #include "atomic/suncc-sparc.h" #elif defined(__FUJITSU) && defined(__sparc__) /* Fujitsu FX10 SPARC compiler requires gcc compatibility with -Xg */ #error Atomics support for Fujitsu FX10 compiler requires -Xg (gcc compatibility) #else /* No atomic operations, use mutex fallback. Documentation is in x86 section */ #ifdef TMPI_CHECK_ATOMICS #error No atomic operations implemented for this cpu/compiler combination. #endif #ifndef DOXYGEN /** Indicates that no support for atomic operations is present. */ #define TMPI_NO_ATOMICS #endif /** Memory barrier operation Modern CPUs rely heavily on out-of-order execution, and one common feature is that load/stores might be reordered. Also, when using inline assembly the compiler might already have loaded the variable we are changing into a register, so any update to memory won't be visible. This command creates a memory barrier, i.e. all memory results before it in the code should be visible to all memory operations after it - the CPU cannot propagate load/stores across it. This barrier is a full barrier: all load and store operations of instructions before it are completed, while all load and store operations that are in instructions after it won't be done before this barrier. \hideinitializer */ #define tMPI_Atomic_memory_barrier() /** Memory barrier operation with acquire semantics This barrier is a barrier with acquire semantics: the terminology comes from its common use after acquiring a lock: all load/store instructions after this barrier may not be re-ordered to happen before this barrier. \hideinitializer */ #define tMPI_Atomic_memory_barrier_acq() /** Memory barrier operation with release semantics This barrier is a barrier with release semantics: the terminology comes from its common use before releasing a lock: all load/store instructions before this barrier may not be re-ordered to happen after this barrier. \hideinitializer */ #define tMPI_Atomic_memory_barrier_rel() #ifndef DOXYGEN /* signal that they exist */ #define TMPI_HAVE_ACQ_REL_BARRIERS #endif /** Atomic operations datatype * * Portable synchronization primitives like mutexes are effective for * many purposes, but usually not very high performance. * One of the problem is that you have the overhead of a function call, * and another is that Mutexes often have extra overhead to make the * scheduling fair. Finally, if performance is important we don't want * to suspend the thread if we cannot lock a mutex, but spin-lock at 100% * CPU usage until the resources is available (e.g. increment a counter). * * These things can often be implemented with inline-assembly or other * system-dependent functions, and we provide such functionality for the * most common platforms. For portability we also have a fallback * implementation using a mutex for locking. * * Performance-wise, the fastest solution is always to avoid locking * completely (obvious, but remember it!). If you cannot do that, the * next best thing is to use atomic operations that e.g. increment a * counter without explicit locking. Spinlocks are useful to lock an * entire region, but leads to more overhead and can be difficult to * debug - it is up to you to make sure that only the thread owning the * lock unlocks it! * * You should normally NOT use atomic operations for things like * I/O threads. These should yield to other threads while waiting for * the disk instead of spinning at 100% CPU usage. * * It is imperative that you use the provided routines for reading * and writing, since some implementations require memory barriers before * the CPU or memory sees an updated result. The structure contents is * only visible here so it can be inlined for performance - it might * change without further notice. * * \note No initialization is required for atomic variables. * * Currently, we have (real) atomic operations for: * * - gcc version 4.1 and later (all platforms) * - x86 or x86_64, using GNU compilers * - x86 or x86_64, using Intel compilers * - x86 or x86_64, using Pathscale compilers * - Itanium, using GNU compilers * - Itanium, using Intel compilers * - Itanium, using HP compilers * - PowerPC, using GNU compilers * - PowerPC, using IBM AIX compilers * - PowerPC, using IBM compilers >=7.0 under Linux or Mac OS X. * - Sparc64, using Fujitsu compilers. * * \see * - tMPI_Atomic_get * - tMPI_Atomic_set * - tMPI_Atomic_cas * - tMPI_Atomic_add_return * - tMPI_Atomic_fetch_add */ typedef struct tMPI_Atomic { int value; /**< The atomic value.*/ } tMPI_Atomic_t; /** Atomic pointer type equivalent to tMPI_Atomic_t * * Useful for lock-free and wait-free data structures. * The only operations available for this type are: * \see * - tMPI_Atomic_ptr_get * - tMPI_Atomic_ptr_set * - tMPI_Atomic_ptr_cas */ typedef struct tMPI_Atomic_ptr { void *value; /**< The atomic pointer. */ } tMPI_Atomic_ptr_t; /** Spinlock * * Spinlocks provide a faster synchronization than mutexes, * although they consume CPU-cycles while waiting. They are implemented * with atomic operations and inline assembly whenever possible, and * otherwise we use a fallback implementation where a spinlock is identical * to a mutex (this is one of the reasons why you have to initialize them). * * There are no guarantees whatsoever about fair scheduling or * debugging if you make a mistake and unlock a variable somebody * else has locked - performance is the primary goal of spinlocks. * * \see * - tMPI_Spinlock_init * - tMPI_Spinlock_lock * - tMPI_Spinlock_unlock * - tMPI_Spinlock_trylock * - tMPI_Spinlock_wait */ typedef struct tMPI_Spinlock *tMPI_Spinlock_t; /*! \def TMPI_SPINLOCK_INITIALIZER * \brief Spinlock static initializer * * This is used for static spinlock initialization, and has the same * properties as TMPI_THREAD_MUTEX_INITIALIZER has for mutexes. * This is only for inlining in the tMPI_Thread.h header file. Whether * it is 0, 1, or something else when unlocked depends on the platform. * Don't assume anything about it. It might even be a mutex when using the * fallback implementation! * * \hideinitializer */ #define TMPI_SPINLOCK_INITIALIZER { NULL } /* Since mutexes guarantee memory barriers this works fine */ /** Return value of an atomic integer * * Also implements proper memory barriers when necessary. * The actual implementation is system-dependent. * * \param a Atomic variable to read * \return Integer value of the atomic variable * * \hideinitializer */ TMPI_EXPORT int tMPI_Atomic_get(const tMPI_Atomic_t *a); /** Write value to an atomic integer * * Also implements proper memory barriers when necessary. * The actual implementation is system-dependent. * * \param a Atomic variable * \param i Integer to set the atomic variable to. * * \hideinitializer */ TMPI_EXPORT void tMPI_Atomic_set(tMPI_Atomic_t *a, int i); /** Return value of an atomic pointer * * Also implements proper memory barriers when necessary. * The actual implementation is system-dependent. * * \param a Atomic variable to read * \return Pointer value of the atomic variable * * \hideinitializer */ TMPI_EXPORT void* tMPI_Atomic_ptr_get(const tMPI_Atomic_ptr_t *a); /** Write value to an atomic pointer * * Also implements proper memory barriers when necessary. * The actual implementation is system-dependent. * * \param a Atomic variable * \param p Pointer value to set the atomic variable to. * * \hideinitializer */ TMPI_EXPORT void tMPI_Atomic_ptr_set(tMPI_Atomic_ptr_t *a, void *p); /** Add integer to atomic variable * * Also implements proper memory barriers when necessary. * The actual implementation is system-dependent. * * \param a atomic datatype to modify * \param i integer to increment with. Use i<0 to subtract atomically. * * \return The new value (after summation). */ TMPI_EXPORT int tMPI_Atomic_add_return(tMPI_Atomic_t *a, int i); #ifndef DOXYGEN #define TMPI_ATOMIC_HAVE_NATIVE_ADD_RETURN #endif /** Add to variable, return the old value. * * This operation is quite useful for synchronization counters. * By performing a fetchadd with N, a thread can e.g. reserve a chunk * with the next N iterations, and the return value is the index * of the first element to treat. * * Also implements proper memory barriers when necessary. * The actual implementation is system-dependent. * * \param a atomic datatype to modify * \param i integer to increment with. Use i<0 to subtract atomically. * * \return The value of the atomic variable before addition. */ TMPI_EXPORT int tMPI_Atomic_fetch_add(tMPI_Atomic_t *a, int i); #ifndef DOXYGEN #define TMPI_ATOMIC_HAVE_NATIVE_FETCH_ADD #endif /** Atomic compare-and-swap operation * * The \a old value is compared with the memory value in the atomic datatype. * If the are identical, the atomic type is swapped with the new value, * and otherwise left unchanged. * * This is *the* synchronization primitive: it has a consensus number of * infinity, and is available in some form on all modern CPU architectures. * In the words of Herlihy&Shavit (The art of multiprocessor programming), * it is the 'king of all wild things'. * * In practice, use it as follows: You can start by reading a value * (without locking anything), perform some calculations, and then * atomically try to update it in memory unless it has changed. If it has * changed you will get an error return code - reread the new value * an repeat the calculations in that case. * * \param a Atomic datatype ('memory' value) * \param old_val Integer value read from the atomic type at an earlier point * \param new_val New value to write to the atomic type if it currently is * identical to the old value. * * \return True (1) if the swap occurred: i.e. if the value in a was equal * to old_val. False (0) if the swap didn't occur and the value * was not equal to old_val. * * \note The exchange occured if the return value is identical to \a old. */ TMPI_EXPORT int tMPI_Atomic_cas(tMPI_Atomic_t *a, int old_val, int new_val); /** Atomic pointer compare-and-swap operation * * The \a old value is compared with the memory value in the atomic datatype. * If the are identical, the atomic type is swapped with the new value, * and otherwise left unchanged. * * This is essential for implementing wait-free lists and other data * structures. See 'tMPI_Atomic_cas()'. * * \param a Atomic datatype ('memory' value) * \param old_val Pointer value read from the atomic type at an earlier point * \param new_val New value to write to the atomic type if it currently is * identical to the old value. * * \return True (1) if the swap occurred: i.e. if the value in a was equal * to old_val. False (0) if the swap didn't occur and the value * was not equal to old_val. * * \note The exchange occured if the return value is identical to \a old. */ TMPI_EXPORT int tMPI_Atomic_ptr_cas(tMPI_Atomic_ptr_t * a, void *old_val, void *new_val); /** Atomic swap operation. Atomically swaps the data in the tMPI_Atomic_t operand with the value of b. Note: This has no good assembly counterparts on many architectures, so it might not be faster than a repreated CAS. \param a Pointer to atomic type \param b Value to swap \return the original value of a */ TMPI_EXPORT int tMPI_Atomic_swap(tMPI_Atomic_t *a, int b); /** Atomic swap pointer operation. Atomically swaps the pointer in the tMPI_Atomic_ptr_t operand with the value of b. Note: This has no good assembly counterparts on many architectures, so it might not be faster than a repreated CAS. \param a Pointer to atomic type \param b Value to swap \return the original value of a */ TMPI_EXPORT void *tMPI_Atomic_ptr_swap(tMPI_Atomic_ptr_t *a, void *b); #ifndef DOXYGEN #define TMPI_ATOMIC_HAVE_NATIVE_SWAP #endif /** Initialize spinlock * * In theory you can call this from multiple threads, but remember * that we don't check for errors. If the first thread proceeded to * lock the spinlock after initialization, the second will happily * overwrite the contents and unlock it without warning you. * * \param x Spinlock pointer. * * \hideinitializer */ TMPI_EXPORT void tMPI_Spinlock_init( tMPI_Spinlock_t *x); #ifndef DOXYGEN #define TMPI_ATOMIC_HAVE_NATIVE_SPINLOCK #endif /** Acquire spinlock * * This routine blocks until the spinlock is available, and * the locks it again before returning. * * \param x Spinlock pointer */ TMPI_EXPORT void tMPI_Spinlock_lock( tMPI_Spinlock_t *x); /** Attempt to acquire spinlock * * This routine acquires the spinlock if possible, but if * already locked it return an error code immediately. * * \param x Spinlock pointer * * \return 0 if the mutex was available so we could lock it, * otherwise a non-zero integer (1) if the lock is busy. */ TMPI_EXPORT int tMPI_Spinlock_trylock( tMPI_Spinlock_t *x); /** Release spinlock * * \param x Spinlock pointer * * Unlocks the spinlock, regardless if which thread locked it. */ TMPI_EXPORT void tMPI_Spinlock_unlock( tMPI_Spinlock_t *x); /** Check if spinlock is locked * * This routine returns immediately with the lock status. * * \param x Spinlock pointer * * \return 1 if the spinlock is locked, 0 otherwise. */ TMPI_EXPORT int tMPI_Spinlock_islocked( tMPI_Spinlock_t *x); /** Wait for a spinlock to become available * * This routine blocks until the spinlock is unlocked, * but in contrast to tMPI_Spinlock_lock() it returns without * trying to lock the spinlock. * * \param x Spinlock pointer */ TMPI_EXPORT void tMPI_Spinlock_wait(tMPI_Spinlock_t *x); #endif /* platform-specific checks */ /* now define all the atomics that are not avaible natively. These are done on the assumption that a native CAS does exist. */ #include "atomic/derived.h" /* this allows us to use the inline keyword without breaking support for some compilers that don't support it: */ #ifdef inline_defined_in_atomic #undef inline #endif #if !defined(TMPI_NO_ATOMICS) && !defined(TMPI_ATOMICS) /* Set it here to make sure the user code can check this without having to have a config.h */ /** Indicates that support for atomic operations is present. */ #define TMPI_ATOMICS #endif #ifdef __cplusplus } #endif #endif /* TMPI_ATOMIC_H_ */
hiperbolt9/MortenSchenkb
src/main/java/com/budwk/app/web/commons/ext/websocket/WkWsHandler.java
package com.budwk.app.web.commons.ext.websocket; import com.budwk.app.base.constant.RedisConstant; import com.budwk.app.sys.services.SysMsgService; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Strings; import org.nutz.lang.util.NutMap; import org.nutz.log.Log; import org.nutz.log.Logs; import org.nutz.plugins.mvc.websocket.handler.SimpleWsHandler; @IocBean public class WkWsHandler extends SimpleWsHandler { private static final Log log = Logs.get(); @Inject private SysMsgService sysMsgService; @Override public void join(NutMap req) { join(req.getString("room")); } @Override public void left(NutMap req) { left(req.getString("room")); } @Override public void join(String room) { if (!Strings.isBlank(room)) { room = RedisConstant.REDIS_KEY_WSROOM + room; log.debugf("session(id=%s) join room(name=%s)", session.getId(), room); roomProvider.join(room, session.getId()); sysMsgService.getMsg(room.split(":")[2]); } } @Override public void left(String room) { if (!Strings.isBlank(room)) { room = RedisConstant.REDIS_KEY_WSROOM + room; log.debugf("session(id=%s) left room(name=%s)", session.getId(), room); roomProvider.left(room, session.getId()); } } @Override public void depose() { //覆盖原生写法,因为room= loginname + httpSessionId 和聊天室的机制不一样,不覆盖的话功能会异常 } }
jiripetrlik/kie-wb-common
kie-wb-common-stunner/kie-wb-common-stunner-core/kie-wb-common-stunner-api/kie-wb-common-stunner-client-api/src/main/java/org/kie/workbench/common/stunner/core/client/api/SessionManager.java
<reponame>jiripetrlik/kie-wb-common<gh_stars>0 /* * Copyright 2017 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kie.workbench.common.stunner.core.client.api; import org.kie.workbench.common.stunner.core.client.session.ClientSession; import org.kie.workbench.common.stunner.core.client.session.ClientSessionFactory; import org.kie.workbench.common.stunner.core.diagram.Metadata; /** * A singleton instance for each application's client that handles the different Stunner's sessions on client side. * Four operations describe the lifecycle for the Stunner's client sessions: * <ul> * <li>When a session is opened, its canvas controls, listeners and other behaviours should be constructed, * registered and enabled, although each implementation can provide its own behaviours</li> * <li>When a session is destroyed, its canvas controls, listeners and other behaviours should be removed and * destroyed. The session will no longer be paused/resumed.</li> * <li>A session is paused when the client does not interact with any of the components that the * session aggregates. Implementations can do some memory cleans, if necessary.</li> * <li>A session is resumed when the client does interact again with any of the components that the paused * session aggregates. Implementations can activate again whatever previously disabled when pausing * here, if necessary.</li> * </ul> */ public interface SessionManager { /** * Returns the factory instance for the given session type.and targeted for the given Diagram type.. */ <S extends ClientSession> ClientSessionFactory<S> getSessionFactory(final Metadata metadata, final Class<S> sessionType); /** * Returns the current active session. */ <S extends ClientSession> S getCurrentSession(); /** * Opens the session <code>session</code>. */ <S extends ClientSession> void open(final S session); /** * Pause the current session. */ void pause(); /** * Resume the session <code>session</code> and pause the current one, if any. */ <S extends ClientSession> void resume(final S session); /** * Destroys the current active session (do not destroys this manager instance!). */ void destroy(); }
YiJiangFengYun/vulkan-graphics-examples
framework/graphics/graphics/pass/pass_ext_uniform_buffer.hpp
#ifndef VG_PASS_EXT_UNIFORM_BUFFER_HPP #define VG_PASS_EXT_UNIFORM_BUFFER_HPP namespace vg { } //vg #endif //VG_PASS_EXT_UNIFORM_BUFFER_HPP
lymr/fun-chat
fun-chat-server/src/main/scala/restapi/http/routes/support/CorsSupport.scala
package restapi.http.routes.support import akka.http.scaladsl.model.HttpMethods._ import akka.http.scaladsl.model.headers._ import akka.http.scaladsl.model.{HttpResponse, StatusCodes} import akka.http.scaladsl.server.Directives._ import akka.http.scaladsl.server.Route import com.typesafe.config.ConfigFactory import restapi.http.routes.support.AllowedOrigins._ import scala.collection.immutable.Seq private[http] trait CorsSupport { def AccessControlCheck(inner: Route): Route = { checkSameOrigin(HttpOriginRange.Default(allowedOrigins)) { preflightCorsCheck ~ inner } } private def preflightCorsCheck: Route = { options { complete { HttpResponse(StatusCodes.OK).withHeaders( `Access-Control-Allow-Origin`(HttpOriginRange.Default(allowedOrigins)), `Access-Control-Allow-Credentials`(allow = true), `Access-Control-Allow-Methods`(GET, POST, PATCH, DELETE), `Access-Control-Allow-Headers`("Authorization", "Content-Type", "X-Requested-With")) } } } } object AllowedOrigins { private val httpPort: Int = ConfigFactory.load().getConfig("http").getInt("port") private val HTTP_ORIGIN = HttpOrigin("http", Host("fun-chat", httpPort)) val allowedOrigins = Seq(HTTP_ORIGIN) }
factset/enterprise-sdk
code/typescript/ETFProfileandPrices/v2/src/model/InlineResponse20011Data.js
<filename>code/typescript/ETFProfileandPrices/v2/src/model/InlineResponse20011Data.js /** * Prime Developer Trial * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. * */ import ApiClient from '../ApiClient'; /** * The InlineResponse20011Data model module. * @module model/InlineResponse20011Data * @version 0.10.0 */ class InlineResponse20011Data { /** * Constructs a new <code>InlineResponse20011Data</code>. * Portfolio statistics. * @alias module:model/InlineResponse20011Data */ constructor() { InlineResponse20011Data.initialize(this); } /** * Initializes the fields of this object. * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). * Only for internal use. */ static initialize(obj) { } /** * Constructs a <code>InlineResponse20011Data</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/InlineResponse20011Data} obj Optional instance to populate. * @return {module:model/InlineResponse20011Data} The populated <code>InlineResponse20011Data</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new InlineResponse20011Data(); if (data.hasOwnProperty('asOfDate')) { obj['asOfDate'] = ApiClient.convertToType(data['asOfDate'], 'Date'); } if (data.hasOwnProperty('numberHoldings')) { obj['numberHoldings'] = ApiClient.convertToType(data['numberHoldings'], 'Number'); } if (data.hasOwnProperty('concentration')) { obj['concentration'] = ApiClient.convertToType(data['concentration'], 'String'); } if (data.hasOwnProperty('dividendYield')) { obj['dividendYield'] = ApiClient.convertToType(data['dividendYield'], 'Number'); } if (data.hasOwnProperty('priceEarningsRatio')) { obj['priceEarningsRatio'] = ApiClient.convertToType(data['priceEarningsRatio'], 'Number'); } if (data.hasOwnProperty('priceBookRatio')) { obj['priceBookRatio'] = ApiClient.convertToType(data['priceBookRatio'], 'Number'); } if (data.hasOwnProperty('marketCapitalization')) { obj['marketCapitalization'] = ApiClient.convertToType(data['marketCapitalization'], 'Number'); } if (data.hasOwnProperty('timeToMaturity')) { obj['timeToMaturity'] = ApiClient.convertToType(data['timeToMaturity'], 'Number'); } if (data.hasOwnProperty('creditRating')) { obj['creditRating'] = ApiClient.convertToType(data['creditRating'], 'String'); } } return obj; } } /** * Date the analytics data was published. Available for the regions: US, Europe, and Canada. * @member {Date} asOfDate */ InlineResponse20011Data.prototype['asOfDate'] = undefined; /** * A measure of portfolio diversification, calculated by summing the squared weights of each fund constituent. Low concentration implies high diversification, and vice versa. Outputs are Low, Medium or High. Available for regions: US. * @member {Number} numberHoldings */ InlineResponse20011Data.prototype['numberHoldings'] = undefined; /** * A measure of portfolio diversification, calculated by summing the squared weights of each fund constituent. Low concentration implies high diversification, and vice versa. Possible values are Low, Medium or High. Available for regions: US. * @member {String} concentration */ InlineResponse20011Data.prototype['concentration'] = undefined; /** * The annualized weighted average of the current dividend yield of the portfolio's holdings, gross of fees. Available for the regions: US. * @member {Number} dividendYield */ InlineResponse20011Data.prototype['dividendYield'] = undefined; /** * Weighted average ratio of prices of a fund’s stocks values to their trailing earnings of underlying stocks. Aggregate prices are scaled by the sum of individual earnings, including negative earnings. Available for the regions: US. * @member {Number} priceEarningsRatio */ InlineResponse20011Data.prototype['priceEarningsRatio'] = undefined; /** * Weighted average ratio of prices of a fund’s stocks to the book value of underlying stocks. Aggregate prices are scaled by the sum of individual book values. Available for the regions: US. * @member {Number} priceBookRatio */ InlineResponse20011Data.prototype['priceBookRatio'] = undefined; /** * The weighted average market capitalization of the stocks in the fund's portfolio (USD). Available for regions: US. * @member {Number} marketCapitalization */ InlineResponse20011Data.prototype['marketCapitalization'] = undefined; /** * The weighted average of remaining time until maturity for all bonds in the portfolio, measured in (possibly fractional) years. Available for the regions: US. * @member {Number} timeToMaturity */ InlineResponse20011Data.prototype['timeToMaturity'] = undefined; /** * Average credit rating for the portfolio, determined by mapping ratings from credit agencies (Fitch, Moody's and Standard & Poor's) to numerical likelihood of default for each bond in the portfolio and then finding the weighted average default probability, then mapping back to an agency credit rating. Accounts for the nonlinear probability of default when aggregating agency ratings. FactSet has developed a numeric equivalent system that allows math functions such as averaging and comparisons across sources (using greater than, equal to, or less than operators), to facilitate easier evaluation. Available for the regions: US. * @member {String} creditRating */ InlineResponse20011Data.prototype['creditRating'] = undefined; export default InlineResponse20011Data;
CarlosIribarren/Ejemplos-Examples
Java/Java SE/7/11 Excepciones/Main.java
<filename>Java/Java SE/7/11 Excepciones/Main.java import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub // LEER DEL TECLADO BufferedReader lectura = new BufferedReader(new InputStreamReader(System.in)); String dato=""; System.out.println("Escribe tu nombre : "); try { dato = lectura.readLine(); if (dato.isEmpty()) { //lanzar la excepcion //creando una excepcion de tipo x throw new ExcepcionCadenaVacia(); } } catch (IOException e) { e.printStackTrace(); //tratar la excepcion que hemos lanzado } catch (ExcepcionCadenaVacia e) { System.out.println(e.getMessage()); } } }
starksm64/cdi-tck2
impl/src/main/java/org/jboss/cdi/tck/tests/implementation/producer/method/broken/parameterizedTypeWithWildcard/ParametrizedTypeWithWildcard02Test.java
<gh_stars>1-10 package org.jboss.cdi.tck.tests.implementation.producer.method.broken.parameterizedTypeWithWildcard; import static org.jboss.cdi.tck.cdi.Sections.LEGAL_BEAN_TYPES; import static org.jboss.cdi.tck.cdi.Sections.PRODUCER_METHOD; import jakarta.enterprise.inject.spi.DefinitionException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.container.test.api.ShouldThrowException; import org.jboss.cdi.tck.AbstractTest; import org.jboss.cdi.tck.shrinkwrap.WebArchiveBuilder; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.jboss.test.audit.annotations.SpecAssertion; import org.jboss.test.audit.annotations.SpecAssertions; import org.jboss.test.audit.annotations.SpecVersion; import org.testng.annotations.Test; @SpecVersion(spec = "cdi", version = "2.0") public class ParametrizedTypeWithWildcard02Test extends AbstractTest { @ShouldThrowException(DefinitionException.class) @Deployment public static WebArchive createTestArchive() { return new WebArchiveBuilder().withTestClass(ParametrizedTypeWithWildcard02Test.class) .withClasses(Spiderman.class, SpidermanProducer.class, FunnelWeaver.class).build(); } @Test @SpecAssertions({ @SpecAssertion(section = PRODUCER_METHOD, id = "ha"), @SpecAssertion(section = LEGAL_BEAN_TYPES, id = "lb") }) public void testParameterizedReturnTypeWithDoubleWildcard() throws Exception { } }
cclauss/VTK
Common/DataModel/Testing/Cxx/TestHyperTreeGridBitmask.cxx
/*========================================================================= Program: Visualization Toolkit Module: TestHyperTreeGridBitmask.cxx Copyright (c) <NAME>, <NAME>, <NAME> All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #include "vtkBitArray.h" #include "vtkHyperTree.h" #include "vtkHyperTreeGrid.h" #include "vtkHyperTreeGridNonOrientedCursor.h" #include "vtkUniformHyperTreeGrid.h" #include <iostream> #include <string> #include <vector> // exist in ElderChildIndex test void SubdivideAndInitMaskChildrenTrue(vtkHyperTreeGridNonOrientedCursor* cursor); void CheckTestStatusHTG(int rc, const std::string& TestName); //------------------------------------------------------------------------------ bool compareMask(vtkBitArray* bm, const std::vector<bool>& ref_bm) { const size_t nbElementsBm = bm->GetNumberOfValues(); const size_t nbElementsRef = ref_bm.size(); if (nbElementsRef != nbElementsBm) { std::cout << "Not same amount of bits in expected and actual mask: [REF]" << nbElementsRef << " vs [Actual]" << nbElementsBm << std::endl; return false; } for (size_t i = 0; i < nbElementsRef; ++i) { const bool ref_val = ref_bm.at(i); const vtkIdType vtkIdx = static_cast<vtkIdType>(i); const bool act_val = bm->GetValue(vtkIdx) == 0 ? false : true; if (ref_val != act_val) { std::cout << "Mask value different for idx " << i << ": " << ref_val << "[REF] vs " << act_val << "[Actual]" << std::endl; return false; } } return true; } //------------------------------------------------------------------------------ void displayMask(const std::string& msg, vtkHyperTreeGrid* htg) { if (!msg.empty()) { std::cout << msg << " "; std::cout.flush(); } auto* bm = htg->GetMask(); if (!bm) { std::cout << "No Mask" << std::endl; std::cout.flush(); return; } std::cout << "Mask: "; std::cout.flush(); const vtkIdType nbElements = bm->GetNumberOfValues(); for (vtkIdType i = 0; i < nbElements; ++i) { std::cout << bm->GetValue(i); } std::cout << std::endl; std::cout.flush(); } //------------------------------------------------------------------------------ void initUniformHyperTreeOneRootCell(vtkUniformHyperTreeGrid* uhtg) { std::cout << "Initializing Uniform Grid\n"; std::cout.flush(); uhtg->SetBranchFactor(2); uhtg->SetGridScale(1.1); uhtg->SetOrigin(0., 0., 0.); uhtg->SetDimensions(3, 3, 2); vtkNew<vtkBitArray> mask; uhtg->SetMask(mask); vtkNew<vtkHyperTreeGridNonOrientedCursor> cursor; const unsigned int treeId = 1; const vtkIdType nbElementsInHTG = uhtg->GetNumberOfVertices(); uhtg->InitializeNonOrientedCursor(cursor, treeId, true); cursor->SetGlobalIndexStart(nbElementsInHTG); cursor->SetMask(false); } //------------------------------------------------------------------------------ int TestUniformHyperTreeOneRootCell() { vtkNew<vtkUniformHyperTreeGrid> uhtg; initUniformHyperTreeOneRootCell(uhtg); auto* bm = uhtg->GetMask(); // 0 return !compareMask(bm, { false }); } void subdivide(vtkHyperTreeGridNonOrientedCursor* cursor, const std::vector<char>& sub) { for (size_t i = 0; i < sub.size(); ++i) { const char subIdx = sub[i]; if (subIdx == -1) { cursor->ToParent(); continue; } if (cursor->IsLeaf()) { SubdivideAndInitMaskChildrenTrue(cursor); } cursor->ToChild(subIdx); cursor->SetMask(false); } } //------------------------------------------------------------------------------ int TestUniformHyperTreeOneRootCellSubdivided() { vtkNew<vtkUniformHyperTreeGrid> uhtg; initUniformHyperTreeOneRootCell(uhtg); vtkHyperTreeGrid::vtkHyperTreeGridIterator it; uhtg->InitializeTreeIterator(it); vtkIdType treeId = -1; it.GetNextTree(treeId); if (treeId == -1) { std::cout << "Impossible to retrieve either of the trees" << std::endl; std::cout.flush(); return 1; } vtkNew<vtkHyperTreeGridNonOrientedCursor> cursor; uhtg->InitializeNonOrientedCursor(cursor, treeId); cursor->SetMask(false); subdivide(cursor, { 7, 2, -1, -1, 2, 7 }); // 0 11011110 11011111 11111110 auto* bm = uhtg->GetMask(); displayMask("OneRootCellSubdivided", uhtg); // 0 11011110 11011111 11111110 std::vector<bool> exp_bm(25, true); for (unsigned int i : { 0, 3, 8, 11, 24 }) { exp_bm[i] = false; } return !compareMask(bm, exp_bm); } //------------------------------------------------------------------------------ void initUniformHyperTreeSeveralRootCells( vtkUniformHyperTreeGrid* uhtg, const std::vector<std::vector<char>>& sub = {}) { std::cout << "Init Uniform Grid several root cells\n"; std::cout.flush(); uhtg->SetBranchFactor(2); uhtg->SetGridScale(1.1); uhtg->SetOrigin(0., 0., 0.); uhtg->SetDimensions(3, 4, 2); vtkNew<vtkBitArray> mask; uhtg->SetMask(mask); vtkNew<vtkHyperTreeGridNonOrientedCursor> cursor; const std::vector<unsigned int> treeIds = { 3, 1, 5, 4 }; unsigned int treeIndex = 0; for (unsigned int treeId : treeIds) { const vtkIdType nbElementsInHTG = uhtg->GetNumberOfVertices(); uhtg->InitializeNonOrientedCursor(cursor, treeId, true); cursor->SetGlobalIndexStart(nbElementsInHTG); // std::cout << "GlobalIndexStart of HT " << treeId << " : " << nbElementsInHTG << std::endl; cursor->SetMask(false); if (!sub.empty()) { subdivide(cursor, sub.at(treeIndex)); } // displayMask("Inserted 1 root cell (tree)", uhtg); ++treeIndex; } displayMask("Inserted 4 root cells (trees)", uhtg); } //------------------------------------------------------------------------------ int TestUniformHyperTreeSeveralRootCells() { std::cout << "Test Uniform Grid several root cells\n"; std::cout.flush(); vtkNew<vtkUniformHyperTreeGrid> uhtg; initUniformHyperTreeSeveralRootCells(uhtg); auto* bm = uhtg->GetMask(); // 0 0 0 0 const std::vector<bool> exp_bm(4, false); return !compareMask(bm, exp_bm); } //------------------------------------------------------------------------------ int TestUniformHyperTreeSeveralRootCellsSubdivided() { std::cout << "Test Uniform Grid several root cells subdivided\n"; std::cout.flush(); vtkNew<vtkUniformHyperTreeGrid> uhtg; initUniformHyperTreeSeveralRootCells(uhtg, { { 5, 0, -1, 2 }, { 7, 7, 7 }, { 4, -1, 6 }, { 4 } }); auto* bm = uhtg->GetMask(); //(HTa - 3) 0 11111011 01011111 //(HTb - 1) 0 11111110 11111110 11111110 //(HTc - 5) 0 11110101 //(HTd - 4) 0 11101111 // 0 6 9 10 17 25 33 41 42 4749 51 56 // 0 11111011 01011111 0 11111110 11111110 11111110 0 11110101 0 11110111 std::vector<bool> exp_bm(60, true); for (unsigned int i : { 0, 6, 9, 11, 17, 25, 33, 41, 42, 47, 49, 51, 56 }) { exp_bm[i] = false; } displayMask("TestUniformHyperTreeSeveralRootCellsSubdivided", uhtg); return !compareMask(bm, exp_bm); } //------------------------------------------------------------------------------ int TestUniformHyperTreeEmpty() { std::cout << "Initializing Empty Uniform Grid\n"; std::cout.flush(); vtkNew<vtkUniformHyperTreeGrid> uhtg; uhtg->SetBranchFactor(2); uhtg->SetGridScale(1.1); uhtg->SetOrigin(0., 0., 0.); uhtg->SetDimensions(3, 3, 2); vtkNew<vtkBitArray> mask; uhtg->SetMask(mask); displayMask("Empty HTG", uhtg); auto* bm = uhtg->GetMask(); return !(bm->GetNumberOfValues() == 0); } //------------------------------------------------------------------------------ int TestHyperTreeGridBitmask(int, char*[]) { std::cout << "Starting tests" << std::endl; std::cout.flush(); int rc = 0; rc += TestUniformHyperTreeEmpty(); CheckTestStatusHTG(rc, "TestUniformHyperTreeEmpty"); rc += TestUniformHyperTreeOneRootCell(); CheckTestStatusHTG(rc, "TestUniformHyperTreeOneRootCell"); rc += TestUniformHyperTreeOneRootCellSubdivided(); CheckTestStatusHTG(rc, "TestUniformHyperTreeOneRootCellSubdivided"); rc += TestUniformHyperTreeSeveralRootCells(); CheckTestStatusHTG(rc, "TestUniformHyperTreeSeveralRootCells"); rc += TestUniformHyperTreeSeveralRootCellsSubdivided(); CheckTestStatusHTG(rc, "TestUniformHyperTreeSeveralRootCellsSubdivided"); return (rc); }
jarocho105/pre2
erp_desktop_all/src_facturacion/com/bydan/erp/facturacion/presentation/swing/jinternalframes/PedidoExporJInternalFrame.java
/* *AVISO LEGAL © Copyright *Este programa esta protegido por la ley de derechos de autor. *La reproduccion o distribucion ilicita de este programa o de cualquiera de *sus partes esta penado por la ley con severas sanciones civiles y penales, *y seran objeto de todas las sanciones legales que correspondan. *Su contenido no puede copiarse para fines comerciales o de otras, *ni puede mostrarse, incluso en una version modificada, en otros sitios Web. Solo esta permitido colocar hipervinculos al sitio web. */ package com.bydan.erp.facturacion.presentation.swing.jinternalframes; import com.bydan.erp.seguridad.presentation.swing.jinternalframes.*; import com.bydan.erp.contabilidad.presentation.swing.jinternalframes.*; import com.bydan.erp.nomina.presentation.swing.jinternalframes.*; import com.bydan.erp.inventario.presentation.swing.jinternalframes.*; import com.bydan.erp.cartera.presentation.swing.jinternalframes.*; import com.bydan.erp.comisiones.presentation.swing.jinternalframes.*; import com.bydan.erp.facturacion.presentation.web.jsf.sessionbean.*;//; import com.bydan.erp.facturacion.presentation.swing.jinternalframes.*; import com.bydan.erp.facturacion.presentation.swing.jinternalframes.auxiliar.*; import com.bydan.erp.seguridad.presentation.web.jsf.sessionbean.*; import com.bydan.erp.contabilidad.presentation.web.jsf.sessionbean.*; import com.bydan.erp.nomina.presentation.web.jsf.sessionbean.*; import com.bydan.erp.inventario.presentation.web.jsf.sessionbean.*; import com.bydan.erp.cartera.presentation.web.jsf.sessionbean.*; import com.bydan.erp.comisiones.presentation.web.jsf.sessionbean.*; import com.bydan.erp.seguridad.business.entity.*; import com.bydan.erp.contabilidad.business.entity.*; import com.bydan.erp.nomina.business.entity.*; import com.bydan.erp.inventario.business.entity.*; import com.bydan.erp.cartera.business.entity.*; import com.bydan.erp.comisiones.business.entity.*; //import com.bydan.erp.facturacion.presentation.report.source.*; import com.bydan.framework.erp.business.entity.Reporte; import com.bydan.erp.seguridad.business.entity.Modulo; import com.bydan.erp.seguridad.business.entity.Opcion; import com.bydan.erp.seguridad.business.entity.Usuario; import com.bydan.erp.seguridad.business.entity.ResumenUsuario; import com.bydan.erp.seguridad.business.entity.ParametroGeneralSg; import com.bydan.erp.seguridad.business.entity.ParametroGeneralUsuario; import com.bydan.erp.seguridad.util.SistemaParameterReturnGeneral; import com.bydan.erp.facturacion.business.entity.*; import com.bydan.erp.facturacion.util.PedidoExporConstantesFunciones; import com.bydan.erp.facturacion.business.logic.*; import com.bydan.framework.erp.business.entity.DatoGeneral; import com.bydan.framework.erp.business.entity.OrderBy; import com.bydan.framework.erp.business.entity.Mensajes; import com.bydan.framework.erp.business.entity.Classe; import com.bydan.framework.erp.business.logic.*; import com.bydan.framework.erp.presentation.desktop.swing.DateConverter; import com.bydan.framework.erp.presentation.desktop.swing.DateConverterFromDate; import com.bydan.framework.erp.presentation.desktop.swing.FuncionesSwing; import com.bydan.framework.erp.presentation.desktop.swing.JInternalFrameBase; import com.bydan.framework.erp.presentation.desktop.swing.*; import com.bydan.framework.erp.util.*; import java.util.Date; import java.util.List; import java.util.ArrayList; import java.io.File; import java.util.HashMap; import java.util.Map; import java.io.PrintWriter; import java.sql.SQLException; import java.sql.*; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRRuntimeException; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.util.JRLoader; import net.sf.jasperreports.engine.export.JRHtmlExporter; import net.sf.jasperreports.j2ee.servlets.BaseHttpServlet; import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.data.JRBeanArrayDataSource; import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; import javax.swing.*; import java.awt.*; import javax.swing.border.EtchedBorder; import javax.swing.border.Border; import javax.swing.border.TitledBorder; import java.awt.event.*; import javax.swing.event.*; import javax.swing.GroupLayout.Alignment; import javax.swing.table.TableColumn; import com.toedter.calendar.JDateChooser; @SuppressWarnings("unused") public class PedidoExporJInternalFrame extends PedidoExporBeanSwingJInternalFrameAdditional { private static final long serialVersionUID = 1L; //protected Usuario usuarioActual=null; public JToolBar jTtoolBarPedidoExpor; protected JMenuBar jmenuBarPedidoExpor; protected JMenu jmenuPedidoExpor; protected JMenu jmenuDatosPedidoExpor; protected JMenu jmenuArchivoPedidoExpor; protected JMenu jmenuAccionesPedidoExpor; protected JPanel jContentPane = null; protected JPanel jPanelBusquedasParametrosPedidoExpor = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); protected GridBagLayout gridaBagLayoutPedidoExpor; protected GridBagConstraints gridBagConstraintsPedidoExpor; //protected JInternalFrameBase jInternalFrameParent; public PedidoExporDetalleFormJInternalFrame jInternalFrameDetalleFormPedidoExpor; protected ReporteDinamicoJInternalFrame jInternalFrameReporteDinamicoPedidoExpor; protected ImportacionJInternalFrame jInternalFrameImportacionPedidoExpor; //VENTANAS PARA ACTUALIZAR Y BUSCAR FK protected EmpresaBeanSwingJInternalFrame empresaBeanSwingJInternalFrame; public String sFinalQueryGeneral_empresa=""; protected SucursalBeanSwingJInternalFrame sucursalBeanSwingJInternalFrame; public String sFinalQueryGeneral_sucursal=""; protected EjercicioBeanSwingJInternalFrame ejercicioBeanSwingJInternalFrame; public String sFinalQueryGeneral_ejercicio=""; protected PeriodoBeanSwingJInternalFrame periodoBeanSwingJInternalFrame; public String sFinalQueryGeneral_periodo=""; protected AnioBeanSwingJInternalFrame anioBeanSwingJInternalFrame; public String sFinalQueryGeneral_anio=""; protected MesBeanSwingJInternalFrame mesBeanSwingJInternalFrame; public String sFinalQueryGeneral_mes=""; protected UsuarioBeanSwingJInternalFrame usuarioBeanSwingJInternalFrame; public String sFinalQueryGeneral_usuario=""; protected MonedaBeanSwingJInternalFrame monedaBeanSwingJInternalFrame; public String sFinalQueryGeneral_moneda=""; protected EmpleadoBeanSwingJInternalFrame empleadoBeanSwingJInternalFrame; public String sFinalQueryGeneral_empleado=""; protected TipoPrecioBeanSwingJInternalFrame tipoprecioBeanSwingJInternalFrame; public String sFinalQueryGeneral_tipoprecio=""; protected FormatoBeanSwingJInternalFrame formatoBeanSwingJInternalFrame; public String sFinalQueryGeneral_formato=""; protected ClienteBeanSwingJInternalFrame clienteBeanSwingJInternalFrame; public String sFinalQueryGeneral_cliente=""; protected PaisBeanSwingJInternalFrame paisBeanSwingJInternalFrame; public String sFinalQueryGeneral_pais=""; protected TransporteBeanSwingJInternalFrame transporteBeanSwingJInternalFrame; public String sFinalQueryGeneral_transporte=""; protected VendedorBeanSwingJInternalFrame vendedorBeanSwingJInternalFrame; public String sFinalQueryGeneral_vendedor=""; protected SubClienteBeanSwingJInternalFrame subclienteBeanSwingJInternalFrame; public String sFinalQueryGeneral_subcliente=""; protected ConsignatarioBeanSwingJInternalFrame consignatarioBeanSwingJInternalFrame; public String sFinalQueryGeneral_consignatario=""; protected ConsultorBeanSwingJInternalFrame consultorBeanSwingJInternalFrame; public String sFinalQueryGeneral_consultor=""; protected EstadoPedidoBeanSwingJInternalFrame estadopedidoexporBeanSwingJInternalFrame; public String sFinalQueryGeneral_estadopedidoexpor=""; protected TipoCambioBeanSwingJInternalFrame tipocambioBeanSwingJInternalFrame; public String sFinalQueryGeneral_tipocambio=""; protected CentroCostoBeanSwingJInternalFrame centrocostoBeanSwingJInternalFrame; public String sFinalQueryGeneral_centrocosto=""; protected ResponsableBeanSwingJInternalFrame responsableBeanSwingJInternalFrame; public String sFinalQueryGeneral_responsable=""; protected TransportistaBeanSwingJInternalFrame transportistaBeanSwingJInternalFrame; public String sFinalQueryGeneral_transportista=""; public PedidoExporSessionBean pedidoexporSessionBean; public EmpresaSessionBean empresaSessionBean; public SucursalSessionBean sucursalSessionBean; public EjercicioSessionBean ejercicioSessionBean; public PeriodoSessionBean periodoSessionBean; public AnioSessionBean anioSessionBean; public MesSessionBean mesSessionBean; public UsuarioSessionBean usuarioSessionBean; public MonedaSessionBean monedaSessionBean; public EmpleadoSessionBean empleadoSessionBean; public TipoPrecioSessionBean tipoprecioSessionBean; public FormatoSessionBean formatoSessionBean; public ClienteSessionBean clienteSessionBean; public PaisSessionBean paisSessionBean; public TransporteSessionBean transporteSessionBean; public VendedorSessionBean vendedorSessionBean; public SubClienteSessionBean subclienteSessionBean; public ConsignatarioSessionBean consignatarioSessionBean; public ConsultorSessionBean consultorSessionBean; public EstadoPedidoSessionBean estadopedidoexporSessionBean; public TipoCambioSessionBean tipocambioSessionBean; public CentroCostoSessionBean centrocostoSessionBean; public ResponsableSessionBean responsableSessionBean; public TransportistaSessionBean transportistaSessionBean; //protected JDesktopPane jDesktopPane; public List<PedidoExpor> pedidoexpors; public List<PedidoExpor> pedidoexporsEliminados; public List<PedidoExpor> pedidoexporsAux; protected OrderByJInternalFrame jInternalFrameOrderByPedidoExpor; protected JButton jButtonAbrirOrderByPedidoExpor; //protected JPanel jPanelOrderByPedidoExpor; //public JScrollPane jScrollPanelOrderByPedidoExpor; //protected JButton jButtonCerrarOrderByPedidoExpor; public ArrayList<OrderBy> arrOrderBy= new ArrayList<OrderBy>(); public PedidoExporLogic pedidoexporLogic; public JScrollPane jScrollPanelDatosPedidoExpor; public JScrollPane jScrollPanelDatosEdicionPedidoExpor; public JScrollPane jScrollPanelDatosGeneralPedidoExpor; //public JScrollPane jScrollPanelDatosPedidoExporOrderBy; //public JScrollPane jScrollPanelReporteDinamicoPedidoExpor; //public JScrollPane jScrollPanelImportacionPedidoExpor; protected JPanel jPanelAccionesPedidoExpor; protected JPanel jPanelPaginacionPedidoExpor; protected JPanel jPanelParametrosReportesPedidoExpor; protected JPanel jPanelParametrosReportesAccionesPedidoExpor; protected JPanel jPanelCamposFintotalPedidoExpor; protected Integer iXPanelCamposFintotalPedidoExpor=0; protected Integer iYPanelCamposFintotalPedidoExpor=0;; protected JPanel jPanelParametrosAuxiliar1PedidoExpor; protected JPanel jPanelParametrosAuxiliar2PedidoExpor; protected JPanel jPanelParametrosAuxiliar3PedidoExpor; protected JPanel jPanelParametrosAuxiliar4PedidoExpor; //protected JPanel jPanelParametrosAuxiliar5PedidoExpor; //protected JPanel jPanelReporteDinamicoPedidoExpor; //protected JPanel jPanelImportacionPedidoExpor; public JTable jTableDatosPedidoExpor; //public JTable jTableDatosPedidoExporOrderBy; //ELEMENTOS TABLAS PARAMETOS //ELEMENTOS TABLAS PARAMETOS_FIN protected JButton jButtonNuevoPedidoExpor; protected JButton jButtonDuplicarPedidoExpor; protected JButton jButtonCopiarPedidoExpor; protected JButton jButtonVerFormPedidoExpor; protected JButton jButtonNuevoRelacionesPedidoExpor; protected JButton jButtonModificarPedidoExpor; protected JButton jButtonGuardarCambiosTablaPedidoExpor; protected JButton jButtonCerrarPedidoExpor; protected JButton jButtonRecargarInformacionPedidoExpor; protected JButton jButtonProcesarInformacionPedidoExpor; protected JButton jButtonAnterioresPedidoExpor; protected JButton jButtonSiguientesPedidoExpor; protected JButton jButtonNuevoGuardarCambiosPedidoExpor; //protected JButton jButtonGenerarReporteDinamicoPedidoExpor; //protected JButton jButtonCerrarReporteDinamicoPedidoExpor; //protected JButton jButtonGenerarExcelReporteDinamicoPedidoExpor; //protected JButton jButtonAbrirImportacionPedidoExpor; //protected JButton jButtonGenerarImportacionPedidoExpor; //protected JButton jButtonCerrarImportacionPedidoExpor; //protected JFileChooser jFileChooserImportacionPedidoExpor; //protected File fileImportacionPedidoExpor; //TOOLBAR protected JButton jButtonNuevoToolBarPedidoExpor; protected JButton jButtonDuplicarToolBarPedidoExpor; protected JButton jButtonNuevoRelacionesToolBarPedidoExpor; public JButton jButtonGuardarCambiosToolBarPedidoExpor; protected JButton jButtonCopiarToolBarPedidoExpor; protected JButton jButtonVerFormToolBarPedidoExpor; public JButton jButtonGuardarCambiosTablaToolBarPedidoExpor; protected JButton jButtonMostrarOcultarTablaToolBarPedidoExpor; protected JButton jButtonCerrarToolBarPedidoExpor; protected JButton jButtonRecargarInformacionToolBarPedidoExpor; protected JButton jButtonProcesarInformacionToolBarPedidoExpor; protected JButton jButtonAnterioresToolBarPedidoExpor; protected JButton jButtonSiguientesToolBarPedidoExpor; protected JButton jButtonNuevoGuardarCambiosToolBarPedidoExpor; protected JButton jButtonAbrirOrderByToolBarPedidoExpor; //TOOLBAR //MENU protected JMenuItem jMenuItemNuevoPedidoExpor; protected JMenuItem jMenuItemDuplicarPedidoExpor; protected JMenuItem jMenuItemNuevoRelacionesPedidoExpor; protected JMenuItem jMenuItemGuardarCambiosPedidoExpor; protected JMenuItem jMenuItemCopiarPedidoExpor; protected JMenuItem jMenuItemVerFormPedidoExpor; protected JMenuItem jMenuItemGuardarCambiosTablaPedidoExpor; protected JMenuItem jMenuItemCerrarPedidoExpor; protected JMenuItem jMenuItemDetalleCerrarPedidoExpor; protected JMenuItem jMenuItemDetalleAbrirOrderByPedidoExpor; protected JMenuItem jMenuItemDetalleMostarOcultarPedidoExpor; protected JMenuItem jMenuItemRecargarInformacionPedidoExpor; protected JMenuItem jMenuItemProcesarInformacionPedidoExpor; protected JMenuItem jMenuItemAnterioresPedidoExpor; protected JMenuItem jMenuItemSiguientesPedidoExpor; protected JMenuItem jMenuItemNuevoGuardarCambiosPedidoExpor; protected JMenuItem jMenuItemAbrirOrderByPedidoExpor; protected JMenuItem jMenuItemMostrarOcultarPedidoExpor; //MENU protected JLabel jLabelAccionesPedidoExpor; protected JCheckBox jCheckBoxSeleccionarTodosPedidoExpor; protected JCheckBox jCheckBoxSeleccionadosPedidoExpor; protected JCheckBox jCheckBoxConAltoMaximoTablaPedidoExpor; protected JCheckBox jCheckBoxConGraficoReportePedidoExpor; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposArchivosReportesPedidoExpor; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposReportesPedidoExpor; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxTiposArchivosReportesDinamicoPedidoExpor; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxTiposReportesDinamicoPedidoExpor; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposGraficosReportesPedidoExpor; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposPaginacionPedidoExpor; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposRelacionesPedidoExpor; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposAccionesPedidoExpor; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposSeleccionarPedidoExpor; protected JTextField jTextFieldValorCampoGeneralPedidoExpor; //<NAME> //@SuppressWarnings("rawtypes") //public JLabel jLabelColumnasSelectReportePedidoExpor; //public JList<Reporte> jListColumnasSelectReportePedidoExpor; //public JScrollPane jScrollColumnasSelectReportePedidoExpor; //public JLabel jLabelRelacionesSelectReportePedidoExpor; //public JList<Reporte> jListRelacionesSelectReportePedidoExpor; //public JScrollPane jScrollRelacionesSelectReportePedidoExpor; //public JLabel jLabelConGraficoDinamicoPedidoExpor; //protected JCheckBox jCheckBoxConGraficoDinamicoPedidoExpor; //public JLabel jLabelGenerarExcelReporteDinamicoPedidoExpor; //public JLabel jLabelTiposArchivoReporteDinamicoPedidoExpor; //public JLabel jLabelArchivoImportacionPedidoExpor; //public JLabel jLabelPathArchivoImportacionPedidoExpor; //protected JTextField jTextFieldPathArchivoImportacionPedidoExpor; //public JLabel jLabelColumnaCategoriaGraficoPedidoExpor; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxColumnaCategoriaGraficoPedidoExpor; //public JLabel jLabelColumnaCategoriaValorPedidoExpor; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxColumnaCategoriaValorPedidoExpor; //public JLabel jLabelColumnasValoresGraficoPedidoExpor; //public JList<Reporte> jListColumnasValoresGraficoPedidoExpor; //public JScrollPane jScrollColumnasValoresGraficoPedidoExpor; //public JLabel jLabelTiposGraficosReportesDinamicoPedidoExpor; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxTiposGraficosReportesDinamicoPedidoExpor; protected Boolean conMaximoRelaciones=true; protected Boolean conFuncionalidadRelaciones=true; public Boolean conCargarMinimo=false; public Boolean cargarRelaciones=false; public Boolean conMostrarAccionesCampo=false; public Boolean permiteRecargarForm=false;//PARA NUEVO PREPARAR Y MANEJO DE EVENTOS, EVITAR QUE SE EJECUTE AL CARGAR VENTANA O LOAD public Boolean conCargarFormDetalle=false; //BYDAN_BUSQUEDAS public JTabbedPane jTabbedPaneBusquedasPedidoExpor; public JPanel jPanelFK_IdCentroCostoPedidoExpor; public JButton jButtonFK_IdCentroCostoPedidoExpor; public JPanel jPanelFK_IdClientePedidoExpor; public JButton jButtonFK_IdClientePedidoExpor; public JPanel jPanelFK_IdConsignatarioPedidoExpor; public JButton jButtonFK_IdConsignatarioPedidoExpor; public JPanel jPanelFK_IdConsultorPedidoExpor; public JButton jButtonFK_IdConsultorPedidoExpor; public JPanel jPanelFK_IdEmpleadoPedidoExpor; public JButton jButtonFK_IdEmpleadoPedidoExpor; public JPanel jPanelFK_IdEstadoPedidoExporPedidoExpor; public JButton jButtonFK_IdEstadoPedidoExporPedidoExpor; public JPanel jPanelFK_IdFormatoPedidoExpor; public JButton jButtonFK_IdFormatoPedidoExpor; public JPanel jPanelFK_IdPaisPedidoExpor; public JButton jButtonFK_IdPaisPedidoExpor; public JPanel jPanelFK_IdResponsablePedidoExpor; public JButton jButtonFK_IdResponsablePedidoExpor; public JPanel jPanelFK_IdSubClientePedidoExpor; public JButton jButtonFK_IdSubClientePedidoExpor; public JPanel jPanelFK_IdTipoCambioPedidoExpor; public JButton jButtonFK_IdTipoCambioPedidoExpor; public JPanel jPanelFK_IdTipoPrecioPedidoExpor; public JButton jButtonFK_IdTipoPrecioPedidoExpor; public JPanel jPanelFK_IdTransportePedidoExpor; public JButton jButtonFK_IdTransportePedidoExpor; public JPanel jPanelFK_IdTransportistaPedidoExpor; public JButton jButtonFK_IdTransportistaPedidoExpor; public JPanel jPanelFK_IdVendedorPedidoExpor; public JButton jButtonFK_IdVendedorPedidoExpor; public JPanel jPanelid_centro_costoFK_IdCentroCostoPedidoExpor; public JLabel jLabelid_centro_costoFK_IdCentroCostoPedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_centro_costoFK_IdCentroCostoPedidoExpor; public JButton jButtonid_centro_costoFK_IdCentroCostoPedidoExpor= new JButtonMe(); public JButton jButtonid_centro_costoFK_IdCentroCostoPedidoExporUpdate= new JButtonMe(); public JButton jButtonid_centro_costoFK_IdCentroCostoPedidoExporBusqueda= new JButtonMe(); public JButton jButtonid_centro_costoFK_IdCentroCostoPedidoExporArbol= new JButtonMe(); public JButton jButtonBuscarFK_IdCentroCostoid_centro_costoPedidoExpor; public JPanel jPanelid_clienteFK_IdClientePedidoExpor; public JLabel jLabelid_clienteFK_IdClientePedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_clienteFK_IdClientePedidoExpor; public JButton jButtonid_clienteFK_IdClientePedidoExpor= new JButtonMe(); public JButton jButtonid_clienteFK_IdClientePedidoExporUpdate= new JButtonMe(); public JButton jButtonid_clienteFK_IdClientePedidoExporBusqueda= new JButtonMe(); public JButton jButtonBuscarFK_IdClienteid_clientePedidoExpor; public JPanel jPanelid_consignatarioFK_IdConsignatarioPedidoExpor; public JLabel jLabelid_consignatarioFK_IdConsignatarioPedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_consignatarioFK_IdConsignatarioPedidoExpor; public JButton jButtonid_consignatarioFK_IdConsignatarioPedidoExpor= new JButtonMe(); public JButton jButtonid_consignatarioFK_IdConsignatarioPedidoExporUpdate= new JButtonMe(); public JButton jButtonid_consignatarioFK_IdConsignatarioPedidoExporBusqueda= new JButtonMe(); public JPanel jPanelid_consultorFK_IdConsultorPedidoExpor; public JLabel jLabelid_consultorFK_IdConsultorPedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_consultorFK_IdConsultorPedidoExpor; public JButton jButtonid_consultorFK_IdConsultorPedidoExpor= new JButtonMe(); public JButton jButtonid_consultorFK_IdConsultorPedidoExporUpdate= new JButtonMe(); public JButton jButtonid_consultorFK_IdConsultorPedidoExporBusqueda= new JButtonMe(); public JPanel jPanelid_empleadoFK_IdEmpleadoPedidoExpor; public JLabel jLabelid_empleadoFK_IdEmpleadoPedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_empleadoFK_IdEmpleadoPedidoExpor; public JButton jButtonid_empleadoFK_IdEmpleadoPedidoExpor= new JButtonMe(); public JButton jButtonid_empleadoFK_IdEmpleadoPedidoExporUpdate= new JButtonMe(); public JButton jButtonid_empleadoFK_IdEmpleadoPedidoExporBusqueda= new JButtonMe(); public JButton jButtonBuscarFK_IdEmpleadoid_empleadoPedidoExpor; public JPanel jPanelid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor; public JLabel jLabelid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor; public JButton jButtonid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor= new JButtonMe(); public JButton jButtonid_estado_pedidoFK_IdEstadoPedidoExporPedidoExporUpdate= new JButtonMe(); public JButton jButtonid_estado_pedidoFK_IdEstadoPedidoExporPedidoExporBusqueda= new JButtonMe(); public JPanel jPanelid_formatoFK_IdFormatoPedidoExpor; public JLabel jLabelid_formatoFK_IdFormatoPedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_formatoFK_IdFormatoPedidoExpor; public JButton jButtonid_formatoFK_IdFormatoPedidoExpor= new JButtonMe(); public JButton jButtonid_formatoFK_IdFormatoPedidoExporUpdate= new JButtonMe(); public JButton jButtonid_formatoFK_IdFormatoPedidoExporBusqueda= new JButtonMe(); public JPanel jPanelid_paisFK_IdPaisPedidoExpor; public JLabel jLabelid_paisFK_IdPaisPedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_paisFK_IdPaisPedidoExpor; public JButton jButtonid_paisFK_IdPaisPedidoExpor= new JButtonMe(); public JButton jButtonid_paisFK_IdPaisPedidoExporUpdate= new JButtonMe(); public JButton jButtonid_paisFK_IdPaisPedidoExporBusqueda= new JButtonMe(); public JPanel jPanelid_responsableFK_IdResponsablePedidoExpor; public JLabel jLabelid_responsableFK_IdResponsablePedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_responsableFK_IdResponsablePedidoExpor; public JButton jButtonid_responsableFK_IdResponsablePedidoExpor= new JButtonMe(); public JButton jButtonid_responsableFK_IdResponsablePedidoExporUpdate= new JButtonMe(); public JButton jButtonid_responsableFK_IdResponsablePedidoExporBusqueda= new JButtonMe(); public JPanel jPanelid_sub_clienteFK_IdSubClientePedidoExpor; public JLabel jLabelid_sub_clienteFK_IdSubClientePedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_sub_clienteFK_IdSubClientePedidoExpor; public JButton jButtonid_sub_clienteFK_IdSubClientePedidoExpor= new JButtonMe(); public JButton jButtonid_sub_clienteFK_IdSubClientePedidoExporUpdate= new JButtonMe(); public JButton jButtonid_sub_clienteFK_IdSubClientePedidoExporBusqueda= new JButtonMe(); public JPanel jPanelid_tipo_cambioFK_IdTipoCambioPedidoExpor; public JLabel jLabelid_tipo_cambioFK_IdTipoCambioPedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_tipo_cambioFK_IdTipoCambioPedidoExpor; public JButton jButtonid_tipo_cambioFK_IdTipoCambioPedidoExpor= new JButtonMe(); public JButton jButtonid_tipo_cambioFK_IdTipoCambioPedidoExporUpdate= new JButtonMe(); public JButton jButtonid_tipo_cambioFK_IdTipoCambioPedidoExporBusqueda= new JButtonMe(); public JButton jButtonBuscarFK_IdTipoCambioid_tipo_cambioPedidoExpor; public JPanel jPanelid_tipo_precioFK_IdTipoPrecioPedidoExpor; public JLabel jLabelid_tipo_precioFK_IdTipoPrecioPedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_tipo_precioFK_IdTipoPrecioPedidoExpor; public JButton jButtonid_tipo_precioFK_IdTipoPrecioPedidoExpor= new JButtonMe(); public JButton jButtonid_tipo_precioFK_IdTipoPrecioPedidoExporUpdate= new JButtonMe(); public JButton jButtonid_tipo_precioFK_IdTipoPrecioPedidoExporBusqueda= new JButtonMe(); public JPanel jPanelid_transporteFK_IdTransportePedidoExpor; public JLabel jLabelid_transporteFK_IdTransportePedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_transporteFK_IdTransportePedidoExpor; public JButton jButtonid_transporteFK_IdTransportePedidoExpor= new JButtonMe(); public JButton jButtonid_transporteFK_IdTransportePedidoExporUpdate= new JButtonMe(); public JButton jButtonid_transporteFK_IdTransportePedidoExporBusqueda= new JButtonMe(); public JPanel jPanelid_transportistaFK_IdTransportistaPedidoExpor; public JLabel jLabelid_transportistaFK_IdTransportistaPedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_transportistaFK_IdTransportistaPedidoExpor; public JButton jButtonid_transportistaFK_IdTransportistaPedidoExpor= new JButtonMe(); public JButton jButtonid_transportistaFK_IdTransportistaPedidoExporUpdate= new JButtonMe(); public JButton jButtonid_transportistaFK_IdTransportistaPedidoExporBusqueda= new JButtonMe(); public JPanel jPanelid_vendedorFK_IdVendedorPedidoExpor; public JLabel jLabelid_vendedorFK_IdVendedorPedidoExpor; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_vendedorFK_IdVendedorPedidoExpor; public JButton jButtonid_vendedorFK_IdVendedorPedidoExpor= new JButtonMe(); public JButton jButtonid_vendedorFK_IdVendedorPedidoExporUpdate= new JButtonMe(); public JButton jButtonid_vendedorFK_IdVendedorPedidoExporBusqueda= new JButtonMe(); public JButton jButtonid_vendedorFK_IdVendedorPedidoExporArbol= new JButtonMe(); public JButton jButtonBuscarFK_IdVendedorid_vendedorPedidoExpor; //ELEMENTOS TABLAS PARAMETOS //ELEMENTOS TABLAS PARAMETOS_FIN public static int openFrameCount = 0; public static final int xOffset = 10, yOffset = 35; //LOS DATOS DE NUEVO Y EDICION ACTUAL APARECEN EN OTRA VENTANA(true) O NO(false) public static Boolean CON_DATOS_FRAME=true; public static Boolean ISBINDING_MANUAL=true; public static Boolean ISLOAD_FKLOTE=true; public static Boolean ISBINDING_MANUAL_TABLA=true; public static Boolean CON_CARGAR_MEMORIA_INICIAL=true; //Al final no se utilizan, se inicializan desde JInternalFrameBase, desde ParametroGeneralUsuario public static String STIPO_TAMANIO_GENERAL="NORMAL"; public static String STIPO_TAMANIO_GENERAL_TABLA="NORMAL"; public static Boolean CONTIPO_TAMANIO_MANUAL=false; public static Boolean CON_LLAMADA_SIMPLE=true; public static Boolean CON_LLAMADA_SIMPLE_TOTAL=true; public static Boolean ESTA_CARGADO_PORPARTE=false; public int iWidthScroll=0;//(screenSize.width-screenSize.width/2)+(250*3); public int iHeightScroll=0;//(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO); //public int iWidthFormulario=1480;//(screenSize.width-screenSize.width/2)+(250*3); //public int iHeightFormulario=814;//(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO); //Esto va en DetalleForm //public int iHeightFormularioMaximo=0; //public int iWidthFormularioMaximo=0; public int iWidthTableDefinicion=0; public double dStart = 0; public double dEnd = 0; public double dDif = 0; /* double start=(double)System.currentTimeMillis(); double end=0; double dif=0; end=(double)System.currentTimeMillis(); dif=end - start; start=(double)System.currentTimeMillis(); System.out.println("Tiempo(ms) Carga TEST 1_2 DetalleMovimientoInventario: " + dif); */ public SistemaParameterReturnGeneral sistemaReturnGeneral; public List<Opcion> opcionsRelacionadas=new ArrayList<Opcion>(); //ES AUXILIAR PARA WINDOWS FORMS public PedidoExporJInternalFrame() throws Exception { super(PaginaTipo.PRINCIPAL); //super("PedidoExpor No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable try { //Boolean cargarRelaciones=false; initialize(null,false,false,false/*cargarRelaciones*/,null,null,null,null,null,null,PaginaTipo.PRINCIPAL); } catch(Exception e) { FuncionesSwing.manageException(this, e, null); } } public PedidoExporJInternalFrame(Boolean cargarRelaciones,PaginaTipo paginaTipo) throws Exception { super(paginaTipo); //super("PedidoExpor No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable try { initialize(null,false,false,cargarRelaciones,null,null,null,null,null,null,paginaTipo); } catch(Exception e) { FuncionesSwing.manageException(this, e, null); } } public PedidoExporJInternalFrame(Boolean conGuardarRelaciones,Boolean esGuardarRelacionado,Boolean cargarRelaciones,PaginaTipo paginaTipo) throws Exception { super(paginaTipo); //super("PedidoExpor No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable try { initialize(null,conGuardarRelaciones,esGuardarRelacionado,cargarRelaciones,null,null,null,null,null,null,paginaTipo); } catch(Exception e) { FuncionesSwing.manageException(this, e, null); } } public PedidoExporJInternalFrame(JDesktopPane jdesktopPane,Boolean conGuardarRelaciones,Boolean esGuardarRelacionado,Boolean cargarRelaciones,Usuario usuarioActual,ResumenUsuario resumenUsuarioActual,Modulo moduloActual,Opcion opcionActual,ParametroGeneralSg parametroGeneralSg,ParametroGeneralUsuario parametroGeneralUsuario,PaginaTipo paginaTipo) throws Exception { super(paginaTipo);//,jdesktopPane this.jDesktopPane=jdesktopPane; this.dStart=(double)System.currentTimeMillis(); //super("PedidoExpor No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable try { //OBLIGA VALIDA CON GUARDAR RELACIONES, TAMBIEN EN SWING conGuardarRelaciones=true; long start_time=0; long end_time=0; if(Constantes2.ISDEVELOPING2) { start_time = System.currentTimeMillis(); } initialize(jdesktopPane,conGuardarRelaciones,esGuardarRelacionado,cargarRelaciones,usuarioActual,resumenUsuarioActual,moduloActual,opcionActual,parametroGeneralSg,parametroGeneralUsuario,paginaTipo); if(Constantes2.ISDEVELOPING2) { end_time = System.currentTimeMillis(); String sTipo="Clase Padre Ventana"; Funciones2.getMensajeTiempoEjecucion(start_time, end_time, sTipo,false); } } catch(Exception e) { FuncionesSwing.manageException(this, e, null); } } public JInternalFrameBase getJInternalFrameParent() { return jInternalFrameParent; } public void setJInternalFrameParent(JInternalFrameBase internalFrameParent) { jInternalFrameParent = internalFrameParent; } public void setjButtonRecargarInformacion(JButton jButtonRecargarInformacionPedidoExpor) { this.jButtonRecargarInformacionPedidoExpor = jButtonRecargarInformacionPedidoExpor; } public JButton getjButtonProcesarInformacionPedidoExpor() { return this.jButtonProcesarInformacionPedidoExpor; } public void setjButtonProcesarInformacion(JButton jButtonProcesarInformacionPedidoExpor) { this.jButtonProcesarInformacionPedidoExpor = jButtonProcesarInformacionPedidoExpor; } public JButton getjButtonRecargarInformacionPedidoExpor() { return this.jButtonRecargarInformacionPedidoExpor; } public List<PedidoExpor> getpedidoexpors() { return this.pedidoexpors; } public void setpedidoexpors(List<PedidoExpor> pedidoexpors) { this.pedidoexpors = pedidoexpors; } public List<PedidoExpor> getpedidoexporsAux() { return this.pedidoexporsAux; } public void setpedidoexporsAux(List<PedidoExpor> pedidoexporsAux) { this.pedidoexporsAux = pedidoexporsAux; } public List<PedidoExpor> getpedidoexporsEliminados() { return this.pedidoexporsEliminados; } public void setPedidoExporsEliminados(List<PedidoExpor> pedidoexporsEliminados) { this.pedidoexporsEliminados = pedidoexporsEliminados; } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposSeleccionarPedidoExpor() { return jComboBoxTiposSeleccionarPedidoExpor; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposSeleccionarPedidoExpor( JComboBox jComboBoxTiposSeleccionarPedidoExpor) { this.jComboBoxTiposSeleccionarPedidoExpor = jComboBoxTiposSeleccionarPedidoExpor; } public void setBorderResaltarTiposSeleccionarPedidoExpor() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarPedidoExpor.setBorder(borderResaltar); this.jComboBoxTiposSeleccionarPedidoExpor .setBorder(borderResaltar); } public JTextField getjTextFieldValorCampoGeneralPedidoExpor() { return jTextFieldValorCampoGeneralPedidoExpor; } public void setjTextFieldValorCampoGeneralPedidoExpor( JTextField jTextFieldValorCampoGeneralPedidoExpor) { this.jTextFieldValorCampoGeneralPedidoExpor = jTextFieldValorCampoGeneralPedidoExpor; } public void setBorderResaltarValorCampoGeneralPedidoExpor() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarPedidoExpor.setBorder(borderResaltar); this.jTextFieldValorCampoGeneralPedidoExpor .setBorder(borderResaltar); } public JCheckBox getjCheckBoxSeleccionarTodosPedidoExpor() { return this.jCheckBoxSeleccionarTodosPedidoExpor; } public void setjCheckBoxSeleccionarTodosPedidoExpor( JCheckBox jCheckBoxSeleccionarTodosPedidoExpor) { this.jCheckBoxSeleccionarTodosPedidoExpor = jCheckBoxSeleccionarTodosPedidoExpor; } public void setBorderResaltarSeleccionarTodosPedidoExpor() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarPedidoExpor.setBorder(borderResaltar); this.jCheckBoxSeleccionarTodosPedidoExpor .setBorder(borderResaltar); } public JCheckBox getjCheckBoxSeleccionadosPedidoExpor() { return this.jCheckBoxSeleccionadosPedidoExpor; } public void setjCheckBoxSeleccionadosPedidoExpor( JCheckBox jCheckBoxSeleccionadosPedidoExpor) { this.jCheckBoxSeleccionadosPedidoExpor = jCheckBoxSeleccionadosPedidoExpor; } public void setBorderResaltarSeleccionadosPedidoExpor() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarPedidoExpor.setBorder(borderResaltar); this.jCheckBoxSeleccionadosPedidoExpor .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposArchivosReportesPedidoExpor() { return this.jComboBoxTiposArchivosReportesPedidoExpor; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposArchivosReportesPedidoExpor( JComboBox jComboBoxTiposArchivosReportesPedidoExpor) { this.jComboBoxTiposArchivosReportesPedidoExpor = jComboBoxTiposArchivosReportesPedidoExpor; } public void setBorderResaltarTiposArchivosReportesPedidoExpor() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarPedidoExpor.setBorder(borderResaltar); this.jComboBoxTiposArchivosReportesPedidoExpor .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposReportesPedidoExpor() { return this.jComboBoxTiposReportesPedidoExpor; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposReportesPedidoExpor( JComboBox jComboBoxTiposReportesPedidoExpor) { this.jComboBoxTiposReportesPedidoExpor = jComboBoxTiposReportesPedidoExpor; } //@SuppressWarnings("rawtypes") //public JComboBox getjComboBoxTiposReportesDinamicoPedidoExpor() { // return jComboBoxTiposReportesDinamicoPedidoExpor; //} //@SuppressWarnings("rawtypes") //public void setjComboBoxTiposReportesDinamicoPedidoExpor( // JComboBox jComboBoxTiposReportesDinamicoPedidoExpor) { // this.jComboBoxTiposReportesDinamicoPedidoExpor = jComboBoxTiposReportesDinamicoPedidoExpor; //} //@SuppressWarnings("rawtypes") //public JComboBox getjComboBoxTiposArchivosReportesDinamicoPedidoExpor() { // return jComboBoxTiposArchivosReportesDinamicoPedidoExpor; //} //@SuppressWarnings("rawtypes") //public void setjComboBoxTiposArchivosReportesDinamicoPedidoExpor( // JComboBox jComboBoxTiposArchivosReportesDinamicoPedidoExpor) { // this.jComboBoxTiposArchivosReportesDinamicoPedidoExpor = jComboBoxTiposArchivosReportesDinamicoPedidoExpor; //} public void setBorderResaltarTiposReportesPedidoExpor() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarPedidoExpor.setBorder(borderResaltar); this.jComboBoxTiposReportesPedidoExpor .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposGraficosReportesPedidoExpor() { return this.jComboBoxTiposGraficosReportesPedidoExpor; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposGraficosReportesPedidoExpor( JComboBox jComboBoxTiposGraficosReportesPedidoExpor) { this.jComboBoxTiposGraficosReportesPedidoExpor = jComboBoxTiposGraficosReportesPedidoExpor; } public void setBorderResaltarTiposGraficosReportesPedidoExpor() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarPedidoExpor.setBorder(borderResaltar); this.jComboBoxTiposGraficosReportesPedidoExpor .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposPaginacionPedidoExpor() { return this.jComboBoxTiposPaginacionPedidoExpor; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposPaginacionPedidoExpor( JComboBox jComboBoxTiposPaginacionPedidoExpor) { this.jComboBoxTiposPaginacionPedidoExpor = jComboBoxTiposPaginacionPedidoExpor; } public void setBorderResaltarTiposPaginacionPedidoExpor() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarPedidoExpor.setBorder(borderResaltar); this.jComboBoxTiposPaginacionPedidoExpor .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposRelacionesPedidoExpor() { return this.jComboBoxTiposRelacionesPedidoExpor; } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposAccionesPedidoExpor() { return this.jComboBoxTiposAccionesPedidoExpor; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposRelacionesPedidoExpor( JComboBox jComboBoxTiposRelacionesPedidoExpor) { this.jComboBoxTiposRelacionesPedidoExpor = jComboBoxTiposRelacionesPedidoExpor; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposAccionesPedidoExpor( JComboBox jComboBoxTiposAccionesPedidoExpor) { this.jComboBoxTiposAccionesPedidoExpor = jComboBoxTiposAccionesPedidoExpor; } public void setBorderResaltarTiposRelacionesPedidoExpor() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarPedidoExpor.setBorder(borderResaltar); this.jComboBoxTiposRelacionesPedidoExpor .setBorder(borderResaltar); } public void setBorderResaltarTiposAccionesPedidoExpor() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarPedidoExpor.setBorder(borderResaltar); this.jComboBoxTiposAccionesPedidoExpor .setBorder(borderResaltar); } //public JCheckBox getjCheckBoxConGraficoDinamicoPedidoExpor() { // return jCheckBoxConGraficoDinamicoPedidoExpor; //} //public void setjCheckBoxConGraficoDinamicoPedidoExpor( // JCheckBox jCheckBoxConGraficoDinamicoPedidoExpor) { // this.jCheckBoxConGraficoDinamicoPedidoExpor = jCheckBoxConGraficoDinamicoPedidoExpor; //} //public void setBorderResaltarConGraficoDinamicoPedidoExpor() { // Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); // this.jTtoolBarPedidoExpor.setBorder(borderResaltar); // this.jCheckBoxConGraficoDinamicoPedidoExpor .setBorder(borderResaltar); //} /* public JDesktopPane getJDesktopPane() { return jDesktopPane; } public void setJDesktopPane(JDesktopPane desktopPane) { jDesktopPane = desktopPane; } */ private void initialize(JDesktopPane jdesktopPane,Boolean conGuardarRelaciones,Boolean esGuardarRelacionado,Boolean cargarRelaciones,Usuario usuarioActual,ResumenUsuario resumenUsuarioActual,Modulo moduloActual,Opcion opcionActual,ParametroGeneralSg parametroGeneralSg,ParametroGeneralUsuario parametroGeneralUsuario,PaginaTipo paginaTipo) throws Exception { this.pedidoexporSessionBean=new PedidoExporSessionBean(); this.pedidoexporSessionBean.setConGuardarRelaciones(conGuardarRelaciones); this.pedidoexporSessionBean.setEsGuardarRelacionado(esGuardarRelacionado); this.conCargarMinimo=this.pedidoexporSessionBean.getEsGuardarRelacionado(); this.cargarRelaciones=cargarRelaciones; if(!this.conCargarMinimo) { } //this.sTipoTamanioGeneral=PedidoExporJInternalFrame.STIPO_TAMANIO_GENERAL; //this.sTipoTamanioGeneralTabla=PedidoExporJInternalFrame.STIPO_TAMANIO_GENERAL_TABLA; this.sTipoTamanioGeneral=FuncionesSwing.getTipoTamanioGeneral(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado); this.sTipoTamanioGeneralTabla=FuncionesSwing.getTipoTamanioGeneralTabla(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado); this.conTipoTamanioManual=FuncionesSwing.getConTipoTamanioManual(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado); this.conTipoTamanioTodo=FuncionesSwing.getConTipoTamanioTodo(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado); PedidoExporJInternalFrame.STIPO_TAMANIO_GENERAL=this.sTipoTamanioGeneral; PedidoExporJInternalFrame.STIPO_TAMANIO_GENERAL_TABLA=this.sTipoTamanioGeneralTabla; PedidoExporJInternalFrame.CONTIPO_TAMANIO_MANUAL=this.conTipoTamanioManual; Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int iWidth=(screenSize.width-screenSize.width/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ANCHO); int iHeight=(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO); //this.setTitle(Funciones.GetTituloSistema(this.parametroGeneralSg,this.moduloActual,this.opcionActual,this.usuarioActual,"Pedido Exportacion MANTENIMIENTO")); if(iWidth > 4350) { iWidth=4350; } if(iHeight > 1110) { iHeight=1110; } this.setSize(iWidth,iHeight); this.setFrameIcon(new ImageIcon(FuncionesSwing.getImagenBackground(Constantes2.S_ICON_IMAGE))); this.setContentPane(this.getJContentPane(iWidth,iHeight,jdesktopPane,cargarRelaciones,usuarioActual,resumenUsuarioActual,moduloActual,opcionActual,parametroGeneralSg,parametroGeneralUsuario,paginaTipo)); if(!this.pedidoexporSessionBean.getEsGuardarRelacionado()) { this.setResizable(true); this.setClosable(true); this.setMaximizable(true); this.iconable=true; setLocation(xOffset*openFrameCount, yOffset*openFrameCount); if(Constantes.CON_VARIAS_VENTANAS) { openFrameCount++; if(openFrameCount==Constantes.INUM_MAX_VENTANAS) { openFrameCount=0; } } } PedidoExporJInternalFrame.ESTA_CARGADO_PORPARTE=true; //super("PedidoExpor No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable //SwingUtilities.updateComponentTreeUI(this); } public void inicializarToolBar() { this.jTtoolBarPedidoExpor= new JToolBar("MENU PRINCIPAL"); //TOOLBAR //PRINCIPAL this.jButtonNuevoToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonNuevoToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "nuevo","nuevo","Nuevo"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("NUEVO"),"Nuevo",false); this.jButtonNuevoGuardarCambiosToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonNuevoGuardarCambiosToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "nuevoguardarcambios","nuevoguardarcambios","Nuevo" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA"),"Nuevo",false); this.jButtonGuardarCambiosTablaToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonGuardarCambiosTablaToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "guardarcambiostabla","guardarcambiostabla","Guardar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS"),"Guardar",false); this.jButtonDuplicarToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonDuplicarToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "duplicar","duplicar","Duplicar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("DUPLICAR"),"Duplicar",false); this.jButtonCopiarToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonCopiarToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "copiar","copiar","Copiar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("COPIAR"),"Copiar",false); this.jButtonVerFormToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonVerFormToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "ver_form","ver_form","Ver"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("VER_FORM"),"Ver",false); this.jButtonRecargarInformacionToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonRecargarInformacionToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "recargar","recargar","Recargar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("RECARGAR"),"Recargar",false); this.jButtonAnterioresToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonRecargarInformacionToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "anteriores","anteriores","Anteriores Datos" + FuncionesSwing.getKeyMensaje("ANTERIORES"),"<<",false); this.jButtonSiguientesToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonRecargarInformacionToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "siguientes","siguientes","Siguientes Datos" + FuncionesSwing.getKeyMensaje("SIGUIENTES"),">>",false); this.jButtonAbrirOrderByToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonAbrirOrderByToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "orden","orden","Orden" + FuncionesSwing.getKeyMensaje("ORDEN"),"Orden",false); this.jButtonNuevoRelacionesToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonNuevoRelacionesToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "nuevo_relaciones","nuevo_relaciones","NUEVO RELACIONES" + FuncionesSwing.getKeyMensaje("NUEVO_RELACIONES"),"NUEVO RELACIONES",false); this.jButtonMostrarOcultarTablaToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonMostrarOcultarTablaToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "mostrar_ocultar","mostrar_ocultar","Mostrar Ocultar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("MOSTRAR_OCULTAR"),"Mostrar Ocultar",false); this.jButtonCerrarToolBarPedidoExpor=FuncionesSwing.getButtonToolBarGeneral(this.jButtonCerrarToolBarPedidoExpor,this.jTtoolBarPedidoExpor, "cerrar","cerrar","Salir"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("CERRAR"),"Salir",false); //this.jButtonNuevoRelacionesToolBarPedidoExpor=new JButtonMe(); //protected JButton jButtonNuevoRelacionesToolBarPedidoExpor; this.jButtonProcesarInformacionToolBarPedidoExpor=new JButtonMe(); //protected JButton jButtonProcesarInformacionToolBarPedidoExpor; //protected JButton jButtonModificarToolBarPedidoExpor; //PRINCIPAL //DETALLE //DETALLE_FIN } public void cargarMenus() { this.jmenuBarPedidoExpor=new JMenuBarMe(); //PRINCIPAL this.jmenuPedidoExpor=new JMenuMe("General"); this.jmenuArchivoPedidoExpor=new JMenuMe("Archivo"); this.jmenuAccionesPedidoExpor=new JMenuMe("Acciones"); this.jmenuDatosPedidoExpor=new JMenuMe("Datos"); //PRINCIPAL_FIN //DETALLE //DETALLE_FIN this.jMenuItemNuevoPedidoExpor= new JMenuItem("Nuevo" + FuncionesSwing.getKeyMensaje("NUEVO")); this.jMenuItemNuevoPedidoExpor.setActionCommand("Nuevo"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemNuevoPedidoExpor,"nuevo_button","Nuevo"); FuncionesSwing.setBoldMenuItem(this.jMenuItemNuevoPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemDuplicarPedidoExpor= new JMenuItem("Duplicar" + FuncionesSwing.getKeyMensaje("DUPLICAR")); this.jMenuItemDuplicarPedidoExpor.setActionCommand("Duplicar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemDuplicarPedidoExpor,"duplicar_button","Duplicar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemDuplicarPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemNuevoRelacionesPedidoExpor= new JMenuItem("Nuevo Rel" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA")); this.jMenuItemNuevoRelacionesPedidoExpor.setActionCommand("Nuevo Rel"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemNuevoRelacionesPedidoExpor,"nuevorelaciones_button","Nuevo Rel"); FuncionesSwing.setBoldMenuItem(this.jMenuItemNuevoRelacionesPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemGuardarCambiosPedidoExpor= new JMenuItem("Guardar" + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS")); this.jMenuItemGuardarCambiosPedidoExpor.setActionCommand("Guardar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemGuardarCambiosPedidoExpor,"guardarcambios_button","Guardar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemGuardarCambiosPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemCopiarPedidoExpor= new JMenuItem("Copiar" + FuncionesSwing.getKeyMensaje("COPIAR")); this.jMenuItemCopiarPedidoExpor.setActionCommand("Copiar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemCopiarPedidoExpor,"copiar_button","Copiar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemCopiarPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemVerFormPedidoExpor= new JMenuItem("Ver" + FuncionesSwing.getKeyMensaje("VER_FORM")); this.jMenuItemVerFormPedidoExpor.setActionCommand("Ver"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemVerFormPedidoExpor,"ver_form_button","Ver"); FuncionesSwing.setBoldMenuItem(this.jMenuItemVerFormPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemGuardarCambiosTablaPedidoExpor= new JMenuItem("Guardar Tabla" + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS")); this.jMenuItemGuardarCambiosTablaPedidoExpor.setActionCommand("Guardar Tabla"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemGuardarCambiosTablaPedidoExpor,"guardarcambiostabla_button","Guardar Tabla"); FuncionesSwing.setBoldMenuItem(this.jMenuItemGuardarCambiosTablaPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemCerrarPedidoExpor= new JMenuItem("Salir" + FuncionesSwing.getKeyMensaje("CERRAR")); this.jMenuItemCerrarPedidoExpor.setActionCommand("Cerrar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemCerrarPedidoExpor,"cerrar_button","Salir"); FuncionesSwing.setBoldMenuItem(this.jMenuItemCerrarPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemRecargarInformacionPedidoExpor= new JMenuItem("Recargar" + FuncionesSwing.getKeyMensaje("RECARGAR")); this.jMenuItemRecargarInformacionPedidoExpor.setActionCommand("Recargar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemRecargarInformacionPedidoExpor,"recargar_button","Recargar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemRecargarInformacionPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemProcesarInformacionPedidoExpor= new JMenuItem("Procesar Informacion"); this.jMenuItemProcesarInformacionPedidoExpor.setActionCommand("Procesar Informacion"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemProcesarInformacionPedidoExpor,"procesar_button","Procesar Informacion"); this.jMenuItemAnterioresPedidoExpor= new JMenuItem("Anteriores" + FuncionesSwing.getKeyMensaje("ANTERIORES")); this.jMenuItemAnterioresPedidoExpor.setActionCommand("Anteriores"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemAnterioresPedidoExpor,"anteriores_button","Anteriores"); FuncionesSwing.setBoldMenuItem(this.jMenuItemAnterioresPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemSiguientesPedidoExpor= new JMenuItem("Siguientes" + FuncionesSwing.getKeyMensaje("SIGUIENTES")); this.jMenuItemSiguientesPedidoExpor.setActionCommand("Siguientes"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemSiguientesPedidoExpor,"siguientes_button","Siguientes"); FuncionesSwing.setBoldMenuItem(this.jMenuItemSiguientesPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemAbrirOrderByPedidoExpor= new JMenuItem("Orden" + FuncionesSwing.getKeyMensaje("ORDEN")); this.jMenuItemAbrirOrderByPedidoExpor.setActionCommand("Orden"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemAbrirOrderByPedidoExpor,"orden_button","Orden"); FuncionesSwing.setBoldMenuItem(this.jMenuItemAbrirOrderByPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemMostrarOcultarPedidoExpor= new JMenuItem("Mostrar Ocultar" + FuncionesSwing.getKeyMensaje("MOSTRAR_OCULTAR")); this.jMenuItemMostrarOcultarPedidoExpor.setActionCommand("Mostrar Ocultar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemMostrarOcultarPedidoExpor,"mostrar_ocultar_button","Mostrar Ocultar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemMostrarOcultarPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemDetalleAbrirOrderByPedidoExpor= new JMenuItem("Orden" + FuncionesSwing.getKeyMensaje("ORDEN")); this.jMenuItemDetalleAbrirOrderByPedidoExpor.setActionCommand("Orden"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemDetalleAbrirOrderByPedidoExpor,"orden_button","Orden"); FuncionesSwing.setBoldMenuItem(this.jMenuItemDetalleAbrirOrderByPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemDetalleMostarOcultarPedidoExpor= new JMenuItem("Mostrar Ocultar" + FuncionesSwing.getKeyMensaje("MOSTRAR_OCULTAR")); this.jMenuItemDetalleMostarOcultarPedidoExpor.setActionCommand("Mostrar Ocultar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemDetalleMostarOcultarPedidoExpor,"mostrar_ocultar_button","Mostrar Ocultar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemDetalleMostarOcultarPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemNuevoGuardarCambiosPedidoExpor= new JMenuItem("Nuevo Tabla" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA")); this.jMenuItemNuevoGuardarCambiosPedidoExpor.setActionCommand("Nuevo Tabla"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemNuevoGuardarCambiosPedidoExpor,"nuevoguardarcambios_button","Nuevo"); FuncionesSwing.setBoldMenuItem(this.jMenuItemNuevoGuardarCambiosPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); //PRINCIPAL if(!this.conCargarMinimo) { this.jmenuArchivoPedidoExpor.add(this.jMenuItemCerrarPedidoExpor); this.jmenuAccionesPedidoExpor.add(this.jMenuItemNuevoPedidoExpor); this.jmenuAccionesPedidoExpor.add(this.jMenuItemNuevoGuardarCambiosPedidoExpor); this.jmenuAccionesPedidoExpor.add(this.jMenuItemNuevoRelacionesPedidoExpor); this.jmenuAccionesPedidoExpor.add(this.jMenuItemGuardarCambiosTablaPedidoExpor); this.jmenuAccionesPedidoExpor.add(this.jMenuItemDuplicarPedidoExpor); this.jmenuAccionesPedidoExpor.add(this.jMenuItemCopiarPedidoExpor); this.jmenuAccionesPedidoExpor.add(this.jMenuItemVerFormPedidoExpor); this.jmenuDatosPedidoExpor.add(this.jMenuItemRecargarInformacionPedidoExpor); this.jmenuDatosPedidoExpor.add(this.jMenuItemAnterioresPedidoExpor); this.jmenuDatosPedidoExpor.add(this.jMenuItemSiguientesPedidoExpor); this.jmenuDatosPedidoExpor.add(this.jMenuItemAbrirOrderByPedidoExpor); this.jmenuDatosPedidoExpor.add(this.jMenuItemMostrarOcultarPedidoExpor); } //PRINCIPAL_FIN //DETALLE //this.jmenuDetalleAccionesPedidoExpor.add(this.jMenuItemGuardarCambiosPedidoExpor); //DETALLE_FIN //RELACIONES //RELACIONES //PRINCIPAL if(!this.conCargarMinimo) { FuncionesSwing.setBoldMenu(this.jmenuArchivoPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldMenu(this.jmenuAccionesPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldMenu(this.jmenuDatosPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jmenuBarPedidoExpor.add(this.jmenuArchivoPedidoExpor); this.jmenuBarPedidoExpor.add(this.jmenuAccionesPedidoExpor); this.jmenuBarPedidoExpor.add(this.jmenuDatosPedidoExpor); } //PRINCIPAL_FIN //DETALLE //DETALLE_FIN //AGREGA MENU A PANTALLA if(!this.conCargarMinimo) { this.setJMenuBar(this.jmenuBarPedidoExpor); } //AGREGA MENU DETALLE A PANTALLA } public void inicializarElementosBusquedasPedidoExpor() { //BYDAN_BUSQUEDAS //INDICES BUSQUEDA this.jPanelFK_IdCentroCostoPedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdCentroCostoPedidoExpor.setToolTipText("Buscar Por Centro Costo "); this.jButtonFK_IdCentroCostoPedidoExpor= new JButtonMe(); this.jButtonFK_IdCentroCostoPedidoExpor.setText("Buscar"); this.jButtonFK_IdCentroCostoPedidoExpor.setToolTipText("Buscar Por Centro Costo "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdCentroCostoPedidoExpor,"buscar_button","Buscar Por Centro Costo "); FuncionesSwing.setBoldButton(this.jButtonFK_IdCentroCostoPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_centro_costoFK_IdCentroCostoPedidoExpor = new JLabelMe(); jLabelid_centro_costoFK_IdCentroCostoPedidoExpor.setText("Centro Costo :"); jLabelid_centro_costoFK_IdCentroCostoPedidoExpor.setToolTipText("Centro Costo"); jLabelid_centro_costoFK_IdCentroCostoPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_centro_costoFK_IdCentroCostoPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_centro_costoFK_IdCentroCostoPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_centro_costoFK_IdCentroCostoPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_centro_costoFK_IdCentroCostoPedidoExpor= new JComboBoxMe(); jComboBoxid_centro_costoFK_IdCentroCostoPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_centro_costoFK_IdCentroCostoPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_centro_costoFK_IdCentroCostoPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_centro_costoFK_IdCentroCostoPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonBuscarFK_IdCentroCostoid_centro_costoPedidoExpor= new JButtonMe(); this.jButtonBuscarFK_IdCentroCostoid_centro_costoPedidoExpor.setMinimumSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdCentroCostoid_centro_costoPedidoExpor.setMaximumSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdCentroCostoid_centro_costoPedidoExpor.setPreferredSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdCentroCostoid_centro_costoPedidoExpor.setText("Buscar"); this.jButtonBuscarFK_IdCentroCostoid_centro_costoPedidoExpor.setToolTipText("Buscar"); this.jButtonBuscarFK_IdCentroCostoid_centro_costoPedidoExpor.setFocusable(false); this.jPanelFK_IdClientePedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdClientePedidoExpor.setToolTipText("Buscar Por Cliente "); this.jButtonFK_IdClientePedidoExpor= new JButtonMe(); this.jButtonFK_IdClientePedidoExpor.setText("Buscar"); this.jButtonFK_IdClientePedidoExpor.setToolTipText("Buscar Por Cliente "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdClientePedidoExpor,"buscar_button","Buscar Por Cliente "); FuncionesSwing.setBoldButton(this.jButtonFK_IdClientePedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_clienteFK_IdClientePedidoExpor = new JLabelMe(); jLabelid_clienteFK_IdClientePedidoExpor.setText("Cliente :"); jLabelid_clienteFK_IdClientePedidoExpor.setToolTipText("Cliente"); jLabelid_clienteFK_IdClientePedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_clienteFK_IdClientePedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_clienteFK_IdClientePedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_clienteFK_IdClientePedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_clienteFK_IdClientePedidoExpor= new JComboBoxMe(); jComboBoxid_clienteFK_IdClientePedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,75),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_clienteFK_IdClientePedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,75),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_clienteFK_IdClientePedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,75),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_clienteFK_IdClientePedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonBuscarFK_IdClienteid_clientePedidoExpor= new JButtonMe(); this.jButtonBuscarFK_IdClienteid_clientePedidoExpor.setMinimumSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdClienteid_clientePedidoExpor.setMaximumSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdClienteid_clientePedidoExpor.setPreferredSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdClienteid_clientePedidoExpor.setText("Buscar"); this.jButtonBuscarFK_IdClienteid_clientePedidoExpor.setToolTipText("Buscar"); this.jButtonBuscarFK_IdClienteid_clientePedidoExpor.setFocusable(false); this.jPanelFK_IdConsignatarioPedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdConsignatarioPedidoExpor.setToolTipText("Buscar Por Consignatario "); this.jButtonFK_IdConsignatarioPedidoExpor= new JButtonMe(); this.jButtonFK_IdConsignatarioPedidoExpor.setText("Buscar"); this.jButtonFK_IdConsignatarioPedidoExpor.setToolTipText("Buscar Por Consignatario "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdConsignatarioPedidoExpor,"buscar_button","Buscar Por Consignatario "); FuncionesSwing.setBoldButton(this.jButtonFK_IdConsignatarioPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_consignatarioFK_IdConsignatarioPedidoExpor = new JLabelMe(); jLabelid_consignatarioFK_IdConsignatarioPedidoExpor.setText("Consignatario :"); jLabelid_consignatarioFK_IdConsignatarioPedidoExpor.setToolTipText("Consignatario"); jLabelid_consignatarioFK_IdConsignatarioPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_consignatarioFK_IdConsignatarioPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_consignatarioFK_IdConsignatarioPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_consignatarioFK_IdConsignatarioPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_consignatarioFK_IdConsignatarioPedidoExpor= new JComboBoxMe(); jComboBoxid_consignatarioFK_IdConsignatarioPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_consignatarioFK_IdConsignatarioPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_consignatarioFK_IdConsignatarioPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_consignatarioFK_IdConsignatarioPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jPanelFK_IdConsultorPedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdConsultorPedidoExpor.setToolTipText("Buscar Por Consultor "); this.jButtonFK_IdConsultorPedidoExpor= new JButtonMe(); this.jButtonFK_IdConsultorPedidoExpor.setText("Buscar"); this.jButtonFK_IdConsultorPedidoExpor.setToolTipText("Buscar Por Consultor "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdConsultorPedidoExpor,"buscar_button","Buscar Por Consultor "); FuncionesSwing.setBoldButton(this.jButtonFK_IdConsultorPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_consultorFK_IdConsultorPedidoExpor = new JLabelMe(); jLabelid_consultorFK_IdConsultorPedidoExpor.setText("Consultor :"); jLabelid_consultorFK_IdConsultorPedidoExpor.setToolTipText("Consultor"); jLabelid_consultorFK_IdConsultorPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_consultorFK_IdConsultorPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_consultorFK_IdConsultorPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_consultorFK_IdConsultorPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_consultorFK_IdConsultorPedidoExpor= new JComboBoxMe(); jComboBoxid_consultorFK_IdConsultorPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_consultorFK_IdConsultorPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_consultorFK_IdConsultorPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_consultorFK_IdConsultorPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jPanelFK_IdEmpleadoPedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdEmpleadoPedidoExpor.setToolTipText("Buscar Por Empleado "); this.jButtonFK_IdEmpleadoPedidoExpor= new JButtonMe(); this.jButtonFK_IdEmpleadoPedidoExpor.setText("Buscar"); this.jButtonFK_IdEmpleadoPedidoExpor.setToolTipText("Buscar Por Empleado "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdEmpleadoPedidoExpor,"buscar_button","Buscar Por Empleado "); FuncionesSwing.setBoldButton(this.jButtonFK_IdEmpleadoPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_empleadoFK_IdEmpleadoPedidoExpor = new JLabelMe(); jLabelid_empleadoFK_IdEmpleadoPedidoExpor.setText("Empleado :"); jLabelid_empleadoFK_IdEmpleadoPedidoExpor.setToolTipText("Empleado"); jLabelid_empleadoFK_IdEmpleadoPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_empleadoFK_IdEmpleadoPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_empleadoFK_IdEmpleadoPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_empleadoFK_IdEmpleadoPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_empleadoFK_IdEmpleadoPedidoExpor= new JComboBoxMe(); jComboBoxid_empleadoFK_IdEmpleadoPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,100),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_empleadoFK_IdEmpleadoPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,100),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_empleadoFK_IdEmpleadoPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,100),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_empleadoFK_IdEmpleadoPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonBuscarFK_IdEmpleadoid_empleadoPedidoExpor= new JButtonMe(); this.jButtonBuscarFK_IdEmpleadoid_empleadoPedidoExpor.setMinimumSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdEmpleadoid_empleadoPedidoExpor.setMaximumSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdEmpleadoid_empleadoPedidoExpor.setPreferredSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdEmpleadoid_empleadoPedidoExpor.setText("Buscar"); this.jButtonBuscarFK_IdEmpleadoid_empleadoPedidoExpor.setToolTipText("Buscar"); this.jButtonBuscarFK_IdEmpleadoid_empleadoPedidoExpor.setFocusable(false); this.jPanelFK_IdEstadoPedidoExporPedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdEstadoPedidoExporPedidoExpor.setToolTipText("Buscar Por Estado "); this.jButtonFK_IdEstadoPedidoExporPedidoExpor= new JButtonMe(); this.jButtonFK_IdEstadoPedidoExporPedidoExpor.setText("Buscar"); this.jButtonFK_IdEstadoPedidoExporPedidoExpor.setToolTipText("Buscar Por Estado "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdEstadoPedidoExporPedidoExpor,"buscar_button","Buscar Por Estado "); FuncionesSwing.setBoldButton(this.jButtonFK_IdEstadoPedidoExporPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor = new JLabelMe(); jLabelid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor.setText("Estado :"); jLabelid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor.setToolTipText("Estado"); jLabelid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor= new JComboBoxMe(); jComboBoxid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jPanelFK_IdFormatoPedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdFormatoPedidoExpor.setToolTipText("Buscar Por Formato "); this.jButtonFK_IdFormatoPedidoExpor= new JButtonMe(); this.jButtonFK_IdFormatoPedidoExpor.setText("Buscar"); this.jButtonFK_IdFormatoPedidoExpor.setToolTipText("Buscar Por Formato "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdFormatoPedidoExpor,"buscar_button","Buscar Por Formato "); FuncionesSwing.setBoldButton(this.jButtonFK_IdFormatoPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_formatoFK_IdFormatoPedidoExpor = new JLabelMe(); jLabelid_formatoFK_IdFormatoPedidoExpor.setText("Formato :"); jLabelid_formatoFK_IdFormatoPedidoExpor.setToolTipText("Formato"); jLabelid_formatoFK_IdFormatoPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_formatoFK_IdFormatoPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_formatoFK_IdFormatoPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_formatoFK_IdFormatoPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_formatoFK_IdFormatoPedidoExpor= new JComboBoxMe(); jComboBoxid_formatoFK_IdFormatoPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_formatoFK_IdFormatoPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_formatoFK_IdFormatoPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_formatoFK_IdFormatoPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jPanelFK_IdPaisPedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdPaisPedidoExpor.setToolTipText("Buscar Por Origen "); this.jButtonFK_IdPaisPedidoExpor= new JButtonMe(); this.jButtonFK_IdPaisPedidoExpor.setText("Buscar"); this.jButtonFK_IdPaisPedidoExpor.setToolTipText("Buscar Por Origen "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdPaisPedidoExpor,"buscar_button","Buscar Por Origen "); FuncionesSwing.setBoldButton(this.jButtonFK_IdPaisPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_paisFK_IdPaisPedidoExpor = new JLabelMe(); jLabelid_paisFK_IdPaisPedidoExpor.setText("Origen :"); jLabelid_paisFK_IdPaisPedidoExpor.setToolTipText("Origen"); jLabelid_paisFK_IdPaisPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_paisFK_IdPaisPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_paisFK_IdPaisPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_paisFK_IdPaisPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_paisFK_IdPaisPedidoExpor= new JComboBoxMe(); jComboBoxid_paisFK_IdPaisPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_paisFK_IdPaisPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_paisFK_IdPaisPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_paisFK_IdPaisPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jPanelFK_IdResponsablePedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdResponsablePedidoExpor.setToolTipText("Buscar Por Responsable "); this.jButtonFK_IdResponsablePedidoExpor= new JButtonMe(); this.jButtonFK_IdResponsablePedidoExpor.setText("Buscar"); this.jButtonFK_IdResponsablePedidoExpor.setToolTipText("Buscar Por Responsable "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdResponsablePedidoExpor,"buscar_button","Buscar Por Responsable "); FuncionesSwing.setBoldButton(this.jButtonFK_IdResponsablePedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_responsableFK_IdResponsablePedidoExpor = new JLabelMe(); jLabelid_responsableFK_IdResponsablePedidoExpor.setText("Responsable :"); jLabelid_responsableFK_IdResponsablePedidoExpor.setToolTipText("Responsable"); jLabelid_responsableFK_IdResponsablePedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_responsableFK_IdResponsablePedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_responsableFK_IdResponsablePedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_responsableFK_IdResponsablePedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_responsableFK_IdResponsablePedidoExpor= new JComboBoxMe(); jComboBoxid_responsableFK_IdResponsablePedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_responsableFK_IdResponsablePedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_responsableFK_IdResponsablePedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_responsableFK_IdResponsablePedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jPanelFK_IdSubClientePedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdSubClientePedidoExpor.setToolTipText("Buscar Por Contacto "); this.jButtonFK_IdSubClientePedidoExpor= new JButtonMe(); this.jButtonFK_IdSubClientePedidoExpor.setText("Buscar"); this.jButtonFK_IdSubClientePedidoExpor.setToolTipText("Buscar Por Contacto "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdSubClientePedidoExpor,"buscar_button","Buscar Por Contacto "); FuncionesSwing.setBoldButton(this.jButtonFK_IdSubClientePedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_sub_clienteFK_IdSubClientePedidoExpor = new JLabelMe(); jLabelid_sub_clienteFK_IdSubClientePedidoExpor.setText("Contacto :"); jLabelid_sub_clienteFK_IdSubClientePedidoExpor.setToolTipText("Contacto"); jLabelid_sub_clienteFK_IdSubClientePedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_sub_clienteFK_IdSubClientePedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_sub_clienteFK_IdSubClientePedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_sub_clienteFK_IdSubClientePedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_sub_clienteFK_IdSubClientePedidoExpor= new JComboBoxMe(); jComboBoxid_sub_clienteFK_IdSubClientePedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_sub_clienteFK_IdSubClientePedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_sub_clienteFK_IdSubClientePedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_sub_clienteFK_IdSubClientePedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jPanelFK_IdTipoCambioPedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdTipoCambioPedidoExpor.setToolTipText("Buscar Por Tipo Cambio "); this.jButtonFK_IdTipoCambioPedidoExpor= new JButtonMe(); this.jButtonFK_IdTipoCambioPedidoExpor.setText("Buscar"); this.jButtonFK_IdTipoCambioPedidoExpor.setToolTipText("Buscar Por Tipo Cambio "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdTipoCambioPedidoExpor,"buscar_button","Buscar Por Tipo Cambio "); FuncionesSwing.setBoldButton(this.jButtonFK_IdTipoCambioPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_tipo_cambioFK_IdTipoCambioPedidoExpor = new JLabelMe(); jLabelid_tipo_cambioFK_IdTipoCambioPedidoExpor.setText("Tipo Cambio :"); jLabelid_tipo_cambioFK_IdTipoCambioPedidoExpor.setToolTipText("Tipo Cambio"); jLabelid_tipo_cambioFK_IdTipoCambioPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_tipo_cambioFK_IdTipoCambioPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_tipo_cambioFK_IdTipoCambioPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_tipo_cambioFK_IdTipoCambioPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_tipo_cambioFK_IdTipoCambioPedidoExpor= new JComboBoxMe(); jComboBoxid_tipo_cambioFK_IdTipoCambioPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_tipo_cambioFK_IdTipoCambioPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_tipo_cambioFK_IdTipoCambioPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_tipo_cambioFK_IdTipoCambioPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonBuscarFK_IdTipoCambioid_tipo_cambioPedidoExpor= new JButtonMe(); this.jButtonBuscarFK_IdTipoCambioid_tipo_cambioPedidoExpor.setMinimumSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdTipoCambioid_tipo_cambioPedidoExpor.setMaximumSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdTipoCambioid_tipo_cambioPedidoExpor.setPreferredSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdTipoCambioid_tipo_cambioPedidoExpor.setText("Buscar"); this.jButtonBuscarFK_IdTipoCambioid_tipo_cambioPedidoExpor.setToolTipText("Buscar"); this.jButtonBuscarFK_IdTipoCambioid_tipo_cambioPedidoExpor.setFocusable(false); this.jPanelFK_IdTipoPrecioPedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdTipoPrecioPedidoExpor.setToolTipText("Buscar Por Tipo Precio "); this.jButtonFK_IdTipoPrecioPedidoExpor= new JButtonMe(); this.jButtonFK_IdTipoPrecioPedidoExpor.setText("Buscar"); this.jButtonFK_IdTipoPrecioPedidoExpor.setToolTipText("Buscar Por Tipo Precio "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdTipoPrecioPedidoExpor,"buscar_button","Buscar Por Tipo Precio "); FuncionesSwing.setBoldButton(this.jButtonFK_IdTipoPrecioPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_tipo_precioFK_IdTipoPrecioPedidoExpor = new JLabelMe(); jLabelid_tipo_precioFK_IdTipoPrecioPedidoExpor.setText("Tipo Precio :"); jLabelid_tipo_precioFK_IdTipoPrecioPedidoExpor.setToolTipText("Tipo Precio"); jLabelid_tipo_precioFK_IdTipoPrecioPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_tipo_precioFK_IdTipoPrecioPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_tipo_precioFK_IdTipoPrecioPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_tipo_precioFK_IdTipoPrecioPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_tipo_precioFK_IdTipoPrecioPedidoExpor= new JComboBoxMe(); jComboBoxid_tipo_precioFK_IdTipoPrecioPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_tipo_precioFK_IdTipoPrecioPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_tipo_precioFK_IdTipoPrecioPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_tipo_precioFK_IdTipoPrecioPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jPanelFK_IdTransportePedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdTransportePedidoExpor.setToolTipText("Buscar Por Transporte "); this.jButtonFK_IdTransportePedidoExpor= new JButtonMe(); this.jButtonFK_IdTransportePedidoExpor.setText("Buscar"); this.jButtonFK_IdTransportePedidoExpor.setToolTipText("Buscar Por Transporte "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdTransportePedidoExpor,"buscar_button","Buscar Por Transporte "); FuncionesSwing.setBoldButton(this.jButtonFK_IdTransportePedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_transporteFK_IdTransportePedidoExpor = new JLabelMe(); jLabelid_transporteFK_IdTransportePedidoExpor.setText("Transporte :"); jLabelid_transporteFK_IdTransportePedidoExpor.setToolTipText("Transporte"); jLabelid_transporteFK_IdTransportePedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_transporteFK_IdTransportePedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_transporteFK_IdTransportePedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_transporteFK_IdTransportePedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_transporteFK_IdTransportePedidoExpor= new JComboBoxMe(); jComboBoxid_transporteFK_IdTransportePedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_transporteFK_IdTransportePedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_transporteFK_IdTransportePedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_transporteFK_IdTransportePedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jPanelFK_IdTransportistaPedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdTransportistaPedidoExpor.setToolTipText("Buscar Por Transportista "); this.jButtonFK_IdTransportistaPedidoExpor= new JButtonMe(); this.jButtonFK_IdTransportistaPedidoExpor.setText("Buscar"); this.jButtonFK_IdTransportistaPedidoExpor.setToolTipText("Buscar Por Transportista "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdTransportistaPedidoExpor,"buscar_button","Buscar Por Transportista "); FuncionesSwing.setBoldButton(this.jButtonFK_IdTransportistaPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_transportistaFK_IdTransportistaPedidoExpor = new JLabelMe(); jLabelid_transportistaFK_IdTransportistaPedidoExpor.setText("Transportista :"); jLabelid_transportistaFK_IdTransportistaPedidoExpor.setToolTipText("Transportista"); jLabelid_transportistaFK_IdTransportistaPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_transportistaFK_IdTransportistaPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_transportistaFK_IdTransportistaPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_transportistaFK_IdTransportistaPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_transportistaFK_IdTransportistaPedidoExpor= new JComboBoxMe(); jComboBoxid_transportistaFK_IdTransportistaPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_transportistaFK_IdTransportistaPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_transportistaFK_IdTransportistaPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_transportistaFK_IdTransportistaPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jPanelFK_IdVendedorPedidoExpor=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdVendedorPedidoExpor.setToolTipText("Buscar Por Vendedor "); this.jButtonFK_IdVendedorPedidoExpor= new JButtonMe(); this.jButtonFK_IdVendedorPedidoExpor.setText("Buscar"); this.jButtonFK_IdVendedorPedidoExpor.setToolTipText("Buscar Por Vendedor "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdVendedorPedidoExpor,"buscar_button","Buscar Por Vendedor "); FuncionesSwing.setBoldButton(this.jButtonFK_IdVendedorPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_vendedorFK_IdVendedorPedidoExpor = new JLabelMe(); jLabelid_vendedorFK_IdVendedorPedidoExpor.setText("Vendedor :"); jLabelid_vendedorFK_IdVendedorPedidoExpor.setToolTipText("Vendedor"); jLabelid_vendedorFK_IdVendedorPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_vendedorFK_IdVendedorPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_vendedorFK_IdVendedorPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL2 + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL2,-17),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_vendedorFK_IdVendedorPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_vendedorFK_IdVendedorPedidoExpor= new JComboBoxMe(); jComboBoxid_vendedorFK_IdVendedorPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_vendedorFK_IdVendedorPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_vendedorFK_IdVendedorPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_vendedorFK_IdVendedorPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonBuscarFK_IdVendedorid_vendedorPedidoExpor= new JButtonMe(); this.jButtonBuscarFK_IdVendedorid_vendedorPedidoExpor.setMinimumSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdVendedorid_vendedorPedidoExpor.setMaximumSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdVendedorid_vendedorPedidoExpor.setPreferredSize(new Dimension(50,Constantes.ISWING_ALTO_CONTROL)); this.jButtonBuscarFK_IdVendedorid_vendedorPedidoExpor.setText("Buscar"); this.jButtonBuscarFK_IdVendedorid_vendedorPedidoExpor.setToolTipText("Buscar"); this.jButtonBuscarFK_IdVendedorid_vendedorPedidoExpor.setFocusable(false); this.jTabbedPaneBusquedasPedidoExpor=new JTabbedPane(); this.jTabbedPaneBusquedasPedidoExpor.setMinimumSize(new Dimension(this.getWidth(),Constantes.ISWING_ALTO_TABPANE_BUSQUEDA + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_TABPANE_BUSQUEDA,45))); this.jTabbedPaneBusquedasPedidoExpor.setMaximumSize(new Dimension(this.getWidth(),Constantes.ISWING_ALTO_TABPANE_BUSQUEDA + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_TABPANE_BUSQUEDA,45))); this.jTabbedPaneBusquedasPedidoExpor.setPreferredSize(new Dimension(this.getWidth(),Constantes.ISWING_ALTO_TABPANE_BUSQUEDA + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_TABPANE_BUSQUEDA,45))); //this.jTabbedPaneBusquedasPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Busqueda")); this.jTabbedPaneBusquedasPedidoExpor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); FuncionesSwing.setBoldTabbedPane(this.jTabbedPaneBusquedasPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); //INDICES BUSQUEDA_FIN } //JPanel //@SuppressWarnings({"unchecked" })//"rawtypes" public JScrollPane getJContentPane(int iWidth,int iHeight,JDesktopPane jDesktopPane,Boolean cargarRelaciones,Usuario usuarioActual,ResumenUsuario resumenUsuarioActual,Modulo moduloActual,Opcion opcionActual,ParametroGeneralSg parametroGeneralSg,ParametroGeneralUsuario parametroGeneralUsuario,PaginaTipo paginaTipo) throws Exception { //PARA TABLA PARAMETROS String sKeyStrokeName=""; KeyStroke keyStrokeControl=null; this.jContentPane = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.usuarioActual=usuarioActual; this.resumenUsuarioActual=resumenUsuarioActual; this.opcionActual=opcionActual; this.moduloActual=moduloActual; this.parametroGeneralSg=parametroGeneralSg; this.parametroGeneralUsuario=parametroGeneralUsuario; this.jDesktopPane=jDesktopPane; this.conFuncionalidadRelaciones=parametroGeneralUsuario.getcon_guardar_relaciones(); //INDEPENDIENTE DEL PARAMETRO TIENE LA FUNCIONALIDAD DE GUARDAR RELACIONES this.conFuncionalidadRelaciones=true; int iGridyPrincipal=0; this.inicializarToolBar(); //CARGAR MENUS if(this.conCargarFormDetalle) { //true) { //this.jInternalFrameDetallePedidoExpor = new PedidoExporDetalleJInternalFrame(paginaTipo);//JInternalFrameBase("Pedido Exportacion DATOS"); this.jInternalFrameDetalleFormPedidoExpor = new PedidoExporDetalleFormJInternalFrame(jDesktopPane,this.pedidoexporSessionBean.getConGuardarRelaciones(),this.pedidoexporSessionBean.getEsGuardarRelacionado(),cargarRelaciones,usuarioActual,resumenUsuarioActual,moduloActual,opcionActual,parametroGeneralSg,parametroGeneralUsuario,paginaTipo); } else { this.jInternalFrameDetalleFormPedidoExpor = null;//new PedidoExporDetalleFormJInternalFrame("MINIMO"); } this.cargarMenus(); this.gridaBagLayoutPedidoExpor= new GridBagLayout(); this.jTableDatosPedidoExpor = new JTableMe(); String sToolTipPedidoExpor=""; sToolTipPedidoExpor=PedidoExporConstantesFunciones.SCLASSWEBTITULO; if(Constantes.ISDEVELOPING) { sToolTipPedidoExpor+="(Facturacion.PedidoExpor)"; } if(!this.pedidoexporSessionBean.getEsGuardarRelacionado()) { sToolTipPedidoExpor+="_"+this.opcionActual.getId(); } this.jTableDatosPedidoExpor.setToolTipText(sToolTipPedidoExpor); //SE DEFINE EN DETALLE //FuncionesSwing.setBoldLabelTable(this.jTableDatosPedidoExpor); this.jTableDatosPedidoExpor.setAutoCreateRowSorter(true); this.jTableDatosPedidoExpor.setRowHeight(Constantes.ISWING_ALTO_FILA_TABLA + Constantes.ISWING_ALTO_FILA_TABLA_EXTRA_FECHA); //MULTIPLE SELECTION this.jTableDatosPedidoExpor.setRowSelectionAllowed(true); this.jTableDatosPedidoExpor.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); FuncionesSwing.setBoldTable(jTableDatosPedidoExpor,STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonNuevoPedidoExpor = new JButtonMe(); this.jButtonDuplicarPedidoExpor = new JButtonMe(); this.jButtonCopiarPedidoExpor = new JButtonMe(); this.jButtonVerFormPedidoExpor = new JButtonMe(); this.jButtonNuevoRelacionesPedidoExpor = new JButtonMe(); this.jButtonGuardarCambiosTablaPedidoExpor = new JButtonMe(); this.jButtonCerrarPedidoExpor = new JButtonMe(); this.jScrollPanelDatosPedidoExpor = new JScrollPane(); this.jScrollPanelDatosGeneralPedidoExpor = new JScrollPane(); this.jPanelAccionesPedidoExpor = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true); //if(!this.conCargarMinimo) { this.jPanelCamposFintotalPedidoExpor = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);; //} this.sPath=" <---> Acceso: Pedido Exportacion"; if(!this.pedidoexporSessionBean.getEsGuardarRelacionado()) { this.jScrollPanelDatosPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Pedido Exportacions" + this.sPath)); } else { this.jScrollPanelDatosPedidoExpor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); } this.jScrollPanelDatosGeneralPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Edicion Datos")); this.jPanelAccionesPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Acciones")); this.jPanelAccionesPedidoExpor.setToolTipText("Acciones"); this.jPanelAccionesPedidoExpor.setName("Acciones"); FuncionesSwing.setBoldScrollPanel(this.jScrollPanelDatosGeneralPedidoExpor, STIPO_TAMANIO_GENERAL,false,false,this); FuncionesSwing.setBoldScrollPanel(this.jScrollPanelDatosPedidoExpor, STIPO_TAMANIO_GENERAL,false,false,this); //if(!this.conCargarMinimo) { this.jPanelCamposFintotalPedidoExpor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.jPanelCamposFintotalPedidoExpor.setName("jPanelCamposFintotalPedidoExpor"); FuncionesSwing.setBoldPanel(this.jPanelCamposFintotalPedidoExpor, STIPO_TAMANIO_GENERAL,false,false,this);; //} //ELEMENTOS TABLAS PARAMETOS if(!this.conCargarMinimo) { } //ELEMENTOS TABLAS PARAMETOS_FIN if(!this.conCargarMinimo) { //REPORTE DINAMICO //NO CARGAR INICIALMENTE, EN BOTON AL ABRIR //this.jInternalFrameReporteDinamicoPedidoExpor=new ReporteDinamicoJInternalFrame(PedidoExporConstantesFunciones.SCLASSWEBTITULO,this); //this.cargarReporteDinamicoPedidoExpor(); //IMPORTACION //NO CARGAR INICIALMENTE, EN BOTON AL ABRIR //this.jInternalFrameImportacionPedidoExpor=new ImportacionJInternalFrame(PedidoExporConstantesFunciones.SCLASSWEBTITULO,this); //this.cargarImportacionPedidoExpor(); } String sMapKey = ""; InputMap inputMap =null; this.jButtonAbrirOrderByPedidoExpor = new JButtonMe(); this.jButtonAbrirOrderByPedidoExpor.setText("Orden"); this.jButtonAbrirOrderByPedidoExpor.setToolTipText("Orden"+FuncionesSwing.getKeyMensaje("ORDEN")); FuncionesSwing.addImagenButtonGeneral(this.jButtonAbrirOrderByPedidoExpor,"orden_button","Orden"); FuncionesSwing.setBoldButton(this.jButtonAbrirOrderByPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; sMapKey = "AbrirOrderBySistema"; inputMap = this.jButtonAbrirOrderByPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("ORDEN") , FuncionesSwing.getMaskKey("ORDEN")), sMapKey); this.jButtonAbrirOrderByPedidoExpor.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"AbrirOrderBySistema")); if(!this.conCargarMinimo) { //NO CARGAR INICIALMENTE, EN BOTON AL ABRIR //this.jInternalFrameOrderByPedidoExpor=new OrderByJInternalFrame(STIPO_TAMANIO_GENERAL,this.jButtonAbrirOrderByPedidoExpor,false,this); //this.cargarOrderByPedidoExpor(false); } else { //NO CARGAR INICIALMENTE, EN BOTON AL ABRIR //this.jInternalFrameOrderByPedidoExpor=new OrderByJInternalFrame(STIPO_TAMANIO_GENERAL,this.jButtonAbrirOrderByPedidoExpor,true,this); //this.cargarOrderByPedidoExpor(true); } //VALORES PARA DISENO /* this.jTableDatosPedidoExpor.setMinimumSize(new Dimension(400,50));//4330 this.jTableDatosPedidoExpor.setMaximumSize(new Dimension(400,50));//4330 this.jTableDatosPedidoExpor.setPreferredSize(new Dimension(400,50));//4330 this.jScrollPanelDatosPedidoExpor.setMinimumSize(new Dimension(400,50)); this.jScrollPanelDatosPedidoExpor.setMaximumSize(new Dimension(400,50)); this.jScrollPanelDatosPedidoExpor.setPreferredSize(new Dimension(400,50)); */ this.jButtonNuevoPedidoExpor.setText("Nuevo"); this.jButtonDuplicarPedidoExpor.setText("Duplicar"); this.jButtonCopiarPedidoExpor.setText("Copiar"); this.jButtonVerFormPedidoExpor.setText("Ver"); this.jButtonNuevoRelacionesPedidoExpor.setText("Nuevo Rel"); this.jButtonGuardarCambiosTablaPedidoExpor.setText("Guardar"); this.jButtonCerrarPedidoExpor.setText("Salir"); FuncionesSwing.addImagenButtonGeneral(this.jButtonNuevoPedidoExpor,"nuevo_button","Nuevo",this.pedidoexporSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonDuplicarPedidoExpor,"duplicar_button","Duplicar",this.pedidoexporSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonCopiarPedidoExpor,"copiar_button","Copiar",this.pedidoexporSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonVerFormPedidoExpor,"ver_form","Ver",this.pedidoexporSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonNuevoRelacionesPedidoExpor,"nuevorelaciones_button","Nuevo Rel",this.pedidoexporSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonGuardarCambiosTablaPedidoExpor,"guardarcambiostabla_button","Guardar",this.pedidoexporSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarPedidoExpor,"cerrar_button","Salir",this.pedidoexporSessionBean.getEsGuardarRelacionado()); FuncionesSwing.setBoldButton(this.jButtonNuevoPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonDuplicarPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonCopiarPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonVerFormPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonNuevoRelacionesPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonGuardarCambiosTablaPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonCerrarPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonNuevoPedidoExpor.setToolTipText("Nuevo"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("NUEVO")); this.jButtonDuplicarPedidoExpor.setToolTipText("Duplicar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("DUPLICAR")); this.jButtonCopiarPedidoExpor.setToolTipText("Copiar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO+ FuncionesSwing.getKeyMensaje("COPIAR")); this.jButtonVerFormPedidoExpor.setToolTipText("Ver"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO+ FuncionesSwing.getKeyMensaje("VER_FORM")); this.jButtonNuevoRelacionesPedidoExpor.setToolTipText("Nuevo Rel"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("NUEVO_RELACIONES")); this.jButtonGuardarCambiosTablaPedidoExpor.setToolTipText("Guardar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS")); this.jButtonCerrarPedidoExpor.setToolTipText("Salir"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("CERRAR")); //HOT KEYS /* N->Nuevo N->Alt + Nuevo Relaciones (ANTES R) A->Actualizar E->Eliminar S->Cerrar C->->Mayus + Cancelar (ANTES Q->Quit) G->Guardar Cambios D->Duplicar C->Alt + Cop?ar O->Orden N->Nuevo Tabla R->Recargar Informacion Inicial (ANTES I) Alt + Pag.Down->Siguientes Alt + Pag.Up->Anteriores NO UTILIZADOS M->Modificar */ //String sMapKey = ""; //InputMap inputMap =null; //NUEVO sMapKey = "NuevoPedidoExpor"; inputMap = this.jButtonNuevoPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("NUEVO") , FuncionesSwing.getMaskKey("NUEVO")), sMapKey); this.jButtonNuevoPedidoExpor.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"NuevoPedidoExpor")); //DUPLICAR sMapKey = "DuplicarPedidoExpor"; inputMap = this.jButtonDuplicarPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("DUPLICAR") , FuncionesSwing.getMaskKey("DUPLICAR")), sMapKey); this.jButtonDuplicarPedidoExpor.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"DuplicarPedidoExpor")); //COPIAR sMapKey = "CopiarPedidoExpor"; inputMap = this.jButtonCopiarPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("COPIAR") , FuncionesSwing.getMaskKey("COPIAR")), sMapKey); this.jButtonCopiarPedidoExpor.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"CopiarPedidoExpor")); //VEr FORM sMapKey = "VerFormPedidoExpor"; inputMap = this.jButtonVerFormPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("VER_FORM") , FuncionesSwing.getMaskKey("VER_FORM")), sMapKey); this.jButtonVerFormPedidoExpor.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"VerFormPedidoExpor")); //NUEVO RELACIONES sMapKey = "NuevoRelacionesPedidoExpor"; inputMap = this.jButtonNuevoRelacionesPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("NUEVO_RELACIONES") , FuncionesSwing.getMaskKey("NUEVO_RELACIONES")), sMapKey); this.jButtonNuevoRelacionesPedidoExpor.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"NuevoRelacionesPedidoExpor")); //MODIFICAR /* sMapKey = "ModificarPedidoExpor"; inputMap = this.jButtonModificarPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("MODIFICAR") , FuncionesSwing.getMaskKey("MODIFICAR")), sMapKey); this.jButtonModificarPedidoExpor.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"ModificarPedidoExpor")); */ //CERRAR sMapKey = "CerrarPedidoExpor"; inputMap = this.jButtonCerrarPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("CERRAR") , FuncionesSwing.getMaskKey("CERRAR")), sMapKey); this.jButtonCerrarPedidoExpor.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"CerrarPedidoExpor")); //GUARDAR CAMBIOS sMapKey = "GuardarCambiosTablaPedidoExpor"; inputMap = this.jButtonGuardarCambiosTablaPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("GUARDAR_CAMBIOS") , FuncionesSwing.getMaskKey("GUARDAR_CAMBIOS")), sMapKey); this.jButtonGuardarCambiosTablaPedidoExpor.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"GuardarCambiosTablaPedidoExpor")); //ABRIR ORDER BY if(!this.conCargarMinimo) { } //HOT KEYS this.jPanelParametrosReportesPedidoExpor = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosReportesAccionesPedidoExpor = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelPaginacionPedidoExpor = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosAuxiliar1PedidoExpor= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosAuxiliar2PedidoExpor= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosAuxiliar3PedidoExpor= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosAuxiliar4PedidoExpor= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); //this.jPanelParametrosAuxiliar5PedidoExpor= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosReportesPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Parametros Reportes-Acciones")); this.jPanelParametrosReportesPedidoExpor.setName("jPanelParametrosReportesPedidoExpor"); this.jPanelParametrosReportesAccionesPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Parametros Acciones")); //this.jPanelParametrosReportesAccionesPedidoExpor.setBorder(javax.swing.BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); this.jPanelParametrosReportesAccionesPedidoExpor.setName("jPanelParametrosReportesAccionesPedidoExpor"); FuncionesSwing.setBoldPanel(this.jPanelParametrosReportesPedidoExpor, STIPO_TAMANIO_GENERAL,false,false,this); FuncionesSwing.setBoldPanel(this.jPanelParametrosReportesAccionesPedidoExpor, STIPO_TAMANIO_GENERAL,false,false,this); this.jButtonRecargarInformacionPedidoExpor = new JButtonMe(); this.jButtonRecargarInformacionPedidoExpor.setText("Recargar"); this.jButtonRecargarInformacionPedidoExpor.setToolTipText("Recargar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("RECARGAR")); FuncionesSwing.addImagenButtonGeneral(this.jButtonRecargarInformacionPedidoExpor,"recargar_button","Recargar"); this.jButtonProcesarInformacionPedidoExpor = new JButtonMe(); this.jButtonProcesarInformacionPedidoExpor.setText("Procesar"); this.jButtonProcesarInformacionPedidoExpor.setToolTipText("Procesar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO); this.jButtonProcesarInformacionPedidoExpor.setVisible(false); this.jButtonProcesarInformacionPedidoExpor.setMinimumSize(new Dimension(185,25)); this.jButtonProcesarInformacionPedidoExpor.setMaximumSize(new Dimension(185,25)); this.jButtonProcesarInformacionPedidoExpor.setPreferredSize(new Dimension(185,25)); this.jComboBoxTiposArchivosReportesPedidoExpor = new JComboBoxMe(); //this.jComboBoxTiposArchivosReportesPedidoExpor.setText("TIPO"); this.jComboBoxTiposArchivosReportesPedidoExpor.setToolTipText("Tipos De Archivo"); this.jComboBoxTiposReportesPedidoExpor = new JComboBoxMe(); //this.jComboBoxTiposArchivosReportesPedidoExpor.setText("TIPO"); this.jComboBoxTiposReportesPedidoExpor.setToolTipText("Tipos De Reporte"); this.jComboBoxTiposGraficosReportesPedidoExpor = new JComboBoxMe(); //this.jComboBoxTiposArchivosReportesPedidoExpor.setText("TIPO"); this.jComboBoxTiposGraficosReportesPedidoExpor.setToolTipText("Tipos De Reporte"); this.jComboBoxTiposPaginacionPedidoExpor = new JComboBoxMe(); //this.jComboBoxTiposPaginacionPedidoExpor.setText("Paginacion"); this.jComboBoxTiposPaginacionPedidoExpor.setToolTipText("Tipos De Paginacion"); this.jComboBoxTiposRelacionesPedidoExpor = new JComboBoxMe(); //this.jComboBoxTiposRelacionesPedidoExpor.setText("Accion"); this.jComboBoxTiposRelacionesPedidoExpor.setToolTipText("Tipos de Relaciones"); this.jComboBoxTiposAccionesPedidoExpor = new JComboBoxMe(); //this.jComboBoxTiposAccionesPedidoExpor.setText("Accion"); this.jComboBoxTiposAccionesPedidoExpor.setToolTipText("Tipos de Acciones"); this.jComboBoxTiposSeleccionarPedidoExpor = new JComboBoxMe(); //this.jComboBoxTiposSeleccionarPedidoExpor.setText("Accion"); this.jComboBoxTiposSeleccionarPedidoExpor.setToolTipText("Tipos de Seleccion"); this.jTextFieldValorCampoGeneralPedidoExpor=new JTextFieldMe(); this.jTextFieldValorCampoGeneralPedidoExpor.setMinimumSize(new Dimension(100,Constantes.ISWING_ALTO_CONTROL)); this.jTextFieldValorCampoGeneralPedidoExpor.setMaximumSize(new Dimension(100,Constantes.ISWING_ALTO_CONTROL)); this.jTextFieldValorCampoGeneralPedidoExpor.setPreferredSize(new Dimension(100,Constantes.ISWING_ALTO_CONTROL)); this.jLabelAccionesPedidoExpor = new JLabelMe(); this.jLabelAccionesPedidoExpor.setText("Acciones"); this.jLabelAccionesPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelAccionesPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelAccionesPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jCheckBoxSeleccionarTodosPedidoExpor = new JCheckBoxMe(); this.jCheckBoxSeleccionarTodosPedidoExpor.setText("Sel. Todos"); this.jCheckBoxSeleccionarTodosPedidoExpor.setToolTipText("Sel. Todos"); this.jCheckBoxSeleccionadosPedidoExpor = new JCheckBoxMe(); //this.jCheckBoxSeleccionadosPedidoExpor.setText("Seleccionados"); this.jCheckBoxSeleccionadosPedidoExpor.setToolTipText("SELECCIONAR SELECCIONADOS"); this.jCheckBoxConAltoMaximoTablaPedidoExpor = new JCheckBoxMe(); //this.jCheckBoxConAltoMaximoTablaPedidoExpor.setText("Con Maximo Alto Tabla"); this.jCheckBoxConAltoMaximoTablaPedidoExpor.setToolTipText("Con Maximo Alto Tabla"); this.jCheckBoxConGraficoReportePedidoExpor = new JCheckBoxMe(); this.jCheckBoxConGraficoReportePedidoExpor.setText("Graf."); this.jCheckBoxConGraficoReportePedidoExpor.setToolTipText("Con Grafico"); this.jButtonAnterioresPedidoExpor = new JButtonMe(); //this.jButtonAnterioresPedidoExpor.setText("<<"); this.jButtonAnterioresPedidoExpor.setToolTipText("Anteriores Datos" + FuncionesSwing.getKeyMensaje("ANTERIORES")); FuncionesSwing.addImagenButtonGeneral(this.jButtonAnterioresPedidoExpor,"anteriores_button","<<"); FuncionesSwing.setBoldButton(this.jButtonAnterioresPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonSiguientesPedidoExpor = new JButtonMe(); //this.jButtonSiguientesPedidoExpor.setText(">>"); this.jButtonSiguientesPedidoExpor.setToolTipText("Siguientes Datos" + FuncionesSwing.getKeyMensaje("SIGUIENTES")); FuncionesSwing.addImagenButtonGeneral(this.jButtonSiguientesPedidoExpor,"siguientes_button",">>"); FuncionesSwing.setBoldButton(this.jButtonSiguientesPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonNuevoGuardarCambiosPedidoExpor = new JButtonMe(); this.jButtonNuevoGuardarCambiosPedidoExpor.setText("Nue"); this.jButtonNuevoGuardarCambiosPedidoExpor.setToolTipText("Nuevo" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA")); FuncionesSwing.addImagenButtonGeneral(this.jButtonNuevoGuardarCambiosPedidoExpor,"nuevoguardarcambios_button","Nue",this.pedidoexporSessionBean.getEsGuardarRelacionado()); FuncionesSwing.setBoldButton(this.jButtonNuevoGuardarCambiosPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); //HOT KEYS2 /* T->Nuevo Tabla */ //NUEVO GUARDAR CAMBIOS O NUEVO TABLA sMapKey = "NuevoGuardarCambiosPedidoExpor"; inputMap = this.jButtonNuevoGuardarCambiosPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("NUEVO_TABLA") , FuncionesSwing.getMaskKey("NUEVO_TABLA")), sMapKey); this.jButtonNuevoGuardarCambiosPedidoExpor.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"NuevoGuardarCambiosPedidoExpor")); //RECARGAR sMapKey = "RecargarInformacionPedidoExpor"; inputMap = this.jButtonRecargarInformacionPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("RECARGAR") , FuncionesSwing.getMaskKey("RECARGAR")), sMapKey); this.jButtonRecargarInformacionPedidoExpor.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"RecargarInformacionPedidoExpor")); //SIGUIENTES sMapKey = "SiguientesPedidoExpor"; inputMap = this.jButtonSiguientesPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("SIGUIENTES") , FuncionesSwing.getMaskKey("SIGUIENTES")), sMapKey); this.jButtonSiguientesPedidoExpor.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"SiguientesPedidoExpor")); //ANTERIORES sMapKey = "AnterioresPedidoExpor"; inputMap = this.jButtonAnterioresPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("ANTERIORES") , FuncionesSwing.getMaskKey("ANTERIORES")), sMapKey); this.jButtonAnterioresPedidoExpor.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"AnterioresPedidoExpor")); //HOT KEYS2 //DETALLE //TOOLBAR //INDICES BUSQUEDA //INDICES BUSQUEDA_FIN //INDICES BUSQUEDA if(!this.conCargarMinimo) { this.inicializarElementosBusquedasPedidoExpor(); } //INDICES BUSQUEDA_FIN //ELEMENTOS TABLAS PARAMETOS if(!this.conCargarMinimo) { } //ELEMENTOS TABLAS PARAMETOS_FIN //ELEMENTOS TABLAS PARAMETOS_FIN //ESTA EN BEAN /* this.jTabbedPaneRelacionesPedidoExpor.setMinimumSize(new Dimension(this.getWidth(),PedidoExporBean.ALTO_TABPANE_RELACIONES + FuncionesSwing.getValorProporcion(PedidoExporBean.ALTO_TABPANE_RELACIONES,0))); this.jTabbedPaneRelacionesPedidoExpor.setMaximumSize(new Dimension(this.getWidth(),PedidoExporBean.ALTO_TABPANE_RELACIONES + FuncionesSwing.getValorProporcion(PedidoExporBean.ALTO_TABPANE_RELACIONES,0))); this.jTabbedPaneRelacionesPedidoExpor.setPreferredSize(new Dimension(this.getWidth(),PedidoExporBean.ALTO_TABPANE_RELACIONES + FuncionesSwing.getValorProporcion(PedidoExporBean.ALTO_TABPANE_RELACIONES,0))); */ int iPosXAccionPaginacion=0; GridBagLayout gridaBagLayoutPaginacionPedidoExpor = new GridBagLayout(); this.jPanelPaginacionPedidoExpor.setLayout(gridaBagLayoutPaginacionPedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.EAST; this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = 0; this.gridBagConstraintsPedidoExpor.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionPedidoExpor.add(this.jButtonAnterioresPedidoExpor, this.gridBagConstraintsPedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints();// this.gridBagConstraintsPedidoExpor.gridx = iPosXAccionPaginacion++;// this.gridBagConstraintsPedidoExpor.gridy = 0;// this.jPanelPaginacionPedidoExpor.add(this.jButtonNuevoGuardarCambiosPedidoExpor, this.gridBagConstraintsPedidoExpor);// this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.gridx = iPosXAccionPaginacion++; this.gridBagConstraintsPedidoExpor.gridy = 0; this.jPanelPaginacionPedidoExpor.add(this.jButtonSiguientesPedidoExpor, this.gridBagConstraintsPedidoExpor); iPosXAccionPaginacion=0; this.gridBagConstraintsPedidoExpor = new GridBagConstraints();// this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL;// this.gridBagConstraintsPedidoExpor.gridy = 1;// this.gridBagConstraintsPedidoExpor.gridx = iPosXAccionPaginacion++;// this.jPanelPaginacionPedidoExpor.add(this.jButtonNuevoPedidoExpor, this.gridBagConstraintsPedidoExpor);// if(this.conFuncionalidadRelaciones) { this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = 1; this.gridBagConstraintsPedidoExpor.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionPedidoExpor.add(this.jButtonNuevoRelacionesPedidoExpor, this.gridBagConstraintsPedidoExpor); } if(!this.pedidoexporSessionBean.getEsGuardarRelacionado() && !this.conCargarMinimo) { this.gridBagConstraintsPedidoExpor = new GridBagConstraints();// this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL;// this.gridBagConstraintsPedidoExpor.gridy = 1;// this.gridBagConstraintsPedidoExpor.gridx = iPosXAccionPaginacion++;// this.jPanelPaginacionPedidoExpor.add(this.jButtonGuardarCambiosTablaPedidoExpor, this.gridBagConstraintsPedidoExpor);// } this.gridBagConstraintsPedidoExpor = new GridBagConstraints();// this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL;// this.gridBagConstraintsPedidoExpor.gridy = 1;// this.gridBagConstraintsPedidoExpor.gridx = iPosXAccionPaginacion++;// this.jPanelPaginacionPedidoExpor.add(this.jButtonDuplicarPedidoExpor, this.gridBagConstraintsPedidoExpor);// this.gridBagConstraintsPedidoExpor = new GridBagConstraints();// this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL;// this.gridBagConstraintsPedidoExpor.gridy = 1;// this.gridBagConstraintsPedidoExpor.gridx = iPosXAccionPaginacion++;// this.jPanelPaginacionPedidoExpor.add(this.jButtonCopiarPedidoExpor, this.gridBagConstraintsPedidoExpor);// this.gridBagConstraintsPedidoExpor = new GridBagConstraints();// this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL;// this.gridBagConstraintsPedidoExpor.gridy = 1;// this.gridBagConstraintsPedidoExpor.gridx = iPosXAccionPaginacion++;// this.jPanelPaginacionPedidoExpor.add(this.jButtonVerFormPedidoExpor, this.gridBagConstraintsPedidoExpor);// this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = 1; this.gridBagConstraintsPedidoExpor.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionPedidoExpor.add(this.jButtonCerrarPedidoExpor, this.gridBagConstraintsPedidoExpor); this.jButtonRecargarInformacionPedidoExpor.setMinimumSize(new Dimension(95,25)); this.jButtonRecargarInformacionPedidoExpor.setMaximumSize(new Dimension(95,25)); this.jButtonRecargarInformacionPedidoExpor.setPreferredSize(new Dimension(95,25)); FuncionesSwing.setBoldButton(this.jButtonRecargarInformacionPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jComboBoxTiposArchivosReportesPedidoExpor.setMinimumSize(new Dimension(105,20)); this.jComboBoxTiposArchivosReportesPedidoExpor.setMaximumSize(new Dimension(105,20)); this.jComboBoxTiposArchivosReportesPedidoExpor.setPreferredSize(new Dimension(105,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposArchivosReportesPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposReportesPedidoExpor.setMinimumSize(new Dimension(100,20)); this.jComboBoxTiposReportesPedidoExpor.setMaximumSize(new Dimension(100,20)); this.jComboBoxTiposReportesPedidoExpor.setPreferredSize(new Dimension(100,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposReportesPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposGraficosReportesPedidoExpor.setMinimumSize(new Dimension(80,20)); this.jComboBoxTiposGraficosReportesPedidoExpor.setMaximumSize(new Dimension(80,20)); this.jComboBoxTiposGraficosReportesPedidoExpor.setPreferredSize(new Dimension(80,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposGraficosReportesPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposPaginacionPedidoExpor.setMinimumSize(new Dimension(80,20)); this.jComboBoxTiposPaginacionPedidoExpor.setMaximumSize(new Dimension(80,20)); this.jComboBoxTiposPaginacionPedidoExpor.setPreferredSize(new Dimension(80,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposPaginacionPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposRelacionesPedidoExpor.setMinimumSize(new Dimension(145,20)); this.jComboBoxTiposRelacionesPedidoExpor.setMaximumSize(new Dimension(145,20)); this.jComboBoxTiposRelacionesPedidoExpor.setPreferredSize(new Dimension(145,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposRelacionesPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposAccionesPedidoExpor.setMinimumSize(new Dimension(145,20)); this.jComboBoxTiposAccionesPedidoExpor.setMaximumSize(new Dimension(145,20)); this.jComboBoxTiposAccionesPedidoExpor.setPreferredSize(new Dimension(145,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposAccionesPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposSeleccionarPedidoExpor.setMinimumSize(new Dimension(145,20)); this.jComboBoxTiposSeleccionarPedidoExpor.setMaximumSize(new Dimension(145,20)); this.jComboBoxTiposSeleccionarPedidoExpor.setPreferredSize(new Dimension(145,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposSeleccionarPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; this.jCheckBoxConAltoMaximoTablaPedidoExpor.setMinimumSize(new Dimension(20,20)); this.jCheckBoxConAltoMaximoTablaPedidoExpor.setMaximumSize(new Dimension(20,20)); this.jCheckBoxConAltoMaximoTablaPedidoExpor.setPreferredSize(new Dimension(20,20)); FuncionesSwing.setBoldCheckBox(this.jCheckBoxConAltoMaximoTablaPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; this.jCheckBoxConGraficoReportePedidoExpor.setMinimumSize(new Dimension(60,20)); this.jCheckBoxConGraficoReportePedidoExpor.setMaximumSize(new Dimension(60,20)); this.jCheckBoxConGraficoReportePedidoExpor.setPreferredSize(new Dimension(60,20)); FuncionesSwing.setBoldCheckBox(this.jCheckBoxConGraficoReportePedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this); this.jCheckBoxSeleccionarTodosPedidoExpor.setMinimumSize(new Dimension(100,20)); this.jCheckBoxSeleccionarTodosPedidoExpor.setMaximumSize(new Dimension(100,20)); this.jCheckBoxSeleccionarTodosPedidoExpor.setPreferredSize(new Dimension(100,20)); FuncionesSwing.setBoldCheckBox(this.jCheckBoxSeleccionarTodosPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; this.jCheckBoxSeleccionadosPedidoExpor.setMinimumSize(new Dimension(20,20)); this.jCheckBoxSeleccionadosPedidoExpor.setMaximumSize(new Dimension(20,20)); this.jCheckBoxSeleccionadosPedidoExpor.setPreferredSize(new Dimension(20,20)); FuncionesSwing.setBoldCheckBox(this.jCheckBoxSeleccionadosPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; GridBagLayout gridaBagParametrosReportesPedidoExpor = new GridBagLayout(); GridBagLayout gridaBagParametrosReportesAccionesPedidoExpor = new GridBagLayout(); GridBagLayout gridaBagParametrosAuxiliar1PedidoExpor = new GridBagLayout(); GridBagLayout gridaBagParametrosAuxiliar2PedidoExpor = new GridBagLayout(); GridBagLayout gridaBagParametrosAuxiliar3PedidoExpor = new GridBagLayout(); GridBagLayout gridaBagParametrosAuxiliar4PedidoExpor = new GridBagLayout(); int iGridxParametrosReportes=0; int iGridyParametrosReportes=0; int iGridxParametrosAuxiliar=0; int iGridyParametrosAuxiliar=0; this.jPanelParametrosReportesPedidoExpor.setLayout(gridaBagParametrosReportesPedidoExpor); this.jPanelParametrosReportesAccionesPedidoExpor.setLayout(gridaBagParametrosReportesAccionesPedidoExpor); this.jPanelParametrosAuxiliar1PedidoExpor.setLayout(gridaBagParametrosAuxiliar1PedidoExpor); this.jPanelParametrosAuxiliar2PedidoExpor.setLayout(gridaBagParametrosAuxiliar2PedidoExpor); this.jPanelParametrosAuxiliar3PedidoExpor.setLayout(gridaBagParametrosAuxiliar3PedidoExpor); this.jPanelParametrosAuxiliar4PedidoExpor.setLayout(gridaBagParametrosAuxiliar4PedidoExpor); //this.jPanelParametrosAuxiliar5PedidoExpor.setLayout(gridaBagParametrosAuxiliar2PedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesPedidoExpor.add(this.jButtonRecargarInformacionPedidoExpor, this.gridBagConstraintsPedidoExpor); //PAGINACION this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar1PedidoExpor.add(this.jComboBoxTiposPaginacionPedidoExpor, this.gridBagConstraintsPedidoExpor); //CON ALTO MAXIMO TABLA this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar1PedidoExpor.add(this.jCheckBoxConAltoMaximoTablaPedidoExpor, this.gridBagConstraintsPedidoExpor); //TIPOS ARCHIVOS REPORTES this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar1PedidoExpor.add(this.jComboBoxTiposArchivosReportesPedidoExpor, this.gridBagConstraintsPedidoExpor); //USANDO AUXILIAR this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesPedidoExpor.add(this.jPanelParametrosAuxiliar1PedidoExpor, this.gridBagConstraintsPedidoExpor); //USANDO AUXILIAR FIN //AUXILIAR4 TIPOS REPORTES Y TIPOS GRAFICOS REPORTES iGridxParametrosAuxiliar=0; iGridyParametrosAuxiliar=0; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar4PedidoExpor.add(this.jComboBoxTiposReportesPedidoExpor, this.gridBagConstraintsPedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes //POR EL MOMENTO SOLO SE UTILIZA EN REPORTES DINAMICOS SIMPLES //this.jPanelParametrosAuxiliar4PedidoExpor.add(this.jComboBoxTiposGraficosReportesPedidoExpor, this.gridBagConstraintsPedidoExpor); //AUXILIAR4 TIPOS REPORTES Y TIPOS GRAFICOS REPORTES //USANDO AUXILIAR 4 this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesPedidoExpor.add(this.jPanelParametrosAuxiliar4PedidoExpor, this.gridBagConstraintsPedidoExpor); //USANDO AUXILIAR 4 FIN //TIPOS REPORTES /* this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes;//iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosReportes++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesPedidoExpor.add(this.jComboBoxTiposReportesPedidoExpor, this.gridBagConstraintsPedidoExpor); */ //GENERAR REPORTE (jCheckBoxExportar) /* this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesPedidoExpor.add(this.jCheckBoxGenerarReportePedidoExpor, this.gridBagConstraintsPedidoExpor); */ iGridxParametrosAuxiliar=0; iGridyParametrosAuxiliar=0; //USANDO AUXILIAR this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesPedidoExpor.add(this.jPanelParametrosAuxiliar2PedidoExpor, this.gridBagConstraintsPedidoExpor); //USANDO AUXILIAR FIN //PARAMETROS ACCIONES //iGridxParametrosReportes=1; iGridxParametrosReportes=0; iGridyParametrosReportes=1; /* this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx =iGridxParametrosReportes++; this.jPanelParametrosReportesPedidoExpor.add(this.jLabelAccionesPedidoExpor, this.gridBagConstraintsPedidoExpor); */ //PARAMETROS_ACCIONES-PARAMETROS_REPORTES //ORDER BY if(!this.conCargarMinimo) { this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesPedidoExpor.add(this.jButtonAbrirOrderByPedidoExpor, this.gridBagConstraintsPedidoExpor); } //PARAMETROS_ACCIONES-PARAMETROS_REPORTES this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesPedidoExpor.add(this.jComboBoxTiposSeleccionarPedidoExpor, this.gridBagConstraintsPedidoExpor); /* this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx =iGridxParametrosReportes++; this.jPanelParametrosReportesPedidoExpor.add(this.jCheckBoxSeleccionarTodosPedidoExpor, this.gridBagConstraintsPedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx =iGridxParametrosReportes++; this.jPanelParametrosReportesPedidoExpor.add(this.jCheckBoxConGraficoReportePedidoExpor, this.gridBagConstraintsPedidoExpor); */ iGridxParametrosAuxiliar=0; iGridyParametrosAuxiliar=0; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar3PedidoExpor.add(this.jCheckBoxSeleccionarTodosPedidoExpor, this.gridBagConstraintsPedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar3PedidoExpor.add(this.jCheckBoxSeleccionadosPedidoExpor, this.gridBagConstraintsPedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar3PedidoExpor.add(this.jCheckBoxConGraficoReportePedidoExpor, this.gridBagConstraintsPedidoExpor); //USANDO AUXILIAR3 this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesPedidoExpor.add(this.jPanelParametrosAuxiliar3PedidoExpor, this.gridBagConstraintsPedidoExpor); //USANDO AUXILIAR3 FIN this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesPedidoExpor.add(this.jComboBoxTiposRelacionesPedidoExpor, this.gridBagConstraintsPedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesPedidoExpor.add(this.jComboBoxTiposAccionesPedidoExpor, this.gridBagConstraintsPedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy = iGridyParametrosReportes; this.gridBagConstraintsPedidoExpor.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesPedidoExpor.add(this.jTextFieldValorCampoGeneralPedidoExpor, this.gridBagConstraintsPedidoExpor); GridBagLayout gridaBagLayoutCamposFintotalPedidoExpor= new GridBagLayout(); this.jPanelCamposFintotalPedidoExpor.setLayout(gridaBagLayoutCamposFintotalPedidoExpor);; //ELEMENTOS TABLAS PARAMETOS //SUBPANELES POR CAMPO if(!this.conCargarMinimo) { //SUBPANELES EN PANEL CAMPOS } //ELEMENTOS TABLAS PARAMETOS_FIN /* GridBagLayout gridaBagLayoutDatosPedidoExpor = new GridBagLayout(); this.jScrollPanelDatosPedidoExpor.setLayout(gridaBagLayoutDatosPedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = 0; this.gridBagConstraintsPedidoExpor.gridx = 0; this.jScrollPanelDatosPedidoExpor.add(this.jTableDatosPedidoExpor, this.gridBagConstraintsPedidoExpor); */ this.redimensionarTablaDatos(-1); this.jScrollPanelDatosPedidoExpor.setViewportView(this.jTableDatosPedidoExpor); this.jTableDatosPedidoExpor.setFillsViewportHeight(true); this.jTableDatosPedidoExpor.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); Integer iGridXParametrosAccionesFormulario=0; Integer iGridYParametrosAccionesFormulario=0; GridBagLayout gridaBagLayoutAccionesPedidoExpor= new GridBagLayout(); this.jPanelAccionesPedidoExpor.setLayout(gridaBagLayoutAccionesPedidoExpor); /* this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = 0; this.gridBagConstraintsPedidoExpor.gridx = 0; this.jPanelAccionesPedidoExpor.add(this.jButtonNuevoPedidoExpor, this.gridBagConstraintsPedidoExpor); */ int iPosXAccion=0; if(!this.conCargarMinimo) { //BYDAN_BUSQUEDAS GridBagLayout gridaBagLayoutFK_IdCentroCostoPedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdCentroCostoPedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdCentroCostoPedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdCentroCostoPedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdCentroCostoPedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdCentroCostoPedidoExpor.setLayout(gridaBagLayoutFK_IdCentroCostoPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdCentroCostoPedidoExpor.add(jLabelid_centro_costoFK_IdCentroCostoPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdCentroCostoPedidoExpor.add(jComboBoxid_centro_costoFK_IdCentroCostoPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.EAST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.NONE; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdCentroCostoPedidoExpor.add(this.jButtonBuscarFK_IdCentroCostoid_centro_costoPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdCentroCostoPedidoExpor.add(jButtonFK_IdCentroCostoPedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("1.-Por Centro Costo ", jPanelFK_IdCentroCostoPedidoExpor); jTabbedPaneBusquedasPedidoExpor.setMnemonicAt(0, KeyEvent.VK_1); GridBagLayout gridaBagLayoutFK_IdClientePedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdClientePedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdClientePedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdClientePedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdClientePedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdClientePedidoExpor.setLayout(gridaBagLayoutFK_IdClientePedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdClientePedidoExpor.add(jLabelid_clienteFK_IdClientePedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdClientePedidoExpor.add(jComboBoxid_clienteFK_IdClientePedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.EAST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.NONE; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdClientePedidoExpor.add(this.jButtonBuscarFK_IdClienteid_clientePedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdClientePedidoExpor.add(jButtonFK_IdClientePedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("2.-Por Cliente ", jPanelFK_IdClientePedidoExpor); jTabbedPaneBusquedasPedidoExpor.setMnemonicAt(1, KeyEvent.VK_2); GridBagLayout gridaBagLayoutFK_IdConsignatarioPedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdConsignatarioPedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdConsignatarioPedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdConsignatarioPedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdConsignatarioPedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdConsignatarioPedidoExpor.setLayout(gridaBagLayoutFK_IdConsignatarioPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdConsignatarioPedidoExpor.add(jLabelid_consignatarioFK_IdConsignatarioPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdConsignatarioPedidoExpor.add(jComboBoxid_consignatarioFK_IdConsignatarioPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdConsignatarioPedidoExpor.add(jButtonFK_IdConsignatarioPedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("3.-Por Consignatario ", jPanelFK_IdConsignatarioPedidoExpor); jTabbedPaneBusquedasPedidoExpor.setMnemonicAt(2, KeyEvent.VK_3); GridBagLayout gridaBagLayoutFK_IdConsultorPedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdConsultorPedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdConsultorPedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdConsultorPedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdConsultorPedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdConsultorPedidoExpor.setLayout(gridaBagLayoutFK_IdConsultorPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdConsultorPedidoExpor.add(jLabelid_consultorFK_IdConsultorPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdConsultorPedidoExpor.add(jComboBoxid_consultorFK_IdConsultorPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdConsultorPedidoExpor.add(jButtonFK_IdConsultorPedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("4.-Por Consultor ", jPanelFK_IdConsultorPedidoExpor); jTabbedPaneBusquedasPedidoExpor.setMnemonicAt(3, KeyEvent.VK_4); GridBagLayout gridaBagLayoutFK_IdEmpleadoPedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdEmpleadoPedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdEmpleadoPedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdEmpleadoPedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdEmpleadoPedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdEmpleadoPedidoExpor.setLayout(gridaBagLayoutFK_IdEmpleadoPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdEmpleadoPedidoExpor.add(jLabelid_empleadoFK_IdEmpleadoPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdEmpleadoPedidoExpor.add(jComboBoxid_empleadoFK_IdEmpleadoPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.EAST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.NONE; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdEmpleadoPedidoExpor.add(this.jButtonBuscarFK_IdEmpleadoid_empleadoPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdEmpleadoPedidoExpor.add(jButtonFK_IdEmpleadoPedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("5.-Por Empleado ", jPanelFK_IdEmpleadoPedidoExpor); jTabbedPaneBusquedasPedidoExpor.setMnemonicAt(4, KeyEvent.VK_5); GridBagLayout gridaBagLayoutFK_IdEstadoPedidoExporPedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdEstadoPedidoExporPedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdEstadoPedidoExporPedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdEstadoPedidoExporPedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdEstadoPedidoExporPedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdEstadoPedidoExporPedidoExpor.setLayout(gridaBagLayoutFK_IdEstadoPedidoExporPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdEstadoPedidoExporPedidoExpor.add(jLabelid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdEstadoPedidoExporPedidoExpor.add(jComboBoxid_estado_pedidoFK_IdEstadoPedidoExporPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdEstadoPedidoExporPedidoExpor.add(jButtonFK_IdEstadoPedidoExporPedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("6.-Por Estado ", jPanelFK_IdEstadoPedidoExporPedidoExpor); jTabbedPaneBusquedasPedidoExpor.setMnemonicAt(5, KeyEvent.VK_6); GridBagLayout gridaBagLayoutFK_IdFormatoPedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdFormatoPedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdFormatoPedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdFormatoPedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdFormatoPedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdFormatoPedidoExpor.setLayout(gridaBagLayoutFK_IdFormatoPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdFormatoPedidoExpor.add(jLabelid_formatoFK_IdFormatoPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdFormatoPedidoExpor.add(jComboBoxid_formatoFK_IdFormatoPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdFormatoPedidoExpor.add(jButtonFK_IdFormatoPedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("7.-Por Formato ", jPanelFK_IdFormatoPedidoExpor); jTabbedPaneBusquedasPedidoExpor.setMnemonicAt(6, KeyEvent.VK_7); GridBagLayout gridaBagLayoutFK_IdPaisPedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdPaisPedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdPaisPedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdPaisPedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdPaisPedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdPaisPedidoExpor.setLayout(gridaBagLayoutFK_IdPaisPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdPaisPedidoExpor.add(jLabelid_paisFK_IdPaisPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdPaisPedidoExpor.add(jComboBoxid_paisFK_IdPaisPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdPaisPedidoExpor.add(jButtonFK_IdPaisPedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("8.-Por Origen ", jPanelFK_IdPaisPedidoExpor); jTabbedPaneBusquedasPedidoExpor.setMnemonicAt(7, KeyEvent.VK_8); GridBagLayout gridaBagLayoutFK_IdResponsablePedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdResponsablePedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdResponsablePedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdResponsablePedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdResponsablePedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdResponsablePedidoExpor.setLayout(gridaBagLayoutFK_IdResponsablePedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdResponsablePedidoExpor.add(jLabelid_responsableFK_IdResponsablePedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdResponsablePedidoExpor.add(jComboBoxid_responsableFK_IdResponsablePedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdResponsablePedidoExpor.add(jButtonFK_IdResponsablePedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("9.-Por Responsable ", jPanelFK_IdResponsablePedidoExpor); jTabbedPaneBusquedasPedidoExpor.setMnemonicAt(8, KeyEvent.VK_9); GridBagLayout gridaBagLayoutFK_IdSubClientePedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdSubClientePedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdSubClientePedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdSubClientePedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdSubClientePedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdSubClientePedidoExpor.setLayout(gridaBagLayoutFK_IdSubClientePedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdSubClientePedidoExpor.add(jLabelid_sub_clienteFK_IdSubClientePedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdSubClientePedidoExpor.add(jComboBoxid_sub_clienteFK_IdSubClientePedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdSubClientePedidoExpor.add(jButtonFK_IdSubClientePedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("10.-Por Contacto ", jPanelFK_IdSubClientePedidoExpor); GridBagLayout gridaBagLayoutFK_IdTipoCambioPedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdTipoCambioPedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdTipoCambioPedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdTipoCambioPedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdTipoCambioPedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdTipoCambioPedidoExpor.setLayout(gridaBagLayoutFK_IdTipoCambioPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdTipoCambioPedidoExpor.add(jLabelid_tipo_cambioFK_IdTipoCambioPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdTipoCambioPedidoExpor.add(jComboBoxid_tipo_cambioFK_IdTipoCambioPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.EAST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.NONE; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdTipoCambioPedidoExpor.add(this.jButtonBuscarFK_IdTipoCambioid_tipo_cambioPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdTipoCambioPedidoExpor.add(jButtonFK_IdTipoCambioPedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("11.-Por Tipo Cambio ", jPanelFK_IdTipoCambioPedidoExpor); GridBagLayout gridaBagLayoutFK_IdTipoPrecioPedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdTipoPrecioPedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdTipoPrecioPedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdTipoPrecioPedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdTipoPrecioPedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdTipoPrecioPedidoExpor.setLayout(gridaBagLayoutFK_IdTipoPrecioPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdTipoPrecioPedidoExpor.add(jLabelid_tipo_precioFK_IdTipoPrecioPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdTipoPrecioPedidoExpor.add(jComboBoxid_tipo_precioFK_IdTipoPrecioPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdTipoPrecioPedidoExpor.add(jButtonFK_IdTipoPrecioPedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("12.-Por Tipo Precio ", jPanelFK_IdTipoPrecioPedidoExpor); GridBagLayout gridaBagLayoutFK_IdTransportePedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdTransportePedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdTransportePedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdTransportePedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdTransportePedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdTransportePedidoExpor.setLayout(gridaBagLayoutFK_IdTransportePedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdTransportePedidoExpor.add(jLabelid_transporteFK_IdTransportePedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdTransportePedidoExpor.add(jComboBoxid_transporteFK_IdTransportePedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdTransportePedidoExpor.add(jButtonFK_IdTransportePedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("13.-Por Transporte ", jPanelFK_IdTransportePedidoExpor); GridBagLayout gridaBagLayoutFK_IdTransportistaPedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdTransportistaPedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdTransportistaPedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdTransportistaPedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdTransportistaPedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdTransportistaPedidoExpor.setLayout(gridaBagLayoutFK_IdTransportistaPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdTransportistaPedidoExpor.add(jLabelid_transportistaFK_IdTransportistaPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdTransportistaPedidoExpor.add(jComboBoxid_transportistaFK_IdTransportistaPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdTransportistaPedidoExpor.add(jButtonFK_IdTransportistaPedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("14.-Por Transportista ", jPanelFK_IdTransportistaPedidoExpor); GridBagLayout gridaBagLayoutFK_IdVendedorPedidoExpor= new GridBagLayout(); gridaBagLayoutFK_IdVendedorPedidoExpor.rowHeights = new int[] {1}; gridaBagLayoutFK_IdVendedorPedidoExpor.columnWidths = new int[] {1}; gridaBagLayoutFK_IdVendedorPedidoExpor.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdVendedorPedidoExpor.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdVendedorPedidoExpor.setLayout(gridaBagLayoutFK_IdVendedorPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdVendedorPedidoExpor.add(jLabelid_vendedorFK_IdVendedorPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 1; jPanelFK_IdVendedorPedidoExpor.add(jComboBoxid_vendedorFK_IdVendedorPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.EAST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.NONE; gridBagConstraintsPedidoExpor.gridy = 0; gridBagConstraintsPedidoExpor.gridx = 0; jPanelFK_IdVendedorPedidoExpor.add(this.jButtonBuscarFK_IdVendedorid_vendedorPedidoExpor, gridBagConstraintsPedidoExpor); gridBagConstraintsPedidoExpor = new GridBagConstraints(); gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; gridBagConstraintsPedidoExpor.gridy = 1; gridBagConstraintsPedidoExpor.gridx =1; jPanelFK_IdVendedorPedidoExpor.add(jButtonFK_IdVendedorPedidoExpor, gridBagConstraintsPedidoExpor); jTabbedPaneBusquedasPedidoExpor.addTab("15.-Por Vendedor ", jPanelFK_IdVendedorPedidoExpor); } //this.setJProgressBarToJPanel(); GridBagLayout gridaBagLayoutPedidoExpor = new GridBagLayout(); this.jContentPane.setLayout(gridaBagLayoutPedidoExpor); if(this.parametroGeneralUsuario.getcon_botones_tool_bar() && !this.pedidoexporSessionBean.getEsGuardarRelacionado()) { this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy = iGridyPrincipal++; this.gridBagConstraintsPedidoExpor.gridx = 0; //this.gridBagConstraintsPedidoExpor.fill =GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.CENTER;//.CENTER;NORTH this.gridBagConstraintsPedidoExpor.ipadx = 100; this.jContentPane.add(this.jTtoolBarPedidoExpor, this.gridBagConstraintsPedidoExpor); } //PROCESANDO EN OTRA PANTALLA /* this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy = iGridyPrincipal++; this.gridBagConstraintsPedidoExpor.gridx = 0; //this.gridBagConstraintsPedidoExpor.fill =GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.CENTER; this.gridBagConstraintsPedidoExpor.ipadx = 100; this.jContentPane.add(this.jPanelProgressProcess, this.gridBagConstraintsPedidoExpor); */ int iGridxBusquedasParametros=0; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); if(!this.conCargarMinimo) { this.gridBagConstraintsPedidoExpor.gridy = iGridyPrincipal++; this.gridBagConstraintsPedidoExpor.gridx = 0; this.gridBagConstraintsPedidoExpor.fill =GridBagConstraints.BOTH;//GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.NORTHWEST; this.gridBagConstraintsPedidoExpor.ipadx = 150; if(!this.conCargarMinimo) { this.jContentPane.add(this.jTabbedPaneBusquedasPedidoExpor, this.gridBagConstraintsPedidoExpor); } } //PARAMETROS TABLAS PARAMETROS if(!this.conCargarMinimo) { } //PARAMETROS TABLAS PARAMETROS_FIN //PARAMETROS REPORTES this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy = iGridyPrincipal++; this.gridBagConstraintsPedidoExpor.gridx = 0; this.jContentPane.add(this.jPanelParametrosReportesPedidoExpor, this.gridBagConstraintsPedidoExpor); /* this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy = iGridyPrincipal++; this.gridBagConstraintsPedidoExpor.gridx = 0; this.jContentPane.add(this.jPanelParametrosReportesAccionesPedidoExpor, this.gridBagConstraintsPedidoExpor); */ this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy =iGridyPrincipal++; this.gridBagConstraintsPedidoExpor.gridx =0; this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.BOTH; //this.gridBagConstraintsPedidoExpor.ipady =150; this.jContentPane.add(this.jScrollPanelDatosPedidoExpor, this.gridBagConstraintsPedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy = iGridyPrincipal++; this.gridBagConstraintsPedidoExpor.gridx = 0; this.jContentPane.add(this.jPanelPaginacionPedidoExpor, this.gridBagConstraintsPedidoExpor); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); iWidthScroll=(screenSize.width-screenSize.width/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ANCHO_RELSCROLL)+(250*3); iHeightScroll=(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO_RELSCROLL); //iWidthFormulario=iWidthScroll; //iHeightFormulario=iHeightScroll; if(PedidoExporJInternalFrame.CON_DATOS_FRAME) { this.jPanelBusquedasParametrosPedidoExpor= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); int iGridyRelaciones=0; GridBagLayout gridaBagLayoutBusquedasParametrosPedidoExpor = new GridBagLayout(); this.jPanelBusquedasParametrosPedidoExpor.setLayout(gridaBagLayoutBusquedasParametrosPedidoExpor); if(this.parametroGeneralUsuario.getcon_botones_tool_bar()) { } this.jScrollPanelDatosGeneralPedidoExpor= new JScrollPane(jContentPane,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); this.jScrollPanelDatosGeneralPedidoExpor.setMinimumSize(new Dimension(iWidthScroll,iHeightScroll)); this.jScrollPanelDatosGeneralPedidoExpor.setMaximumSize(new Dimension(iWidthScroll,iHeightScroll)); this.jScrollPanelDatosGeneralPedidoExpor.setPreferredSize(new Dimension(iWidthScroll,iHeightScroll)); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill=GridBagConstraints.NONE; this.gridBagConstraintsPedidoExpor.anchor = GridBagConstraints.WEST; //if(!this.conCargarMinimo) { //} this.conMaximoRelaciones=true; if(this.parametroGeneralUsuario.getcon_cargar_por_parte()) { } Boolean tieneColumnasOcultas=false; tieneColumnasOcultas=true; if(!Constantes.ISDEVELOPING) { } else { if(tieneColumnasOcultas) { } } } else { //DISENO_DETALLE COMENTAR Y //DISENO_DETALLE(Solo Descomentar Seccion Inferior) //NOTA-DISENO_DETALLE(Si cambia lo de abajo, cambiar lo comentado, Al final no es lo mismo) } //DISENO_DETALLE-(Descomentar) /* this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy = iGridyPrincipal++; this.gridBagConstraintsPedidoExpor.gridx = 0; this.jContentPane.add(this.jPanelCamposPedidoExpor, this.gridBagConstraintsPedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy = iGridyPrincipal++; this.gridBagConstraintsPedidoExpor.gridx = 0; this.jContentPane.add(this.jPanelCamposOcultosPedidoExpor, this.gridBagConstraintsPedidoExpor); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy =iGridyPrincipal++; this.gridBagConstraintsPedidoExpor.gridx =0; this.jContentPane.add(this.jPanelAccionesPedidoExpor, this.gridBagConstraintsPedidoExpor); */ //pack(); return this.jScrollPanelDatosGeneralPedidoExpor;//jContentPane; } /* public void cargarReporteDinamicoPedidoExpor() throws Exception { int iWidthReporteDinamico=350; int iHeightReporteDinamico=450;//250;400; iHeightReporteDinamico+=180; int iPosXReporteDinamico=0; int iPosYReporteDinamico=0; GridBagLayout gridaBagLayoutReporteDinamicoPedidoExpor = new GridBagLayout(); //PANEL this.jPanelReporteDinamicoPedidoExpor = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true); this.jPanelReporteDinamicoPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Campos")); this.jPanelReporteDinamicoPedidoExpor.setName("jPanelReporteDinamicoPedidoExpor"); this.jPanelReporteDinamicoPedidoExpor.setMinimumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); this.jPanelReporteDinamicoPedidoExpor.setMaximumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); this.jPanelReporteDinamicoPedidoExpor.setPreferredSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); this.jPanelReporteDinamicoPedidoExpor.setLayout(gridaBagLayoutReporteDinamicoPedidoExpor); this.jInternalFrameReporteDinamicoPedidoExpor= new ReporteDinamicoJInternalFrame(); this.jScrollPanelReporteDinamicoPedidoExpor = new JScrollPane(); //PANEL_CONTROLES //this.jScrollColumnasSelectReportePedidoExpor= new JScrollPane(); //JINTERNAL FRAME this.jInternalFrameReporteDinamicoPedidoExpor.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.jInternalFrameReporteDinamicoPedidoExpor.setjInternalFrameParent(this); this.jInternalFrameReporteDinamicoPedidoExpor.setTitle("REPORTE DINAMICO"); this.jInternalFrameReporteDinamicoPedidoExpor.setSize(iWidthReporteDinamico+70,iHeightReporteDinamico+100); this.jInternalFrameReporteDinamicoPedidoExpor.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y)); this.jInternalFrameReporteDinamicoPedidoExpor.setResizable(true); this.jInternalFrameReporteDinamicoPedidoExpor.setClosable(true); this.jInternalFrameReporteDinamicoPedidoExpor.setMaximizable(true); //SCROLL PANEL //this.jScrollPanelReporteDinamicoPedidoExpor.setMinimumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); //this.jScrollPanelReporteDinamicoPedidoExpor.setMaximumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); //this.jScrollPanelReporteDinamicoPedidoExpor.setPreferredSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); //this.jScrollPanelReporteDinamicoPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Pedido Exportacions")); //CONTROLES-ELEMENTOS //LABEL SELECT COLUMNAS this.jLabelColumnasSelectReportePedidoExpor = new JLabelMe(); this.jLabelColumnasSelectReportePedidoExpor.setText("Columnas Seleccion"); this.jLabelColumnasSelectReportePedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelColumnasSelectReportePedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelColumnasSelectReportePedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico=0; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jLabelColumnasSelectReportePedidoExpor, this.gridBagConstraintsPedidoExpor); //LISTA SELECT COLUMNAS this.jListColumnasSelectReportePedidoExpor = new JList<Reporte>(); this.jListColumnasSelectReportePedidoExpor.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); this.jListColumnasSelectReportePedidoExpor.setToolTipText("Tipos de Seleccion"); this.jListColumnasSelectReportePedidoExpor.setMinimumSize(new Dimension(145,300)); this.jListColumnasSelectReportePedidoExpor.setMaximumSize(new Dimension(145,300)); this.jListColumnasSelectReportePedidoExpor.setPreferredSize(new Dimension(145,300)); //SCROLL_PANEL_CONTROL this.jScrollColumnasSelectReportePedidoExpor=new JScrollPane(this.jListColumnasSelectReportePedidoExpor); this.jScrollColumnasSelectReportePedidoExpor.setMinimumSize(new Dimension(180,150)); this.jScrollColumnasSelectReportePedidoExpor.setMaximumSize(new Dimension(180,150)); this.jScrollColumnasSelectReportePedidoExpor.setPreferredSize(new Dimension(180,150)); this.jScrollColumnasSelectReportePedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("COLUMNAS")); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; //this.jPanelReporteDinamicoPedidoExpor.add(this.jListColumnasSelectReportePedidoExpor, this.gridBagConstraintsPedidoExpor); this.jPanelReporteDinamicoPedidoExpor.add(this.jScrollColumnasSelectReportePedidoExpor, this.gridBagConstraintsPedidoExpor); //LABEL SELECT RELACIONES this.jLabelRelacionesSelectReportePedidoExpor = new JLabelMe(); this.jLabelRelacionesSelectReportePedidoExpor.setText("Relaciones Seleccion"); this.jLabelRelacionesSelectReportePedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelRelacionesSelectReportePedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelRelacionesSelectReportePedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jLabelRelacionesSelectReportePedidoExpor, this.gridBagConstraintsPedidoExpor); //LABEL SELECT RELACIONES_FIN //LISTA SELECT RELACIONES this.jListRelacionesSelectReportePedidoExpor = new JList<Reporte>(); this.jListRelacionesSelectReportePedidoExpor.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); this.jListRelacionesSelectReportePedidoExpor.setToolTipText("Tipos de Seleccion"); this.jListRelacionesSelectReportePedidoExpor.setMinimumSize(new Dimension(145,300)); this.jListRelacionesSelectReportePedidoExpor.setMaximumSize(new Dimension(145,300)); this.jListRelacionesSelectReportePedidoExpor.setPreferredSize(new Dimension(145,300)); //SCROLL_PANEL_CONTROL this.jScrollRelacionesSelectReportePedidoExpor=new JScrollPane(this.jListRelacionesSelectReportePedidoExpor); this.jScrollRelacionesSelectReportePedidoExpor.setMinimumSize(new Dimension(180,120)); this.jScrollRelacionesSelectReportePedidoExpor.setMaximumSize(new Dimension(180,120)); this.jScrollRelacionesSelectReportePedidoExpor.setPreferredSize(new Dimension(180,120)); this.jScrollRelacionesSelectReportePedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("RELACIONES")); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; //this.jPanelReporteDinamicoPedidoExpor.add(this.jListRelacionesSelectReportePedidoExpor, this.gridBagConstraintsPedidoExpor); this.jPanelReporteDinamicoPedidoExpor.add(this.jScrollRelacionesSelectReportePedidoExpor, this.gridBagConstraintsPedidoExpor); //LISTA SELECT RELACIONES_FIN this.jCheckBoxConGraficoDinamicoPedidoExpor = new JCheckBoxMe(); this.jComboBoxColumnaCategoriaGraficoPedidoExpor = new JComboBoxMe(); this.jListColumnasValoresGraficoPedidoExpor = new JList<Reporte>(); //COMBO TIPOS REPORTES this.jComboBoxTiposReportesDinamicoPedidoExpor = new JComboBoxMe(); this.jComboBoxTiposReportesDinamicoPedidoExpor.setToolTipText("Tipos De Reporte"); this.jComboBoxTiposReportesDinamicoPedidoExpor.setMinimumSize(new Dimension(100,20)); this.jComboBoxTiposReportesDinamicoPedidoExpor.setMaximumSize(new Dimension(100,20)); this.jComboBoxTiposReportesDinamicoPedidoExpor.setPreferredSize(new Dimension(100,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposReportesDinamicoPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; //COMBO TIPOS REPORTES //COMBO TIPOS ARCHIVOS this.jComboBoxTiposArchivosReportesDinamicoPedidoExpor = new JComboBoxMe(); this.jComboBoxTiposArchivosReportesDinamicoPedidoExpor.setToolTipText("Tipos Archivos"); this.jComboBoxTiposArchivosReportesDinamicoPedidoExpor.setMinimumSize(new Dimension(100,20)); this.jComboBoxTiposArchivosReportesDinamicoPedidoExpor.setMaximumSize(new Dimension(100,20)); this.jComboBoxTiposArchivosReportesDinamicoPedidoExpor.setPreferredSize(new Dimension(100,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposArchivosReportesDinamicoPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; //COMBO TIPOS ARCHIVOS //LABEL CON GRAFICO DINAMICO this.jLabelConGraficoDinamicoPedidoExpor = new JLabelMe(); this.jLabelConGraficoDinamicoPedidoExpor.setText("Con Grafico"); this.jLabelConGraficoDinamicoPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelConGraficoDinamicoPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelConGraficoDinamicoPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jLabelConGraficoDinamicoPedidoExpor, this.gridBagConstraintsPedidoExpor); //CHECKBOX CON GRAFICO DINAMICO this.jCheckBoxConGraficoDinamicoPedidoExpor = new JCheckBoxMe(); this.jCheckBoxConGraficoDinamicoPedidoExpor.setText("Graf."); this.jCheckBoxConGraficoDinamicoPedidoExpor.setToolTipText("Con Grafico"); this.jCheckBoxConGraficoDinamicoPedidoExpor.setMinimumSize(new Dimension(100,20)); this.jCheckBoxConGraficoDinamicoPedidoExpor.setMaximumSize(new Dimension(100,20)); this.jCheckBoxConGraficoDinamicoPedidoExpor.setPreferredSize(new Dimension(100,20)); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jCheckBoxConGraficoDinamicoPedidoExpor, this.gridBagConstraintsPedidoExpor); //LABEL COMBO COLUMNA CATEGORIA this.jLabelColumnaCategoriaGraficoPedidoExpor = new JLabelMe(); this.jLabelColumnaCategoriaGraficoPedidoExpor.setText("Categoria Grafico"); this.jLabelColumnaCategoriaGraficoPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelColumnaCategoriaGraficoPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelColumnaCategoriaGraficoPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jLabelColumnaCategoriaGraficoPedidoExpor, this.gridBagConstraintsPedidoExpor); //COMBO COLUMNA CATEGORIA this.jComboBoxColumnaCategoriaGraficoPedidoExpor = new JComboBoxMe(); //this.jComboBoxColumnaCategoriaGraficoPedidoExpor.setText("Accion"); this.jComboBoxColumnaCategoriaGraficoPedidoExpor.setToolTipText("Tipos de Seleccion"); this.jComboBoxColumnaCategoriaGraficoPedidoExpor.setMinimumSize(new Dimension(145,20)); this.jComboBoxColumnaCategoriaGraficoPedidoExpor.setMaximumSize(new Dimension(145,20)); this.jComboBoxColumnaCategoriaGraficoPedidoExpor.setPreferredSize(new Dimension(145,20)); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jComboBoxColumnaCategoriaGraficoPedidoExpor, this.gridBagConstraintsPedidoExpor); //LABEL COMBO COLUMNA CATEGORIA VALOR this.jLabelColumnaCategoriaValorPedidoExpor = new JLabelMe(); this.jLabelColumnaCategoriaValorPedidoExpor.setText("Categoria Valor"); this.jLabelColumnaCategoriaValorPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelColumnaCategoriaValorPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelColumnaCategoriaValorPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jLabelColumnaCategoriaValorPedidoExpor, this.gridBagConstraintsPedidoExpor); //COMBO COLUMNA CATEGORIA VALOR this.jComboBoxColumnaCategoriaValorPedidoExpor = new JComboBoxMe(); //this.jComboBoxColumnaCategoriaValorPedidoExpor.setText("Accion"); this.jComboBoxColumnaCategoriaValorPedidoExpor.setToolTipText("Tipos de Seleccion"); this.jComboBoxColumnaCategoriaValorPedidoExpor.setMinimumSize(new Dimension(145,20)); this.jComboBoxColumnaCategoriaValorPedidoExpor.setMaximumSize(new Dimension(145,20)); this.jComboBoxColumnaCategoriaValorPedidoExpor.setPreferredSize(new Dimension(145,20)); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jComboBoxColumnaCategoriaValorPedidoExpor, this.gridBagConstraintsPedidoExpor); //LABEL VALORES GRAFICO COLUMNAS this.jLabelColumnasValoresGraficoPedidoExpor = new JLabelMe(); this.jLabelColumnasValoresGraficoPedidoExpor.setText("Columnas Valor Graf."); this.jLabelColumnasValoresGraficoPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelColumnasValoresGraficoPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelColumnasValoresGraficoPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jLabelColumnasValoresGraficoPedidoExpor, this.gridBagConstraintsPedidoExpor); //LISTA VALORES GRAFICO COLUMNAS this.jListColumnasValoresGraficoPedidoExpor = new JList<Reporte>(); this.jListColumnasValoresGraficoPedidoExpor.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); this.jListColumnasValoresGraficoPedidoExpor.setToolTipText("VALORES GRAFICO"); this.jListColumnasValoresGraficoPedidoExpor.setMinimumSize(new Dimension(145,300)); this.jListColumnasValoresGraficoPedidoExpor.setMaximumSize(new Dimension(145,300)); this.jListColumnasValoresGraficoPedidoExpor.setPreferredSize(new Dimension(145,300)); //SCROLL_VALORES GRAFICO COLUMNAS this.jScrollColumnasValoresGraficoPedidoExpor=new JScrollPane(this.jListColumnasValoresGraficoPedidoExpor); this.jScrollColumnasValoresGraficoPedidoExpor.setMinimumSize(new Dimension(180,150)); this.jScrollColumnasValoresGraficoPedidoExpor.setMaximumSize(new Dimension(180,150)); this.jScrollColumnasValoresGraficoPedidoExpor.setPreferredSize(new Dimension(180,150)); this.jScrollColumnasValoresGraficoPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("COLUMNAS")); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; //this.jPanelReporteDinamicoPedidoExpor.add(this.jListColumnasSelectReportePedidoExpor, this.gridBagConstraintsPedidoExpor); this.jPanelReporteDinamicoPedidoExpor.add(this.jScrollColumnasValoresGraficoPedidoExpor, this.gridBagConstraintsPedidoExpor); //LABEL TIPOS GRAFICO REPORTES this.jLabelTiposGraficosReportesDinamicoPedidoExpor = new JLabelMe(); this.jLabelTiposGraficosReportesDinamicoPedidoExpor.setText("Tipo Grafico"); this.jLabelTiposGraficosReportesDinamicoPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelTiposGraficosReportesDinamicoPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelTiposGraficosReportesDinamicoPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jLabelTiposGraficosReportesDinamicoPedidoExpor, this.gridBagConstraintsPedidoExpor); //COMBO TIPO GRAFICO REPORTE this.jComboBoxTiposGraficosReportesDinamicoPedidoExpor = new JComboBoxMe(); //this.jComboBoxColumnaCategoriaGraficoPedidoExpor.setText("Accion"); this.jComboBoxTiposGraficosReportesDinamicoPedidoExpor.setToolTipText("Tipos de Seleccion"); this.jComboBoxTiposGraficosReportesDinamicoPedidoExpor.setMinimumSize(new Dimension(145,20)); this.jComboBoxTiposGraficosReportesDinamicoPedidoExpor.setMaximumSize(new Dimension(145,20)); this.jComboBoxTiposGraficosReportesDinamicoPedidoExpor.setPreferredSize(new Dimension(145,20)); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jComboBoxTiposGraficosReportesDinamicoPedidoExpor, this.gridBagConstraintsPedidoExpor); //LABEL GENERAR EXCEL this.jLabelGenerarExcelReporteDinamicoPedidoExpor = new JLabelMe(); this.jLabelGenerarExcelReporteDinamicoPedidoExpor.setText("Tipos de Reporte"); this.jLabelGenerarExcelReporteDinamicoPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelGenerarExcelReporteDinamicoPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelGenerarExcelReporteDinamicoPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jLabelGenerarExcelReporteDinamicoPedidoExpor, this.gridBagConstraintsPedidoExpor); //BOTON GENERAR EXCEL this.jButtonGenerarExcelReporteDinamicoPedidoExpor = new JButtonMe(); this.jButtonGenerarExcelReporteDinamicoPedidoExpor.setText("Generar Excel"); FuncionesSwing.addImagenButtonGeneral(this.jButtonGenerarExcelReporteDinamicoPedidoExpor,"generar_excel_reporte_dinamico_button","Generar EXCEL"); this.jButtonGenerarExcelReporteDinamicoPedidoExpor.setToolTipText("Generar EXCEL"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO); //this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); //this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; //this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; //this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; //this.jPanelReporteDinamicoPedidoExpor.add(this.jButtonGenerarExcelReporteDinamicoPedidoExpor, this.gridBagConstraintsPedidoExpor); //COMBO TIPOS REPORTES this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jComboBoxTiposReportesDinamicoPedidoExpor, this.gridBagConstraintsPedidoExpor); //LABEL TIPOS DE ARCHIVO this.jLabelTiposArchivoReporteDinamicoPedidoExpor = new JLabelMe(); this.jLabelTiposArchivoReporteDinamicoPedidoExpor.setText("Tipos de Archivo"); this.jLabelTiposArchivoReporteDinamicoPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelTiposArchivoReporteDinamicoPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelTiposArchivoReporteDinamicoPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jLabelTiposArchivoReporteDinamicoPedidoExpor, this.gridBagConstraintsPedidoExpor); //COMBO TIPOS ARCHIVOS this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jComboBoxTiposArchivosReportesDinamicoPedidoExpor, this.gridBagConstraintsPedidoExpor); //BOTON GENERAR this.jButtonGenerarReporteDinamicoPedidoExpor = new JButtonMe(); this.jButtonGenerarReporteDinamicoPedidoExpor.setText("Generar"); FuncionesSwing.addImagenButtonGeneral(this.jButtonGenerarReporteDinamicoPedidoExpor,"generar_reporte_dinamico_button","Generar"); this.jButtonGenerarReporteDinamicoPedidoExpor.setToolTipText("Generar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jButtonGenerarReporteDinamicoPedidoExpor, this.gridBagConstraintsPedidoExpor); //BOTON CERRAR this.jButtonCerrarReporteDinamicoPedidoExpor = new JButtonMe(); this.jButtonCerrarReporteDinamicoPedidoExpor.setText("Cancelar"); FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarReporteDinamicoPedidoExpor,"cerrar_reporte_dinamico_button","Cancelar"); this.jButtonCerrarReporteDinamicoPedidoExpor.setToolTipText("Cancelar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoPedidoExpor.add(this.jButtonCerrarReporteDinamicoPedidoExpor, this.gridBagConstraintsPedidoExpor); //GLOBAL AGREGAR PANELES GridBagLayout gridaBagLayoutReporteDinamicoPrincipalPedidoExpor = new GridBagLayout(); this.jScrollPanelReporteDinamicoPedidoExpor= new JScrollPane(jPanelReporteDinamicoPedidoExpor,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); this.jScrollPanelReporteDinamicoPedidoExpor.setMinimumSize(new Dimension(iWidthReporteDinamico+90,iHeightReporteDinamico+90)); this.jScrollPanelReporteDinamicoPedidoExpor.setMaximumSize(new Dimension(iWidthReporteDinamico+90,iHeightReporteDinamico+90)); this.jScrollPanelReporteDinamicoPedidoExpor.setPreferredSize(new Dimension(iWidthReporteDinamico+90,iHeightReporteDinamico+90)); this.jScrollPanelReporteDinamicoPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Pedido Exportacions")); iPosXReporteDinamico=0; iPosYReporteDinamico=0; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy =iPosYReporteDinamico; this.gridBagConstraintsPedidoExpor.gridx =iPosXReporteDinamico; this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.BOTH; this.jInternalFrameReporteDinamicoPedidoExpor.setContentPane(new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true)); this.jInternalFrameReporteDinamicoPedidoExpor.getContentPane().setLayout(gridaBagLayoutReporteDinamicoPrincipalPedidoExpor); this.jInternalFrameReporteDinamicoPedidoExpor.getContentPane().add(this.jScrollPanelReporteDinamicoPedidoExpor, this.gridBagConstraintsPedidoExpor); } */ /* public void cargarImportacionPedidoExpor() throws Exception { int iWidthImportacion=350; int iHeightImportacion=250;//400; int iPosXImportacion=0; int iPosYImportacion=0; GridBagLayout gridaBagLayoutImportacionPedidoExpor = new GridBagLayout(); //PANEL this.jPanelImportacionPedidoExpor = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true); this.jPanelImportacionPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Campos")); this.jPanelImportacionPedidoExpor.setName("jPanelImportacionPedidoExpor"); this.jPanelImportacionPedidoExpor.setMinimumSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jPanelImportacionPedidoExpor.setMaximumSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jPanelImportacionPedidoExpor.setPreferredSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jPanelImportacionPedidoExpor.setLayout(gridaBagLayoutImportacionPedidoExpor); this.jInternalFrameImportacionPedidoExpor= new ImportacionJInternalFrame(); //this.jInternalFrameImportacionPedidoExpor= new ImportacionJInternalFrame(); this.jScrollPanelImportacionPedidoExpor = new JScrollPane(); //PANEL_CONTROLES //this.jScrollColumnasSelectReportePedidoExpor= new JScrollPane(); //JINTERNAL FRAME this.jInternalFrameImportacionPedidoExpor.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.jInternalFrameImportacionPedidoExpor.setjInternalFrameParent(this); this.jInternalFrameImportacionPedidoExpor.setTitle("REPORTE DINAMICO"); this.jInternalFrameImportacionPedidoExpor.setSize(iWidthImportacion+70,iHeightImportacion+100); this.jInternalFrameImportacionPedidoExpor.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y)); this.jInternalFrameImportacionPedidoExpor.setResizable(true); this.jInternalFrameImportacionPedidoExpor.setClosable(true); this.jInternalFrameImportacionPedidoExpor.setMaximizable(true); //JINTERNAL FRAME IMPORTACION this.jInternalFrameImportacionPedidoExpor.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.jInternalFrameImportacionPedidoExpor.setjInternalFrameParent(this); this.jInternalFrameImportacionPedidoExpor.setTitle("IMPORTACION"); this.jInternalFrameImportacionPedidoExpor.setSize(iWidthImportacion+70,iHeightImportacion+100); this.jInternalFrameImportacionPedidoExpor.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y)); this.jInternalFrameImportacionPedidoExpor.setResizable(true); this.jInternalFrameImportacionPedidoExpor.setClosable(true); this.jInternalFrameImportacionPedidoExpor.setMaximizable(true); //SCROLL PANEL this.jScrollPanelImportacionPedidoExpor.setMinimumSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jScrollPanelImportacionPedidoExpor.setMaximumSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jScrollPanelImportacionPedidoExpor.setPreferredSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jScrollPanelImportacionPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Pedido Exportacions")); //LABEL ARCHIVO IMPORTACION this.jLabelArchivoImportacionPedidoExpor = new JLabelMe(); this.jLabelArchivoImportacionPedidoExpor.setText("ARCHIVO IMPORTACION"); this.jLabelArchivoImportacionPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelArchivoImportacionPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelArchivoImportacionPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXImportacion=0; iPosYImportacion++; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYImportacion; this.gridBagConstraintsPedidoExpor.gridx = iPosXImportacion++; this.jPanelImportacionPedidoExpor.add(this.jLabelArchivoImportacionPedidoExpor, this.gridBagConstraintsPedidoExpor); //BOTON ABRIR IMPORTACION this.jFileChooserImportacionPedidoExpor = new JFileChooser(); this.jFileChooserImportacionPedidoExpor.setToolTipText("ESCOGER ARCHIVO"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO); this.jButtonAbrirImportacionPedidoExpor = new JButtonMe(); this.jButtonAbrirImportacionPedidoExpor.setText("ESCOGER"); FuncionesSwing.addImagenButtonGeneral(this.jButtonAbrirImportacionPedidoExpor,"generar_importacion_button","ESCOGER"); this.jButtonAbrirImportacionPedidoExpor.setToolTipText("Generar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYImportacion; this.gridBagConstraintsPedidoExpor.gridx = iPosXImportacion++; this.jPanelImportacionPedidoExpor.add(this.jButtonAbrirImportacionPedidoExpor, this.gridBagConstraintsPedidoExpor); //LABEL PATH IMPORTACION this.jLabelPathArchivoImportacionPedidoExpor = new JLabelMe(); this.jLabelPathArchivoImportacionPedidoExpor.setText("PATH ARCHIVO"); this.jLabelPathArchivoImportacionPedidoExpor.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelPathArchivoImportacionPedidoExpor.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelPathArchivoImportacionPedidoExpor.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXImportacion=0; iPosYImportacion++; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYImportacion; this.gridBagConstraintsPedidoExpor.gridx = iPosXImportacion++; this.jPanelImportacionPedidoExpor.add(this.jLabelPathArchivoImportacionPedidoExpor, this.gridBagConstraintsPedidoExpor); //PATH IMPORTACION this.jTextFieldPathArchivoImportacionPedidoExpor=new JTextFieldMe(); this.jTextFieldPathArchivoImportacionPedidoExpor.setMinimumSize(new Dimension(150,Constantes.ISWING_ALTO_CONTROL)); this.jTextFieldPathArchivoImportacionPedidoExpor.setMaximumSize(new Dimension(150,Constantes.ISWING_ALTO_CONTROL)); this.jTextFieldPathArchivoImportacionPedidoExpor.setPreferredSize(new Dimension(150,Constantes.ISWING_ALTO_CONTROL)); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYImportacion; this.gridBagConstraintsPedidoExpor.gridx = iPosXImportacion++; this.jPanelImportacionPedidoExpor.add(this.jTextFieldPathArchivoImportacionPedidoExpor, this.gridBagConstraintsPedidoExpor); //BOTON IMPORTACION this.jButtonGenerarImportacionPedidoExpor = new JButtonMe(); this.jButtonGenerarImportacionPedidoExpor.setText("IMPORTAR"); FuncionesSwing.addImagenButtonGeneral(this.jButtonGenerarImportacionPedidoExpor,"generar_importacion_button","IMPORTAR"); this.jButtonGenerarImportacionPedidoExpor.setToolTipText("Generar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO); iPosXImportacion=0; iPosYImportacion++; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYImportacion; this.gridBagConstraintsPedidoExpor.gridx = iPosXImportacion++; this.jPanelImportacionPedidoExpor.add(this.jButtonGenerarImportacionPedidoExpor, this.gridBagConstraintsPedidoExpor); //BOTON CERRAR this.jButtonCerrarImportacionPedidoExpor = new JButtonMe(); this.jButtonCerrarImportacionPedidoExpor.setText("Cancelar"); FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarImportacionPedidoExpor,"cerrar_reporte_dinamico_button","Cancelar"); this.jButtonCerrarImportacionPedidoExpor.setToolTipText("Cancelar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO); this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYImportacion; this.gridBagConstraintsPedidoExpor.gridx = iPosXImportacion++; this.jPanelImportacionPedidoExpor.add(this.jButtonCerrarImportacionPedidoExpor, this.gridBagConstraintsPedidoExpor); //GLOBAL AGREGAR PANELES GridBagLayout gridaBagLayoutImportacionPrincipalPedidoExpor = new GridBagLayout(); this.jScrollPanelImportacionPedidoExpor= new JScrollPane(jPanelImportacionPedidoExpor,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); iPosXImportacion=0; iPosYImportacion=0; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy =iPosYImportacion; this.gridBagConstraintsPedidoExpor.gridx =iPosXImportacion; this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.BOTH; this.jInternalFrameImportacionPedidoExpor.setContentPane(new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true)); this.jInternalFrameImportacionPedidoExpor.getContentPane().setLayout(gridaBagLayoutImportacionPrincipalPedidoExpor); this.jInternalFrameImportacionPedidoExpor.getContentPane().add(this.jScrollPanelImportacionPedidoExpor, this.gridBagConstraintsPedidoExpor); } */ /* public void cargarOrderByPedidoExpor(Boolean cargaMinima) throws Exception { String sMapKey = ""; InputMap inputMap =null; int iWidthOrderBy=350; int iHeightOrderBy=300;//400; int iPosXOrderBy=0; int iPosYOrderBy=0; if(!cargaMinima) { this.jButtonAbrirOrderByPedidoExpor = new JButtonMe(); this.jButtonAbrirOrderByPedidoExpor.setText("Orden"); this.jButtonAbrirOrderByPedidoExpor.setToolTipText("Orden"+FuncionesSwing.getKeyMensaje("ORDEN")); FuncionesSwing.addImagenButtonGeneral(this.jButtonAbrirOrderByPedidoExpor,"orden_button","Orden"); FuncionesSwing.setBoldButton(this.jButtonAbrirOrderByPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; sMapKey = "AbrirOrderByPedidoExpor"; inputMap = this.jButtonAbrirOrderByPedidoExpor.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("ORDEN") , FuncionesSwing.getMaskKey("ORDEN")), sMapKey); this.jButtonAbrirOrderByPedidoExpor.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"AbrirOrderByPedidoExpor")); GridBagLayout gridaBagLayoutOrderByPedidoExpor = new GridBagLayout(); //PANEL this.jPanelOrderByPedidoExpor = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true); this.jPanelOrderByPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Campos")); this.jPanelOrderByPedidoExpor.setName("jPanelOrderByPedidoExpor"); this.jPanelOrderByPedidoExpor.setMinimumSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); this.jPanelOrderByPedidoExpor.setMaximumSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); this.jPanelOrderByPedidoExpor.setPreferredSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); FuncionesSwing.setBoldPanel(this.jPanelOrderByPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; this.jPanelOrderByPedidoExpor.setLayout(gridaBagLayoutOrderByPedidoExpor); this.jTableDatosPedidoExporOrderBy = new JTableMe(); this.jTableDatosPedidoExporOrderBy.setAutoCreateRowSorter(true); FuncionesSwing.setBoldTable(jTableDatosPedidoExporOrderBy,STIPO_TAMANIO_GENERAL,false,true,this); this.jScrollPanelDatosPedidoExporOrderBy = new JScrollPane(); this.jScrollPanelDatosPedidoExporOrderBy.setBorder(javax.swing.BorderFactory.createTitledBorder("Orden")); this.jScrollPanelDatosPedidoExporOrderBy.setViewportView(this.jTableDatosPedidoExporOrderBy); this.jTableDatosPedidoExporOrderBy.setFillsViewportHeight(true); this.jTableDatosPedidoExporOrderBy.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); this.jInternalFrameOrderByPedidoExpor= new OrderByJInternalFrame(); this.jInternalFrameOrderByPedidoExpor= new OrderByJInternalFrame(); this.jScrollPanelOrderByPedidoExpor = new JScrollPane(); //PANEL_CONTROLES //this.jScrollColumnasSelectReportePedidoExpor= new JScrollPane(); //JINTERNAL FRAME OrderBy this.jInternalFrameOrderByPedidoExpor.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.jInternalFrameOrderByPedidoExpor.setjInternalFrameParent(this); this.jInternalFrameOrderByPedidoExpor.setTitle("Orden"); this.jInternalFrameOrderByPedidoExpor.setSize(iWidthOrderBy+70,iHeightOrderBy+100); this.jInternalFrameOrderByPedidoExpor.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y)); this.jInternalFrameOrderByPedidoExpor.setResizable(true); this.jInternalFrameOrderByPedidoExpor.setClosable(true); this.jInternalFrameOrderByPedidoExpor.setMaximizable(true); //FuncionesSwing.setBoldPanel(this.jInternalFrameOrderByPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; //SCROLL PANEL this.jScrollPanelOrderByPedidoExpor.setMinimumSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); this.jScrollPanelOrderByPedidoExpor.setMaximumSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); this.jScrollPanelOrderByPedidoExpor.setPreferredSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); FuncionesSwing.setBoldScrollPanel(this.jScrollPanelOrderByPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; this.jScrollPanelOrderByPedidoExpor.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Pedido Exportacions")); //DATOS TOTALES this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy =iPosYOrderBy++; this.gridBagConstraintsPedidoExpor.gridx =iPosXOrderBy; this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.BOTH; //this.gridBagConstraintsPedidoExpor.ipady =150; this.jPanelOrderByPedidoExpor.add(jScrollPanelDatosPedidoExporOrderBy, this.gridBagConstraintsPedidoExpor);//this.jTableDatosPedidoExporTotales //BOTON CERRAR this.jButtonCerrarOrderByPedidoExpor = new JButtonMe(); this.jButtonCerrarOrderByPedidoExpor.setText("Salir"); FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarOrderByPedidoExpor,"cerrar","Salir");//cerrar_reporte_dinamico_button this.jButtonCerrarOrderByPedidoExpor.setToolTipText("Cancelar"+" "+PedidoExporConstantesFunciones.SCLASSWEBTITULO); FuncionesSwing.setBoldButton(this.jButtonCerrarOrderByPedidoExpor, STIPO_TAMANIO_GENERAL,false,true,this);; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsPedidoExpor.gridy = iPosYOrderBy++; this.gridBagConstraintsPedidoExpor.gridx = iPosXOrderBy; this.jPanelOrderByPedidoExpor.add(this.jButtonCerrarOrderByPedidoExpor, this.gridBagConstraintsPedidoExpor); //GLOBAL AGREGAR PANELES GridBagLayout gridaBagLayoutOrderByPrincipalPedidoExpor = new GridBagLayout(); this.jScrollPanelOrderByPedidoExpor= new JScrollPane(jPanelOrderByPedidoExpor,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); iPosXOrderBy=0; iPosYOrderBy=0; this.gridBagConstraintsPedidoExpor = new GridBagConstraints(); this.gridBagConstraintsPedidoExpor.gridy =iPosYOrderBy; this.gridBagConstraintsPedidoExpor.gridx =iPosXOrderBy; this.gridBagConstraintsPedidoExpor.fill = GridBagConstraints.BOTH; this.jInternalFrameOrderByPedidoExpor.setContentPane(new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true)); this.jInternalFrameOrderByPedidoExpor.getContentPane().setLayout(gridaBagLayoutOrderByPrincipalPedidoExpor); this.jInternalFrameOrderByPedidoExpor.getContentPane().add(this.jScrollPanelOrderByPedidoExpor, this.gridBagConstraintsPedidoExpor); } else { this.jButtonAbrirOrderByPedidoExpor = new JButtonMe(); } } */ public void redimensionarTablaDatos(int iNumFilas) { this.redimensionarTablaDatos(iNumFilas,0); } public void redimensionarTablaDatos(int iNumFilas,int iTamanioFilaTabla) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int iWidthTable=screenSize.width*2;//screenSize.width - (screenSize.width/8); int iWidthTableScroll=screenSize.width - (screenSize.width/8); int iWidthTableCalculado=0;//10530 int iHeightTable=0;//screenSize.height/3; int iHeightTableTotal=0; //ANCHO COLUMNAS SIMPLES iWidthTableCalculado+=4330; //ANCHO COLUMNAS OCULTAS if(Constantes.ISDEVELOPING) { iWidthTableCalculado+=6100; } //ANCHO COLUMNAS RELACIONES iWidthTableCalculado+=100; //ESPACION PARA SELECT RELACIONES if(this.conMaximoRelaciones && this.pedidoexporSessionBean.getConGuardarRelaciones() ) { if(this.conFuncionalidadRelaciones) { iWidthTableCalculado+=Constantes.ISWING_ANCHO_COLUMNA; } } //SI CALCULADO ES MENOR QUE MAXIMO /* if(iWidthTableCalculado<=iWidthTable) { iWidthTable=iWidthTableCalculado; } */ //SI TABLA ES MENOR QUE SCROLL if(iWidthTableCalculado<=iWidthTableScroll) { iWidthTableScroll=iWidthTableCalculado; } //NO VALE SIEMPRE PONE TAMANIO COLUMNA 200 /* int iTotalWidth=0; int iWidthColumn=0; int iCountColumns=this.jTableDatosPedidoExpor.getColumnModel().getColumnCount(); if(iCountColumns>0) { for(int i = 0; i < this.jTableDatosPedidoExpor.getColumnModel().getColumnCount(); i++) { TableColumn column = this.jTableDatosPedidoExpor.getColumnModel().getColumn(i); iWidthColumn=column.getWidth(); iTotalWidth+=iWidthColumn; } //iWidthTableCalculado=iTotalWidth; } */ if(iTamanioFilaTabla<=0) { iTamanioFilaTabla=this.jTableDatosPedidoExpor.getRowHeight();//PedidoExporConstantesFunciones.ITAMANIOFILATABLA; } if(iNumFilas>0) { iHeightTable=(iNumFilas * iTamanioFilaTabla); } else { iHeightTable=iTamanioFilaTabla; } iHeightTableTotal=iHeightTable; if(!this.pedidoexporSessionBean.getEsGuardarRelacionado()) { if(iHeightTable > PedidoExporConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOS) { //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS) { //SI SE SELECCIONA MAXIMO TABLA SE AMPLIA A ALTO MAXIMO DE SCROLL, PARA QUE SCROLL NO SEA TAN PEQUE?O if(!this.jCheckBoxConAltoMaximoTablaPedidoExpor.isSelected()) { iHeightTable=PedidoExporConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOS; //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS; } else { iHeightTable=iHeightTableTotal + FuncionesSwing.getValorProporcion(iHeightTableTotal,30); } } else { if(iHeightTable < PedidoExporConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOS) {//Constantes.ISWING_TAMANIOMINIMO_TABLADATOS) { iHeightTable=PedidoExporConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOS; //Constantes.ISWING_TAMANIOMINIMO_TABLADATOS; } } } else { if(iHeightTable > PedidoExporConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOSREL) { //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS) { //SI SE SELECCIONA MAXIMO TABLA SE AMPLIA A ALTO MAXIMO DE SCROLL, PARA QUE SCROLL NO SEA TAN PEQUE?O if(!this.jCheckBoxConAltoMaximoTablaPedidoExpor.isSelected()) { iHeightTable=PedidoExporConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOSREL; //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS; } else { iHeightTable=iHeightTableTotal + FuncionesSwing.getValorProporcion(iHeightTableTotal,30); } } else { if(iHeightTable < PedidoExporConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOSREL) {//Constantes.ISWING_TAMANIOMINIMO_TABLADATOS) { iHeightTable=PedidoExporConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOSREL; //Constantes.ISWING_TAMANIOMINIMO_TABLADATOS; } } } //OJO:SE DESHABILITA CALCULADO //NO SE UTILIZA CALCULADO SI POR DEFINICION if(iWidthTableDefinicion>0) { iWidthTableCalculado=iWidthTableDefinicion; } this.jTableDatosPedidoExpor.setMinimumSize(new Dimension(iWidthTableCalculado,iHeightTableTotal)); this.jTableDatosPedidoExpor.setMaximumSize(new Dimension(iWidthTableCalculado,iHeightTableTotal)); this.jTableDatosPedidoExpor.setPreferredSize(new Dimension(iWidthTableCalculado,iHeightTableTotal));//iWidthTable this.jScrollPanelDatosPedidoExpor.setMinimumSize(new Dimension(iWidthTableScroll,iHeightTable)); this.jScrollPanelDatosPedidoExpor.setMaximumSize(new Dimension(iWidthTableScroll,iHeightTable)); this.jScrollPanelDatosPedidoExpor.setPreferredSize(new Dimension(iWidthTableScroll,iHeightTable)); //ORDER BY //OrderBy int iHeightTableOrderBy=0; int iNumFilasOrderBy=this.arrOrderBy.size(); int iTamanioFilaTablaOrderBy=0; if(this.jInternalFrameOrderByPedidoExpor!=null && this.jInternalFrameOrderByPedidoExpor.getjTableDatosOrderBy()!=null) { //if(!this.pedidoexporSessionBean.getEsGuardarRelacionado()) { iTamanioFilaTablaOrderBy=this.jInternalFrameOrderByPedidoExpor.getjTableDatosOrderBy().getRowHeight(); if(iNumFilasOrderBy>0) { iHeightTableOrderBy=iNumFilasOrderBy * iTamanioFilaTablaOrderBy; } else { iHeightTableOrderBy=iTamanioFilaTablaOrderBy; } this.jInternalFrameOrderByPedidoExpor.getjTableDatosOrderBy().setMinimumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY,iHeightTableOrderBy));//iWidthTableCalculado/4 this.jInternalFrameOrderByPedidoExpor.getjTableDatosOrderBy().setMaximumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY,iHeightTableOrderBy)); this.jInternalFrameOrderByPedidoExpor.getjTableDatosOrderBy().setPreferredSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY,iHeightTableOrderBy));//iWidthTable this.jInternalFrameOrderByPedidoExpor.getjScrollPanelDatosOrderBy().setMinimumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY+30,Constantes2.ISWING_TAMANIO_ALTO_TABLADATOS_ORDERBY));//iHeightTableOrderBy,iWidthTableScroll this.jInternalFrameOrderByPedidoExpor.getjScrollPanelDatosOrderBy().setMaximumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY+30,Constantes2.ISWING_TAMANIO_ALTO_TABLADATOS_ORDERBY)); this.jInternalFrameOrderByPedidoExpor.getjScrollPanelDatosOrderBy().setPreferredSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY+30,Constantes2.ISWING_TAMANIO_ALTO_TABLADATOS_ORDERBY)); } //ORDER BY //this.jScrollPanelDatosPedidoExpor.setMinimumSize(new Dimension(iWidthTableScroll,iHeightTable)); //this.jScrollPanelDatosPedidoExpor.setMaximumSize(new Dimension(iWidthTableScroll,iHeightTable)); //this.jScrollPanelDatosPedidoExpor.setPreferredSize(new Dimension(iWidthTableScroll,iHeightTable)); //VERSION 0 /* //SI CALCULADO ES MENOR QUE MAXIMO if(iWidthTableCalculado<=iWidthTable) { iWidthTable=iWidthTableCalculado; } //SI TABLA ES MENOR QUE SCROLL if(iWidthTable<=iWidthTableScroll) { iWidthTableScroll=iWidthTable; } */ } public void redimensionarTablaDatosConTamanio(int iTamanioFilaTabla) throws Exception { int iSizeTabla=0; //ARCHITECTURE if(Constantes.ISUSAEJBLOGICLAYER) { iSizeTabla=pedidoexporLogic.getPedidoExpors().size(); } else if(Constantes.ISUSAEJBREMOTE || Constantes.ISUSAEJBHOME) { iSizeTabla=pedidoexpors.size(); } //ARCHITECTURE this.redimensionarTablaDatos(iSizeTabla,iTamanioFilaTabla); } /* PARA MANEJAR EL TAB RELACIONES CON TABLA DE DATOS SE DEBE MODIFICAR Y VERIFICAR LOS VALORES CONTANTES: final public static Integer ISWING_TAMANIOMAXIMO_TABLADATOSREL=240;//230;350; final public static Integer ISWING_TAMANIOMINIMO_TABLADATOSREL=240;//230;260 final public static Integer ISWING_ALTO_TABPANE=375;//375;400;260; CASO CONTRARIO, ESTOS VALORES SERIAN PARA CADA CASO (NO CONSTANTES) NOTA: * LA ALINEACION HORIZONTAL,FALTA */ //PARA REPORTES public static List<PedidoExpor> TraerPedidoExporBeans(List<PedidoExpor> pedidoexpors,ArrayList<Classe> classes)throws Exception { try { for(PedidoExpor pedidoexpor:pedidoexpors) { if(!(PedidoExporConstantesFunciones.S_TIPOREPORTE_EXTRA.equals(Constantes2.S_REPORTE_EXTRA_GROUP_GENERICO) || PedidoExporConstantesFunciones.S_TIPOREPORTE_EXTRA.equals(Constantes2.S_REPORTE_EXTRA_GROUP_TOTALES_GENERICO)) ) { pedidoexpor.setsDetalleGeneralEntityReporte(PedidoExporConstantesFunciones.getPedidoExporDescripcion(pedidoexpor)); if(pedidoexpor.getDetallePedidoExpors()!=null && Funciones.existeClass(classes,DetallePedidoExpor.class)) { try{pedidoexpor.setdetallepedidoexporsDescripcionReporte(new JRBeanCollectionDataSource(DetallePedidoExporJInternalFrame.TraerDetallePedidoExporBeans(pedidoexpor.getDetallePedidoExpors(),classes)));}catch(Exception e){e.printStackTrace();} } } else { //pedidoexpor.setsDetalleGeneralEntityReporte(pedidoexpor.getsDetalleGeneralEntityReporte()); } //pedidoexporbeans.add(pedidoexporbean); } } catch(Exception ex) { throw ex; } return pedidoexpors; } //PARA REPORTES FIN }
IntBoat/go-hetzner
server.go
<reponame>IntBoat/go-hetzner<filename>server.go package hetzner import ( "fmt" "net/http" ) // Api: https://robot.your-server.de/doc/webservice/en.html#server // ServerService represents a service to work with server service. type ServerService interface { // List Query data of all servers // See: https://robot.your-server.de/doc/webservice/en.html#get-server List() ([]*ServerSummary, *http.Response, error) // Get Query server data for a specific server // See: https://robot.your-server.de/doc/webservice/en.html#get-server-server-number Get(serverNumber int) (*Server, *http.Response, error) // Update server name for a specific server // See: https://robot.your-server.de/doc/webservice/en.html#post-server-server-number Update(req *UpdateServerRequest) (*Server, *http.Response, error) // GetCancellation Query cancellation data for a server // See: https://robot.your-server.de/doc/webservice/en.html#get-server-server-number-cancellation GetCancellation(serverNumber int) (*Cancellation, *http.Response, error) // CancelServer Cancel a server // See: https://robot.your-server.de/doc/webservice/en.html#post-server-server-number-cancellation CancelServer(req *CancelServerRequest) (*CancellationSingle, *http.Response, error) // WithdrawCancellation Withdraw a server cancellation // See: https://robot.your-server.de/doc/webservice/en.html#delete-server-server-number-cancellation WithdrawCancellation(serverNumber int) (*http.Response, error) } type ServerServiceImpl struct { client *Client } var _ ServerService = &ServerServiceImpl{} func (s *ServerServiceImpl) List() ([]*ServerSummary, *http.Response, error) { path := "/server" data := make([]dataServerSummary, 0) resp, err := s.client.Call(http.MethodGet, path, nil, &data) a := make([]*ServerSummary, len(data)) for i, d := range data { a[i] = d.Server } return a, resp, err } func (s *ServerServiceImpl) Get(serverNumber int) (*Server, *http.Response, error) { path := fmt.Sprintf("/server/%d", serverNumber) data := dataServer{} resp, err := s.client.Call(http.MethodGet, path, nil, &data) return data.Server, resp, err } func (s *ServerServiceImpl) Update(req *UpdateServerRequest) (*Server, *http.Response, error) { path := fmt.Sprintf("/server/%d", req.ServerNumber) data := dataServer{} resp, err := s.client.Call(http.MethodPost, path, req, &data) return data.Server, resp, err } func (s *ServerServiceImpl) GetCancellation(serverNumber int) (*Cancellation, *http.Response, error) { path := fmt.Sprintf("/server/%d/cancellation", serverNumber) data := dataCancellation{} resp, err := s.client.Call(http.MethodGet, path, nil, &data) return data.Cancellation, resp, err } func (s *ServerServiceImpl) CancelServer(req *CancelServerRequest) (*CancellationSingle, *http.Response, error) { path := fmt.Sprintf("/server/%d/cancellation", req.ServerNumber) data := dataCancellationSingle{} resp, err := s.client.Call(http.MethodPost, path, req, &data) return data.Cancellation, resp, err } func (s *ServerServiceImpl) WithdrawCancellation(serverNumber int) (*http.Response, error) { path := fmt.Sprintf("/server/%d/cancellation", serverNumber) return s.client.Call(http.MethodDelete, path, nil, nil) } func (s *ServerServiceImpl) WithdrawOrder(req *WithdrawOrderRequest) (*Cancellation, *http.Response, error) { path := fmt.Sprintf("/server/%s/reversal", req.ServerNumber) data := dataCancellation{} resp, err := s.client.Call(http.MethodPost, path, req, &data) return data.Cancellation, resp, err }
TomTranter/pybamm_pnm
random/lumped_thermal.py
# -*- coding: utf-8 -*- """ Created on Fri Feb 14 11:13:35 2020 @author: Tom """ import openpnm as op import numpy as np import matplotlib.pyplot as plt import openpnm.topotools as tt # >!----!''!---!> spacing = 10.4e-6 area = 1.0 Nseries = 1 + 8 + 2 + 7 + 1 Nparallel = 1 net = op.network.Cubic([Nseries + 1, 1, 1], spacing=10.4e-6) a_al = 8.51e-2 a_lic6 = 1.42e-3 a_sep = 1.19e-3 a_lico = 6.88e-4 a_cu = 1.11e-1 net['throat.thermal_diffusivity'] = 1e-12 net['throat.thermal_diffusivity'][0] = a_al net['throat.thermal_diffusivity'][1:9] = a_lic6 net['throat.thermal_diffusivity'][9:11] = a_sep net['throat.thermal_diffusivity'][11:18] = a_lico net['throat.thermal_diffusivity'][18] = a_cu diffs = net['throat.thermal_diffusivity'].copy() #print(diffs) net['throat.length'] = spacing net['throat.area'] = area alg = op.algorithms.FickianDiffusion(network=net) phase = op.phases.GenericPhase(network=net) t_D = net['throat.thermal_diffusivity'] t_A = net['throat.area'] t_L = net['throat.length'] phase['throat.diffusive_conductance'] = t_D * t_A / t_L alg.setup(phase=phase) alg.set_value_BC(pores=[0], values=1.0) alg.set_value_BC(pores=[-1], values=0.0) alg.run() a_series = alg.calc_effective_diffusivity(domain_area=area, domain_length=spacing * net.Nt) print(a_series) Nparallel = 4 net2 = op.network.Cubic([Nparallel, Nseries, 1], spacing=10.4e-6) rows = np.indices([Nparallel, Nseries])[0] net2['pore.row'] = rows.flatten() conns = net2['throat.conns'] same_row = net2['pore.row'][conns[:, 0]] == net2['pore.row'][conns[:, 1]] net2['throat.thermal_diffusivity'] = 1.0 diffs2 = np.hstack((diffs, diffs, diffs)) net2['throat.thermal_diffusivity'][~same_row] = diffs2 net2['throat.length'] = spacing net2['throat.area'] = area phase2 = op.phases.GenericPhase(network=net2) t_D = net2['throat.thermal_diffusivity'] t_A = net2['throat.area'] t_L = net2['throat.length'] phase2['throat.diffusive_conductance'] = t_D * t_A / t_L alg2 = op.algorithms.FickianDiffusion(network=net2) alg2.setup(phase=phase) alg2.set_value_BC(pores=net2.pores()[net2['pore.row'] == 0], values=1.0) alg2.set_value_BC(pores=net2.pores()[net2['pore.row'] == 2], values=0.0) alg2.run() a_parallel = alg.calc_effective_diffusivity(domain_area=area * len(diffs), domain_length=spacing * (Nparallel - 1)) print(a_parallel) fig = tt.plot_coordinates(net2, pores=net2.Ps, c=net2['pore.row']) col = phase2['throat.diffusive_conductance'][~same_row] for c in np.unique(col): fig = tt.plot_connections(net2, throats=net2.throats()[~same_row][np.where(col == c)], fig=fig) ax = fig.gca() ax.set_xlim(net2['pore.coords'][:, 0].min() - spacing, net2['pore.coords'][:, 0].max() + spacing) ax.set_ylim(net2['pore.coords'][:, 1].min() - spacing, net2['pore.coords'][:, 1].max() + spacing) plt.show()
CBIIT/cadsr-semantic-tools
software/SIW/src/java/gov/nih/nci/ncicb/cadsr/loader/ChangeTracker.java
<reponame>CBIIT/cadsr-semantic-tools /* * Copyright 2000-2003 Oracle, Inc. This software was developed in conjunction with the National Cancer Institute, and so to the extent government employees are co-authors, any rights in such works shall be subject to Title 17 of the United States Code, section 105. * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the disclaimer of Article 3, below. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * * 2. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: * * "This product includes software developed by Oracle, Inc. and the National Cancer Institute." * * If no such end-user documentation is to be included, this acknowledgment shall appear in the software itself, wherever such third-party acknowledgments normally appear. * * 3. The names "The National Cancer Institute", "NCI" and "Oracle" must not be used to endorse or promote products derived from this software. * * 4. This license does not authorize the incorporation of this software into any proprietary programs. This license does not authorize the recipient to use any trademarks owned by either NCI or Oracle, Inc. * * 5. THIS SOFTWARE IS PROVIDED "AS IS," AND ANY EXPRESSED OR IMPLIED WARRANTIES, (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE) ARE DISCLAIMED. IN NO EVENT SHALL THE NATIONAL CANCER INSTITUTE, ORACLE, OR THEIR AFFILIATES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE */ package gov.nih.nci.ncicb.cadsr.loader; import gov.nih.nci.ncicb.cadsr.loader.event.ElementChangeEvent; import gov.nih.nci.ncicb.cadsr.loader.event.ElementChangeListener; import gov.nih.nci.ncicb.cadsr.loader.ui.tree.AbstractUMLNode; import gov.nih.nci.ncicb.cadsr.loader.ui.tree.ReviewableUMLNode; import gov.nih.nci.ncicb.cadsr.loader.util.LookupUtil; import gov.nih.nci.ncicb.cadsr.domain.DataElement; import gov.nih.nci.ncicb.cadsr.domain.Concept; import gov.nih.nci.ncicb.cadsr.domain.ValueMeaning; import java.util.HashMap; /** * ChangeTracker keeps track of objects and their modification Status * by storing them in a HashMap <br> * * Upon saving a file, this tracker may be used to update * only those elements that were modified * * @author <EMAIL> */ public class ChangeTracker implements ElementChangeListener { private HashMap<String, Boolean> map = new HashMap<String, Boolean>(); private static ChangeTracker instance = new ChangeTracker(); private ChangeTracker() { } public static ChangeTracker getInstance() { return instance; } public Boolean get(String key) { if(map.containsKey(key)) return map.get(key); else return false; } public void put(String key, boolean value) { map.put(key, value); } public void elementChanged(ElementChangeEvent event) { if(event.getUserObject() instanceof AbstractUMLNode) { AbstractUMLNode absNode = (AbstractUMLNode) event.getUserObject(); this.put(absNode.getFullPath(), true); } else if(event.getUserObject() instanceof DataElement) { this.put(LookupUtil.lookupFullName((DataElement)event.getUserObject()), true); } else if(event.getUserObject() instanceof Concept) { this.put(((Concept)event.getUserObject()).getPreferredName(), true); } else if(event.getUserObject() instanceof ValueMeaning) { // !!! THIS IS NOT WORKING BECAUSE WE NEED THE VD NAME IN THERE this.put("ValueDomains." + ((ValueMeaning)event.getUserObject()).getLongName(), true); } } public void clear() { map.clear(); } public boolean isEmpty() { return map.isEmpty(); } }
lechium/iPhoneOS_12.1.1_Headers
System/Library/PrivateFrameworks/CoreSuggestions.framework/SGOrigin.h
<filename>System/Library/PrivateFrameworks/CoreSuggestions.framework/SGOrigin.h<gh_stars>10-100 /* * This header is generated by classdump-dyld 1.0 * on Saturday, June 1, 2019 at 6:45:55 PM Mountain Standard Time * Operating System: Version 12.1.1 (Build 16C5050a) * Image Source: /System/Library/PrivateFrameworks/CoreSuggestions.framework/CoreSuggestions * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by <NAME>. */ #import <CoreSuggestions/CoreSuggestions-Structs.h> #import <libobjc.A.dylib/NSCopying.h> #import <libobjc.A.dylib/NSSecureCoding.h> @class NSString, CSPerson, NSArray, NSDate, SGSimpleNamedEmailAddress, NSURL; @interface SGOrigin : NSObject <NSCopying, NSSecureCoding> { unsigned long long _type; NSString* _sourceKey; NSString* _externalKey; NSString* _contextSnippet; NSRange _contextSnippetRange; CSPerson* _fromPerson; NSString* _bundleId; NSArray* _to; NSArray* _cc; NSArray* _bcc; NSDate* _date; NSString* _title; BOOL _fromForwardedMessage; NSString* _localizedApplicationName; NSString* _teamId; } @property (nonatomic,readonly) unsigned long long type; //@synthesize type=_type - In the implementation block @property (nonatomic,readonly) NSString * sourceKey; //@synthesize sourceKey=_sourceKey - In the implementation block @property (nonatomic,readonly) NSString * externalKey; //@synthesize externalKey=_externalKey - In the implementation block @property (nonatomic,readonly) NSString * contextSnippet; //@synthesize contextSnippet=_contextSnippet - In the implementation block @property (nonatomic,readonly) NSRange contextSnippetRange; //@synthesize contextSnippetRange=_contextSnippetRange - In the implementation block @property (nonatomic,readonly) SGSimpleNamedEmailAddress * from; @property (nonatomic,readonly) CSPerson * fromPerson; //@synthesize fromPerson=_fromPerson - In the implementation block @property (nonatomic,readonly) NSString * bundleId; //@synthesize bundleId=_bundleId - In the implementation block @property (nonatomic,readonly) NSString * localizedApplicationName; //@synthesize localizedApplicationName=_localizedApplicationName - In the implementation block @property (nonatomic,readonly) NSString * teamId; //@synthesize teamId=_teamId - In the implementation block @property (nonatomic,readonly) NSArray * to; //@synthesize to=_to - In the implementation block @property (nonatomic,readonly) NSArray * cc; //@synthesize cc=_cc - In the implementation block @property (nonatomic,readonly) NSArray * bcc; //@synthesize bcc=_bcc - In the implementation block @property (nonatomic,readonly) NSDate * date; //@synthesize date=_date - In the implementation block @property (nonatomic,readonly) NSString * title; //@synthesize title=_title - In the implementation block @property (getter=isFromForwardedMessage,readonly) BOOL fromForwardedMessage; //@synthesize fromForwardedMessage=_fromForwardedMessage - In the implementation block @property (nonatomic,readonly) NSURL * url; +(id)originWithType:(unsigned long long)arg1 sourceKey:(id)arg2 externalKey:(id)arg3 bundleId:(id)arg4 fromForwardedMessage:(BOOL)arg5 ; +(id)originWithType:(unsigned long long)arg1 sourceKey:(id)arg2 externalKey:(id)arg3 fromForwardedMessage:(BOOL)arg4 ; +(BOOL)supportsSecureCoding; -(SGSimpleNamedEmailAddress *)from; -(NSArray *)to; -(NSString *)teamId; -(NSString *)localizedApplicationName; -(NSString *)contextSnippet; -(NSRange)contextSnippetRange; -(CSPerson *)fromPerson; -(id)initWithType:(unsigned long long)arg1 sourceKey:(id)arg2 externalKey:(id)arg3 bundleId:(id)arg4 fromForwardedMessage:(BOOL)arg5 ; -(void)_resolveAppName; -(BOOL)isEqualToOrigin:(id)arg1 ; -(NSArray *)bcc; -(NSArray *)cc; -(BOOL)isFromForwardedMessage; -(NSString *)sourceKey; -(NSString *)externalKey; -(id)init; -(BOOL)isEqual:(id)arg1 ; -(void)encodeWithCoder:(id)arg1 ; -(id)initWithCoder:(id)arg1 ; -(unsigned long long)hash; -(NSString *)title; -(id)copyWithZone:(NSZone*)arg1 ; -(unsigned long long)type; -(NSDate *)date; -(NSURL *)url; -(NSString *)bundleId; @end
flyingLowSounds/LRTRack
src/LindenbergResearch.hpp
<filename>src/LindenbergResearch.hpp<gh_stars>0 /* *\ ** __ ___ ______ ** ** / / / _ \/_ __/ ** ** / /__/ , _/ / / Lindenberg ** ** /____/_/|_| /_/ Research Tec. ** ** ** ** ** ** https://github.com/lindenbergresearch/LRTRack ** ** <EMAIL> ** ** ** ** Sound Modules for VCV Rack ** ** Copyright 2017-2019 by <NAME> / LRT ** ** ** ** For Redistribution and use in source and binary forms, ** ** with or without modification please see LICENSE. ** ** ** \* */ #pragma once #include <cmath> #include "rack.hpp" #include "asset.hpp" using namespace rack; extern Plugin *pluginInstance; extern Model *modelType35; extern Model *modelDiodeVCF; extern Model *modelBlankPanel; extern Model *modelBlankPanelWood; extern Model *modelVCO; extern Model *modelSimpleFilter; extern Model *modelReShaper; extern Model *modelBlankPanelEmpty; extern Model *modelBlankPanelSmall; extern Model *modelAlmaFilter; extern Model *modelMS20Filter; extern Model *modelWestcoast; extern Model *modelQuickMix; extern Model *modelVULevelMeter; extern Model *modelTestDriver; /* extern Model *modelEchoBox; extern Model *modelSpeck; */
tenxcloud/mosn
pkg/module/zookeeper/filters/data.go
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package filters import ( "encoding/binary" "mosn.io/mosn/pkg/module/zookeeper" "mosn.io/pkg/log" ) func NewDataFilter() zookeeper.Filter { return new(data) } type data struct{} func (data) HandleRequest(ctx *zookeeper.Context) { if ctx.OpCode == zookeeper.Undefined || len(ctx.Path) <= 0 { return } switch ctx.OpCode { case zookeeper.OpCreate, zookeeper.OpSetData: handleRequestData(ctx) default: } } func handleRequestData(ctx *zookeeper.Context) { pathLength := len(ctx.Path) begin := 4*zookeeper.Uint32Size + pathLength handleDataInternal(ctx, begin) } func (data) HandleResponse(ctx *zookeeper.Context) { if ctx.Error != nil { return } var request *zookeeper.Context if request = ctx.Request; request == nil { return } if request.OpCode == zookeeper.Undefined || len(request.Path) <= 0 { return } switch request.OpCode { case zookeeper.OpGetData: handleResponseData(ctx) default: } } func handleResponseData(ctx *zookeeper.Context) { handleDataInternal(ctx, 5*zookeeper.Uint32Size) } func handleDataInternal(ctx *zookeeper.Context, begin int) { buffer := ctx.RawPayload length := len(buffer) if length < begin { log.DefaultLogger.Errorf("zookeeper.filters.path.handleRequestData, buffer too short") return } dataLenght := int(binary.BigEndian.Uint32(buffer[begin : begin+zookeeper.Uint32Size])) if begin+zookeeper.Uint32Size+dataLenght > length { log.DefaultLogger.Errorf("zookeeper.filters.path.handleRequestData, buffer too short for data") return } ctx.DataBegin = begin + zookeeper.Uint32Size ctx.DataEnd = begin + zookeeper.Uint32Size + dataLenght ctx.Data = buffer[ctx.DataBegin:ctx.DataEnd] }
ashen7/SimpleCaffe
src/caffe/test/test_common.cpp
// // Created by yipeng on 2020/3/23. // #include <gtest/gtest.h> #include "caffe/common.hpp" #include "caffe/synced_memory.hpp" #include "caffe/util/math_functions.hpp" #include "caffe/test/test_caffe_main.hpp" namespace caffe { //固件类fixture class 一个测试套件test suite里 多个测试test可以只用一次初始化数据 //使用SetUp()来初始化 TearDown()来析构 class CommonTest : public ::testing::Test {}; #ifndef CPU_ONLY //GPU Caffe 单例测试 //使用夹具类 这里就用TEST_F 而不是TEST 两个参数 第一个是类名(test suite) 第二个是test name TEST_F(CommonTest, TestCublas) { int device_id; CUDA_CHECK(cudaGetDevice(&device_id)); // expect宏 test失败了产生非致命错误 不会退出 EXPECT_TRUE(Caffe::cublas_handle()); } #endif TEST_F(CommonTest, TestMode) { Caffe::set_mode(Caffe::CPU); EXPECT_EQ(Caffe::mode(), Caffe::CPU); Caffe::set_mode(Caffe::GPU); EXPECT_EQ(Caffe::mode(), Caffe::GPU); } TEST_F(CommonTest, TestRandomSeedCPU) { SyncedMemory a(10 * sizeof(int)); SyncedMemory b(10 * sizeof(int)); // 设置一样的seed 看看生成的随机值是否一样 Caffe::set_random_seed(1701); caffe_rng_bernoulli(10, 0.5, static_cast<int*>(a.mutable_cpu_data())); Caffe::set_random_seed(1701); caffe_rng_bernoulli(10, 0.5, static_cast<int*>(b.mutable_cpu_data())); for (int i = 0; i < 10; ++i) { EXPECT_EQ(static_cast<const int*>(a.cpu_data())[i], static_cast<const int*>(b.cpu_data())[i]); } } TEST_F(CommonTest, TestRandomSeedGPU) { #ifndef CPU_ONLY SyncedMemory a(10 * sizeof(unsigned int)); SyncedMemory b(10 * sizeof(unsigned int)); // 设置一样的seed 看看生成的随机值是否一样 Caffe::set_random_seed(1701); CURAND_CHECK(curandGenerate(Caffe::curand_generator(), static_cast<unsigned int*>(a.mutable_gpu_data()), 10)); Caffe::set_random_seed(1701); CURAND_CHECK(curandGenerate(Caffe::curand_generator(), static_cast<unsigned int*>(b.mutable_gpu_data()), 10)); for (int i = 0; i < 10; ++i) { EXPECT_EQ(static_cast<const int*>(a.cpu_data())[i], static_cast<const int*>(b.cpu_data())[i]); } #endif } } //namespace caffe
HeartCommunity/uiKit
packages/core/field-base/components/FieldBaseStateless.js
<gh_stars>1-10 import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; import _inherits from "@babel/runtime/helpers/inherits"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; import React, { Component } from 'react'; import InlineDialog from '@findable/inline-dialog'; import { Content, ContentWrapper, ChildWrapper } from '../styled/Content'; import ValidationElement from './ValidationElement'; var FieldBaseStateless = /*#__PURE__*/ function (_Component) { _inherits(FieldBaseStateless, _Component); function FieldBaseStateless() { _classCallCheck(this, FieldBaseStateless); return _possibleConstructorReturn(this, _getPrototypeOf(FieldBaseStateless).apply(this, arguments)); } _createClass(FieldBaseStateless, [{ key: "componentDidUpdate", value: function componentDidUpdate() { if (this.props.shouldReset) { this.props.onBlur(); } } }, { key: "render", value: function render() { var _this$props = this.props, appearance = _this$props.appearance, children = _this$props.children, invalidMessage = _this$props.invalidMessage, isCompact = _this$props.isCompact, isDialogOpen = _this$props.isDialogOpen, isDisabled = _this$props.isDisabled, isFitContainerWidthEnabled = _this$props.isFitContainerWidthEnabled, isFocused = _this$props.isFocused, isInvalid = _this$props.isInvalid, isLoading = _this$props.isLoading, isPaddingDisabled = _this$props.isPaddingDisabled, isReadOnly = _this$props.isReadOnly, maxWidth = _this$props.maxWidth, onBlur = _this$props.onBlur, onDialogBlur = _this$props.onDialogBlur, onDialogClick = _this$props.onDialogClick, onDialogFocus = _this$props.onDialogFocus, onFocus = _this$props.onFocus, isValidationHidden = _this$props.isValidationHidden; function getAppearance(a) { if (isDisabled) return 'disabled'; if (isInvalid) return 'invalid'; return a; } return React.createElement(ContentWrapper, { disabled: isDisabled, maxWidth: maxWidth, grow: isFitContainerWidthEnabled }, React.createElement(InlineDialog, { content: invalidMessage, isOpen: isDialogOpen && !!invalidMessage && !isValidationHidden, onContentBlur: onDialogBlur, onContentClick: onDialogClick, onContentFocus: onDialogFocus, placement: "right" }, React.createElement(ChildWrapper, { compact: isCompact }, React.createElement(Content, { appearance: getAppearance(appearance), compact: isCompact, disabled: isDisabled, isFocused: isFocused, invalid: isInvalid && !isFocused, none: appearance === 'none', onBlurCapture: onBlur, onFocusCapture: onFocus, paddingDisabled: isPaddingDisabled, readOnly: isReadOnly, subtle: appearance === 'subtle' }, children, !isValidationHidden ? React.createElement(ValidationElement, { isDisabled: isDisabled, isInvalid: isInvalid, isLoading: isLoading }) : null)))); } }]); return FieldBaseStateless; }(Component); _defineProperty(FieldBaseStateless, "defaultProps", { appearance: 'standard', invalidMessage: '', isCompact: false, isDialogOpen: false, isDisabled: false, isFitContainerWidthEnabled: false, isFocused: false, isInvalid: false, isLoading: false, isPaddingDisabled: false, isReadOnly: false, onDialogBlur: function onDialogBlur() {}, onDialogClick: function onDialogClick() {}, onDialogFocus: function onDialogFocus() {}, shouldReset: false, isValidationHidden: false }); export { FieldBaseStateless as default };
LaudateCorpus1/oraclejet
dist/js/libs/oj/debug_esm/ojcustomelement.js
/** * @license * Copyright (c) 2014, 2022, Oracle and/or its affiliates. * Licensed under The Universal Permissive License (UPL), Version 1.0 * as shown at https://oss.oracle.com/licenses/upl/ * @ignore */ import oj from 'ojs/ojcore'; import { warn } from 'ojs/ojlogger'; import { CustomElementUtils, AttributeUtils, transformPreactValue, ElementUtils, JetElementError } from 'ojs/ojcustomelement-utils'; import { getPropertyMetadata, getFlattenedAttributes, checkEnumValues } from 'ojs/ojmetadatautils'; import { whenDocumentReady } from 'ojs/ojbootstrap'; import oj$1 from 'ojs/ojcore-base'; /** * Custom element bridge prototype. * * @class * @ignore */ const BaseCustomElementBridge = {}; /** * Prototype for subclasses * @ignore */ BaseCustomElementBridge.proto = { getClass: function (descriptor) { var proto = Object.create(HTMLElement.prototype); this.InitializePrototype(proto); var metadata = this.GetMetadata(descriptor); // Enumerate metadata to define the prototype properties, methods, and events BaseCustomElementBridge._enumerateMetadataForKey(proto, metadata, 'properties', this.DefinePropertyCallback.bind(this)); BaseCustomElementBridge._enumerateMetadataForKey(proto, metadata, 'methods', this.DefineMethodCallback.bind(this)); // Add additional element methods not defined in metadata, e.g. getNodeBySubId/getSubIdByNode or get/setProperty this.AddComponentMethods(proto); proto.setProperties = function (props) { CustomElementUtils.getElementBridge(this)._setProperties(this, props); }; // The set/unset methods are used for TypeScript only so we should define these as non enumerated properties Object.defineProperty(proto, 'set', { value: function (prop, value) { this.setProperty(prop, value); } }); Object.defineProperty(proto, 'unset', { value: function (prop) { this.setProperty(prop, undefined); } }); // Add lifecycle listeners proto.attributeChangedCallback = this.AttributeChangedCallback; proto.connectedCallback = this._connectedCallback; proto.disconnectedCallback = this._detachedCallback; // Override appendChild/insertBefore to work around JET-43356 issue w/ Preact const origAppendChild = proto.appendChild; proto.appendChild = function (newNode) { if (CustomElementUtils.canRelocateNode(this, newNode)) { return origAppendChild.call(this, newNode); } return newNode; }; const origInsertBefore = proto.insertBefore; proto.insertBefore = function (newNode, refNode) { if (CustomElementUtils.canRelocateNode(this, newNode)) { return origInsertBefore.call(this, newNode, refNode); } return newNode; }; // Override set/removeAttribute to only allow toggling of classes applied by application/parent component // This is necessary to work with Preact's class patching logic proto.setAttribute = function (qualifiedName, value) { if (qualifiedName === 'class') { const outerClasses = CustomElementUtils.getClassSet(value); CustomElementUtils.getElementState(this).setOuterClasses(outerClasses); } else { HTMLElement.prototype.setAttribute.call(this, qualifiedName, value); } }; proto.removeAttribute = function (qualifiedName) { if (qualifiedName === 'class') { this.setAttribute('class', ''); } else { HTMLElement.prototype.removeAttribute.call(this, qualifiedName); } }; var constructorFunc = function () { var reflect = window.Reflect; var ret; if (typeof reflect !== 'undefined') { ret = reflect.construct(HTMLElement, [], this.constructor); } else { ret = HTMLElement.call(this); } return ret; }; var bridge = this; Object.defineProperty(constructorFunc, 'observedAttributes', { get: function () { return bridge.GetAttributes(metadata); } }); Object.defineProperty(proto, 'constructor', { value: constructorFunc, writable: true, configurable: true }); constructorFunc.prototype = proto; Object.setPrototypeOf(constructorFunc, HTMLElement); return constructorFunc; }, initializeBridge: function (element, descriptor) { // Initialize property storage and other variables needed for property sets. // Since early property sets can occur before the element's connected callback // is triggered we can't rely on performing this logic there. The cases where // the connected callback isn't called before a property set can occur if the // custom element is programatically created and sets are done before adding // the element to the DOM or if the element is stamped by knockout and its expressions // processed disconnected as in the case for oj-bind-for-each. this.METADATA = this.GetMetadata(descriptor); this._eventListeners = {}; this.State = CustomElementUtils.getElementState(element); }, // eslint-disable-next-line no-unused-vars AddComponentMethods: function (proto) {}, AttributeChangedCallback: function (attr, oldValue, newValue) { // The browser triggers this callback even if old and new values are the same // so we should do an equality check ourselves to prevent extra work. // Note that we need to check whether the property has been set and marked dirty // as well since we don't reflect property values back to the DOM attribute. const prop = AttributeUtils.attributeToPropertyName(attr); const bridge = CustomElementUtils.getElementBridge(this); if (oldValue !== newValue || bridge.State.dirtyProps.has(prop)) { bridge.State.dirtyProps.delete(prop.split('.')[0]); // Due to where IE11 disables child inputs for a parent with the disabled attribute, // we will remove the disabled attribute after we save the value and will ignore all disabled // attribute sets after component initialization when the application can just as easily use the property // setter instead. Expressions will be handled in the CustomElementBinding. if (attr === 'disabled' && bridge.ShouldRemoveDisabled() && bridge._isDisabledAttributeRemoved()) { // Always remove the disabled attribute even after component initialization and log warning. // A null value indicates that the value was removed already. if (newValue != null) { warn("Ignoring 'disabled' attribute change after component initialization. Use element property setter instead."); bridge._removeDisabledAttribute(this); } return; } if (bridge.ShouldHandleAttributeChanged(this)) { BaseCustomElementBridge.__CheckOverlappingAttribute(this, attr); // removeAttribute calls return null as the newValue which we want to treat as // a property unset and convert to undefined. We allow property null sets as an // actual property override. if (newValue === null) { // eslint-disable-next-line no-param-reassign newValue = undefined; } var params = { detail: { attribute: attr, value: newValue, previousValue: oldValue } }; this.dispatchEvent(new CustomEvent('attribute-changed', params)); var expression = AttributeUtils.getExpressionInfo(newValue).expr; if (!expression) { const propMeta = getPropertyMetadata(prop, CustomElementUtils.getElementProperties(this)); if (propMeta) { this.setProperty(prop, BaseCustomElementBridge .__ParseAttrValue(this, attr, prop, newValue, propMeta)); } // This allows subclasses to handle special cases like global transfer // attributes for JET components or controlled properties for virtual components bridge.HandleAttributeChanged(this, attr, oldValue, newValue); } } } }, // eslint-disable-next-line no-unused-vars CreateComponent: function (element) {}, // eslint-disable-next-line no-unused-vars DefineMethodCallback: function (proto, method, methodMeta) {}, // eslint-disable-next-line no-unused-vars DefinePropertyCallback: function (proto, property, propertyMeta) {}, GetAttributes: function (metadata) { return metadata ? getFlattenedAttributes(metadata.properties) : []; }, GetMetadata: function (descriptor) { return descriptor[BaseCustomElementBridge.DESC_KEY_META] || {}; }, /** * Returns the aliased component property for a given custom element property, * e.g. readOnly for oj-switch's readonly custom element property. * Will return the original property if there is no aliasing. * @param {string} property The property to check */ GetAliasForProperty: function (property) { return property; }, /** * Tests whether attribute changed processing should be performed. */ // eslint-disable-next-line no-unused-vars ShouldHandleAttributeChanged: function (element) { return this.State.canHandleAttributes(); }, /** * Tests whether the HandleAttributeChanged callback should be called. * This is only needed in the VirtualElementBridge case when a VComponent * is patching and updates a controlled property on the root element which we * want to update our internal _CONTROLLED_PROPS object with, but not cause a * rerender. */ // eslint-disable-next-line no-unused-vars ShouldCallHandleAttributeChanged: function (element) { return this.ShouldHandleAttributeChanged(); }, // eslint-disable-next-line no-unused-vars HandleAttributeChanged: function (element, attr, oldValue, newValue) {}, // eslint-disable-next-line no-unused-vars HandleBindingsApplied: function (element, bindingContext) {}, // eslint-disable-next-line no-unused-vars HandleDetached: function (element) {}, // eslint-disable-next-line no-unused-vars HandleReattached: function (element) {}, // eslint-disable-next-line no-unused-vars InitializeElement: function (element) {}, // eslint-disable-next-line no-unused-vars InitializePrototype: function (proto) {}, BatchedPropertySet: function (elem, props) { var keys = Object.keys(props); for (var i = 0; i < keys.length; i++) { var key = keys[i]; elem.setProperty(key, props[key]); } }, GetEventListenerProperty: function (property) { var event = AttributeUtils.eventListenerPropertyToEventType(property); // Get event listener var eventListener = this._eventListeners[event]; if (eventListener) { return eventListener.getListener(); } return undefined; }, GetProperty: function (element, prop, props) { var meta = getPropertyMetadata(prop, CustomElementUtils.getElementProperties(element)); // For event listener and non component properties, retrieve the value directly stored on the element. // For top level properties, this will delegate to our 'set' methods so we can handle default values. // props is the properties object we pass the definitional element or composite ViewModel if (AttributeUtils.isEventListenerProperty(prop) || !meta || prop.indexOf('.') === -1) { return props[prop]; } return CustomElementUtils.getPropertyValue(props, prop); }, // VComponent hook to queue property change events to be fired asynchronously HandlePropertyChanged: function (element, property, value, previousValue, isOuter, subprop) { var updatedFrom = isOuter ? 'external' : 'internal'; BaseCustomElementBridge.__FirePropertyChangeEvent(element, property, value, previousValue, updatedFrom, subprop); }, PlaybackEarlyPropertySets: function (element) { // Once the binding provider has resolved and we are about // to render the component, we no longer need to track early // property sets to avoid overriding data bound DOM attributes if (this._earlySets) { const descriptor = CustomElementUtils.getElementDescriptor(element.tagName); const propertyMeta = this.GetMetadata(descriptor); while (this._earlySets.length) { const setObj = this._earlySets.shift(); const updatedValue = transformPreactValue( element, propertyMeta.properties[setObj.property], setObj.value); element.setProperty(setObj.property, updatedValue); } } }, /** * Returns true if this property set was handled as an early property set. * An early property set is any set that occurs before the component is created. * These sets do not trigger [property]Changed events. * @param {Element} element * @param {string} prop * @param {any} value * @return {boolean} */ SaveEarlyPropertySet: function (element, prop, value) { // Do not save sets that occur during BaseCustomElementBridge.__InitProperties // or expression evaluation. We can process these as normal. Playback occurs before the // binding provider promise is resolved leading to component creation. if (this.State.allowPropertySets()) { return false; } if (!this._earlySets) { this._earlySets = []; } this._earlySets.push({ property: prop, value: value }); return true; }, SetEventListenerProperty: function (element, property, value) { var event = AttributeUtils.eventListenerPropertyToEventType(property); // Get event listener var eventListener = this._eventListeners[event]; if (!eventListener) { // Create the wrapper eventListener = this._createEventListenerWrapper(); this._eventListeners[event] = eventListener; element.addEventListener(event, eventListener); } if (value == null || value instanceof Function) { eventListener.setListener(value); } else { BaseCustomElementBridge.__ThrowTypeError(element, property, value, 'function'); } }, SetProperty: function (element, prop, value, props, bOuter) { // Check value against any defined enums var meta = getPropertyMetadata(prop, CustomElementUtils.getElementProperties(element)); if (AttributeUtils.isEventListenerProperty(prop) || !meta) { // eslint-disable-next-line no-param-reassign element[prop] = value; } else { // props is the properties object we pass the definitional element or composite ViewModel var previousValue = element.getProperty(prop); var propPath = prop.split('.'); var topProp = propPath[0]; // If the top level property is an object, make a copy otherwise the old/new values // will be the same. var topPropPrevValue = props[topProp]; if (oj.CollectionUtils.isPlainObject(topPropPrevValue)) { topPropPrevValue = oj.CollectionUtils.copyInto({}, topPropPrevValue, undefined, true); } if (!ElementUtils.comparePropertyValues(meta, value, previousValue)) { var isSubprop = prop.indexOf('.') !== -1; if (isSubprop) { // Set a flag for the case a subproperty results in a set of the top level property // which was not instantiated to an empty object to avoid firing two events. this._SKIP_PROP_CHANGE_EVENT = true; } if (bOuter) { // This ultimately triggers our element defined property setter this.ValidateAndSetProperty(this.GetAliasForProperty.bind(this), props, prop, value, element); } else { // Skip validation for inner sets so we don't throw an error when updating readOnly writeable properties BaseCustomElementBridge.__SetProperty(this.GetAliasForProperty.bind(this), props, prop, value); } this._SKIP_PROP_CHANGE_EVENT = false; // Property change events for top level properties will be triggered by ValidateAndSetProperty so avoid firing twice if (isSubprop) { var subprop = { path: prop, value, previousValue }; this.HandlePropertyChanged(element, topProp, props[topProp], topPropPrevValue, bOuter, subprop); } this.State.dirtyProps.add(topProp); return { property: topProp, propertySet: true, isSubproperty: isSubprop }; } } // We return true if a component property is updated with a different value and false // for other cases like on[Event] property updates return { property: null, propertySet: false, isSubproperty: false }; }, ShouldRemoveDisabled: function () { // Subclasses should override if the disabled attribute shouldn't be unconditionally removed // from the DOM, e.g. definitional and composite components return true; }, ValidateAndSetProperty: function (propNameFun, componentProps, property, value, element) { var _value = this.ValidatePropertySet(element, property, value); BaseCustomElementBridge.__SetProperty(propNameFun, componentProps, property, _value); }, ValidatePropertySet: function (element, property, value) { var propsMeta = CustomElementUtils.getElementProperties(element); var propMeta = getPropertyMetadata(property, propsMeta); var propAr = property.split('.'); if (!propMeta) { warn(CustomElementUtils.getElementInfo(element) + ": Ignoring property set for undefined property '" + property + "'."); return undefined; } // Check readOnly property for top level property if (propsMeta[propAr[0]].readOnly) { throw new JetElementError(element, `Read-only property '${property}' cannot be set.`); } try { checkEnumValues(element, property, value, propMeta); } catch (error) { throw new JetElementError(element, error.message); } if (value != null) { return BaseCustomElementBridge.checkType(element, property, value, propMeta); } return value; }, PostCreate: function (element) { // After parsing the DOM attribute values and initializing properties, remove the disabled // property if it exists due to if (element.hasAttribute('disabled') && this.ShouldRemoveDisabled() && !this._isDisabledAttributeRemoved()) { this._removeDisabledAttribute(element); } }, _connected: function (element) { const state = this.State; // If the component has not finished its creation cycle, // attempt to create it vs handling as a reattached since // the component could have finished in an error state. // The element state will no-op the creation process if // the component is already in an error state. if (!state.isComplete()) { state.startCreationCycle(); if (state.isCreating()) { // initial attach // Initializing props from DOM needs to be called // before we playback properties so we cannot call this // inside the createComponentCallback this.InitializeElement(element); // Should be able to call PlaybackEarlyPropertySets inside // createComponentCallback, but ojradioset/ojcheckboxset rely on // on a side effect of the flow where we playback early property sets // before resolving the binding provider. In those components the parent // renders the oj-option instead of the ojOption's own render method. state.setBindingProviderCallback(this.PlaybackEarlyPropertySets.bind(this, element)); const createComponentCallback = () => { try { // Cache the slot map since we don't support adding new // slot content after initial render state.getSlotMap(true); const createPromise = this.CreateComponent(element) || Promise.resolve(); return createPromise.then(this.PostCreate.bind(this, element)); } catch (error) { return Promise.reject(error); } }; state.setCreateCallback(createComponentCallback); } } else { this.HandleReattached(element); } }, _connectedCallback: function () { var bridge = CustomElementUtils.getElementBridge(this); bridge._connected(this); }, _detachedCallback: function () { const bridge = CustomElementUtils.getElementBridge(this); const state = bridge.State; if (!state.isComplete()) { state.pauseCreationCycle(); } else { bridge.HandleDetached(this); } }, // This wrapper does not provide any additional functionality to event listener functions // It exists solely to preserve event listener order _createEventListenerWrapper: function () { var eventListener; var domListener = function (event) { if (eventListener) { eventListener(event); } }; domListener.setListener = function (listener) { eventListener = listener; }; domListener.getListener = function () { return eventListener; }; return domListener; }, _setProperties: function (elem, props) { var mutationKeys = []; // keys for the 'dot mutation' properties var regularProps = {}; // the rest of the properties var hasRegularProps = false; var keys = Object.keys(props); for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (key.indexOf('.') >= 0) { mutationKeys.push(key); } else { regularProps[key] = props[key]; hasRegularProps = true; } } // Regular property updates may be batched if (hasRegularProps) { this.BatchedPropertySet(elem, regularProps); } // 'Dot notation' properties can only be set individually for now for (var p = 0; p < mutationKeys.length; p++) { var mkey = mutationKeys[p]; elem.setProperty(mkey, props[mkey]); } }, /** * Returns true if the disabled attribute has already been removed by the bridge. * @return {boolean} * @private */ _isDisabledAttributeRemoved: function () { return this._disabledProcessed === true; }, /** * Removes the disabled attribute from an element and marks the bridge as having * processed the value to prevent evaluation of additional attribute sets. * @param {Element} element The custom element * @private */ _removeDisabledAttribute: function (element) { this._disabledProcessed = true; element.removeAttribute('disabled'); } }; /** ***************************/ /* NON PUBLIC STATIC METHODS */ /** ***************************/ /** * @ignore */ BaseCustomElementBridge._enumerateMetadataForKey = function (proto, metadata, key, callback) { if (!metadata || !metadata[key]) { return; } var values = metadata[key]; var names = Object.keys(values); names.forEach( function (name) { callback(proto, name, values[name]); } ); }; /** * Checks to see whether a value is valid for an element property and throws an error if not. * @param {Element} element The custom element * @param {string} property The property to check * @param {string} value The property value * @param {Object} metadata The property metadata * @ignore */ BaseCustomElementBridge.checkType = function (element, property, value, metadata) { // Only check non union primitive, array, and object types const type = metadata.type; const supportedTypes = ElementUtils.getSupportedTypes(type); if (supportedTypes.typeCount === 1 && !supportedTypes.any && !supportedTypes.other) { const valueType = typeof value; if ((supportedTypes.array && !Array.isArray(value)) || (supportedTypes.object && !(valueType === 'object')) || (supportedTypes.string && !(valueType === 'string')) || (supportedTypes.number && !(valueType === 'number' && isFinite(value)))) { BaseCustomElementBridge.__ThrowTypeError(element, property, value, type); } else if (supportedTypes.boolean) { // Treat boolean property sets like the DOM does where any value that passes // 'if (boolVal)' results in a true prop set return !!value; } } return value; }; /** * @ignore */ BaseCustomElementBridge.__ThrowTypeError = function (element, property, value, type) { throw new JetElementError(element, `Invalid type '${typeof value}' found for property '${property}'.\ Expected value of type '${type}'.`); }; /** * Checks to see if there are any overlapping attribute for the given element and attribute * @ignore */ BaseCustomElementBridge.__CheckOverlappingAttribute = function (element, attr) { var attrPath = attr.split('.'); if (attrPath.length > 1) { attrPath.pop(); while (attrPath.length) { var attrSubPath = attrPath.join('.'); if (element.hasAttribute(attrSubPath)) { throw new JetElementError(element, `Cannot set overlapping attributes '${attr}' and '${attrSubPath}'.`); } attrPath.pop(); } } }; /** * @ignore */ BaseCustomElementBridge.__InitProperties = function (element, componentProps) { const bridge = CustomElementUtils.getElementBridge(element); var metaProps = CustomElementUtils.getElementProperties(element); if (metaProps) { var attrs = element.attributes; // attrs is a NodeList for (var i = 0; i < attrs.length; i++) { var attr = attrs[i]; var property = AttributeUtils.attributeToPropertyName(attr.nodeName); // See if attribute is a component property var meta = getPropertyMetadata(property, metaProps); if (meta && !meta.readOnly) { // If complex property, check if there are any overlapping attributes BaseCustomElementBridge.__CheckOverlappingAttribute(element, attr.nodeName); var info = AttributeUtils.getExpressionInfo(attr.value); if (!info.expr) { var value = BaseCustomElementBridge.__ParseAttrValue(element, attr.nodeName, property, attr.value, meta); bridge.ValidateAndSetProperty(bridge.GetAliasForProperty.bind(bridge), componentProps, property, value, element); } } } } }; /** * @param {function} propNameFun A function that returns the actual property name to use, e.g. an alias * @param {Object} componentProps The object to set the new property value on which is the * element for outer property sets and the property bag for inner sets. * @param {string} property The property name * @param {Object} value The value to set for the property * @ignore */ BaseCustomElementBridge.__SetProperty = function (propNameFun, componentProps, property, value) { var propsObj = componentProps; var propPath = property.split('.'); var branchedProps; // Set subproperty, initializing parent objects along the way unless the top level // property is not defined since setting it to an empty object will trigger a property changed // event. Instead, branch and set at the end. We only have listeners on top level properties // so setting a subproperty will not trigger a property changed event along the way. var topProp = propNameFun(propPath[0]); if (propPath.length > 1 && !componentProps[topProp]) { branchedProps = {}; propsObj = branchedProps; } // Walk to the correct location for (var i = 0; i < propPath.length; i++) { var subprop = propNameFun(propPath[i]); if (i === propPath.length - 1) { propsObj[subprop] = value; } else if (!propsObj[subprop]) { propsObj[subprop] = {}; } propsObj = propsObj[subprop]; } // Update the original component properties if we branched if (branchedProps) { // eslint-disable-next-line no-param-reassign componentProps[topProp] = branchedProps[topProp]; } }; /** * Returns the coerced attribute value using a custom parse function or the framework default. * @ignore */ BaseCustomElementBridge.__ParseAttrValue = function (elem, attr, prop, val, metadata) { if (val == null) { return val; } function _coerceVal(value) { return AttributeUtils.attributeToPropertyValue(elem, attr, value, metadata); } var parseFunction = CustomElementUtils.getElementDescriptor(elem.tagName).parseFunction; if (parseFunction) { return parseFunction(val, prop, metadata, function (value) { return _coerceVal(value); } ); } return _coerceVal(val); }; /** * @ignore */ BaseCustomElementBridge.__ProcessEventListeners = function (_metadata) { var metadata = oj.CollectionUtils.copyInto({}, _metadata, undefined, true, 1); metadata.properties = metadata.properties || {}; BaseCustomElementBridge._enumerateMetadataForKey(null, metadata, 'properties', function (proto, property) { var eventName = AttributeUtils.propertyNameToChangeEventType(property); var eventListenerProperty = AttributeUtils.eventTypeToEventListenerProperty(eventName); metadata.properties[eventListenerProperty] = { _derived: true, _eventListener: true }; } ); BaseCustomElementBridge._enumerateMetadataForKey(null, metadata, 'events', function (proto, event) { var eventListenerProperty = AttributeUtils.eventTypeToEventListenerProperty(event); metadata.properties[eventListenerProperty] = { _derived: true, _eventListener: true }; } ); return metadata; }; /** * @ignore * @param {Element} element * @param {string} name * @param {Object} value * @param {Object} previousValue * @param {string} updatedFrom * @param {Object=} subprop */ BaseCustomElementBridge.__FirePropertyChangeEvent = function (element, name, value, previousValue, updatedFrom, subprop) { var bridge = CustomElementUtils.getElementBridge(element); // There are cases where a subproperty set can trigger a top level property set // if the top level property was not instantiated to an empty object. We don't want // to fire two events for that case. The BaseCustomElementBridge has logic to fire // the subproperty change event there. if (!bridge._SKIP_PROP_CHANGE_EVENT) { var detail = {}; if (subprop) { detail.subproperty = subprop; } detail.value = value; detail.previousValue = previousValue; detail.updatedFrom = updatedFrom; // Check if the subclass needs to do anything before we fire the property change event, // e.g. composites that need to call the propertyChanged ViewModel callback. if (bridge.beforePropertyChangedEvent) { bridge.beforePropertyChangedEvent(element, name, detail); } // The bridge sets the ready to fire flag after the component has been instantiated. // We shouldn't fire property changed events before then unless the update comes from internally // for cases like readOnly property updates. if (updatedFrom !== 'external' || bridge.State.isComplete()) { element.dispatchEvent(new CustomEvent(name + 'Changed', { detail: detail })); } } }; /** * @ignore */ BaseCustomElementBridge.__DefineDynamicObjectProperty = function (obj, property, getter, setter) { Object.defineProperty(obj, property, { enumerable: true, get: getter, set: setter }); }; /** @ignore */ BaseCustomElementBridge.DESC_KEY_META = 'metadata'; oj._registerLegacyNamespaceProp('BaseCustomElementBridge', BaseCustomElementBridge); /** * in some OS/browser combinations you can attempt to detect high contrast mode * in javascript, go to the url below and look for "High Contrast" * https://www.w3.org/TR/2016/WD-wai-aria-practices-1.1-20160317/ * * This function uses a variation of the code in the "High Contrast" section of * the site above to try and detect high contrast mode * by script, but it by no means definitively tells you whether or not you * are actually in high contrast mode. As discussed at the url above you * may need to have a user preference setting for high contrast. * * If the script is able to detect high contrast mode it sets the class * "oj-hicontrast" on the body tag. When "oj-high-contrast" is present * JET provides alternate informational images that are specially designed * for high contrast users. * @private */ function _ojHighContrast() { // using a data uri, I googled for shortest uri to get this one since // I don't care about the actual image, but I do want a legit image // otherwise I see an error in chrome and I don't want users to be // confused by seeing any error. var div = document.createElement('div'); div.style.border = '1px solid'; div.style.borderColor = 'red green'; div.style.position = 'absolute'; div.style.top = '-999px'; div.style.backgroundImage = 'url(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=)'; var body = document.body; body.appendChild(div); // @HTMLUpdateOK safe manipulation var computedStyles = window.getComputedStyle(div); var bki = computedStyles.backgroundImage; if (computedStyles.borderTopColor === computedStyles.borderRightColor || (bki != null && (bki === 'none' || bki === 'url (invalid-url:)'))) { body.classList.add('oj-hicontrast'); } body.removeChild(div); } whenDocumentReady().then(function () { _ojHighContrast(); }); /** * @ojoverviewdoc CustomElementOverview - [2]JET Web Components * @classdesc * {@ojinclude "name":"customElementOverviewDoc"} */ /** * <h2 id="ce-overview-section"> * Overview<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-overview-section"></a> * </h2> * <p> * JET components and <a href="CompositeOverview.html">custom components</a>, collectively referred to as <b>JET Web Components</b>, * are implemented as <a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components/Custom_Elements">custom HTML elements</a> * and extend the <a href="https://html.spec.whatwg.org/multipage/dom.html#htmlelement">HTMLElement</a> interface. This means that * JET custom elements automatically inherit * <a href=https://html.spec.whatwg.org/multipage/dom.html#global-attributes>global attributes</a> * and programmatic access to these components is similar to interacting with native HTML elements. * All JET components live in the "oj" namespace and have HTML element names starting with "oj-". We will use * the term "JET component" to refer to both native JET custom elements and custom elements implemented using the * <a href="Composite.html">Composite</a> component APIs after this point. * </p> * <h2 id="ce-overview-upgrade-section" class="subsection-title"> * Upgrading a Custom Element<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-overview-upgrade-section"></a> * </h2> * <p> * The upgrade process will begin for current JET custom elements in the DOM when the component module is loaded, * registering a class constructor with its tag name using the * <a href="https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define">CustomElementRegistry</a> * <code>define()</code> API. Existing elements matching the registered tag name will be updated to inherit the new * class definition and all of the component properties and methods will be available on the custom element after * this process completes. Additionally, JET components will resolve any data bindings during the upgrade process. * The application is responsible for calling their binding provider to apply bindings or for adding a * <code>data-oj-binding-provider="none"</code> attribute in their page to indicate that no data bindings exist. * If an application is rendered using Preact, <code>data-oj-binding-provider="preact"</code> should be set instead. * Note that the JET custom element upgrade process will not complete until data bindings * are resolved or no binding provider is indicated using the <code>data-oj-binding-provider</code> attribute. * Also, due to JET components' data binding support, all JET component upgrades will occur asynchronously regardless * of whether a binding provider is used. * Please see the <a href="#ce-databind-section">data binding</a> section for more details on binding providers and data binding. * The application should not interact with the JET custom element except to programmatically set properties until the * custom element upgrade is complete. The recommended way to wait on the asynchronous upgrade process is to use an * element-scoped or page-level <a href="oj.BusyContext.html">BusyContext</a>. * </p> * <h2 id="ce-overview-usage-section" class="subsection-title"> * Using a JET Custom Element<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-overview-usage-section"></a> * </h2> * <p> * Custom elements can be used declaratively in HTML by using the component tag name and attributes. They are not self closing * elements and applications should include a closing tag. To interact with them programmatically, DOM APIs can be used to * retrieve the element and then access properties and methods directly on the element instance. JET custom elements can also fire * <code>CustomEvents</code> for which the application can attach event listeners both declaratively and programmatically. * The rest of this document discusses these features in more detail. * </p> * * <h2 id="ce-attributes-section" class="subsection-title"> * Attributes<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-attributes-section"></a> * </h2> * <p> * Attribute values set as string literals will be parsed and coerced to the property type. JET currently * only supports the following string literal type coercions: boolean, number, string, Object and Array, where * Object and Array types must use JSON notation with double quoted strings. A special "any" type is also supported * and is described <a href="#ce-attrs-any-section">below</a>. All other types should to be set using * <a href="#ce-databind-section">expression syntax</a> in the DOM or using the element's property setters or <code>setProperty</code> * and <code>setProperties</code> methods programmatically. Unless updates are done via the DOM element.setAttribute(), * the DOM's attribute value will not reflect changes like those done via the property setters or the setProperty and * setProperties methods. Attribute removals are treated as unsetting of a property where the component default value will be used if one exists. * </p> * <p> * As described <a href="#ce-databind-section">below</a>, JET uses [[...]] and {{...}} syntax to represent data bound expressions. * JET does not currently provide any escaping syntax for "[[" or "{{" appearing at the beginning of the attribute * value. You will need to add a space character to avoid having the string literal value interpreted as a binding * expression (e.g. &lt;oj-some-element some-attribute='[ ["arrayValue1", "arrayValue2", ... ] ]'>&lt;/oj-some-element>). * </p> * <h2 id="ce-attrs-boolean-section" class="subsection-title"> * Boolean Attributes<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-attrs-boolean-section"></a> * </h2> * <p> * JET components treat boolean attributes differently than HTML5. Since a common application use case * is to toggle a data bound boolean attribute, JET will coerce the string literal "false" to the boolean * false for boolean attributes. The absence of a boolean attribute in the DOM will also be interpreted as false. * JET will coerce the following string literal values to the boolean true and throw an Error for all other * invalid values. * <ul> * <li>No value assignment (e.g. &lt;oj-some-element boolean-attribute>&lt;/oj-some-element>)</li> * <li>Empty string (e.g. &lt;oj-some-element boolean-attribute="">&lt;/oj-some-element>)</li> * <li>The "true" string literal (e.g. &lt;oj-some-element boolean-attribute="true">&lt;/oj-some-element>)</li> * <li>The case-insensitive attribute name (e.g. &lt;oj-some-element boolean-attribute="boolean-attribute">&lt;/oj-some-element>)</li> * </ul> * </p> * <h2 id="ce-attrs-object-section" class="subsection-title"> * Object-Typed Attributes<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-attrs-object-section"></a> * </h2> * <p> * Attributes that support Object type can be declaratively set using dot notation. * Note that applications should not set overlapping attributes as these will cause an error to be thrown. * <pre class="prettyprint"> * <code> * &lt;!-- person is an Object typed attribute with a firstName subproperty --> * &lt;oj-some-element person.first-name="{{name}}">&lt;/oj-some-element> * * &lt;!-- overlapping attributes will throw an error --> * &lt;oj-some-element person="{{personInfo}}" person.first-name="{{name}}">&lt;/oj-some-element> * </code> * </pre> * If applications need to programmatically set subproperties, they can call the JET components's <code>setProperty</code> * method with dot notation using the camelCased property syntax (e.g. element.setProperty("person.firstName", "Sally")). * </p> * <h2 id="ce-attrs-any-section" class="subsection-title"> * Any-Typed Attributes<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-attrs-any-section"></a> * </h2> * <p> * Attributes that support any type are documented with type {any} in the API doc and will be coerced as * Objects, Arrays, or strings when set in HTML as a string literal. Numeric types are not supported due * to the fact that we cannot determine whether value="2" on a property supporting any type should be * coerced to a string or a number. The application should use data binding for all other value types and ensure * that when linking any-typed attributes across multiple components, that the resolved types will match, e.g. * do not data bind an <oj-select-one> <code>value</code> attribute to a numeric value and use a string literal * number for its child <oj-option> <code>value</code> attributes since those would evaluate to strings. * </p> * * <h2 id="ce-databind-section" class="subsection-title"> * Data Binding<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-databind-section"></a> * </h2> * <p> * Applications can use the JET data binding syntax in order to use expressions or a non coercible attribute * type (e.g. a type other than boolean, number, string, Object or Array) declaratively in HTML. * This syntax can be used on both JET custom elements and native HTML elements. * The application is responsible for applying bindings using a supported binding provider which then notifies * JET framework code that the bindings have been resolved and to finish the custom element upgrade process. * </p> * <h2 id="ce-databind-bindingprovider-section" class="subsection-title"> * Binding Providers<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-databind-bindingprovider-section"></a> * </h2> * <p> * The binding provider is responsible for setting and updating attribute * expressions and any custom elements within its managed subtree will not finish upgrading until it * applies bindings on that subtree. By default, there is a single binding provider for a page, * but subtree specific binding providers can be added by using the <code>data-oj-binding-provider</code> * attribute with values of "none" and "knockout". The default binding provider is knockout, but if a * page or DOM subtree does not use any expression syntax or knockout, the application can set * <code>data-oj-binding-provider="none"</code> on that element so its dependent JET custom elements * do not need to wait for bindings to be applied to finish upgrading. Note that regardless of whether a * binding provider is used, the custom element upgrade process will be asynchronous. <b>When using the * knockout binding provider, applications should require the ojknockout module.</b> * </p> * <h2 id="ce-databind-syntax-section" class="subsection-title"> * Data Binding Syntax for JET Components<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-databind-syntax-section"></a> * </h2> * <p> * Data binding syntax can be used directly on component attributes. See the specific component API doc * for the complete list of component attributes. Global HTML attributes inherited from HTMLElement can also be * data bound, but require special syntax described below. JET detects data bound attributes by looking for values * wrapped with {{...}} or [[...]]. Please note that there should be no spaces between the braces * when using the data bind syntax (e.g. some-attribute="[ [...] ]"). The {{...}} wrapped expression indicates that the * application is allowing the component to update the expression which can be a knockout observable. Attributes * bound using [[...]] will not be updated or "written back" to by the component. Unless the component attribute documents * that it supports "writeback", we recommend that the [[...]] syntax be used, e.g. selection-mode="[[currentSelectionMode]]". * </p> * <h2 id="ce-databind-writeback-section" class="subsection-title"> * Writeback<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-databind-writeback-section"></a> * </h2> * <p> * Certain properties such as "value" on editable components support updating the associated expression * automatically whenever their value changes. This usually occurs after user interaction such as with selection * or typing into an input field. This expression update functionality is also known as "writeback". * Applications can control expression writeback by using the {{...}} syntax for two-way writable * binding expressions or [[...]] for one-way only expressions. The one-way expressions should * be used when the application needs expressions strictly for "downstream-only" purposes, e.g. only for * updating a component property. Note that if a writeback attribute is bound using the "downstream-only" * syntax, the application and component states can become out of sync. This is different from the * read-only properties, which are "upstream-only", e.g. they are used only to monitor component state. * Thus an expression associated with a read-only property should always use the {{}} syntax. * Most component properties do not writeback and those that do will indicate it in their API doc. * </p> * <pre class="prettyprint"> * <code> * &lt;oj-some-element value="[[currentValue]]" selection={{currentSelection}}>&lt;/oj-some-element> * </code> * </pre> * <h2 id="ce-databind-global-section" class="subsection-title"> * Data Binding Syntax for Native HTML Elements and Global Attributes * <a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-databind-global-section"></a> * </h2> * <p> * JET's data binding syntax can also be used on native HTML elements and * <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes">global attributes</a> * to create one-way bindings by prefixing the attribute * name with ":" (e.g. :id="[[idVar]]"). The attribute binding syntax results in the attribute being set in the DOM * with the evaluated expression. Since global HTML attributes are always string typed, expressions using the ":" * prefixing should resolve to strings with the exception of the style and class attributes which support additional types * and are described in more detail below. In the case of component attributes, applications are recommended to bind * the attribute names directly and avoid the use of the ":" prefix. * </p> * <h2 id="ce-databind-class-section" class="subsection-title"> * :Class Attribute<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-databind-class-section"></a> * </h2> * <p> * The class attribute binding supports a space delimited string of classes, an Array of classes, or an Object whose keys are * individual style classes and whose values are booleans to determine whether those style classes should be present in the DOM * (e.g. :class="[[{errorClass: hasErrors}]]"). Note that the Array and string types will override existing values in the class * attribute when updates occur, whereas the Object type will only add and remove the classes specified. Since JET custom elements * add their own classes, we recommend using the Object type when using the class attribute binding on JET custom elements. * </p> * <h2 id="ce-databind-style-section" class="subsection-title"> * :Style Attribute<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-databind-style-section"></a> * </h2> * <p> * When using the style attribute binding with an Object type, the style Object names should be the JavaScript * names for that style (e.g. "fontWeight" instead of "font-weight" style='{"fontWeight": "..."}'). * Since the style attribute supports Object types, it also supports dot notation for setting style subproperties * directly (e.g. :style.font-weight="[[...]]"). * </p> * * <h2 id="ce-properties-section" class="subsection-title"> * Properties<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-properties-section"></a> * </h2> * <p> * In addition to properties inherited from the HTMLElement prototype, attributes listed * in the component API doc will also be exposed as properties on the JET custom element. * See the <a href="#ce-proptoattr-section">property to attribute mapping</a> * section below to see the syntax difference between setting attributes and properties. * These properties can be set at any time, but can only be retrieved once the HTML element * is fully upgraded. Early property sets before the component has been upgraded * will not result in [property]Changed events and will be passed to the component as part of its initial state. * </p> * <h2 id="ce-properties-readonlywriteback-section" class="subsection-title"> * Read-only and Writeback Properties * <a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-properties-readonlywriteback-section"></a> * </h2> * <p> * Some properties are specially marked as read-only or supporting writeback in the component API doc. * Read-only properties can only be read and not set by the application and generally support writeback. * Writeback properties support automatic updates if they are bound using two way data binding syntax to an * expression, e.g. value="{{valueObservable}}". * Applications can bind an expression to a read-only attribute in HTML by using the {{..}} to ensure * that updates will be reflected in the observable, but should not use this syntax to try and push a * value to the read-only attribute which will result in an error state. * Similarly, property sets using the setProperty, setProperties, or the element property setters should also * be avoided for a read-only property. * </p> * <h2 id="ce-properties-subproperties-section" class="subsection-title">Subproperties * <a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-properties-subproperties-section"></a> * </h2> * <p> * Some JET components support complex properties where the top level property is of type Object and it * contains additional subproperties. If the application needs to set a single subproperty * instead of the entire complex property, the <code>setProperty</code> method should be used * instead to ensure that [property]Changed events will be fired with the subproperty changes. * Note that directly updating the subproperty via dot notation (e.g. element.topProp.subProp = newValue) * will not result in a [property]Changed event being fired. * </p> * <h2 id="ce-properties-unset-section" class="subsection-title">Unsetting of a Property * <a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-properties-unset-section"></a> * </h2> * <p> * The undefined value is treated as unsetting of a property when passed to the * property setter and will result in the component using the default value if one exists. Unsetting of * subproperties using the element's <code>setProperty</code> is not supported. Subproperties can only * only be unset when the top level property is unset. * Property sets will not result in DOM attribute updates and after the custom * element is upgraded, the application should use the custom element properties, not attributes to check * the current value. * </p> * <h2 id="ce-properties-changed-section" class="subsection-title">[property]Changed Events * <a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-properties-changed-section"></a> * </h2> * <p> * When a property or attribute value changes, a non-bubbling [property]Changed <code>CustomEvent</code> * will be fired with the following properties in the event's detail property. * <table class="props"> * <thead> * <tr> * <th>Name</th> * <th>Type</th> * <th>Description</th> * </tr> * </thead> * <tbody> * <tr> * <td>value</td> * <td>any</td> * <td>The current value of the property that changed.</td> * </tr> * <tr> * <td>previousValue</td> * <td>any</td> * <td>The previous value of the property that changed.</td> * </tr> * <tr> * <td>updatedFrom</td> * <td>string</td> * <td> * Where the property was updated from. Supported values are: * <ul> * <li>external - By the application, using either the element's property setter, setAttribute, or external data binding.</li> * <li>internal - By the component, e.g. after user interaction with a text field or selection.</li> * </ul> * </td> * </tr> * <tr> * <td>subproperty</td> * <td>Object</td> * <td>An object holding information about the subproperty that changed. * <table class="props"> * <thead> * <tr> * <th>Name</th> * <th>Type</th> * <th>Description</th> * </tr> * </thead> * <tbody> * <tr> * <td>path</td> * <td>string</td> * <td> * The subproperty path that changed, starting from the top level * property with subproperties delimited by ".". * </td> * </tr> * <tr> * <td>value</td> * <td>any</td> * <td>The current value of the subproperty that changed.</td> * </tr> * <tr> * <td>previousValue</td> * <td>any</td> * <td>The previous value of the subproperty that changed.</td> * </tr> * </tbody> * </table> * </td> * </tr> * </tbody> * </table> * </p> * <p> * Please note that in order for components to be notified of a property change for Array properties, the * value should be data bound and updated using an expression, setting the property to an updated copy * by calling slice(), or by refreshing the component after an in place Array mutation. * </p> * <p> * See <a href="#ce-events-section">Events and Listeners</a> for additional information on how to listen for * these events. * </p> * <p> * Note as well that in cases where a component property that supports writeback is bound to a writable expression, * the relative order of expression writing and invocation of property change listeners is not guaranteed. * For this reason, it is not recommended to write logic that depends both on component/event state and application * view model state. * </p> * <h2 id="ce-proptoattr-section" class="subsection-title">Property-to-Attribute Mapping * <a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-proptoattr-section"></a> * </h2> * <p> * The following rules apply when mapping property to attribute names: * <ul> * <li>Attribute names are case insensitive. CamelCased properties are mapped to * kebab-cased attribute names by inserting a dash before the uppercase letter and converting that letter to lower case * (e.g. a "chartType" property will be mapped to a "chart-type" attribute).</li> * <li> The reverse occurs when mapping a property name from an attribute name.</li> * </ul> * </p> * * <h2 id="ce-methods-section" class="subsection-title"> * Methods<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-methods-section"></a> * </h2> * <p> * Methods can be accessed on the JET component after the element is fully upgraded. See * the component API doc for specifics. * </p> * * <h2 id="ce-events-section" class="subsection-title"> * Events and Listeners<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-events-section"></a> * </h2> * <p> * JET Web Components, like other custom HTML elements, may fire <code>CustomEvents</code>. These * events will be described in component documentation, including whether they bubble, are cancelable and any * event detail payloads. In addition, JET components * fire non-bubbling, non-cancelable [property]Changed (e.g. valueChanged) <code>CustomEvents</code> * whenever a property is updated. See the <a href="#ce-properties-section">properties section</a> above * for details on the event payload. * </p> * <p> * JET <code>CustomEvents</code> can be listened to using the standard addEventListener mechanism: * <pre class="prettyprint"> * <code> * someElement.addEventListener("eventName", function(event) {...}); * </code> * </pre> * </p> * <p> * Additionally, JET custom elements and native HTML elements within JET pages support declarative specification of event * listeners via <code>on-[event-name]</code> attributes (e.g. <code>on-click</code>, * <code>on-value-changed</code> or <code>on-oj-expand</code>). The attributes ultimately delegate to the standard * <code>addEventListener</code> mechanism and only support data bound expressions * that evaluate to functions; arbitrary JavaScript will not be accepted. * </p> * <p> * Please note that event listeners specified using this syntax can only be set during component initialization. * Subsequent setAttribute calls for the event listener attributes will be ignored. * There is no associated <code>on[EventName]</code> property on the JET custom element for the equivalent * <code>on-[event-name]</code> attribute. * </p> * <p> * In addition to the event parameter, event listeners specified via <code>on-[event-name]</code> * attributes will receive two additional parameters when they are invoked: <code>data</code> and <code>bindingContext</code>. * The <code>bindingContext</code> parameter provides the listener with the entire data binding context that * was applied to the element while the data parameter provides convenient access to relevant data. * When in an iteration context (e.g. inside an <code>oj-bind-for-each</code>), the <code>data</code> parameter * is equal to <code>bindingContext["$current"]</code>; otherwise, it is equal to <code>bindingContext["$data"]</code>. * These declarative event listeners should take the form: * <pre class="prettyprint"> * <code> * &lt;oj-some-element on-event-name="[[eventListener]]">&lt;/oj-some-element> * * * function eventListener(event, data, bindingContext) { * ... * } * </code> * </pre> * </p> * * <h2 id="ce-slots-section" class="subsection-title"> * Slots<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-slots-section"></a> * </h2> * <p> * Some JET components allow application provided child content. This child content will be moved by the JET component to * a designated "slot" and is referred to as slot content. Slot content can have one of two characteristics: * <ul> * <li> * Named slot content - Any direct child element with a slot attribute will be moved into that named slot, e.g. &lt;span slot='startIcon'>... &lt;/span>. * All supported named slots are described in the API Doc. Child elements with unsupported named slots will be removed from the DOM. * </li> * <li> * Default slot content - Any direct child element lacking a slot attribute will be moved to the default slot, also known as a regular child. * </li> * </ul> * Bindings are applied to slot content in the application's context with the exception of template slots which are described * below. Slot content are moved to their designated component slots after bindings are applied. <b>Please note that only text and * element nodes can be assigned to a slot. Comment nodes are not eligible, so oj-bind-* elements which resolve to comment nodes * after bindings are applied should be wrapped in a span or other element node for slotting.</b> * </p> * <h3 id="ce-slots-template-section" class="subsection-title"> * Template Slots<a class="bookmarkable-link" title="Bookmarkable Link" href="#ce-slots-template-section"></a> * </h3> * <p> * Some components support template slots which allow the application to pass a template element with a DOM fragment that * will be stamped out by the component. Bindings are not applied to template slot content until they are stamped out by the * component. All template slot children will have access to the following variables: * <ul> * <li>$current - Default variable that contains component exposed subproperties as documented in the component's API doc.</li> * <li>component-level template alias - Set by the application if the component has provided a component-level alias attribute * as part of its API. Provides a template alias available to all template slot binding contexts and has the same * subproperties as the $current variable.</li> * <li>template-level alias - Set by the application on the template element via the 'data-oj-as' attribute. Provides an alias * for a specific template instance and has the same subproperties as the $current variable.</li> * </ul> * Note that $current is always availble on the binding context regardless of whether any application provided aliases are set. * </p> * * @ojfragment customElementOverviewDoc - General description doc fragment that shows up in every component's page via a link. * @memberof CustomElementOverview */ /** * Add's the os and browser agent classes to the body tag * @private */ function _ojApplyAgentClasses() { let classes = []; const ai = oj$1.AgentUtils.getAgentInfo(); classes.push(`oj-agent-os-${ai.os.toLowerCase()}`); classes.push(`oj-agent-browser-${ai.browser.toLowerCase()}`); var html = document.documentElement; html.classList.add(...classes); } whenDocumentReady().then(function () { _ojApplyAgentClasses(); });
Neusoft-Technology-Solutions/aws-sdk-cpp
aws-cpp-sdk-iot/source/model/ProvisioningTemplateVersionSummary.cpp
<reponame>Neusoft-Technology-Solutions/aws-sdk-cpp<gh_stars>1-10 /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/iot/model/ProvisioningTemplateVersionSummary.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace IoT { namespace Model { ProvisioningTemplateVersionSummary::ProvisioningTemplateVersionSummary() : m_versionId(0), m_versionIdHasBeenSet(false), m_creationDateHasBeenSet(false), m_isDefaultVersion(false), m_isDefaultVersionHasBeenSet(false) { } ProvisioningTemplateVersionSummary::ProvisioningTemplateVersionSummary(JsonView jsonValue) : m_versionId(0), m_versionIdHasBeenSet(false), m_creationDateHasBeenSet(false), m_isDefaultVersion(false), m_isDefaultVersionHasBeenSet(false) { *this = jsonValue; } ProvisioningTemplateVersionSummary& ProvisioningTemplateVersionSummary::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("versionId")) { m_versionId = jsonValue.GetInteger("versionId"); m_versionIdHasBeenSet = true; } if(jsonValue.ValueExists("creationDate")) { m_creationDate = jsonValue.GetDouble("creationDate"); m_creationDateHasBeenSet = true; } if(jsonValue.ValueExists("isDefaultVersion")) { m_isDefaultVersion = jsonValue.GetBool("isDefaultVersion"); m_isDefaultVersionHasBeenSet = true; } return *this; } JsonValue ProvisioningTemplateVersionSummary::Jsonize() const { JsonValue payload; if(m_versionIdHasBeenSet) { payload.WithInteger("versionId", m_versionId); } if(m_creationDateHasBeenSet) { payload.WithDouble("creationDate", m_creationDate.SecondsWithMSPrecision()); } if(m_isDefaultVersionHasBeenSet) { payload.WithBool("isDefaultVersion", m_isDefaultVersion); } return payload; } } // namespace Model } // namespace IoT } // namespace Aws
kappa-maintainer/RedstoneControl2
src/main/java/cd4017be/rs_ctr2/container/ContainerMemory.java
<filename>src/main/java/cd4017be/rs_ctr2/container/ContainerMemory.java package cd4017be.rs_ctr2.container; import static cd4017be.lib.network.GuiNetworkHandler.GNH_INSTANCE; import static cd4017be.lib.network.GuiNetworkHandler.preparePacket; import static cd4017be.rs_ctr2.Content.mEMORY; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Arrays; import java.util.BitSet; import java.util.function.IntSupplier; import cd4017be.lib.container.AdvancedContainer; import cd4017be.lib.network.StateSyncAdv; import cd4017be.rs_ctr2.container.gui.GuiRAM; import cd4017be.rs_ctr2.part.Memory; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.network.PacketBuffer; import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public class ContainerMemory extends AdvancedContainer { private static final int[] SYNC_FORMAT = new int[66]; static { Arrays.fill(SYNC_FORMAT, 4); SYNC_FORMAT[64] = 2; SYNC_FORMAT[65] = 1; StateSyncAdv.sequence(SYNC_FORMAT); } private final Memory part; private byte page; public ContainerMemory(int id, PlayerInventory inv, PacketBuffer pkt) { this(id, inv, (Memory)null); } public ContainerMemory(int id, PlayerInventory inv, Memory part) { super(mEMORY, id, inv, StateSyncAdv.of(part == null, SYNC_FORMAT, 1, new Object[0]), 0); this.part = part; } @Override public boolean stillValid(PlayerEntity player) { return player.isAlive() && (part == null || part.host != null); } @Override protected void detectChanges(BitSet chng) { int[] data = part.data; int l = data.length; for (int i = 0, j = page << 6; i < 64; i++, j++) sync.setInt(i, j < l ? data[j] : 0); sync.setShort(64, l); sync.setByte(65, page); } @Override protected void writeChanges(BitSet chng, PacketBuffer pkt) { if (chng.get(sync.objIdxOfs())) pkt.writeVarInt(0); } @Override @OnlyIn(Dist.CLIENT) protected void readChanges(BitSet chng, PacketBuffer pkt) throws Exception { if (!chng.get(sync.objIdxOfs())) return; int l = pkt.readVarInt(); if (l == 0) return; byte[] mem = new byte[l << 2]; pkt.readBytes(mem); @SuppressWarnings("resource") Screen gui = Minecraft.getInstance().screen; if (gui instanceof GuiRAM) ((GuiRAM)gui).processDownload(mem); } public static final byte A_PAGE = 0, A_SET_MEM = 1, A_DOWNLOAD = 2, A_UPLOAD = 3; @Override public void handlePlayerPacket(PacketBuffer pkt, ServerPlayerEntity sender) throws Exception { int[] memory = part.data; switch(pkt.readByte()) { case A_PAGE: page = pkt.readByte(); if (page <= 0) page = 0; else if (page >= memory.length + 63 >> 6) page = (byte)Math.max(0, (memory.length + 63 >> 6) - 1); break; case A_SET_MEM: { int i = pkt.readShort() & 0xffff, v = pkt.readByte(); int bit = (i & 7) * 4, idx = i >> 3; if (idx < memory.length) memory[idx] = v << bit | memory[idx] & ~(15 << bit); break; } case A_DOWNLOAD: sync.clear(); sync.set(0, null); sync.write(pkt = preparePacket(this)); pkt.writeVarInt(memory.length); for (int i : memory) pkt.writeIntLE(i); GNH_INSTANCE.sendToPlayer(pkt, (ServerPlayerEntity)inv.player); break; case A_UPLOAD: int l = pkt.readUnsignedShort(); if (l > memory.length) return; for (int i = 0; i < l; i++) memory[i] = pkt.readIntLE(); Arrays.fill(memory, l, memory.length, 0); sender.displayClientMessage(new TranslationTextComponent("msg.rs_ctr2.import_succ"), false); break; default: return; } } public IntSupplier page() { return sync.intGetter(65, false); } public IntSupplier size() { return sync.intGetter(64, false); } public IntBuffer get() { return ((ByteBuffer)sync.buffer().clear()).asIntBuffer(); } }
Caleydo/caleydo
org.caleydo.view.enroute/src/org/caleydo/view/enroute/path/APathUpdateStrategy.java
/******************************************************************************* * Caleydo - Visualization for Molecular Biology - http://caleydo.org * Copyright (c) The Caleydo Team. All rights reserved. * Licensed under the new BSD license, available at http://caleydo.org/license ******************************************************************************/ package org.caleydo.view.enroute.path; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import org.caleydo.core.event.AEvent; import org.caleydo.core.event.AEventListener; import org.caleydo.core.event.EventListenerManager; import org.caleydo.core.event.EventListenerManager.ListenTo; import org.caleydo.core.event.EventListenerManagers; import org.caleydo.core.event.EventPublisher; import org.caleydo.core.event.IListenerOwner; import org.caleydo.core.util.collection.Pair; import org.caleydo.core.view.listener.AddTablePerspectivesEvent; import org.caleydo.core.view.listener.RemoveTablePerspectiveEvent; import org.caleydo.datadomain.pathway.graph.PathwayPath; import org.caleydo.datadomain.pathway.listener.EnableFreePathSelectionEvent; import org.caleydo.datadomain.pathway.listener.EnablePathSelectionEvent; import org.caleydo.datadomain.pathway.listener.PathwayMappingEvent; import org.caleydo.datadomain.pathway.listener.PathwayPathSelectionEvent; import org.caleydo.datadomain.pathway.listener.SampleMappingModeEvent; /** * Strategy that defines how a path reacts to path selections. * * @author <NAME> * */ public abstract class APathUpdateStrategy implements IListenerOwner { protected final APathwayPathRenderer renderer; protected String pathwayPathEventSpace; private final EventListenerManager listeners = EventListenerManagers.wrap(this); /** * The queue which holds the events */ private BlockingQueue<Pair<AEventListener<? extends IListenerOwner>, AEvent>> queue = new LinkedBlockingQueue<Pair<AEventListener<? extends IListenerOwner>, AEvent>>(); public APathUpdateStrategy(APathwayPathRenderer renderer, String pathwayPathEventSpace) { this.renderer = renderer; this.pathwayPathEventSpace = pathwayPathEventSpace; } @Override public final synchronized void queueEvent(AEventListener<? extends IListenerOwner> listener, AEvent event) { queue.add(new Pair<AEventListener<? extends IListenerOwner>, AEvent>(listener, event)); } /** * This method should be called every display cycle when it is save to change the state of the object. It processes * all the previously submitted events. */ public final void processEvents() { Pair<AEventListener<? extends IListenerOwner>, AEvent> pair; while (queue.peek() != null) { pair = queue.poll(); pair.getFirst().handleEvent(pair.getSecond()); } } @Override public void registerEventListeners() { listeners.register(this, pathwayPathEventSpace); } @Override public void unregisterEventListeners() { listeners.unregisterAll(); } /** * @param pathwayPathEventSpace * setter, see {@link pathwayPathEventSpace} */ public void setPathwayPathEventSpace(String pathwayPathEventSpace) { this.pathwayPathEventSpace = pathwayPathEventSpace; } protected void triggerPathUpdate(PathwayPath path) { // List<PathwayPath> segments = new ArrayList<>(pathSegments.size()); // for (List<PathwayVertexRep> segment : pathSegments) { // PathwayVertexRep startVertexRep = segment.get(0); // PathwayVertexRep endVertexRep = segment.get(segment.size() - 1); // List<DefaultEdge> edges = new ArrayList<DefaultEdge>(); // PathwayGraph pathway = startVertexRep.getPathway(); // // for (int i = 0; i < segment.size() - 1; i++) { // PathwayVertexRep currentVertexRep = segment.get(i); // PathwayVertexRep nextVertexRep = segment.get(i + 1); // // DefaultEdge edge = pathway.getEdge(currentVertexRep, nextVertexRep); // if (edge == null) // edge = pathway.getEdge(nextVertexRep, currentVertexRep); // edges.add(edge); // } // GraphPath<PathwayVertexRep, DefaultEdge> graphPath = new GraphPathImpl<PathwayVertexRep, DefaultEdge>( // pathway, startVertexRep, endVertexRep, edges, edges.size()); // // segments.add(new PathwayPath(graphPath)); // } PathwayPathSelectionEvent event = new PathwayPathSelectionEvent(); event.setEventSpace(pathwayPathEventSpace); event.setPath(path); event.setSender(this); EventPublisher.trigger(event); } @ListenTo public void onAddTablePerspectives(AddTablePerspectivesEvent event) { renderer.addTablePerspectives(event.getTablePerspectives()); } @ListenTo public void onRemoveTablePerspectives(RemoveTablePerspectiveEvent event) { renderer.tablePerspectives.remove(event.getTablePerspective()); renderer.setLayoutDirty(true); } @ListenTo public void onSampleMappingModeChanged(SampleMappingModeEvent event) { renderer.sampleMappingMode = event.getSampleMappingMode(); renderer.setLayoutDirty(true); } @ListenTo public void onPathwayMappingChanged(PathwayMappingEvent event) { renderer.mappedPerspective = event.getTablePerspective(); renderer.setLayoutDirty(true); } @ListenTo(restrictExclusiveToEventSpace = true) public abstract void onEnablePathSelection(EnablePathSelectionEvent event); @ListenTo(restrictExclusiveToEventSpace = true) public abstract void onEnableFreePathSelection(EnableFreePathSelectionEvent event); @ListenTo(restrictExclusiveToEventSpace = true) public abstract void onSelectedPathChanged(PathwayPathSelectionEvent event); /** * Triggers events to indicate a path update */ public abstract void triggerPathUpdate(); /** * This method shall be called, when all nodes of the associated {@link APathwayPathRenderer} are created. */ public abstract void nodesCreated(); /** * Tells whether a change to the path that was triggered by the path is permitted or not. * * @param newPath * @return */ public abstract boolean isPathChangePermitted(PathwayPath newPath); /** * Tells whether it is allowed to remove the nodes that are not the first or the last node of the path. * * @return */ public boolean isInnerNodeRemovalAllowed() { return false; } }
crdavis12/script.module.sd4tvh
libschedulesdirect/common/eventteam.py
<filename>libschedulesdirect/common/eventteam.py import logging class EventTeam(object): def __init__(self): self.name = None # type: unicode self.is_home = False # type: bool @classmethod def from_dict(cls, dct): # type: (dict) -> EventTeam """ :param dct: :type dct: dict :return: :rtype: EventTeam """ event_team = cls() if "name" in dct: event_team.name = dct.pop("name") if "isHome" in dct: event_team.is_home = dct.pop("isHome") if len(dct) != 0: logging.warn("Key(s) not processed for EventTeam: %s", ", ".join(dct.keys())) return event_team
mo-xin/vkectl
pkg/model/resource/kitex_gen/paastob/productivity/common/common.go
<filename>pkg/model/resource/kitex_gen/paastob/productivity/common/common.go // Code generated by thriftgo (0.1.3). DO NOT EDIT. package common import ( "fmt" "github.com/apache/thrift/lib/go/thrift" "strings" ) type Error struct { HTTPCode int32 `thrift:"HTTPCode,1" json:"HTTPCode"` Code string `thrift:"Code,2" json:"Code"` Message string `thrift:"Message,3" json:"Message"` Data map[string]string `thrift:"Data,4" json:"Data,omitempty"` } func NewError() *Error { return &Error{} } func (p *Error) GetHTTPCode() (v int32) { return p.HTTPCode } func (p *Error) GetCode() (v string) { return p.Code } func (p *Error) GetMessage() (v string) { return p.Message } func (p *Error) GetData() (v map[string]string) { return p.Data } func (p *Error) SetHTTPCode(val int32) { p.HTTPCode = val } func (p *Error) SetCode(val string) { p.Code = val } func (p *Error) SetMessage(val string) { p.Message = val } func (p *Error) SetData(val map[string]string) { p.Data = val } var fieldIDToName_Error = map[int16]string{ 1: "HTTPCode", 2: "Code", 3: "Message", 4: "Data", } func (p *Error) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError } for { _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() if err != nil { goto ReadFieldBeginError } if fieldTypeId == thrift.STOP { break } switch fieldId { case 1: if fieldTypeId == thrift.I32 { if err = p.ReadField1(iprot); err != nil { goto ReadFieldError } } else { if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } } case 2: if fieldTypeId == thrift.STRING { if err = p.ReadField2(iprot); err != nil { goto ReadFieldError } } else { if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } } case 3: if fieldTypeId == thrift.STRING { if err = p.ReadField3(iprot); err != nil { goto ReadFieldError } } else { if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } } case 4: if fieldTypeId == thrift.MAP { if err = p.ReadField4(iprot); err != nil { goto ReadFieldError } } else { if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } } default: if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } } if err = iprot.ReadFieldEnd(); err != nil { goto ReadFieldEndError } } if err = iprot.ReadStructEnd(); err != nil { goto ReadStructEndError } return nil ReadStructBeginError: return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_Error[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) ReadFieldEndError: return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } func (p *Error) ReadField1(iprot thrift.TProtocol) error { if v, err := iprot.ReadI32(); err != nil { return err } else { p.HTTPCode = v } return nil } func (p *Error) ReadField2(iprot thrift.TProtocol) error { if v, err := iprot.ReadString(); err != nil { return err } else { p.Code = v } return nil } func (p *Error) ReadField3(iprot thrift.TProtocol) error { if v, err := iprot.ReadString(); err != nil { return err } else { p.Message = v } return nil } func (p *Error) ReadField4(iprot thrift.TProtocol) error { _, _, size, err := iprot.ReadMapBegin() if err != nil { return err } p.Data = make(map[string]string, size) for i := 0; i < size; i++ { var _key string if v, err := iprot.ReadString(); err != nil { return err } else { _key = v } var _val string if v, err := iprot.ReadString(); err != nil { return err } else { _val = v } p.Data[_key] = _val } if err := iprot.ReadMapEnd(); err != nil { return err } return nil } func (p *Error) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 if err = oprot.WriteStructBegin("Error"); err != nil { goto WriteStructBeginError } if p != nil { if err = p.writeField1(oprot); err != nil { fieldId = 1 goto WriteFieldError } if err = p.writeField2(oprot); err != nil { fieldId = 2 goto WriteFieldError } if err = p.writeField3(oprot); err != nil { fieldId = 3 goto WriteFieldError } if err = p.writeField4(oprot); err != nil { fieldId = 4 goto WriteFieldError } } if err = oprot.WriteFieldStop(); err != nil { goto WriteFieldStopError } if err = oprot.WriteStructEnd(); err != nil { goto WriteStructEndError } return nil WriteStructBeginError: return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) WriteFieldError: return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) WriteFieldStopError: return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } func (p *Error) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("HTTPCode", thrift.I32, 1); err != nil { goto WriteFieldBeginError } if err := oprot.WriteI32(p.HTTPCode); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { goto WriteFieldEndError } return nil WriteFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } func (p *Error) writeField2(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("Code", thrift.STRING, 2); err != nil { goto WriteFieldBeginError } if err := oprot.WriteString(p.Code); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { goto WriteFieldEndError } return nil WriteFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) } func (p *Error) writeField3(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("Message", thrift.STRING, 3); err != nil { goto WriteFieldBeginError } if err := oprot.WriteString(p.Message); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { goto WriteFieldEndError } return nil WriteFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) } func (p *Error) writeField4(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("Data", thrift.MAP, 4); err != nil { goto WriteFieldBeginError } if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.Data)); err != nil { return err } for k, v := range p.Data { if err := oprot.WriteString(k); err != nil { return err } if err := oprot.WriteString(v); err != nil { return err } } if err := oprot.WriteMapEnd(); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { goto WriteFieldEndError } return nil WriteFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) } func (p *Error) String() string { if p == nil { return "<nil>" } return fmt.Sprintf("Error(%+v)", *p) } func (p *Error) Error() string { return p.String() } func (p *Error) DeepEqual(ano *Error) bool { if p == ano { return true } else if p == nil || ano == nil { return false } if !p.Field1DeepEqual(ano.HTTPCode) { return false } if !p.Field2DeepEqual(ano.Code) { return false } if !p.Field3DeepEqual(ano.Message) { return false } if !p.Field4DeepEqual(ano.Data) { return false } return true } func (p *Error) Field1DeepEqual(src int32) bool { if p.HTTPCode != src { return false } return true } func (p *Error) Field2DeepEqual(src string) bool { if strings.Compare(p.Code, src) != 0 { return false } return true } func (p *Error) Field3DeepEqual(src string) bool { if strings.Compare(p.Message, src) != 0 { return false } return true } func (p *Error) Field4DeepEqual(src map[string]string) bool { if len(p.Data) != len(src) { return false } for k, v := range p.Data { _src := src[k] if strings.Compare(v, _src) != 0 { return false } } return true }
hispindia/dhis2-android-sdk
core/src/main/java/org/hisp/dhis/android/core/calls/TrackerEntitiesDataCall.java
<gh_stars>0 package org.hisp.dhis.android.core.calls; import android.support.annotation.NonNull; import android.util.Log; import org.hisp.dhis.android.core.common.Payload; import org.hisp.dhis.android.core.data.api.Fields; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.data.database.Transaction; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; import org.hisp.dhis.android.core.organisationunit.OrganisationUnitStore; import org.hisp.dhis.android.core.resource.ResourceHandler; import org.hisp.dhis.android.core.resource.ResourceStore; import org.hisp.dhis.android.core.systeminfo.SystemInfo; import org.hisp.dhis.android.core.systeminfo.SystemInfoCall; import org.hisp.dhis.android.core.systeminfo.SystemInfoService; import org.hisp.dhis.android.core.systeminfo.SystemInfoStore; import org.hisp.dhis.android.core.trackedentity.TeiQuery; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceEndPointCall; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceHandler; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceService; import java.util.Date; import java.util.List; import retrofit2.Response; @SuppressWarnings("PMD") public class TrackerEntitiesDataCall implements Call<Response> { private boolean isExecuted; private final int teiLimitByOrgUnit; private final OrganisationUnitStore organisationUnitStore; private final TrackedEntityInstanceService trackedEntityInstanceService; private final DatabaseAdapter databaseAdapter; private final TrackedEntityInstanceHandler trackedEntityInstanceHandler; private final ResourceHandler resourceHandler; private final ResourceStore resourceStore; private final SystemInfoService systemInfoService; private final SystemInfoStore systemInfoStore; public TrackerEntitiesDataCall(@NonNull OrganisationUnitStore organisationUnitStore, @NonNull TrackedEntityInstanceService trackedEntityInstanceService, @NonNull DatabaseAdapter databaseAdapter, @NonNull TrackedEntityInstanceHandler trackedEntityInstanceHandler, @NonNull ResourceHandler resourceHandler, @NonNull ResourceStore resourceStore, @NonNull SystemInfoService systemInfoService, @NonNull SystemInfoStore systemInfoStore, int teiLimitByOrgUnit) { this.teiLimitByOrgUnit = teiLimitByOrgUnit; this.organisationUnitStore = organisationUnitStore; this.trackedEntityInstanceService = trackedEntityInstanceService; this.databaseAdapter = databaseAdapter; this.trackedEntityInstanceHandler = trackedEntityInstanceHandler; this.resourceHandler = resourceHandler; this.resourceStore = resourceStore; this.systemInfoService = systemInfoService; this.systemInfoStore = systemInfoStore; } @Override public boolean isExecuted() { synchronized (this) { return isExecuted; } } @Override public Response call() throws Exception { synchronized (this) { if (isExecuted) { throw new IllegalStateException("Already executed"); } isExecuted = true; } Response response = null; Transaction transaction = databaseAdapter.beginNewTransaction(); try { response = new SystemInfoCall( databaseAdapter, systemInfoStore, systemInfoService, resourceStore ).call(); if (!response.isSuccessful()) { return response; } SystemInfo systemInfo = (SystemInfo) response.body(); Date serverDate = systemInfo.serverDate(); response = trackerCall(serverDate); if (response == null || !response.isSuccessful()) { return response; } transaction.setSuccessful(); return response; } finally { transaction.end(); } } //TODO We may need to refactor the code here. Right now it is not very optimize. // We need a better sync mechanism, based on? lastupdated? private Response trackerCall(Date serverDate) throws Exception { Response<Payload<TrackedEntityInstance>> response = null; List<OrganisationUnit> organisationUnits = organisationUnitStore.queryOrganisationUnits(); int pageSize = TeiQuery.Builder.create().build().getPageSize(); int numPages = (int) Math.ceil((double) teiLimitByOrgUnit / pageSize); int teisDownloaded = 0; int pageLimit = 0; for (OrganisationUnit orgUnit : organisationUnits) { for (int page = 1; page <= numPages; page++) { if (page == numPages && teiLimitByOrgUnit > 0) { pageLimit = teiLimitByOrgUnit - teisDownloaded; } TeiQuery teiQuery = TeiQuery. Builder.create() .withOrgUnit(orgUnit.uid()) .withPage(page) .withPageLimit(pageLimit) .build(); response = trackedEntityInstanceService.getTEIs(teiQuery.getOrgUnit(), fields(), Boolean.TRUE, teiQuery.getPage(), teiQuery.getPageLimit()).execute(); if (response.isSuccessful() && response.body().items() != null) { List<TrackedEntityInstance> trackedEntityInstances = response.body().items(); int size = trackedEntityInstances.size(); Response<TrackedEntityInstance> apiResponse = null; if (teiQuery.getPageLimit() > 0) { size = teiQuery.getPageLimit(); } for (int i = 0; i < size; i++) { apiResponse = new TrackedEntityInstanceEndPointCall(trackedEntityInstanceService, databaseAdapter, trackedEntityInstanceHandler, resourceHandler, serverDate, trackedEntityInstances.get(i).uid()).call(); if (apiResponse == null || !apiResponse.isSuccessful()) { Log.d(this.getClass().getSimpleName(), trackedEntityInstances.get(i).uid() + " conflict"); } } } teisDownloaded = teisDownloaded + teiQuery.getPageSize(); } } return response; } private Fields<TrackedEntityInstance> fields() { return Fields.<TrackedEntityInstance>builder().fields( TrackedEntityInstance.uid, TrackedEntityInstance.created, TrackedEntityInstance.lastUpdated, TrackedEntityInstance.organisationUnit, TrackedEntityInstance.trackedEntity, TrackedEntityInstance.deleted ).build(); } }
minad/crts
cby/disasm.c
<gh_stars>1-10 #include "bytecode/decode.h" #include "bytecode/opcodes.h" #include "cby.h" #include "ffisupport.h" #include "native/color.h" #include "native/location.h" #include "native/sink.h" #undef CHECK_RANGE #define CHECK_RANGE(n) ({ if (IP < codeStart || IP + (n) > codeEnd) goto OUT_OF_RANGE; }) #define REG FgMagenta"@%u"FgDefault #define VAL(x) FgRed x FgDefault #define NAME(n) FgGreen #n FgDefault "=" #define FFIREF FgCyan"<%08x %S>"FgDefault #define FFIREF_NAME ({ const CbyCode* _oldip = IP; IP = ffiref + 4; const ChiStringRef _name = FETCH_STRING; IP = _oldip; _name; }) #define FFIREF_ARGS (uint32_t)(ffiref - codeStart), FFIREF_NAME #define FNREF FgCyan"<%08x %S>"FgDefault #define FNREF_ARGS (uint32_t)(fnref - codeStart), ({ cbyReadLocation(fnref, &loc); loc.fn; }) #define _CBY_FFI_TYPE_NAME(name, libffi, dcarg, dccall, type) #type, static const char* const ffiTypeName[] = { CHI_FOREACH_FFI_TYPE(, _CBY_FFI_TYPE_NAME) }; #undef _CBY_FFI_TYPE_NAME bool cbyDisasm(ChiSink* sink, const CbyCode* codeStart, const CbyCode* codeEnd) { const CbyCode* init = 0, *IP = codeStart + CBY_MAGIC_SIZE; uint32_t constSize = FETCH32; IP += constSize; chiSinkFmt(sink, TitleBegin "module %S"TitleEnd"\n", FETCH_STRING); { const uint32_t ffiCount = FETCH32; const CbyCode* ffiBegin = IP; if (ffiCount > 0) { chiSinkFmt(sink, "\n"FgWhite"%08x"FgDefault" "TitleBegin"[foreign functions]"TitleEnd"\n", (uint32_t)(ffiBegin - codeStart)); for (uint32_t i = 0; i < ffiCount; ++i) { IP += 4; uint32_t off = (uint32_t)(IP - ffiBegin); ChiStringRef name = FETCH_STRING; uint32_t rtype = FETCH8; uint32_t nargs = FETCH8; chiSinkFmt(sink, FgWhite"%8u"FgDefault" #%-*u "NAME(name)VAL("%qS")" "NAME(rtype)VAL("%s")" "NAME(nargs)VAL("%u")" "NAME(atypes)"[", off, OPCODE_MAXLEN - 1, i, name, ffiTypeName[rtype], nargs); for (uint32_t j = 0; j < nargs; ++j) chiSinkFmt(sink, "%*w"VAL("%s"), j > 0, ffiTypeName[FETCH8]); chiSinkPuts(sink, "]\n"); } } } { const uint32_t importCount = FETCH32; const CbyCode* importBegin = IP; if (importCount > 0) { chiSinkFmt(sink, "\n"FgWhite"%08x"FgDefault" "TitleBegin"[imports]"TitleEnd"\n", (uint32_t)(importBegin - codeStart)); for (uint32_t i = 0; i < importCount; ++i) { ChiStringRef name = FETCH_STRING; chiSinkFmt(sink, FgWhite"%8u"FgDefault" %S\n", i, name); } } } { FETCH32; // mainIdx uint32_t initOff = FETCH32; init = IP + initOff; } { uint32_t codeSize = FETCH32; if (IP + codeSize + 1 > codeEnd) { chiSinkFmt(sink, "Invalid code size %u\n", codeSize); return false; } codeEnd = IP + codeSize; } while (IP < codeEnd) { IP += CBY_FNHEADER; ChiLocInfo loc; cbyReadLocation(IP, &loc); chiSinkFmt(sink, "\n"FgWhite"%08x"FgDefault" " TitleBegin"%s%S"TitleEnd" size=%zu%*L\n", (uint32_t)(IP - codeStart), IP == init ? "[init] " : "", loc.fn, loc.size, CHI_LOCFMT_FILE, &loc); for (const CbyCode* fnBegin = IP, *fnEnd = IP + loc.size; IP >= fnBegin && IP < fnEnd;) { IP = cbyDisasmInsn(sink, IP, fnBegin, codeStart, codeEnd); if (!IP) return false; } } chiSinkPutc(sink, '\n'); return true; OUT_OF_RANGE: chiSinkFmt(sink, "\nUnexpected read at position %d\n", (int32_t)(IP - codeStart)); return false; } const CbyCode* cbyDisasmInsn(ChiSink* sink, const CbyCode* IP, const CbyCode* fnBegin, const CbyCode* codeStart, const CbyCode* codeEnd) { ChiLocInfo loc; chiSinkFmt(sink, FgWhite"%8u"FgDefault" ", (uint32_t)(IP - fnBegin)); uint16_t opCode = FETCH16; if (opCode < OPCODE_PRIM) { size_t n = strlen(cbyOpName[opCode]); chiSinkFmt(sink, FgBlue"%s"FgDefault"%*w", cbyOpName[opCode], OPCODE_MAXLEN - (int)n); } else if (opCode < OPCODE_COUNT) { chiSinkFmt(sink, FgBlue"prim"FgDefault"%*w%s", OPCODE_MAXLEN - 3, cbyOpName[opCode]); } else { chiSinkFmt(sink, "Invalid opcode %d\n", opCode); return 0; } switch (opCode) { #include "bytecode/disasm.h" } chiSinkPutc(sink, '\n'); return IP; OUT_OF_RANGE: chiSinkFmt(sink, "\nUnexpected read at position %d\n", (int32_t)(IP - codeStart)); return 0; } #undef CHECK_RANGE #define CHECK_RANGE(n) ({})
paullewallencom/spring-978-1-7871-2831-6
_src/Chapter10/ch10-reports/src/main/java/org/packt/microservice/client/controller/ClientAsyncController.java
package org.packt.microservice.client.controller; import java.util.List; import java.util.concurrent.ExecutionException; import org.packt.microservice.client.model.data.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.util.concurrent.ListenableFuture; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.client.AsyncRestTemplate; @Controller public class ClientAsyncController { @Autowired private AsyncRestTemplate asyncRestTemplate; @RequestMapping(value="/asyncSelectEmp/{id}", produces=MediaType.APPLICATION_JSON_VALUE) @ResponseBody public Employee asyncSelectEmps(@PathVariable("id") Integer id){ String url ="http://localhost:8091/ch10-emp/callSelectEmp/{id}.json"; HttpMethod method = HttpMethod.GET; HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON_VALUE); HttpEntity<String> requestEntity = new HttpEntity<String>("params", headers); ListenableFuture<ResponseEntity<Employee>> future = asyncRestTemplate.exchange(url, method, requestEntity, Employee.class, id); try { ResponseEntity<Employee> entity = future.get(); return entity.getBody(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } return null; } }
linziyanleo/linziyanleo.github.io
work/p5/p5.js-1.0.0/test/unit/assets/array.js
// eslint-disable-next-line no-undef jsonpCallbackFunction([ { id: 0, species: 'Capra hircus', name: 'Goat' }, { id: 1, species: 'Panthera pardus', name: 'Leopard' }, { id: 2, species: 'Equus zebra', name: 'Zebra' } ]);
gbl08ma/disturbancesmlx
compute/avgspeed.go
<filename>compute/avgspeed.go package compute import ( "errors" "runtime" "time" "github.com/gbl08ma/sqalx" "github.com/underlx/disturbancesmlx/types" ) // ErrInfoNotReady is returned when the requested information is not yet available var ErrInfoNotReady = errors.New("information not ready") type avgSpeedCacheKey struct { From int64 To int64 } var avgSpeedCache map[avgSpeedCacheKey]float64 var avgSpeedComputeInProgress map[avgSpeedCacheKey]bool func init() { avgSpeedCache = make(map[avgSpeedCacheKey]float64) avgSpeedComputeInProgress = make(map[avgSpeedCacheKey]bool) } // AverageSpeed returns the average service speed in km/h // based on the trips in the specified time range func AverageSpeed(node sqalx.Node, fromTime time.Time, toTime time.Time, yieldFor time.Duration) (float64, error) { return AverageSpeedFilter(node, fromTime, toTime, yieldFor, func(trip *types.Trip) bool { return true }) } // AverageSpeedFilter returns the average service speed in km/h // based on the trips in the specified time range that match the provided filter func AverageSpeedFilter(node sqalx.Node, fromTime time.Time, toTime time.Time, yieldFor time.Duration, filter func(trip *types.Trip) bool) (float64, error) { tx, err := node.Beginx() if err != nil { return 0, err } defer tx.Commit() // read-only tx tripIDs, err := types.GetTripIDsBetween(tx, fromTime, toTime) if err != nil { return 0, err } if len(tripIDs) == 0 { return 0, nil } var totalTime time.Duration var totalDistance int64 processTrip := func(trip *types.Trip) { if !filter(trip) { return } _, distance, duration, err := trip.AverageSpeed(tx) if err != nil { return } totalDistance += distance totalTime += duration } // instantiate each trip from DB individually // (instead of using types.GetTrips) // to reduce memory usage for _, tripID := range tripIDs { trip, err := types.GetTrip(tx, tripID) if err != nil { return 0, err } processTrip(trip) if yieldFor > 0 { time.Sleep(yieldFor) } } km := float64(totalDistance) / 1000 hours := totalTime.Hours() return km / hours, nil } // AverageSpeedCached returns the average speed of trips within the specified period, // if it has been computed already, or begins computing it, if it has not. Returns // ErrInfoNotReady in the latter case, or the average speed in the former case. func AverageSpeedCached(node sqalx.Node, fromTime time.Time, toTime time.Time) (float64, error) { if val, ok := avgSpeedCache[avgSpeedCacheKey{fromTime.Unix(), toTime.Unix()}]; ok { return val, nil } if !avgSpeedComputeInProgress[avgSpeedCacheKey{fromTime.Unix(), toTime.Unix()}] { go func() { mainLog.Println("Now computing average speed between " + fromTime.String() + " and " + toTime.String()) avgSpeedComputeInProgress[avgSpeedCacheKey{fromTime.Unix(), toTime.Unix()}] = true val, err := AverageSpeed(rootSqalxNode, fromTime, toTime, 5*time.Millisecond) if err != nil { mainLog.Println("Error computing average speed between " + fromTime.String() + " and " + toTime.String() + ": " + err.Error()) return } avgSpeedCache[avgSpeedCacheKey{fromTime.Unix(), toTime.Unix()}] = val avgSpeedComputeInProgress[avgSpeedCacheKey{fromTime.Unix(), toTime.Unix()}] = false mainLog.Println("Average speed between " + fromTime.String() + " and " + toTime.String() + " computed") }() runtime.Gosched() } return 0, ErrInfoNotReady }
ivadasz/DragonFlyBSD
sys/dev/powermng/kate/kate.c
<filename>sys/dev/powermng/kate/kate.c /* $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $ */ /* * Copyright (c) 2008/2010 <NAME> <<EMAIL>> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> #include <sys/sensors.h> #include <bus/pci/pcivar.h> #include "pcidevs.h" /* * AMD NPT Family 0Fh Processors, Function 3 -- Miscellaneous Control */ /* Function 3 Registers */ #define K_THERMTRIP_STAT_R 0xe4 #define K_NORTHBRIDGE_CAP_R 0xe8 #define K_CPUID_FAMILY_MODEL_R 0xfc /* Bits within Thermtrip Status Register */ #define K_THERM_SENSE_SEL (1 << 6) #define K_THERM_SENSE_CORE_SEL (1 << 2) /* Flip core and sensor selection bits */ #define K_T_SEL_C0(v) (v |= K_THERM_SENSE_CORE_SEL) #define K_T_SEL_C1(v) (v &= ~(K_THERM_SENSE_CORE_SEL)) #define K_T_SEL_S0(v) (v &= ~(K_THERM_SENSE_SEL)) #define K_T_SEL_S1(v) (v |= K_THERM_SENSE_SEL) /* * Revision Guide for AMD NPT Family 0Fh Processors, * Publication # 33610, Revision 3.30, February 2008 */ static const struct { const char rev[5]; const uint32_t cpuid[5]; } kate_proc[] = { { "BH-F", { 0x00040FB0, 0x00040F80, 0, 0, 0 } }, /* F2 */ { "DH-F", { 0x00040FF0, 0x00050FF0, 0x00040FC0, 0, 0 } }, /* F2, F3 */ { "JH-F", { 0x00040F10, 0x00040F30, 0x000C0F10, 0, 0 } }, /* F2, F3 */ { "BH-G", { 0x00060FB0, 0x00060F80, 0, 0, 0 } }, /* G1, G2 */ { "DH-G", { 0x00070FF0, 0x00060FF0, 0x00060FC0, 0x00070FC0, 0 } } /* G1, G2 */ }; struct kate_softc { struct device *sc_dev; struct ksensor sc_sensors[4]; struct ksensordev sc_sensordev; char sc_rev; int8_t sc_ii; int8_t sc_in; }; static void kate_identify(driver_t *, struct device *); static int kate_probe(struct device *); static int kate_attach(struct device *); static int kate_detach(struct device *); static void kate_refresh(void *); static device_method_t kate_methods[] = { DEVMETHOD(device_identify, kate_identify), DEVMETHOD(device_probe, kate_probe), DEVMETHOD(device_attach, kate_attach), DEVMETHOD(device_detach, kate_detach), { NULL, NULL } }; static driver_t kate_driver = { "kate", kate_methods, sizeof(struct kate_softc) }; static devclass_t kate_devclass; DRIVER_MODULE(kate, hostb, kate_driver, kate_devclass, NULL, NULL); static void kate_identify(driver_t *driver, struct device *parent) { if (kate_probe(parent) == ENXIO) return; if (device_find_child(parent, driver->name, -1) != NULL) return; device_add_child(parent, driver->name, -1); } static int kate_probe(struct device *dev) { #ifndef KATE_STRICT struct kate_softc ks; struct kate_softc *sc = &ks; #endif uint32_t c; int i, j; if (pci_get_vendor(dev) != PCI_VENDOR_AMD || pci_get_device(dev) != PCI_PRODUCT_AMD_AMD64_MISC) return ENXIO; /* just in case we probe successfully, set the description */ if (device_get_desc(dev) == NULL) device_set_desc(dev, "AMD Family 0Fh temperature sensors"); /* * First, let's probe for chips at or after Revision F, which is * when the temperature readings were officially introduced. */ c = pci_read_config(dev, K_CPUID_FAMILY_MODEL_R, 4); for (i = 0; i < NELEM(kate_proc); i++) for (j = 0; kate_proc[i].cpuid[j] != 0; j++) if ((c & ~0xf) == kate_proc[i].cpuid[j]) return 0; #ifndef KATE_STRICT /* * If the probe above was not successful, let's try to actually * read the sensors from the chip, and see if they make any sense. */ sc->sc_ii = 0; sc->sc_in = 4; sc->sc_dev = dev; kate_refresh(sc); for (i = 0; i < 4; i++) if (!(sc->sc_sensors[i].flags & SENSOR_FINVALID)) return 0; #endif /* !KATE_STRICT */ return ENXIO; } static int kate_attach(struct device *dev) { struct kate_softc *sc; uint32_t c, d; int i, j, cmpcap; sc = device_get_softc(dev); sc->sc_dev = dev; c = pci_read_config(dev, K_CPUID_FAMILY_MODEL_R, 4); for (i = 0; i < NELEM(kate_proc) && sc->sc_rev == '\0'; i++) for (j = 0; kate_proc[i].cpuid[j] != 0; j++) if ((c & ~0xf) == kate_proc[i].cpuid[j]) { sc->sc_rev = kate_proc[i].rev[3]; device_printf(dev, "core rev %.4s%.1x\n", kate_proc[i].rev, c & 0xf); break; } if (c != 0x0 && sc->sc_rev == '\0') { /* CPUID Family Model Register was introduced in Revision F */ sc->sc_rev = 'G'; /* newer than E, assume G */ device_printf(dev, "cpuid 0x%x\n", c); } d = pci_read_config(dev, K_NORTHBRIDGE_CAP_R, 4); cmpcap = (d >> 12) & 0x3; #ifndef KATE_STRICT sc->sc_ii = 0; sc->sc_in = 4; kate_refresh(sc); if (cmpcap == 0) { if ((sc->sc_sensors[0].flags & SENSOR_FINVALID) && (sc->sc_sensors[1].flags & SENSOR_FINVALID)) sc->sc_ii = 2; if ((sc->sc_sensors[4].flags & SENSOR_FINVALID)) sc->sc_in = 3; } #else sc->sc_ii = cmpcap ? 0 : 2; sc->sc_in = 4; #endif /* !KATE_STRICT */ strlcpy(sc->sc_sensordev.xname, device_get_nameunit(dev), sizeof(sc->sc_sensordev.xname)); for (i = sc->sc_ii; i < sc->sc_in; i++) { sc->sc_sensors[i].type = SENSOR_TEMP; sensor_attach(&sc->sc_sensordev, &sc->sc_sensors[i]); } if (sensor_task_register(sc, kate_refresh, 5)) { device_printf(dev, "unable to register update task\n"); return ENXIO; } sensordev_install(&sc->sc_sensordev); return 0; } static int kate_detach(struct device *dev) { struct kate_softc *sc = device_get_softc(dev); sensordev_deinstall(&sc->sc_sensordev); sensor_task_unregister(sc); return 0; } void kate_refresh(void *arg) { struct kate_softc *sc = arg; struct ksensor *s = sc->sc_sensors; uint32_t t, m; int i, v; t = pci_read_config(sc->sc_dev, K_THERMTRIP_STAT_R, 4); for (i = sc->sc_ii; i < sc->sc_in; i++) { switch(i) { case 0: K_T_SEL_C0(t); K_T_SEL_S0(t); break; case 1: K_T_SEL_C0(t); K_T_SEL_S1(t); break; case 2: K_T_SEL_C1(t); K_T_SEL_S0(t); break; case 3: K_T_SEL_C1(t); K_T_SEL_S1(t); break; } m = t & (K_THERM_SENSE_CORE_SEL | K_THERM_SENSE_SEL); pci_write_config(sc->sc_dev, K_THERMTRIP_STAT_R, t, 4); t = pci_read_config(sc->sc_dev, K_THERMTRIP_STAT_R, 4); v = 0x3ff & (t >> 14); #ifdef KATE_STRICT if (sc->sc_rev != 'G') v &= ~0x3; #endif /* KATE_STRICT */ if ((t & (K_THERM_SENSE_CORE_SEL | K_THERM_SENSE_SEL)) == m && (v & ~0x3) != 0) s[i].flags &= ~SENSOR_FINVALID; else s[i].flags |= SENSOR_FINVALID; s[i].value = (v * 250000 - 49000000) + 273150000; } }
rodney-lai/test-site
lib/com/rodneylai/auth/util/TestAccountHelper.scala
<filename>lib/com/rodneylai/auth/util/TestAccountHelper.scala /** * * Copyright (c) 2015-2017 <NAME> * https://github.com/rodney-lai * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ package com.rodneylai.auth.util import javax.inject.{Inject,Singleton} import com.google.inject.AbstractModule import org.mindrot.jbcrypt._ import com.rodneylai.util._ @Singleton class TestAccountHelper @Inject() (configuration:ConfigHelper) { case class TestAccount(email:String,name:String,friendlyUrl:String,roleList:Set[String]) val testAccounts:Seq[TestAccount] = Seq(TestAccount("<EMAIL>","Test User","test-user",Set[String]()), TestAccount("<EMAIL>","Test Admin","test-admin",Set[String]("admin")), TestAccount("<EMAIL>","Test Developer","test-developer",Set[String]("admin","developer")) ) private def testPassword:String = configuration.getString("test.password") match { case Some(testPassword) if (testPassword != "<PASSWORD>") => testPassword case Some(testPassword) if (testPassword == "<PASSWORD>") => throw new Exception("Change default value of test.password config key.") case None => throw new Exception("Missing test.password config key.") } def testPasswordHash:String = BCrypt.hashpw(testPassword, BCrypt.gensalt(14)) } class TestAccountHelperModule extends AbstractModule { override def configure() = { bind(classOf[TestAccountHelper]).asEagerSingleton } }
SpaceGameDev/space-engine
src/main/java/space/engine/lock/keylock/BlockingKeyLock.java
package space.engine.lock.keylock; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.concurrent.TimeUnit; /** * A simple Lock which can be locked with a KEY instead of the current Thread */ public interface BlockingKeyLock<KEY> { //lock void lock(@NotNull KEY key); void lock(@NotNull KEY key, long time, TimeUnit unit); void lockInterruptibly(@NotNull KEY key) throws InterruptedException; void lockInterruptibly(@NotNull KEY key, long time, TimeUnit unit) throws InterruptedException; /** * call is non-blocking */ boolean tryLock(@NotNull KEY key); //unlock void unlock(@NotNull KEY key); /** * call is non-blocking */ boolean tryUnlock(@NotNull KEY key); //getter /** * may be an {@link UnsupportedOperationException} */ boolean isLocked(); /** * may be an {@link UnsupportedOperationException} */ @Nullable KEY getHolder(); default void execute(@NotNull KEY key, Runnable command) { lock(key); try { command.run(); } finally { unlock(key); } } default void executeInterruptibly(@NotNull KEY key, Runnable command) { try { lockInterruptibly(key); try { command.run(); } finally { unlock(key); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
lycantropos/cppbuiltins
tests/lists_tests/test_getitem.py
<gh_stars>1-10 from typing import Tuple import pytest from hypothesis import given from tests.utils import (AlternativeNativeListsPair, are_alternative_native_lists_equal) from . import strategies @given(strategies.non_empty_lists_pairs_with_indices) def test_index(pair_with_index: Tuple[AlternativeNativeListsPair, int] ) -> None: (alternative, native), index = pair_with_index alternative_result, native_result = alternative[index], native[index] assert alternative_result == native_result @given(strategies.lists_pairs_with_invalid_indices) def test_invalid_index(pair_with_index: Tuple[AlternativeNativeListsPair, int] ) -> None: (alternative, native), index = pair_with_index with pytest.raises(IndexError): alternative[index] with pytest.raises(IndexError): native[index] @given(strategies.lists_pairs_with_slices) def test_slice(pair_with_slice: Tuple[AlternativeNativeListsPair, int] ) -> None: (alternative, native), slice_ = pair_with_slice alternative_result, native_result = alternative[slice_], native[slice_] assert are_alternative_native_lists_equal(alternative_result, native_result)
tlandschoff-scale/spyne
spyne/interface/xml_schema/model.py
# # spyne - Copyright (C) Spyne contributors. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 # """The ``spyne.interface.xml_schema.model`` module contains type-specific logic for schema generation.""" import logging logger = logging.getLogger(__name__) import decimal from lxml import etree from spyne.model.complex import XmlAttribute from spyne.model.primitive import AnyXml from spyne.util.etreeconv import dict_to_etree from spyne.model.primitive import Unicode from spyne.util import memoize from spyne.const.xml_ns import xsd as _ns_xs from spyne.const.xml_ns import xsd as _ns_xsd def simple_get_restriction_tag(document, cls): simple_type = etree.Element('{%s}simpleType' % _ns_xsd) simple_type.set('name', cls.get_type_name()) document.add_simple_type(cls, simple_type) restriction = etree.SubElement(simple_type, '{%s}restriction' % _ns_xsd) restriction.set('base', cls.__base_type__.get_type_name_ns(document.interface)) for v in cls.Attributes.values: enumeration = etree.SubElement(restriction, '{%s}enumeration' % _ns_xsd) enumeration.set('value', str(v)) return restriction def simple_add(interface, cls): if not cls.is_default(cls): interface.get_restriction_tag(cls) def complex_add(document, cls): complex_type = etree.Element("{%s}complexType" % _ns_xsd) complex_type.set('name', cls.get_type_name()) if cls.Annotations.doc != '' or cls.Annotations.appinfo != None or \ cls.Annotations.__use_parent_doc__: annotation = etree.SubElement(complex_type, "{%s}annotation" % _ns_xsd) if cls.Annotations.doc != '' or cls.Annotations.__use_parent_doc__: doc = etree.SubElement(annotation, "{%s}documentation" % _ns_xsd) if cls.Annotations.__use_parent_doc__: doc.text = getattr(cls, '__doc__') else: doc.text = cls.Annotations.doc _ai = cls.Annotations.appinfo; if _ai != None: appinfo = etree.SubElement(annotation, "{%s}appinfo" % _ns_xsd) if isinstance(_ai, dict): dict_to_etree(_ai, appinfo) elif isinstance(_ai, str) or isinstance(_ai, unicode): appinfo.text = _ai elif isinstance(_ai, etree._Element): appinfo.append(_ai) else: from spyne.util.xml import get_object_as_xml appinfo.append(get_object_as_xml(_ai)) sequence_parent = complex_type extends = getattr(cls, '__extends__', None) type_info = cls._type_info if extends is not None: if (extends.get_type_name() == cls.get_type_name() and extends.get_namespace() == cls.get_namespace()): raise Exception("%r can't extend %r because they are both '{%s}%s'" % (cls, extends, cls.get_type_name(), cls.get_namespace())) if extends.Attributes.exc_interface: # If the parent class is private, it won't be in the schema, so we # need to act as if its attributes are part of cls as well. type_info = cls.get_simple_type_info(cls) else: complex_content = etree.SubElement(complex_type, "{%s}complexContent" % _ns_xsd) extension = etree.SubElement(complex_content, "{%s}extension" % _ns_xsd) extension.set('base', extends.get_type_name_ns(document.interface)) sequence_parent = extension sequence = etree.SubElement(sequence_parent, '{%s}sequence' % _ns_xsd) for k, v in type_info.items(): if issubclass(v, XmlAttribute): attribute = etree.SubElement(complex_type, '{%s}attribute' % _ns_xsd) v.describe(k, attribute, document) continue if v.Attributes.exc_interface: continue if not issubclass(v, cls): document.add(v) member = etree.SubElement(sequence, v.Attributes.schema_tag) if v.Attributes.schema_tag == '{%s}element' % _ns_xsd: member.set('name', k) member.set('type', v.get_type_name_ns(document.interface)) elif v.Attributes.schema_tag == '{%s}any' % _ns_xsd and \ (issubclass(v, AnyXml)): if v.Attributes.namespace is not None: member.set('namespace', v.Attributes.namespace) if v.Attributes.process_contents is not None: member.set('processContents', v.Attributes.process_contents) else: raise ValueError("Unhandled schema_tag / type combination. %r %r" % (v, v.Attributes.schema_tag)) if v.Attributes.min_occurs != 1: # 1 is the xml schema default member.set('minOccurs', str(v.Attributes.min_occurs)) if v.Attributes.max_occurs != 1: # 1 is the xml schema default val = v.Attributes.max_occurs if val == decimal.Decimal('inf'): val = 'unbounded' else: val = str(val) member.set('maxOccurs', val) if bool(v.Attributes.nillable) != False: # False is the xml schema default member.set('nillable', 'true') document.add_complex_type(cls, complex_type) # simple node element = etree.Element('{%s}element' % _ns_xsd) element.set('name', cls.get_type_name()) element.set('type', cls.get_type_name_ns(document.interface)) document.add_element(cls, element) def alias_add(document, cls): t, = cls._type_info.values() element = etree.Element('{%s}element' % _ns_xsd) element.set('name', cls.get_type_name()) if t is None: etree.SubElement(element, "{%s}complexType" % _ns_xsd) else: element.set('type', t.get_type_name_ns(document.interface)) document.add_element(cls, element) def enum_add(document, cls): simple_type = etree.Element('{%s}simpleType' % _ns_xsd) simple_type.set('name', cls.get_type_name()) restriction = etree.SubElement(simple_type, '{%s}restriction' % _ns_xsd) restriction.set('base', '%s:string' % document.interface.get_namespace_prefix(_ns_xsd)) for v in cls.__values__: enumeration = etree.SubElement(restriction, '{%s}enumeration' % _ns_xsd) enumeration.set('value', v) document.add_simple_type(cls, simple_type) def fault_add(document, cls): extends = getattr(cls, '__extends__', None) if not (extends is None): document.add(extends) complex_type = etree.Element("{%s}complexType" % _ns_xsd) complex_type.set('name', cls.get_type_name()) #sequence = etree.SubElement(complex_type, '{%s}sequence' % _ns_xsd) document.add_complex_type(cls, complex_type) # simple node element = etree.Element('{%s}element' % _ns_xsd) element.set('name', cls.get_type_name()) element.set('type', cls.get_type_name_ns(document.interface)) document.add_element(cls, element) def unicode_get_restriction_tag(interface, cls): restriction = simple_get_restriction_tag(interface, cls) # length if cls.Attributes.min_len == cls.Attributes.max_len: length = etree.SubElement(restriction, '{%s}length' % _ns_xs) length.set('value', str(cls.Attributes.min_len)) else: if cls.Attributes.min_len != Unicode.Attributes.min_len: min_l = etree.SubElement(restriction, '{%s}minLength' % _ns_xs) min_l.set('value', str(cls.Attributes.min_len)) if cls.Attributes.max_len != Unicode.Attributes.max_len: max_l = etree.SubElement(restriction, '{%s}maxLength' % _ns_xs) max_l.set('value', str(cls.Attributes.max_len)) # pattern if cls.Attributes.pattern != Unicode.Attributes.pattern: pattern = etree.SubElement(restriction, '{%s}pattern' % _ns_xs) pattern.set('value', cls.Attributes.pattern) return restriction @memoize def Tget_range_restriction_tag(T): def _get_range_restriction_tag(interface, cls): restriction = simple_get_restriction_tag(interface, cls) if cls.Attributes.gt != T.Attributes.gt: min_l = etree.SubElement(restriction, '{%s}minExclusive' % _ns_xs) min_l.set('value', cls.to_string(cls.Attributes.gt)) if cls.Attributes.ge != T.Attributes.ge: min_l = etree.SubElement(restriction, '{%s}minInclusive' % _ns_xs) min_l.set('value', cls.to_string(cls.Attributes.ge)) if cls.Attributes.lt != T.Attributes.lt: min_l = etree.SubElement(restriction, '{%s}maxExclusive' % _ns_xs) min_l.set('value', cls.to_string(cls.Attributes.lt)) if cls.Attributes.le != T.Attributes.le: min_l = etree.SubElement(restriction, '{%s}maxInclusive' % _ns_xs) min_l.set('value', cls.to_string(cls.Attributes.le)) if cls.Attributes.pattern != T.Attributes.pattern: pattern = etree.SubElement(restriction, '{%s}pattern' % _ns_xs) pattern.set('value', cls.Attributes.pattern) return restriction return _get_range_restriction_tag
decode/eachdo
config/initializers/rails_admin.rb
<filename>config/initializers/rails_admin.rb RailsAdmin.config do |config| ### Popular gems integration ## == Devise == #config.authenticate_with do # warden.authenticate! scope: :user #end #config.current_user_method(&:current_user) ## == Cancan == #config.authorize_with :cancan ## == PaperTrail == # config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0 ### More at https://github.com/sferik/rails_admin/wiki/Base-configuration # 临时解决方法,cancancan无法使用,在app/models/ability.rb的Ability.initialize(user)方法中,user无法传入始终为空 config.authorize_with do |controller| unless current_user.try(:has_role?, :admin) flash[:alter] = '没有权限进行操作' redirect_to main_app.root_path end end config.actions do dashboard # mandatory index # mandatory new export bulk_delete show edit delete show_in_app ## With an audit adapter, you can add: # history_index # history_show end config.model 'User' do list do field :id field :name field :realname field :email field :school field :team field :roles field :sign_in_count field :last_sign_in_at field :last_sign_in_ip field :current_sign_in_at field :current_sign_in_ip end end end
xsjames/upp-components
Examples/SshBasics/Shell.cpp
#include "SshBasics.h" // ShellConsole: // Demonstrates an interactive shell in console mode. void ShellConsole(SshSession& session) { SshShell shell(session); shell.Timeout(Null); if(!shell.Console("ansi")) LOG(shell.GetErrorDesc()); }
tiferrei/PEDASI
datasources/migrations/0008_datasource__connector_string.py
<filename>datasources/migrations/0008_datasource__connector_string.py # Generated by Django 2.0.8 on 2018-10-29 13:20 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('datasources', '0007_datasource_api_key'), ] operations = [ migrations.AddField( model_name='datasource', name='_connector_string', field=models.CharField(blank=True, max_length=255), ), ]
i5possible/service-template
src/main/java/com/template/model/Example2.java
package com.template.model; import lombok.*; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import java.math.BigDecimal; import java.util.Date; import java.util.UUID; /** * @author <EMAIL> * @date 2020/4/18 */ @Getter @Setter @Builder(toBuilder = true) @NoArgsConstructor @AllArgsConstructor @Entity @Table( name = "example2" ) public class Example2 extends EntityBase { @Id private UUID id; @Column(columnDefinition = "varchar") private String stringColumn; @Column(columnDefinition = "text") private String textColumn; @Column(columnDefinition = "decimal(20,2)") private BigDecimal decimalColumn; @Column(columnDefinition = "date") private Date dateColumn; @Column(columnDefinition = "int") private Integer integerColumn; @Column(columnDefinition = "float4") private Float floatColumn; }
Idematica/django-oscar
oscar/apps/wishlists/admin.py
<reponame>Idematica/django-oscar from django.contrib import admin from django.db.models import get_model WishList = get_model('wishlists', 'WishList') Line = get_model('wishlists', 'Line') admin.site.register(WishList) admin.site.register(Line)
SuperDizor/dizornator
node_modules/lzz-gyp/lzz-source/smtc_DefineNavClass.cpp
// smtc_DefineNavClass.cpp // #include "smtc_DefineNavClass.h" // semantic #include "smtc_CreateNavClass.h" #include "smtc_CreateNavClassEntity.h" #include "smtc_CreateNavClassScope.h" #include "smtc_DeclareLazyClassObjParamSet.h" #include "smtc_Message.h" #include "smtc_NavClass.h" #include "smtc_Ns.h" #include "smtc_NsScope.h" #include "smtc_ParamToNavCtorParam.h" #include "smtc_ScopeVisitor.h" #define LZZ_INLINE inline namespace { using namespace smtc; } namespace { struct DefineNavClass : ScopeVisitor { gram::SpecSel const & spec_sel; CvType const & ret_type; NamePtr const & name; CvType const & node_type; ParamPtrVector const & param_set; BaseSpecPtrVector const & base_spec_set; ScopePtr & res_scope; void visit (NsScope const & scope) const; public: explicit DefineNavClass (gram::SpecSel const & spec_sel, CvType const & ret_type, NamePtr const & name, CvType const & node_type, ParamPtrVector const & param_set, BaseSpecPtrVector const & base_spec_set, ScopePtr & res_scope); ~ DefineNavClass (); }; } namespace { void DefineNavClass::visit (NsScope const & scope) const { int flags = spec_sel.getFlags (); ParamPtrVector ctor_param_set; std::transform (param_set.begin (), param_set.end (), std::back_inserter (ctor_param_set), ParamToNavCtorParam ()); NavClassPtr nav_class = createNavClass (flags, name, ctor_param_set, base_spec_set, ret_type, node_type, param_set); // declare params as references declareLazyClassObjParamSet (nav_class, param_set, base_spec_set, true); nav_class->setQualName (name); res_scope = createNavClassScope (nav_class); EntityPtr entity = createNavClassEntity (nav_class); scope.getNs ()->addEntity (entity); } } namespace { LZZ_INLINE DefineNavClass::DefineNavClass (gram::SpecSel const & spec_sel, CvType const & ret_type, NamePtr const & name, CvType const & node_type, ParamPtrVector const & param_set, BaseSpecPtrVector const & base_spec_set, ScopePtr & res_scope) : spec_sel (spec_sel), ret_type (ret_type), name (name), node_type (node_type), param_set (param_set), base_spec_set (base_spec_set), res_scope (res_scope) {} } namespace { DefineNavClass::~ DefineNavClass () {} } namespace smtc { ScopePtr defineNavClass (ScopePtr const & scope, gram::SpecSel const & spec_sel, CvType const & ret_type, NamePtr const & name, CvType const & node_type, ParamPtrVector const & param_set, BaseSpecPtrVector const & base_spec_set) { ScopePtr res_scope; scope->accept (DefineNavClass (spec_sel, ret_type, name, node_type, param_set, base_spec_set, res_scope)); return res_scope; } } #undef LZZ_INLINE
ScalablyTyped/SlinkyTyped
c/chrome/src/main/scala/typingsSlinky/chrome/global/chrome/cast/media.scala
package typingsSlinky.chrome.global.chrome.cast import typingsSlinky.chrome.chrome.cast.media.TrackType import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.`|` import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} object media { @JSGlobal("chrome.cast.media") @js.native val ^ : js.Any = js.native @JSGlobal("chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID") @js.native def DEFAULT_MEDIA_RECEIVER_APP_ID: String = js.native @scala.inline def DEFAULT_MEDIA_RECEIVER_APP_ID_=(x: String): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("DEFAULT_MEDIA_RECEIVER_APP_ID")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.EditTracksInfoRequest") @js.native /** * @param {Array<number>=} opt_activeTrackIds * @param {chrome.cast.media.TextTrackStyle=} opt_textTrackStyle * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.EditTracksInfoRequest */ class EditTracksInfoRequest () extends typingsSlinky.chrome.chrome.cast.media.EditTracksInfoRequest { def this(activeTrackIds: js.Array[Double]) = this() def this( activeTrackIds: js.UndefOr[scala.Nothing], textTrackStyle: typingsSlinky.chrome.chrome.cast.media.TextTrackStyle ) = this() def this( activeTrackIds: js.Array[Double], textTrackStyle: typingsSlinky.chrome.chrome.cast.media.TextTrackStyle ) = this() } @JSGlobal("chrome.cast.media.GenericMediaMetadata") @js.native class GenericMediaMetadata () extends typingsSlinky.chrome.chrome.cast.media.GenericMediaMetadata @JSGlobal("chrome.cast.media.GetStatusRequest") @js.native /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GetStatusRequest */ class GetStatusRequest () extends typingsSlinky.chrome.chrome.cast.media.GetStatusRequest @JSGlobal("chrome.cast.media.IdleReason") @js.native object IdleReason extends StObject { @JSBracketAccess def apply(value: String): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.IdleReason with String] = js.native /* "CANCELLED" */ val CANCELLED: typingsSlinky.chrome.chrome.cast.media.IdleReason.CANCELLED with String = js.native /* "ERROR" */ val ERROR: typingsSlinky.chrome.chrome.cast.media.IdleReason.ERROR with String = js.native /* "FINISHED" */ val FINISHED: typingsSlinky.chrome.chrome.cast.media.IdleReason.FINISHED with String = js.native /* "INTERRUPTED" */ val INTERRUPTED: typingsSlinky.chrome.chrome.cast.media.IdleReason.INTERRUPTED with String = js.native } @JSGlobal("chrome.cast.media.LiveSeekableRange") @js.native /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.LiveSeekableRange */ class LiveSeekableRange () extends typingsSlinky.chrome.chrome.cast.media.LiveSeekableRange { def this(start: Double) = this() def this(start: js.UndefOr[scala.Nothing], end: Double) = this() def this(start: Double, end: Double) = this() def this(start: js.UndefOr[scala.Nothing], end: js.UndefOr[scala.Nothing], isMovingWindow: Boolean) = this() def this(start: js.UndefOr[scala.Nothing], end: Double, isMovingWindow: Boolean) = this() def this(start: Double, end: js.UndefOr[scala.Nothing], isMovingWindow: Boolean) = this() def this(start: Double, end: Double, isMovingWindow: Boolean) = this() def this( start: js.UndefOr[scala.Nothing], end: js.UndefOr[scala.Nothing], isMovingWindow: js.UndefOr[scala.Nothing], isLiveDone: Boolean ) = this() def this( start: js.UndefOr[scala.Nothing], end: js.UndefOr[scala.Nothing], isMovingWindow: Boolean, isLiveDone: Boolean ) = this() def this( start: js.UndefOr[scala.Nothing], end: Double, isMovingWindow: js.UndefOr[scala.Nothing], isLiveDone: Boolean ) = this() def this(start: js.UndefOr[scala.Nothing], end: Double, isMovingWindow: Boolean, isLiveDone: Boolean) = this() def this( start: Double, end: js.UndefOr[scala.Nothing], isMovingWindow: js.UndefOr[scala.Nothing], isLiveDone: Boolean ) = this() def this(start: Double, end: js.UndefOr[scala.Nothing], isMovingWindow: Boolean, isLiveDone: Boolean) = this() def this(start: Double, end: Double, isMovingWindow: js.UndefOr[scala.Nothing], isLiveDone: Boolean) = this() def this(start: Double, end: Double, isMovingWindow: Boolean, isLiveDone: Boolean) = this() } @JSGlobal("chrome.cast.media.LoadRequest") @js.native class LoadRequest protected () extends typingsSlinky.chrome.chrome.cast.media.LoadRequest { /** * @param {!chrome.cast.media.MediaInfo} mediaInfo * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.LoadRequest */ def this(mediaInfo: typingsSlinky.chrome.chrome.cast.media.MediaInfo) = this() } @JSGlobal("chrome.cast.media.Media") @js.native class Media protected () extends typingsSlinky.chrome.chrome.cast.media.Media { /** * @param {string} sessionId * @param {number} mediaSessionId * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.Media */ def this(sessionId: String, mediaSessionId: Double) = this() } @JSGlobal("chrome.cast.media.MediaCommand") @js.native object MediaCommand extends StObject { @JSBracketAccess def apply(value: String): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.MediaCommand with String] = js.native /* "pause" */ val PAUSE: typingsSlinky.chrome.chrome.cast.media.MediaCommand.PAUSE with String = js.native /* "seek" */ val SEEK: typingsSlinky.chrome.chrome.cast.media.MediaCommand.SEEK with String = js.native /* "stream_mute" */ val STREAM_MUTE: typingsSlinky.chrome.chrome.cast.media.MediaCommand.STREAM_MUTE with String = js.native /* "stream_volume" */ val STREAM_VOLUME: typingsSlinky.chrome.chrome.cast.media.MediaCommand.STREAM_VOLUME with String = js.native } @JSGlobal("chrome.cast.media.MediaInfo") @js.native class MediaInfo protected () extends typingsSlinky.chrome.chrome.cast.media.MediaInfo { /** * @param {string} contentId * @param {string} contentType * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MediaInfo */ def this(contentId: String, contentType: String) = this() } @JSGlobal("chrome.cast.media.MetadataType") @js.native object MetadataType extends StObject { @JSBracketAccess def apply(value: Double): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.MetadataType with Double] = js.native /* 0 */ val GENERIC: typingsSlinky.chrome.chrome.cast.media.MetadataType.GENERIC with Double = js.native /* 2 */ val MOVIE: typingsSlinky.chrome.chrome.cast.media.MetadataType.MOVIE with Double = js.native /* 3 */ val MUSIC_TRACK: typingsSlinky.chrome.chrome.cast.media.MetadataType.MUSIC_TRACK with Double = js.native /* 4 */ val PHOTO: typingsSlinky.chrome.chrome.cast.media.MetadataType.PHOTO with Double = js.native /* 1 */ val TV_SHOW: typingsSlinky.chrome.chrome.cast.media.MetadataType.TV_SHOW with Double = js.native } @JSGlobal("chrome.cast.media.MovieMediaMetadata") @js.native /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MovieMediaMetadata */ class MovieMediaMetadata () extends typingsSlinky.chrome.chrome.cast.media.MovieMediaMetadata @JSGlobal("chrome.cast.media.MusicTrackMediaMetadata") @js.native /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MusicTrackMediaMetadata */ class MusicTrackMediaMetadata () extends typingsSlinky.chrome.chrome.cast.media.MusicTrackMediaMetadata @JSGlobal("chrome.cast.media.PauseRequest") @js.native /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PauseRequest */ class PauseRequest () extends typingsSlinky.chrome.chrome.cast.media.PauseRequest @JSGlobal("chrome.cast.media.PhotoMediaMetadata") @js.native /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PhotoMediaMetadata */ class PhotoMediaMetadata () extends typingsSlinky.chrome.chrome.cast.media.PhotoMediaMetadata @JSGlobal("chrome.cast.media.PlayRequest") @js.native /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayRequest */ class PlayRequest () extends typingsSlinky.chrome.chrome.cast.media.PlayRequest @JSGlobal("chrome.cast.media.PlayerState") @js.native object PlayerState extends StObject { @JSBracketAccess def apply(value: String): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.PlayerState with String] = js.native /* "BUFFERING" */ val BUFFERING: typingsSlinky.chrome.chrome.cast.media.PlayerState.BUFFERING with String = js.native /* "IDLE" */ val IDLE: typingsSlinky.chrome.chrome.cast.media.PlayerState.IDLE with String = js.native /* "PAUSED" */ val PAUSED: typingsSlinky.chrome.chrome.cast.media.PlayerState.PAUSED with String = js.native /* "PLAYING" */ val PLAYING: typingsSlinky.chrome.chrome.cast.media.PlayerState.PLAYING with String = js.native } @JSGlobal("chrome.cast.media.QueueInsertItemsRequest") @js.native class QueueInsertItemsRequest protected () extends typingsSlinky.chrome.chrome.cast.media.QueueInsertItemsRequest { /** * @param {!Array<chrome.cast.media.QueueItem>} * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueInsertItemsRequest */ def this(itemsToInsert: js.Array[typingsSlinky.chrome.chrome.cast.media.QueueItem]) = this() } @JSGlobal("chrome.cast.media.QueueItem") @js.native class QueueItem protected () extends typingsSlinky.chrome.chrome.cast.media.QueueItem { /** * @param {!chrome.cast.media.MediaInfo} mediaInfo * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueItem */ def this(mediaInfo: typingsSlinky.chrome.chrome.cast.media.MediaInfo) = this() } @JSGlobal("chrome.cast.media.QueueLoadRequest") @js.native class QueueLoadRequest protected () extends typingsSlinky.chrome.chrome.cast.media.QueueLoadRequest { /** * @param {!Array<chrome.cast.media.QueueItem>} items * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueLoadRequest */ def this(items: js.Array[typingsSlinky.chrome.chrome.cast.media.QueueItem]) = this() } @JSGlobal("chrome.cast.media.QueueRemoveItemsRequest") @js.native class QueueRemoveItemsRequest protected () extends typingsSlinky.chrome.chrome.cast.media.QueueRemoveItemsRequest { /** * @param {!Array<number>} * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueRemoveItemsRequest */ def this(itemIdsToRemove: js.Array[Double]) = this() } @JSGlobal("chrome.cast.media.QueueReorderItemsRequest") @js.native class QueueReorderItemsRequest protected () extends typingsSlinky.chrome.chrome.cast.media.QueueReorderItemsRequest { /** * @param {!Array<number>} * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueReorderItemsRequest */ def this(itemIdsToReorder: js.Array[Double]) = this() } @JSGlobal("chrome.cast.media.QueueUpdateItemsRequest") @js.native class QueueUpdateItemsRequest protected () extends typingsSlinky.chrome.chrome.cast.media.QueueUpdateItemsRequest { /** * @param {!Array<chrome.cast.media.QueueItem>} * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueUpdateItemsRequest */ def this(itemsToUpdate: js.Array[typingsSlinky.chrome.chrome.cast.media.QueueItem]) = this() } @JSGlobal("chrome.cast.media.RepeatMode") @js.native object RepeatMode extends StObject { @JSBracketAccess def apply(value: String): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.RepeatMode with String] = js.native /* "REPEAT_ALL" */ val ALL: typingsSlinky.chrome.chrome.cast.media.RepeatMode.ALL with String = js.native /* "REPEAT_ALL_AND_SHUFFLE" */ val ALL_AND_SHUFFLE: typingsSlinky.chrome.chrome.cast.media.RepeatMode.ALL_AND_SHUFFLE with String = js.native /* "REPEAT_OFF" */ val OFF: typingsSlinky.chrome.chrome.cast.media.RepeatMode.OFF with String = js.native /* "REPEAT_SINGLE" */ val SINGLE: typingsSlinky.chrome.chrome.cast.media.RepeatMode.SINGLE with String = js.native } @JSGlobal("chrome.cast.media.ResumeState") @js.native object ResumeState extends StObject { @JSBracketAccess def apply(value: String): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.ResumeState with String] = js.native /* "PLAYBACK_PAUSE" */ val PLAYBACK_PAUSE: typingsSlinky.chrome.chrome.cast.media.ResumeState.PLAYBACK_PAUSE with String = js.native /* "PLAYBACK_START" */ val PLAYBACK_START: typingsSlinky.chrome.chrome.cast.media.ResumeState.PLAYBACK_START with String = js.native } @JSGlobal("chrome.cast.media.SeekRequest") @js.native /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.SeekRequest */ class SeekRequest () extends typingsSlinky.chrome.chrome.cast.media.SeekRequest @JSGlobal("chrome.cast.media.StopRequest") @js.native /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StopRequest */ class StopRequest () extends typingsSlinky.chrome.chrome.cast.media.StopRequest @JSGlobal("chrome.cast.media.StreamType") @js.native object StreamType extends StObject { @JSBracketAccess def apply(value: String): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.StreamType with String] = js.native /* "BUFFERED" */ val BUFFERED: typingsSlinky.chrome.chrome.cast.media.StreamType.BUFFERED with String = js.native /* "LIVE" */ val LIVE: typingsSlinky.chrome.chrome.cast.media.StreamType.LIVE with String = js.native /* "OTHER" */ val OTHER: typingsSlinky.chrome.chrome.cast.media.StreamType.OTHER with String = js.native } @JSGlobal("chrome.cast.media.TextTrackEdgeType") @js.native object TextTrackEdgeType extends StObject { @JSBracketAccess def apply(value: String): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.TextTrackEdgeType with String] = js.native /* "DEPRESSED" */ val DEPRESSED: typingsSlinky.chrome.chrome.cast.media.TextTrackEdgeType.DEPRESSED with String = js.native /* "DROP_SHADOW" */ val DROP_SHADOW: typingsSlinky.chrome.chrome.cast.media.TextTrackEdgeType.DROP_SHADOW with String = js.native /* "NONE" */ val NONE: typingsSlinky.chrome.chrome.cast.media.TextTrackEdgeType.NONE with String = js.native /* "OUTLINE" */ val OUTLINE: typingsSlinky.chrome.chrome.cast.media.TextTrackEdgeType.OUTLINE with String = js.native /* "RAISED" */ val RAISED: typingsSlinky.chrome.chrome.cast.media.TextTrackEdgeType.RAISED with String = js.native } @JSGlobal("chrome.cast.media.TextTrackFontGenericFamily") @js.native object TextTrackFontGenericFamily extends StObject { @JSBracketAccess def apply(value: String): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.TextTrackFontGenericFamily with String] = js.native /* "CASUAL" */ val CASUAL: typingsSlinky.chrome.chrome.cast.media.TextTrackFontGenericFamily.CASUAL with String = js.native /* "CURSIVE" */ val CURSIVE: typingsSlinky.chrome.chrome.cast.media.TextTrackFontGenericFamily.CURSIVE with String = js.native /* "MONOSPACED_SANS_SERIF" */ val MONOSPACED_SANS_SERIF: typingsSlinky.chrome.chrome.cast.media.TextTrackFontGenericFamily.MONOSPACED_SANS_SERIF with String = js.native /* "MONOSPACED_SERIF" */ val MONOSPACED_SERIF: typingsSlinky.chrome.chrome.cast.media.TextTrackFontGenericFamily.MONOSPACED_SERIF with String = js.native /* "SANS_SERIF" */ val SANS_SERIF: typingsSlinky.chrome.chrome.cast.media.TextTrackFontGenericFamily.SANS_SERIF with String = js.native /* "SERIF" */ val SERIF: typingsSlinky.chrome.chrome.cast.media.TextTrackFontGenericFamily.SERIF with String = js.native /* "SMALL_CAPITALS" */ val SMALL_CAPITALS: typingsSlinky.chrome.chrome.cast.media.TextTrackFontGenericFamily.SMALL_CAPITALS with String = js.native } @JSGlobal("chrome.cast.media.TextTrackFontStyle") @js.native object TextTrackFontStyle extends StObject { @JSBracketAccess def apply(value: String): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.TextTrackFontStyle with String] = js.native /* "BOLD" */ val BOLD: typingsSlinky.chrome.chrome.cast.media.TextTrackFontStyle.BOLD with String = js.native /* "BOLD_ITALIC" */ val BOLD_ITALIC: typingsSlinky.chrome.chrome.cast.media.TextTrackFontStyle.BOLD_ITALIC with String = js.native /* "ITALIC" */ val ITALIC: typingsSlinky.chrome.chrome.cast.media.TextTrackFontStyle.ITALIC with String = js.native /* "NORMAL" */ val NORMAL: typingsSlinky.chrome.chrome.cast.media.TextTrackFontStyle.NORMAL with String = js.native } @JSGlobal("chrome.cast.media.TextTrackStyle") @js.native /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackStyle */ class TextTrackStyle () extends typingsSlinky.chrome.chrome.cast.media.TextTrackStyle @JSGlobal("chrome.cast.media.TextTrackType") @js.native object TextTrackType extends StObject { @JSBracketAccess def apply(value: String): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.TextTrackType with String] = js.native /* "CAPTIONS" */ val CAPTIONS: typingsSlinky.chrome.chrome.cast.media.TextTrackType.CAPTIONS with String = js.native /* "CHAPTERS" */ val CHAPTERS: typingsSlinky.chrome.chrome.cast.media.TextTrackType.CHAPTERS with String = js.native /* "DESCRIPTIONS" */ val DESCRIPTIONS: typingsSlinky.chrome.chrome.cast.media.TextTrackType.DESCRIPTIONS with String = js.native /* "METADATA" */ val METADATA: typingsSlinky.chrome.chrome.cast.media.TextTrackType.METADATA with String = js.native /* "SUBTITLES" */ val SUBTITLES: typingsSlinky.chrome.chrome.cast.media.TextTrackType.SUBTITLES with String = js.native } @JSGlobal("chrome.cast.media.TextTrackWindowType") @js.native object TextTrackWindowType extends StObject { @JSBracketAccess def apply(value: String): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.TextTrackWindowType with String] = js.native /* "NONE" */ val NONE: typingsSlinky.chrome.chrome.cast.media.TextTrackWindowType.NONE with String = js.native /* "NORMAL" */ val NORMAL: typingsSlinky.chrome.chrome.cast.media.TextTrackWindowType.NORMAL with String = js.native /* "ROUNDED_CORNERS" */ val ROUNDED_CORNERS: typingsSlinky.chrome.chrome.cast.media.TextTrackWindowType.ROUNDED_CORNERS with String = js.native } @JSGlobal("chrome.cast.media.Track") @js.native class Track protected () extends typingsSlinky.chrome.chrome.cast.media.Track { /** * @param {number} trackId * @param {!chrome.cast.media.TrackType} trackType * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.Track */ def this(trackId: Double, trackType: TrackType) = this() } @JSGlobal("chrome.cast.media.TrackType") @js.native object TrackType extends StObject { @JSBracketAccess def apply(value: String): js.UndefOr[typingsSlinky.chrome.chrome.cast.media.TrackType with String] = js.native /* "AUDIO" */ val AUDIO: typingsSlinky.chrome.chrome.cast.media.TrackType.AUDIO with String = js.native /* "TEXT" */ val TEXT: typingsSlinky.chrome.chrome.cast.media.TrackType.TEXT with String = js.native /* "VIDEO" */ val VIDEO: typingsSlinky.chrome.chrome.cast.media.TrackType.VIDEO with String = js.native } @JSGlobal("chrome.cast.media.TvShowMediaMetadata") @js.native /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TvShowMediaMetadata */ class TvShowMediaMetadata () extends typingsSlinky.chrome.chrome.cast.media.TvShowMediaMetadata @JSGlobal("chrome.cast.media.VolumeRequest") @js.native class VolumeRequest protected () extends typingsSlinky.chrome.chrome.cast.media.VolumeRequest { /** * @param {!chrome.cast.Volume} volume * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.VolumeRequest */ def this(volume: typingsSlinky.chrome.chrome.cast.Volume) = this() } /** * @namespace * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.timeout */ object timeout { @JSGlobal("chrome.cast.media.timeout") @js.native val ^ : js.Any = js.native @JSGlobal("chrome.cast.media.timeout.editTracksInfo") @js.native def editTracksInfo: Double = js.native @scala.inline def editTracksInfo_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("editTracksInfo")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.timeout.getStatus") @js.native def getStatus: Double = js.native @scala.inline def getStatus_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("getStatus")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.timeout.load") @js.native def load: Double = js.native @scala.inline def load_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("load")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.timeout.pause") @js.native def pause: Double = js.native @scala.inline def pause_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("pause")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.timeout.play") @js.native def play: Double = js.native @scala.inline def play_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("play")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.timeout.queueInsert") @js.native def queueInsert: Double = js.native @scala.inline def queueInsert_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("queueInsert")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.timeout.queueLoad") @js.native def queueLoad: Double = js.native @scala.inline def queueLoad_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("queueLoad")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.timeout.queueRemove") @js.native def queueRemove: Double = js.native @scala.inline def queueRemove_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("queueRemove")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.timeout.queueReorder") @js.native def queueReorder: Double = js.native @scala.inline def queueReorder_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("queueReorder")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.timeout.queueUpdate") @js.native def queueUpdate: Double = js.native @scala.inline def queueUpdate_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("queueUpdate")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.timeout.seek") @js.native def seek: Double = js.native @scala.inline def seek_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("seek")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.timeout.setVolume") @js.native def setVolume: Double = js.native @scala.inline def setVolume_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("setVolume")(x.asInstanceOf[js.Any]) @JSGlobal("chrome.cast.media.timeout.stop") @js.native def stop: Double = js.native @scala.inline def stop_=(x: Double): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("stop")(x.asInstanceOf[js.Any]) } }
yongaro/Borderlands
Source/Borderlands/CollidingPawnMovementComponent.cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "CollidingPawnMovementComponent.h" #include "Borderlands.h" void UCollidingPawnMovementComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) { Super::TickComponent(DeltaTime, TickType, ThisTickFunction); //Make sure that everything is still valid if (!PawnOwner || !UpdatedComponent || ShouldSkipUpdate(DeltaTime)) { return; } //Get (clear) movement vector FVector DesiredMovementThisFrame = ConsumeInputVector().GetClampedToMaxSize(1.0f) * DeltaTime * 150.f; //150 : max speed if (!DesiredMovementThisFrame.IsNearlyZero()) { FHitResult Hit; SafeMoveUpdatedComponent(DesiredMovementThisFrame, UpdatedComponent->GetComponentRotation(), true, Hit); //If we bumped into something, we slide along it if (Hit.IsValidBlockingHit()) { SlideAlongSurface(DesiredMovementThisFrame, 1.f - Hit.Time, Hit.Normal, Hit); } } }
JahodaPaul/FIT_CTU
SI1 - Rogue Game/include/Util/Subject.hpp
#pragma once #include <map> #include "Util/Event.hpp" namespace RG { namespace Util { class Observer; /** * \class Subject * \brief Subject can be observed by Util::Observer * * This class is can send notifications to all registered observers. * */ class Subject { public: Subject(); /** * \brief desstructor * * This will notify all Observers whitch subscribed to this Subject about it's death. */ virtual ~Subject(); /** * \brief Dont use this method!!! * * Dont call this method manualy, use Observer::SubscribeTo( subject ) instead. * This method registers new Util::Observer to this Subject. * * @param observer pointer to Util::Observer to be registed * */ void AddObserver( Observer * observer ); /** * \brief Remove one observer * * @param observer pointer to Util::Observer to be removed * */ void RemoveObserver( Observer * observer ); protected: /** * \brief Send notification to all registered observers * * @param subject pointer to class calling this method * @param event type of notification ( see Util::Event ) * */ void Notify( Subject * subject, Event event ); private: std::map<Observer *, bool > m_observers; bool m_lock; }; } }
npocmaka/Windows-Server-2003
inetsrv/msmq/src/admin/mqsnap/edataobj.h
<filename>inetsrv/msmq/src/admin/mqsnap/edataobj.h // edataobj.h : Declaration of the CEnterpriseDataObject #ifndef __EDATAOBJECT_H_ #define __EDATAOBJECT_H_ #include "resource.h" // main symbols #include "dataobj.h" ///////////////////////////////////////////////////////////////////////////// // CEnterpriseDataObject class CEnterpriseDataObject : public CDataObject, public CComCoClass<CEnterpriseDataObject, &CLSID_EnterpriseDataObject> { public: DECLARE_NOT_AGGREGATABLE(CEnterpriseDataObject) DECLARE_REGISTRY_RESOURCEID(IDR_ENTERPRISEDATAOBJECT) // // IShellPropSheetExt // STDMETHOD(AddPages)(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam); // // IContextMenu // STDMETHOD(QueryContextMenu)(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici); protected: HPROPSHEETPAGE CreateGeneralPage(); virtual HRESULT ExtractMsmqPathFromLdapPath (LPWSTR lpwstrLdapPath); virtual const DWORD GetObjectType(); virtual const PROPID *GetPropidArray(); virtual const DWORD GetPropertiesCount(); private: enum _MENU_ENTRY { eNewForeignSite = 0, eNewForeignComputer }; static const PROPID mx_paPropid[]; }; inline const DWORD CEnterpriseDataObject::GetObjectType( void ) { return MQDS_ENTERPRISE; }; inline const PROPID* CEnterpriseDataObject::GetPropidArray( void ) { return mx_paPropid; } #endif //__EDATAOBJECT_H_
shenhaizhilong/algorithm
src/main/java/com/hui/Array/FindMinimuminRotatedSortedArrayII.java
package com.hui.Array; /** * @author: shenhaizhilong * @date: 2018/9/15 10:19 */ public class FindMinimuminRotatedSortedArrayII { /** * * 154. Find Minimum in Rotated Sorted Array II * DescriptionHintsSubmissionsDiscussSolution * Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. * * (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). * * Find the minimum element. * * The array may contain duplicates. * * Example 1: * * Input: [1,3,5] * Output: 1 * Example 2: * * Input: [2,2,2,0,1] * Output: 0 * Note: * * This is a follow up problem to Find Minimum in Rotated Sorted Array. * Would allow duplicates affect the run-time complexity? How and why? * * @param nums * @return */ public int findMin(int[] nums) { if(nums.length == 1)return nums[0]; if(nums.length == 2)return Math.min(nums[0],nums[1]); if(nums[nums.length -1] > nums[0])return nums[0]; int low = 0; int high = nums.length -1; int middle = 0; while (low < high) { middle = (low + high) >>>1; if(nums[middle] > nums[high]) { low = middle + 1; }else if(nums[middle] < nums[high]) { high = middle; }else { // nums[middle] == nums[high] if(nums[low] == nums[middle]) { low++; high--; }else { high = middle; } } } return nums[high]; } public static void main(String[] args) { FindMinimuminRotatedSortedArrayII findMinimuminRotatedSortedArrayII = new FindMinimuminRotatedSortedArrayII(); System.out.println(findMinimuminRotatedSortedArrayII.findMin(new int[]{10,1,10,10,10})); } }
generaldevelopers/Tilda
src/tilda/db/QueryHelper.java
<filename>src/tilda/db/QueryHelper.java /* =========================================================================== * Copyright (C) 2015 CapsicoHealth Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package tilda.db; import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import tilda.types.*; import tilda.enums.AggregateType; import tilda.enums.ColumnType; import tilda.enums.StatementType; import tilda.grammar.ErrorList; import tilda.grammar.TildaSQLValidator; import tilda.utils.DateTimeUtil; import tilda.utils.TextUtil; /** * <B>LDH-NOTE</B> * This class helps build queries more safely, but it's not a compile-time tool. Therefore, there is no point * in trying to catch syntax errors as the database will do that plenty fine.<BR> * It's tempting to add extra features to catch mismatched parentheses, checking there is no duplicate * table names in the From clause. The only thing that was interesting is that using operators in the SET part * of a select or update causes weird things. For example, select a=3 evaluates as a boolean expression which * i find weird, so i check for it. Other than that, nothing except major issues like * * @author ldh * */ public abstract class QueryHelper { protected QueryHelper(Connection C, StatementType ST, String SchemaName, String TableName, boolean fullSelect) throws Exception { if (C == null) throw new Exception("Cannot create a QueryHelper with a NULL connection."); if (fullSelect == false && ST != StatementType.SELECT) throw new Exception("Cannot create a 'fullSelect' QueryHelper for a StatementType '"+ST.name()+"'."); _SchemaName = SchemaName; _TableName = TableName; _C = C; _ST = ST; _FullSelect = fullSelect; _Section = S.START; if (_ST == StatementType.SELECT) { if (fullSelect == true) _QueryStr.append("select "); else { _Section = S.FROM; _WherePos = 0; } } else if (_ST == StatementType.UPDATE) { _QueryStr.append("update "); C.getFullTableVar(_QueryStr, SchemaName, TableName); _QueryStr.append(" set "); } else if (_ST == StatementType.DELETE) { _QueryStr.append("delete from "); C.getFullTableVar(_QueryStr, SchemaName, TableName); _QueryStr.append(" "); _Section = S.FROM; } else throw new Exception("Unsupported Statement Type '" + ST + "' for the QueryHelper: "+_QueryStr.toString()); } protected static enum S { START, FROM, SET, WHERE, GROUPBY, ORDERBY; } protected final String _SchemaName; protected final String _TableName; protected final StatementType _ST; protected boolean _FullSelect; protected Connection _C; protected StringBuilder _QueryStr = new StringBuilder(); protected S _Section = null; protected boolean _Where = false; protected int _WherePos = -1; protected int _Cardinality = 0; List<ColumnDefinition> _Columns = new ArrayList<ColumnDefinition>(); protected int _SubSelectCount = 0; public int getCardinality() { return _Cardinality; } public Iterator<ColumnDefinition> getColumns() { return _Columns.iterator(); } protected final void valuesBase() throws Exception { if (_Section != S.SET || _ST != StatementType.INSERT) throw new Exception("Invalid query syntax: Calling values() after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); _QueryStr.append(") values ("); } protected final QueryHelper selectColumnBase(String ColStr) throws Exception { if (_Section != S.START && _Section != S.SET || _ST != StatementType.SELECT) throw new Exception("Invalid query syntax: Listing a column in a Select clause after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); if (_Section == S.SET) _QueryStr.append(", "); _QueryStr.append(ColStr); ++_Cardinality; _Section = S.SET; return this; } public final QueryHelper selectColumn(ColumnDefinition Col) throws Exception { _Columns.add(Col); StringBuilder Str = new StringBuilder(); Col.getFullColumnVarForSelect(_C, Str); return selectColumnBase(Str.toString()); } public final QueryHelper selectDistinctColumn(ColumnDefinition Col) throws Exception { _Columns.add(Col); StringBuilder Str = new StringBuilder(); Str.append("distinct("); Col.getFullColumnVarForSelect(_C, Str); Str.append(")"); return selectColumnBase(Str.toString()); } public final QueryHelper selectCountStar() throws Exception { _Columns.add(new ColumnDefinition(_SchemaName, _TableName, "count", 0, ColumnType.LONG, false, "")); return selectColumnBase("count(*)"); } public final QueryHelper selectColumn(ColumnDefinition Col, AggregateType Agg, String Alias) throws Exception { _Columns.add(Col); StringBuilder Str = new StringBuilder(); Str.append(_C.getAggregateStr(Agg)).append("("); Col.getFullColumnVarForSelect(_C, Str); Str.append(") as \"").append(Alias).append("\""); return selectColumnBase(Str.toString()); } public final QueryHelper selectColumn(int TableId, String ColumnName, AggregateType Agg, String AliasName) throws Exception { return selectColumnBase(_C.getAggregateStr(Agg)+"(T"+TableId+".\""+ColumnName+"\") as \""+AliasName+"\""); } protected final QueryHelper fromTable(String SchemaName, String TableName) throws Exception { if (_Section != S.FROM && _Section != S.SET || _ST != StatementType.SELECT) throw new Exception("Invalid query syntax: Calling from() with '" + TableName + "' after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); if (_Section != S.FROM) { _QueryStr.append(" from "); _C.getFullTableVar(_QueryStr, _SchemaName, _TableName); } if (TableName.equalsIgnoreCase(_TableName) == false) { _QueryStr.append(_Section == S.FROM || _TableName != null? ", " : ""); _C.getFullTableVar(_QueryStr, SchemaName, TableName); } _Section = S.FROM; return this; } protected final QueryHelper fromSubSelect(SelectQuery FullSelect) throws Exception { if (_Section != S.FROM && _Section != S.SET || _ST != StatementType.SELECT) throw new Exception("Invalid query syntax: Calling from() with a subselect after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); if (_Section != S.FROM) { _QueryStr.append(" from "); _C.getFullTableVar(_QueryStr, _SchemaName, _TableName); } _QueryStr.append(_Section == S.FROM || _TableName != null? ", (" : " (").append(FullSelect._QueryStr).append(") as T").append(++_SubSelectCount); _Section = S.FROM; return this; } public final QueryHelper where() throws Exception { if (_Section != S.FROM && _Section != S.SET) throw new Exception("Invalid query syntax: Calling where() after a " + _Section + ": "+_QueryStr.toString()); if (_Section != S.WHERE) { if (_Section != S.FROM && _ST == StatementType.SELECT) { _QueryStr.append(" from "); _C.getFullTableVar(_QueryStr, _SchemaName, _TableName); } _QueryStr.append(" where "); _WherePos = _QueryStr.length(); } _Section = S.WHERE; _Where = true; return this; } public QueryHelper subWhere(SelectQuery subWhere) { _QueryStr.append(subWhere.toString()); return this; } /** * Validates the subWhereClause against the TildaSQL parser and if it passes, adds it to the * current query object, in parenthesis as to be cohesive with the rest of the query. * @param subWhereClause * @return * @throws Exception */ public QueryHelper subWhere(String subWhereClause) throws Exception { if (_Section != S.WHERE) throw new Exception("Invalid query syntax: Calling subWhere() after a " + _Section + ": "+_QueryStr.toString()); TildaSQLValidator Validator = new TildaSQLValidator(subWhereClause); if (Validator.getParserSyntaxErrors() != 0) throw new Exception("SubWhereClause '"+subWhereClause+"' had " + Validator.getParserSyntaxErrors() + " syntax error(s)."); Validator.validate(); Iterator<ErrorList.Error> I = Validator.getValidationErrors().getErrors(); if (I != null) { StringBuilder Str = new StringBuilder(); int i = 0; while (I.hasNext() == true) { Str.append(" ").append(I.next()).append("\n"); ++i; } throw new Exception("SubWhereClause '"+subWhereClause+"' had "+i+" validation error(s):\n"+Str.toString()); } this._QueryStr.append("(").append(subWhereClause).append(")"); return this; } public final QueryHelper and() throws Exception { if (_Section != S.WHERE && _Section != S.FROM) throw new Exception("Invalid query syntax: Calling and() after a " + _Section + ": "+_QueryStr.toString()); if (_QueryStr.length() != _WherePos) _QueryStr.append(" and "); _Section = S.WHERE; return this; } public final QueryHelper or() throws Exception { if (_Section != S.WHERE && _Section != S.FROM) throw new Exception("Invalid query syntax: Calling and() after a " + _Section + ": "+_QueryStr.toString()); if (_QueryStr.length() != _WherePos) _QueryStr.append(" or "); _Section = S.WHERE; return this; } public final QueryHelper openPar() throws Exception { if (_Section != S.WHERE && _Section != S.FROM) throw new Exception("Invalid query syntax: Calling openPar() after a " + _Section + ": "+_QueryStr.toString()); _QueryStr.append(" ("); _Section = S.WHERE; _WherePos = _QueryStr.length(); return this; } public final QueryHelper closePar() throws Exception { if (_Section != S.WHERE) throw new Exception("Invalid query syntax: Calling closePar() after a " + _Section + " (Outside of a where clause): "+_QueryStr.toString()); _QueryStr.append(" )"); _Section = S.WHERE; return this; } protected final void OpCol(Op O, ColumnDefinition Col) throws Exception { if (_Section != S.SET && _Section != S.WHERE) throw new Exception("Invalid query syntax: Calling equals() after a " + _Section + ": "+_QueryStr.toString()); _QueryStr.append(O._Str); if (_ST == StatementType.SELECT) Col.getFullColumnVarForSelect(_C, _QueryStr); else Col.getShortColumnVarForSelect(_C, _QueryStr); } public static enum Op { EQUALS(" = ") , LT(" < ") , LTE(" <= ") , GT(" > ") , GTE(" >= ") , NOT_EQUALS(" <> ") , PLUS(" + ") , MINUS(" - ") , MULTIPLY(" * ") , DIVIDE(" / ") , LIKE(" like "); Op(String Str) { _Str = Str; } public final String _Str; } protected final void OpVal(Op O, String V) throws Exception { if ( _ST == StatementType.SELECT && (_Section == S.WHERE || _Section == S.FROM) || _ST == StatementType.DELETE && (_Section == S.WHERE || _Section == S.FROM) || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET) ) { if (V == null) { if (_Section == S.WHERE || _Section == S.FROM) { if (O == Op.EQUALS) _QueryStr.append(" IS NULL "); else if (O == Op.NOT_EQUALS) _QueryStr.append(" IS NOT NULL "); else throw new Exception("Invalid query syntax: cannot use the operator " + O + " with a NULL value: "+_QueryStr.toString()); } else _QueryStr.append(" = NULL "); } else { _QueryStr.append(O._Str); TextUtil.EscapeSingleQuoteForSQL(_QueryStr, V); } _Section = S.WHERE; } else throw new Exception("Invalid query syntax: Calling an operator() after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } protected final void OpVal(Op O, boolean V) throws Exception { if (_ST == StatementType.SELECT && (_Section == S.WHERE || _Section == S.FROM) || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { _QueryStr.append(O._Str).append(V); _Section = S.WHERE; } else throw new Exception("Invalid query syntax: Calling an operator() after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } protected final void OpVal(Op O, double V) throws Exception { if (_ST == StatementType.SELECT && (_Section == S.WHERE || _Section == S.FROM) || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { _QueryStr.append(O._Str).append(V); _Section = S.WHERE; } else throw new Exception("Invalid query syntax: Calling an operator() after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } protected final void OpVal(Op O, float V) throws Exception { if (_ST == StatementType.SELECT && (_Section == S.WHERE || _Section == S.FROM) || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { _QueryStr.append(O._Str).append(V); _Section = S.WHERE; } else throw new Exception("Invalid query syntax: Calling an operator() after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } protected final void OpVal(Op O, int V) throws Exception { if (_ST == StatementType.SELECT && (_Section == S.WHERE || _Section == S.FROM) || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { _QueryStr.append(O._Str).append(V); _Section = S.WHERE; } else throw new Exception("Invalid query syntax: Calling an operator() after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } protected final void OpVal(Op O, long V) throws Exception { if (_ST == StatementType.SELECT && (_Section == S.WHERE || _Section == S.FROM) || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET) || _ST == StatementType.DELETE && _Section == S.WHERE) { _QueryStr.append(O._Str).append(V); _Section = S.WHERE; } else throw new Exception("Invalid query syntax: Calling an operator() after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } protected final void OpVal(Op O, char V) throws Exception { if (_ST == StatementType.SELECT && (_Section == S.WHERE || _Section == S.FROM) || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { _QueryStr.append(O._Str).append('\'').append(V).append('\''); _Section = S.WHERE; } else throw new Exception("Invalid query syntax: Calling an operator() after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } protected final void OpVal(Op O, ZonedDateTime V) throws Exception { if (_ST == StatementType.SELECT && (_Section == S.WHERE || _Section == S.FROM) || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { if (DateTimeUtil.isNowPlaceholder(V) == true) _QueryStr.append(O._Str).append(_C.getCurrentTimestampStr()); else if (V == null) { if (_Section == S.WHERE || _Section == S.FROM) { if (O == Op.EQUALS) _QueryStr.append(" IS NULL "); else if (O == Op.NOT_EQUALS) _QueryStr.append(" IS NOT NULL "); else throw new Exception("Invalid query syntax: cannot use the operator " + O + " with a NULL value: "+_QueryStr.toString()); } else _QueryStr.append(" = NULL "); } else { _QueryStr.append(O._Str).append("'").append(DateTimeUtil.printDateTimeForSQL(V)).append("'"); } _Section = S.WHERE; } else throw new Exception("Invalid query syntax: Calling an operator() after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } public String getWhereClause() throws Exception { if (_ST == StatementType.SELECT && _FullSelect == false) { String Str = _QueryStr.toString(); if (_Where == false) Str = " where "+Str; return Str; } throw new Exception("Error: Calling getWhereClause() on non 'where clause' QueryHelper object (constructed as a SELECT with a null Connection): "+_QueryStr.toString()); } public QueryHelper values() throws Exception { valuesBase(); return this; } public QueryHelper from(String SchemaName, String TableName) throws Exception { fromTable(SchemaName, TableName); return this; } public QueryHelper from(SelectQuery Q) throws Exception { fromSubSelect(Q); return this; } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SETTERS // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected final void setColumn(ColumnDefinition Col) throws Exception { if (_Section != S.START && _Section != S.SET || _ST != StatementType.UPDATE) throw new Exception("Invalid query syntax: Calling set() after a " + _Section + ": "+_QueryStr.toString()); if (_Section == S.SET) _QueryStr.append(", "); Col.getShortColumnVarForSelect(_C, _QueryStr); _Section = S.SET; } public QueryHelper set(Type_StringPrimitive Col1, Type_StringPrimitive Col2) throws Exception { setColumn(Col1); return equals(Col2); } public QueryHelper set(Type_CharPrimitive Col1, Type_CharPrimitive Col2) throws Exception { setColumn(Col1); return equals(Col2); } public QueryHelper set(Type_BooleanPrimitive Col1, Type_BooleanPrimitive Col2) throws Exception { setColumn(Col1); return equals(Col2); } public QueryHelper set(Type_IntegerPrimitive Col1, Type_IntegerPrimitive Col2) throws Exception { setColumn(Col1); return equals(Col2); } public QueryHelper set(Type_LongPrimitive Col1, Type_IntegerPrimitive Col2) throws Exception { setColumn(Col1); return equals(Col2); } public QueryHelper set(Type_LongPrimitive Col1, Type_LongPrimitive Col2) throws Exception { setColumn(Col1); return equals(Col2); } public QueryHelper set(Type_FloatPrimitive Col1, Type_FloatPrimitive Col2) throws Exception { setColumn(Col1); return equals(Col2); } public QueryHelper set(Type_DoublePrimitive Col1, Type_DoublePrimitive Col2) throws Exception { setColumn(Col1); return equals(Col2); } public QueryHelper set(Type_DatetimePrimitive Col1, Type_DatetimePrimitive Col2) throws Exception { setColumn(Col1); return equals(Col2); } public QueryHelper set(Type_StringPrimitive Col1, String V) throws Exception { setColumn(Col1); return equals(V); } public QueryHelper set(Type_CharPrimitive Col1, char V) throws Exception { setColumn(Col1); return equals(V); } public QueryHelper set(Type_BooleanPrimitive Col1, boolean V) throws Exception { setColumn(Col1); return equals(V); } public QueryHelper set(Type_IntegerPrimitive Col1, int V) throws Exception { setColumn(Col1); return equals(V); } public QueryHelper set(Type_LongPrimitive Col1, long V) throws Exception { setColumn(Col1); return equals(V); } public QueryHelper set(Type_FloatPrimitive Col1, float V) throws Exception { setColumn(Col1); return equals(V); } public QueryHelper set(Type_DoublePrimitive Col1, double V) throws Exception { setColumn(Col1); return equals(V); } public QueryHelper set(Type_DatetimePrimitive Col1, ZonedDateTime V) throws Exception { setColumn(Col1); return equals(V); } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // IN // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public QueryHelper in(Type_StringPrimitive Col, String[] V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" in ("); if (_ST == StatementType.SELECT && _Section == S.WHERE || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { TextUtil.EscapeSingleQuoteForSQL(_QueryStr, V, true); _QueryStr.append(")"); return this; } throw new Exception("Invalid query syntax: Calling the operator 'in' after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } public QueryHelper in(Type_StringPrimitive Col, Collection<String> V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" in ("); if (_ST == StatementType.SELECT && _Section == S.WHERE || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { TextUtil.EscapeSingleQuoteForSQL(_QueryStr, V, true); _QueryStr.append(")"); return this; } throw new Exception("Invalid query syntax: Calling the operator 'in' after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } public QueryHelper in(Type_StringCollection Col, String[] V) throws Exception { _QueryStr.append(" TILDA.In("); Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(", ARRAY["); if (_ST == StatementType.SELECT && _Section == S.WHERE || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { TextUtil.EscapeSingleQuoteForSQL(_QueryStr, V, true); _QueryStr.append("])"); return this; } throw new Exception("Invalid query syntax: Calling the operator 'in' after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } public QueryHelper in(Type_StringCollection Col, Collection<String> V) throws Exception { _QueryStr.append(" TILDA.In("); Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(", ARRAY["); if (_ST == StatementType.SELECT && _Section == S.WHERE || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { TextUtil.EscapeSingleQuoteForSQL(_QueryStr, V, true); _QueryStr.append("])"); return this; } throw new Exception("Invalid query syntax: Calling the operator 'in' after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } public QueryHelper in(Type_CharPrimitive Col, char[] v) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" in ("); if (_ST == StatementType.SELECT && _Section == S.WHERE || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { if (v != null) for (int i = 0; i < v.length; ++i) { if (i != 0) _QueryStr.append(", "); TextUtil.EscapeSingleQuoteForSQL(_QueryStr, "" + v[i]); } _QueryStr.append(")"); return this; } throw new Exception("Invalid query syntax: Calling the operator 'in' after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } public QueryHelper in(Type_IntegerPrimitive Col, int[] v) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" in ("); if (_ST == StatementType.SELECT && _Section == S.WHERE || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { if (v != null) for (int i = 0; i < v.length; ++i) { if (i != 0) _QueryStr.append(", "); _QueryStr.append(v[i]); } _QueryStr.append(")"); return this; } throw new Exception("Invalid query syntax: Calling the operator 'in' after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } public QueryHelper in(Type_LongPrimitive Col, long[] v) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" in ("); if (_ST == StatementType.SELECT && _Section == S.WHERE || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { if (v != null) for (int i = 0; i < v.length; ++i) { if (i != 0) _QueryStr.append(", "); _QueryStr.append(v[i]); } _QueryStr.append(")"); return this; } throw new Exception("Invalid query syntax: Calling the operator 'in' after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } public QueryHelper in(Type_FloatPrimitive Col, float[] v) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" in ("); if (_ST == StatementType.SELECT && _Section == S.WHERE || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { if (v != null) for (int i = 0; i < v.length; ++i) { if (i != 0) _QueryStr.append(", "); _QueryStr.append(v[i]); } _QueryStr.append(")"); return this; } throw new Exception("Invalid query syntax: Calling the operator 'in' after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } public QueryHelper in(Type_DoublePrimitive Col, double[] v) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" in ("); if (_ST == StatementType.SELECT && _Section == S.WHERE || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { if (v != null) for (int i = 0; i < v.length; ++i) { if (i != 0) _QueryStr.append(", "); _QueryStr.append(v[i]); } _QueryStr.append(")"); return this; } throw new Exception("Invalid query syntax: Calling the operator 'in' after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } public QueryHelper in(Type_DatetimePrimitive Col, ZonedDateTime[] v) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" in ("); if (_ST == StatementType.SELECT && _Section == S.WHERE || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { if (v != null) for (int i = 0; i < v.length; ++i) { if (i != 0) _QueryStr.append(", "); if (DateTimeUtil.isNowPlaceholder(v[i]) == true) _QueryStr.append(_C.getCurrentTimestampStr()); else if (v[i] == null) _QueryStr.append("NULL"); else _QueryStr.append("'").append(DateTimeUtil.printDateTimeForSQL(v[i])).append("'"); } _QueryStr.append(")"); return this; } throw new Exception("Invalid query syntax: Calling an operator() after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } public QueryHelper in(Type_DatetimePrimitive Col, Collection<ZonedDateTime> v) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" in ("); if (_ST == StatementType.SELECT && _Section == S.WHERE || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { if (v != null) { Iterator<ZonedDateTime> I = v.iterator(); boolean first = true; while (I.hasNext() == true) { if (first == true) first = false; else _QueryStr.append(", "); ZonedDateTime val = I.next(); if (DateTimeUtil.isNowPlaceholder(val) == true) _QueryStr.append(_C.getCurrentTimestampStr()); else if (val == null) _QueryStr.append("NULL"); else _QueryStr.append("'").append(DateTimeUtil.printDateTimeForSQL(val)).append("'"); } } _QueryStr.append(")"); return this; } throw new Exception("Invalid query syntax: Calling the operator 'in' after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } public QueryHelper in(ColumnDefinition Col, SelectQuery Q) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" in ("); if (Q._Cardinality != 1) throw new Exception("Invalid query syntax: Calling the operator 'in' with a subquery that has a column cardinality " + Q._Cardinality + ": "+_QueryStr.toString()); if (_ST == StatementType.SELECT && _Section == S.WHERE || _ST == StatementType.UPDATE && (_Section == S.WHERE || _Section == S.SET)) { _QueryStr.append(Q._QueryStr).append(")"); return this; } throw new Exception("Invalid query syntax: Calling the operator 'in' after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Col EQUALS Col // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public QueryHelper equals(String V) throws Exception { OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(char V) throws Exception { OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(boolean V) throws Exception { OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(int V) throws Exception { OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(long V) throws Exception { OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(float V) throws Exception { OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(double V) throws Exception { OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(ZonedDateTime ZDT) throws Exception { OpVal(Op.EQUALS, ZDT); return this; } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Col EQUALS Col // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected QueryHelper equalsBase(ColumnDefinition Col1, ColumnDefinition Col2) throws Exception { Col1.getFullColumnVarForSelect(_C, _QueryStr); OpCol(Op.EQUALS, Col2); return this; } public QueryHelper equals(ColumnDefinition Col1) throws Exception { OpCol(Op.EQUALS, Col1); return this; } public QueryHelper equals(Type_StringPrimitive Col1, Type_StringPrimitive Col2) throws Exception { return equalsBase(Col1, Col2); } public QueryHelper equals(Type_DatetimePrimitive Col1, Type_DatetimePrimitive Col2) throws Exception { return equalsBase(Col1, Col2); } public QueryHelper equals(Type_CharPrimitive Col1, Type_CharPrimitive Col2) throws Exception { return equalsBase(Col1, Col2); } public QueryHelper equals(Type_BooleanPrimitive Col1, Type_BooleanPrimitive Col2) throws Exception { return equalsBase(Col1, Col2); } public QueryHelper equals(Type_IntegerPrimitive Col1, Type_IntegerPrimitive Col2) throws Exception { return equalsBase(Col1, Col2); } public QueryHelper equals(Type_LongPrimitive Col1, Type_LongPrimitive Col2) throws Exception { return equalsBase(Col1, Col2); } public QueryHelper equals(Type_FloatPrimitive Col1, Type_FloatPrimitive Col2) throws Exception { return equalsBase(Col1, Col2); } public QueryHelper equals(Type_DoublePrimitive Col1, Type_DoublePrimitive Col2) throws Exception { return equalsBase(Col1, Col2); } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Col EQUALS value // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public QueryHelper equals(Type_StringPrimitive Col, String V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(Type_CharPrimitive Col, char V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(Type_BooleanPrimitive Col, boolean V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(Type_IntegerPrimitive Col, int V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(Type_LongPrimitive Col, long V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(Type_FloatPrimitive Col, float V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(Type_DoublePrimitive Col, double V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.EQUALS, V); return this; } public QueryHelper equals(Type_DatetimePrimitive Col, ZonedDateTime ZDT) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.EQUALS, ZDT); return this; } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Col < value // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public QueryHelper lt(Type_StringPrimitive Col, String V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LT, V); return this; } public QueryHelper lt(Type_CharPrimitive Col, char V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LT, V); return this; } public QueryHelper lt(Type_BooleanPrimitive Col, boolean V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LT, V); return this; } public QueryHelper lt(Type_IntegerPrimitive Col, int V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LT, V); return this; } public QueryHelper lt(Type_LongPrimitive Col, long V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LT, V); return this; } public QueryHelper lt(Type_FloatPrimitive Col, float V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LT, V); return this; } public QueryHelper lt(Type_DoublePrimitive Col, double V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LT, V); return this; } public QueryHelper lt(Type_DatetimePrimitive Col, ZonedDateTime ZDT) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LT, ZDT); return this; } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Col <= value // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public QueryHelper lte(Type_StringPrimitive Col, String V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LTE, V); return this; } public QueryHelper lte(Type_CharPrimitive Col, char V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LTE, V); return this; } public QueryHelper lte(Type_BooleanPrimitive Col, boolean V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LTE, V); return this; } public QueryHelper lte(Type_IntegerPrimitive Col, int V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LTE, V); return this; } public QueryHelper lte(Type_LongPrimitive Col, long V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LTE, V); return this; } public QueryHelper lte(Type_FloatPrimitive Col, float V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LTE, V); return this; } public QueryHelper lte(Type_DoublePrimitive Col, double V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LTE, V); return this; } public QueryHelper lte(Type_DatetimePrimitive Col, ZonedDateTime ZDT) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LTE, ZDT); return this; } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Col > value // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public QueryHelper gt(Type_StringPrimitive Col, String V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GT, V); return this; } public QueryHelper gt(Type_CharPrimitive Col, char V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GT, V); return this; } public QueryHelper gt(Type_BooleanPrimitive Col, boolean V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GT, V); return this; } public QueryHelper gt(Type_IntegerPrimitive Col, int V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GT, V); return this; } public QueryHelper gt(Type_LongPrimitive Col, long V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GT, V); return this; } public QueryHelper gt(Type_FloatPrimitive Col, float V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GT, V); return this; } public QueryHelper gt(Type_DoublePrimitive Col, double V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GT, V); return this; } public QueryHelper gt(Type_DatetimePrimitive Col, ZonedDateTime ZDT) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GT, ZDT); return this; } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Col >= value // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public QueryHelper gte(ColumnDefinition Col) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpCol(Op.GTE, Col); return this; } public QueryHelper gte(Type_StringPrimitive Col, String V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GTE, V); return this; } public QueryHelper gte(Type_CharPrimitive Col, char V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GTE, V); return this; } public QueryHelper gte(Type_BooleanPrimitive Col, boolean V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GTE, V); return this; } public QueryHelper gte(Type_IntegerPrimitive Col, int V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GTE, V); return this; } public QueryHelper gte(Type_LongPrimitive Col, long V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GTE, V); return this; } public QueryHelper gte(Type_FloatPrimitive Col, float V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GTE, V); return this; } public QueryHelper gte(Type_DoublePrimitive Col, double V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GTE, V); return this; } public QueryHelper gte(Type_DatetimePrimitive Col, ZonedDateTime ZDT) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.GTE, ZDT); return this; } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Col <> value // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public QueryHelper not_equals(Type_StringPrimitive Col, String V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.NOT_EQUALS, V); return this; } public QueryHelper not_equals(Type_CharPrimitive Col, char V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.NOT_EQUALS, V); return this; } public QueryHelper not_equals(Type_BooleanPrimitive Col, boolean V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.NOT_EQUALS, V); return this; } public QueryHelper not_equals(Type_IntegerPrimitive Col, int V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.NOT_EQUALS, V); return this; } public QueryHelper not_equals(Type_LongPrimitive Col, long V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.NOT_EQUALS, V); return this; } public QueryHelper not_equals(Type_FloatPrimitive Col, float V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.NOT_EQUALS, V); return this; } public QueryHelper not_equals(Type_DoublePrimitive Col, double V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.NOT_EQUALS, V); return this; } public QueryHelper not_equals(Type_DatetimePrimitive Col, ZonedDateTime ZDT) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.NOT_EQUALS, ZDT); return this; } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Operators // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public QueryHelper plus(ColumnDefinition Col) throws Exception { OpCol(Op.PLUS, Col); return this; } public QueryHelper plus(String V) throws Exception { OpVal(Op.PLUS, V); return this; } public QueryHelper plus(char V) throws Exception { OpVal(Op.PLUS, V); return this; } public QueryHelper plus(boolean V) throws Exception { OpVal(Op.PLUS, V); return this; } public QueryHelper plus(int V) throws Exception { OpVal(Op.PLUS, V); return this; } public QueryHelper plus(long V) throws Exception { OpVal(Op.PLUS, V); return this; } public QueryHelper plus(float V) throws Exception { OpVal(Op.PLUS, V); return this; } public QueryHelper plus(double V) throws Exception { OpVal(Op.PLUS, V); return this; } public QueryHelper plus(ZonedDateTime ZDT) throws Exception { OpVal(Op.PLUS, ZDT); return this; } public QueryHelper minus(ColumnDefinition Col) throws Exception { OpCol(Op.MINUS, Col); return this; } public QueryHelper minus(String V) throws Exception { OpVal(Op.MINUS, V); return this; } public QueryHelper minus(char V) throws Exception { OpVal(Op.MINUS, V); return this; } public QueryHelper minus(boolean V) throws Exception { OpVal(Op.MINUS, V); return this; } public QueryHelper minus(int V) throws Exception { OpVal(Op.MINUS, V); return this; } public QueryHelper minus(long V) throws Exception { OpVal(Op.MINUS, V); return this; } public QueryHelper minus(float V) throws Exception { OpVal(Op.MINUS, V); return this; } public QueryHelper minus(double V) throws Exception { OpVal(Op.MINUS, V); return this; } public QueryHelper minus(ZonedDateTime ZDT) throws Exception { OpVal(Op.MINUS, ZDT); return this; } public QueryHelper multiply(ColumnDefinition Col) throws Exception { OpCol(Op.MULTIPLY, Col); return this; } public QueryHelper multiply(String V) throws Exception { OpVal(Op.MULTIPLY, V); return this; } public QueryHelper multiply(char V) throws Exception { OpVal(Op.MULTIPLY, V); return this; } public QueryHelper multiply(boolean V) throws Exception { OpVal(Op.MULTIPLY, V); return this; } public QueryHelper multiply(int V) throws Exception { OpVal(Op.MULTIPLY, V); return this; } public QueryHelper multiply(long V) throws Exception { OpVal(Op.MULTIPLY, V); return this; } public QueryHelper multiply(float V) throws Exception { OpVal(Op.MULTIPLY, V); return this; } public QueryHelper multiply(double V) throws Exception { OpVal(Op.MULTIPLY, V); return this; } public QueryHelper multiply(ZonedDateTime ZDT) throws Exception { OpVal(Op.MULTIPLY, ZDT); return this; } public QueryHelper divide(ColumnDefinition Col) throws Exception { OpCol(Op.DIVIDE, Col); return this; } public QueryHelper divide(String V) throws Exception { OpVal(Op.DIVIDE, V); return this; } public QueryHelper divide(char V) throws Exception { OpVal(Op.DIVIDE, V); return this; } public QueryHelper divide(boolean V) throws Exception { OpVal(Op.DIVIDE, V); return this; } public QueryHelper divide(int V) throws Exception { OpVal(Op.DIVIDE, V); return this; } public QueryHelper divide(long V) throws Exception { OpVal(Op.DIVIDE, V); return this; } public QueryHelper divide(float V) throws Exception { OpVal(Op.DIVIDE, V); return this; } public QueryHelper divide(double V) throws Exception { OpVal(Op.DIVIDE, V); return this; } public QueryHelper divide(ZonedDateTime ZDT) throws Exception { OpVal(Op.DIVIDE, ZDT); return this; } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // IS NULL and IS NOT NULL // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public QueryHelper isNull(Nullable Col) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.EQUALS, (String) null); return this; } public QueryHelper isNotNull(Nullable Col) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.NOT_EQUALS, (String) null); return this; } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // LIKE // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public QueryHelper like(Type_StringPrimitive Col, String V) throws Exception { Col.getFullColumnVarForSelect(_C, _QueryStr); OpVal(Op.LIKE, V); return this; } public QueryHelper like(Type_StringCollection Col, String V) throws Exception { _QueryStr.append(" TILDA.like("); Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(", "); TextUtil.EscapeSingleQuoteForSQL(_QueryStr, V); _QueryStr.append(")"); return this; } public QueryHelper like(Type_StringCollection Col, String[] V) throws Exception { _QueryStr.append(" TILDA.like("); Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(", ARRAY["); boolean First = true; for (String v : V) { if (First == true) First = false; else _QueryStr.append(", "); TextUtil.EscapeSingleQuoteForSQL(_QueryStr, v); } _QueryStr.append("])"); return this; } public QueryHelper like(Type_StringPrimitive[] Cols, String V) throws Exception { boolean First = true; for (Type_StringPrimitive c : Cols) { if (First == true) { _QueryStr.append(" lower("); First = false; } else _QueryStr.append(" || ' ' || "); c.getFullColumnVarForSelect(_C, _QueryStr); } if (First == false) _QueryStr.append(")"); OpVal(Op.LIKE, V); return this; } public QueryHelper like(Type_StringPrimitive Col, String[] Vals, boolean Or) throws Exception { if (Vals == null) return this; boolean First = true; for (String v : Vals) { if (First == true) First = false; else if (Or == true) or(); else and(); like(Col, v); } return this; } public QueryHelper like(Type_StringPrimitive[] Cols, String[] Vals, boolean Or) throws Exception { if (Vals == null) return this; boolean First = true; for (String v : Vals) { if (First == true) First = false; else if (Or == true) or(); else and(); like(Cols, v); } return this; } // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ANY // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public QueryHelper any(Type_StringCollection Col, String v) { TextUtil.EscapeSingleQuoteForSQL(_QueryStr, v); _QueryStr.append(" any "); Col.getFullColumnVarForSelect(_C, _QueryStr); return this; } public QueryHelper any(Type_StringCollection Col, String[] Vals) { if (Vals == null) return this; Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" && ARRAY["); boolean First = true; for (String v : Vals) { if (First == true) First = false; else _QueryStr.append(", "); TextUtil.EscapeSingleQuoteForSQL(_QueryStr, v); } _QueryStr.append("]"); return this; } public QueryHelper any(Type_StringCollection Col, Collection<String> Vals) { if (Vals == null) return this; Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" && ARRAY["); boolean First = true; for (String v : Vals) { if (First == true) First = false; else _QueryStr.append(", "); TextUtil.EscapeSingleQuoteForSQL(_QueryStr, v); } _QueryStr.append("]"); return this; } public QueryHelper any(Type_IntegerCollection Col, int v) { _QueryStr.append(v); _QueryStr.append(" any "); Col.getFullColumnVarForSelect(_C, _QueryStr); return this; } public QueryHelper any(Type_IntegerCollection Col, int[] Vals) { if (Vals == null) return this; Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" && ARRAY["); boolean First = true; for (int v : Vals) { if (First == true) First = false; else _QueryStr.append(", "); _QueryStr.append(v); } _QueryStr.append("]"); return this; } public QueryHelper any(Type_CharCollection Col, char v) { _QueryStr.append("'").append(v).append("'"); _QueryStr.append(" any "); Col.getFullColumnVarForSelect(_C, _QueryStr); return this; } public QueryHelper any(Type_CharCollection Col, char[] Vals) { if (Vals == null) return this; Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" && ARRAY["); boolean First = true; for (int v : Vals) { if (First == true) First = false; else _QueryStr.append(", "); _QueryStr.append("'").append(v).append("'"); } _QueryStr.append("]"); return this; } public QueryHelper groupBy(ColumnDefinition Col) throws Exception { if (_Section != S.WHERE && _Section != S.GROUPBY || _ST != StatementType.SELECT) throw new Exception("Invalid query syntax: GroupBy after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); if (_Section == S.GROUPBY) _QueryStr.append(", "); else _QueryStr.append(" group by "); Col.getFullColumnVarForSelect(_C, _QueryStr); _Section = S.GROUPBY; return this; } protected void orderByBase() throws Exception { if (_Section != S.WHERE && _Section != S.GROUPBY && _Section != S.ORDERBY || _ST != StatementType.SELECT) throw new Exception("Invalid query syntax: OrderBy after a " + _Section + " in a query of type " + _ST + ": "+_QueryStr.toString()); if (_Section == S.ORDERBY) _QueryStr.append(", "); else _QueryStr.append(" order by "); _Section = S.ORDERBY; } public QueryHelper orderBy(ColumnDefinition Col, boolean Asc) throws Exception { orderByBase(); Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(Asc==true?" ASC":" DESC"); return this; } public QueryHelper orderByCountStar(boolean Asc) throws Exception { orderByBase(); _QueryStr.append("count(*)").append(Asc==true?" ASC":" DESC"); return this; } public QueryHelper orderBy(ColumnDefinition Col, boolean Asc, boolean NullsLast) throws Exception { orderByBase(); _C.setOrderByWithNullsOrdering(_QueryStr, Col, Asc, NullsLast); return this; } public QueryHelper ageBetween(Type_DatetimePrimitive Col, int[] ageRange) { ZonedDateTime Today = DateTimeUtil.getTodayTimestamp(true); ZonedDateTime D1 = Today.minusYears(ageRange[1]); ZonedDateTime D2 = Today.minusYears(ageRange[0]-1).minusNanos(1); Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" BETWEEN ").append("'").append(DateTimeUtil.printDateTimeForSQL(D1)).append("'") .append(" AND ").append("'").append(DateTimeUtil.printDateTimeForSQL(D2)).append("'"); return this; } public QueryHelper ageGreaterThan(Type_DatetimePrimitive Col, int Age) throws Exception { ZonedDateTime Today = DateTimeUtil.getTodayTimestamp(true); ZonedDateTime D = Today.minusYears(Age); return gt(Col, D); } public QueryHelper ageGreaterThanOrEqual(Type_DatetimePrimitive Col, int Age) throws Exception { ZonedDateTime Today = DateTimeUtil.getTodayTimestamp(true); ZonedDateTime D = Today.minusYears(Age); return gte(Col, D); } public QueryHelper ageLessThan(Type_DatetimePrimitive Col, int Age) throws Exception { ZonedDateTime Today = DateTimeUtil.getTodayTimestamp(true); ZonedDateTime D = Today.minusYears(Age); return lt(Col, D); } public QueryHelper ageLessThanOrEqual(Type_DatetimePrimitive Col, int Age) throws Exception { ZonedDateTime Today = DateTimeUtil.getTodayTimestamp(true); ZonedDateTime D = Today.minusYears(Age); return lte(Col, D); } public QueryHelper ageEquals(Type_DatetimePrimitive Col, int Age) throws Exception { ZonedDateTime Yesterday = DateTimeUtil.getIthDayTimestamp(true, -1); ZonedDateTime D1 = Yesterday.minusYears(Age-1); Col.getFullColumnVarForSelect(_C, _QueryStr); _QueryStr.append(" BETWEEN ").append("'").append(DateTimeUtil.printDateTimeForSQL(D1)).append("'") .append(" AND ").append("'").append(DateTimeUtil.printDateTimeForSQL(Yesterday)).append("'"); return this; } public String toString() { return _QueryStr.toString(); } }
longyinzaitian/LbsPhoto
app/src/main/java/com/lbsphoto/app/camera/CameraFragment.java
<gh_stars>0 package com.lbsphoto.app.camera; import android.Manifest; import android.support.annotation.RequiresPermission; import com.lbsphoto.app.camera.configuration.Configuration; import com.lbsphoto.app.camera.ui.BaseAnncaFragment; public class CameraFragment extends BaseAnncaFragment { @RequiresPermission(Manifest.permission.CAMERA) public static CameraFragment newInstance(Configuration configuration) { return (CameraFragment) BaseAnncaFragment.newInstance(new CameraFragment(), configuration); } }
yangjintao1/myfirstpro
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/physical/batch/BatchExecSort.scala
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.flink.table.plan.nodes.physical.batch import org.apache.flink.api.common.typeutils.{TypeComparator, TypeSerializer} import org.apache.flink.runtime.operators.DamBehavior import org.apache.flink.streaming.api.operators.OneInputStreamOperator import org.apache.flink.streaming.api.transformations.{OneInputTransformation, StreamTransformation} import org.apache.flink.table.api.types.DataTypes import org.apache.flink.table.api.{BatchTableEnvironment, TableConfig} import org.apache.flink.table.calcite.FlinkTypeFactory import org.apache.flink.table.codegen.{GeneratedSorter, SortCodeGenerator} import org.apache.flink.table.dataformat.BaseRow import org.apache.flink.table.plan.cost.FlinkBatchCost._ import org.apache.flink.table.plan.cost.FlinkCostFactory import org.apache.flink.table.plan.nodes.exec.RowBatchExecNode import org.apache.flink.table.plan.nodes.exec.batch.BatchExecNodeVisitor import org.apache.flink.table.plan.nodes.physical.FlinkPhysicalRel import org.apache.flink.table.plan.util.SortUtil import org.apache.flink.table.runtime.sort.SortOperator import org.apache.flink.table.typeutils.TypeUtils import org.apache.flink.table.util.NodeResourceUtil import org.apache.calcite.plan.{RelOptCluster, RelOptCost, RelOptPlanner, RelTraitSet} import org.apache.calcite.rel.core.Sort import org.apache.calcite.rel.metadata.RelMetadataQuery import org.apache.calcite.rel.{RelCollation, RelNode, RelWriter} import org.apache.calcite.rex.RexNode import scala.collection.JavaConversions._ class BatchExecSort( cluster: RelOptCluster, traitSet: RelTraitSet, inp: RelNode, collations: RelCollation) extends Sort(cluster, traitSet, inp, collations) with BatchPhysicalRel with RowBatchExecNode { private val (keys, orders, nullsIsLast) = SortUtil.getKeysAndOrders(collations.getFieldCollations) override def copy( traitSet: RelTraitSet, newInput: RelNode, newCollation: RelCollation, offset: RexNode, fetch: RexNode): Sort = new BatchExecSort(cluster, traitSet, newInput, newCollation) override def explainTerms(pw: RelWriter): RelWriter = { pw.input("input", getInput) .item("orderBy", SortUtil.sortFieldsToString(collations, getRowType)) } override def estimateRowCount(mq: RelMetadataQuery): Double = mq.getRowCount(input) override def computeSelfCost(planner: RelOptPlanner, mq: RelMetadataQuery): RelOptCost = { val rowCount = mq.getRowCount(getInput()) if (rowCount == null) { return null } val numOfSort = collations.getFieldCollations.size() val cpuCost = COMPARE_CPU_COST * numOfSort * rowCount * Math.max(Math.log(rowCount), 1.0) val memCost = SortUtil.calcNeedMemoryForSort(mq, input) val costFactory = planner.getCostFactory.asInstanceOf[FlinkCostFactory] costFactory.makeCost(rowCount, cpuCost, 0, 0, memCost) } override def isDeterministic: Boolean = true //~ ExecNode methods ----------------------------------------------------------- override def getDamBehavior: DamBehavior = DamBehavior.FULL_DAM override def accept(visitor: BatchExecNodeVisitor): Unit = visitor.visit(this) override def getFlinkPhysicalRel: FlinkPhysicalRel = this /** * Internal method, translates the [[org.apache.flink.table.plan.nodes.exec.BatchExecNode]] * into a Batch operator. * * @param tableEnv The [[BatchTableEnvironment]] of the translated Table. */ override def translateToPlanInternal( tableEnv: BatchTableEnvironment): StreamTransformation[BaseRow] = { val input = getInputNodes.get(0).translateToPlan(tableEnv) .asInstanceOf[StreamTransformation[BaseRow]] val binaryType = FlinkTypeFactory.toInternalBaseRowTypeInfo(getRowType) // sort code gen val (comparators, serializers, codeGen) = getSortInfo(tableEnv.getConfig) val reservedMangedMemorySize = getResource.getReservedManagedMem * NodeResourceUtil.SIZE_IN_MB val preferMangedMemorySize = getResource.getMaxManagedMem * NodeResourceUtil.SIZE_IN_MB val perRequestSize = NodeResourceUtil.getPerRequestManagedMemory( tableEnv.getConfig.getConf)* NodeResourceUtil.SIZE_IN_MB val operator = new SortOperator( reservedMangedMemorySize, preferMangedMemorySize, perRequestSize.toLong, GeneratedSorter( codeGen.generateNormalizedKeyComputer("SortBatchExecComputer"), codeGen.generateRecordComparator("SortBatchExecComparator"), serializers, comparators)) val transformation = new OneInputTransformation( input, s"Sort(${SortUtil.sortFieldsToString(collations, getRowType)})", operator.asInstanceOf[OneInputStreamOperator[BaseRow, BaseRow]], binaryType, getResource.getParallelism) tableEnv.getRUKeeper.addTransformation(this, transformation) transformation.setDamBehavior(getDamBehavior) transformation.setResources(getResource.getReservedResourceSpec, getResource.getPreferResourceSpec) transformation } private def getSortInfo(tableConfig: TableConfig) : (Array[TypeComparator[_]], Array[TypeSerializer[_]], SortCodeGenerator) = { val inputRowType = FlinkTypeFactory.toInternalRowType(input.getRowType) // sort code gen val keyTypes = keys.map(inputRowType.getFieldInternalTypes()(_)) val compAndSers = keyTypes.zip(orders).map { case (internalType, order) => (TypeUtils.createInternalComparator(internalType, order), DataTypes.createInternalSerializer(internalType)) } val comps = compAndSers.map(_._1) val sers = compAndSers.map(_._2) val codeGen = new SortCodeGenerator(keys, keyTypes, comps, orders, nullsIsLast) (comps, sers, codeGen) } }
UMich-BipedLab/Cassie_StateEstimation
gen/windows/kin/eigen/src/Jp_LeftToeBottom.cpp
/* * Automatically Generated from Mathematica. * Thu 23 May 2019 13:10:13 GMT-04:00 */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include "Jp_LeftToeBottom.h" #ifdef _MSC_VER #define INLINE __forceinline /* use __forceinline (VC++ specific) */ #else #define INLINE static inline /* use standard inline */ #endif /** * Copied from Wolfram Mathematica C Definitions file mdefs.hpp * Changed marcos to inline functions (<NAME>) */ INLINE double Power(double x, double y) { return pow(x, y); } INLINE double Sqrt(double x) { return sqrt(x); } INLINE double Abs(double x) { return fabs(x); } INLINE double Exp(double x) { return exp(x); } INLINE double Log(double x) { return log(x); } INLINE double Sin(double x) { return sin(x); } INLINE double Cos(double x) { return cos(x); } INLINE double Tan(double x) { return tan(x); } INLINE double Csc(double x) { return 1.0/sin(x); } INLINE double Sec(double x) { return 1.0/cos(x); } INLINE double ArcSin(double x) { return asin(x); } INLINE double ArcCos(double x) { return acos(x); } /* update ArcTan function to use atan2 instead. */ INLINE double ArcTan(double x, double y) { return atan2(y,x); } INLINE double Sinh(double x) { return sinh(x); } INLINE double Cosh(double x) { return cosh(x); } INLINE double Tanh(double x) { return tanh(x); } #define E 2.71828182845904523536029 #define Pi 3.14159265358979323846264 #define Degree 0.01745329251994329576924 /* * Sub functions */ static void output1(Eigen::Matrix<double,3,20> &p_output1, const Eigen::Matrix<double,20,1> &var1) { double t291; double t418; double t456; double t224; double t558; double t53; double t387; double t570; double t644; double t686; double t743; double t747; double t762; double t1061; double t1095; double t1102; double t1161; double t949; double t969; double t1015; double t1286; double t1651; double t1698; double t1707; double t1758; double t1558; double t1605; double t1614; double t1835; double t1861; double t1872; double t1965; double t1970; double t1982; double t2033; double t2180; double t2199; double t2245; double t2412; double t2415; double t2422; double t2446; double t2463; double t2481; double t2514; double t2626; double t2697; double t2698; double t2821; double t2828; double t2839; double t2852; double t2860; double t2868; double t2890; double t2948; double t2954; double t2956; double t3039; double t3042; double t3067; double t3118; double t3119; double t3176; double t3190; double t3243; double t3248; double t3260; double t3326; double t3376; double t3377; double t114; double t149; double t184; double t190; double t817; double t854; double t3555; double t3560; double t3562; double t3630; double t3635; double t3636; double t1132; double t1191; double t1218; double t1287; double t1396; double t1419; double t3711; double t3732; double t3737; double t1733; double t1761; double t1805; double t1875; double t1882; double t1906; double t2019; double t2035; double t2173; double t3829; double t3852; double t3863; double t3868; double t3922; double t3927; double t2255; double t2341; double t2359; double t2491; double t2578; double t2617; double t3955; double t3972; double t3990; double t4010; double t4022; double t4032; double t2770; double t2781; double t2794; double t2878; double t2907; double t2915; double t4046; double t4055; double t4061; double t4098; double t4151; double t4157; double t2966; double t3016; double t3020; double t3177; double t3218; double t3235; double t4176; double t4181; double t4182; double t4230; double t4258; double t4288; double t3272; double t3289; double t3321; double t4307; double t4318; double t4322; double t4379; double t4387; double t4390; double t4611; double t4661; double t4671; double t4807; double t4831; double t4841; double t4884; double t4932; double t4938; double t4960; double t4967; double t4991; double t5012; double t5038; double t5110; double t5127; double t5133; double t5136; double t5150; double t5157; double t5199; double t5210; double t5212; double t5216; double t5242; double t5255; double t5271; double t5317; double t5320; double t5333; double t5363; double t5367; double t5382; double t5507; double t5518; double t5524; double t5553; double t5559; double t5562; double t5570; double t5571; double t5575; double t5588; double t5599; double t5605; double t5629; double t5636; double t5639; double t5652; double t5655; double t5664; double t5712; double t5719; double t5724; double t5738; double t5767; double t5770; double t5816; double t5820; double t5824; double t5832; double t5853; double t5864; double t5887; double t5888; double t5901; double t6003; double t6051; double t6069; double t6135; double t6136; double t6137; double t6157; double t6182; double t6185; double t6213; double t6219; double t6240; double t6248; double t6280; double t6294; double t6316; double t6320; double t6326; double t6347; double t6358; double t6371; double t6392; double t6396; double t6412; double t6427; double t6431; double t6440; double t6447; double t6453; double t6470; double t6481; double t6487; double t6500; double t6655; double t6662; double t6665; double t6692; double t6702; double t6732; double t6746; double t6760; double t6764; double t6768; double t6769; double t6794; double t6804; double t6813; double t6816; double t6817; double t6819; double t6829; double t6835; double t6839; double t6854; double t6857; double t6859; double t6879; double t6880; double t6882; double t6897; double t6907; double t6910; double t6917; double t6941; double t6955; double t7046; double t7059; double t7065; double t7079; double t7081; double t7095; double t7119; double t7120; double t7143; double t7151; double t7153; double t7167; double t7176; double t7180; double t7184; double t7195; double t7197; double t7200; double t7206; double t7212; double t7220; double t7227; double t7228; double t7242; double t7258; double t7264; double t7272; double t7276; double t7278; double t7291; double t7299; double t7305; double t7355; double t7360; double t7366; double t7385; double t7392; double t7399; double t7404; double t7407; double t7414; double t7431; double t7441; double t7443; double t7456; double t7476; double t7482; double t7500; double t7503; double t7505; double t7539; double t7553; double t7562; double t7572; double t7585; double t7588; double t7606; double t7608; double t7609; double t7623; double t7628; double t7630; double t7730; double t7731; double t7737; double t7739; double t7747; double t7756; double t7760; double t7769; double t7787; double t7791; double t7798; double t7800; double t7806; double t7817; double t7841; double t7847; double t7848; double t7854; double t7868; double t7870; double t7880; double t7891; double t7900; double t7909; double t7911; double t7916; double t7994; double t7995; double t8011; double t8023; double t8036; double t8069; double t8073; double t8087; double t8088; double t8094; double t8115; double t8116; double t8117; double t8121; double t8125; double t8130; double t8137; double t8144; double t8149; double t8163; double t8193; double t8229; double t8251; double t8252; double t8283; double t8306; double t8323; double t8339; double t8378; double t8391; double t8395; double t7373; double t7376; double t7377; double t7402; double t7424; double t7453; double t7487; double t7509; double t7567; double t7595; double t7611; double t7632; double t7634; double t7652; double t7653; double t7656; double t7664; double t7671; double t7672; double t7678; double t3769; double t3771; double t3788; double t8616; double t8617; double t8621; double t8627; double t8631; double t8633; double t8663; double t8674; double t8682; double t8688; double t8693; double t8708; double t8743; double t8744; double t8748; double t8777; double t8783; double t8790; double t8513; double t8516; double t8519; double t8531; double t8539; double t8864; double t8875; double t8879; double t8913; double t8920; double t8929; double t9013; double t9016; double t9021; double t9053; double t9079; double t9081; double t9103; double t9110; double t9112; double t9121; double t9127; double t9130; double t9155; double t9161; double t9162; double t9199; double t9210; double t9212; double t9278; double t9290; double t9305; double t9315; double t9316; double t9325; double t9380; double t9388; double t9402; double t9420; double t9427; double t9432; double t9467; double t9468; double t9474; double t9489; double t9496; double t9497; double t9512; double t9525; double t9529; double t9555; double t9558; double t9567; double t9679; double t9686; double t9687; double t9738; double t9742; double t9766; double t9767; double t9777; double t9802; double t9808; double t9813; double t9824; double t9825; double t9834; double t9847; double t9853; double t9855; double t9861; double t9876; double t9878; double t9647; double t9657; double t9663; double t9664; double t9669; double t9941; double t9951; double t9953; double t9964; double t9979; double t9981; double t9997; double t10016; double t10029; double t10042; double t10043; double t10045; double t10047; double t10058; double t10078; double t10099; double t10123; double t10126; double t10145; double t10149; double t10151; double t10166; double t10171; double t10183; double t10192; double t10195; double t10205; double t10281; double t10283; double t10284; double t10297; double t10298; double t10302; double t10308; double t10317; double t10323; double t10338; double t10352; double t10357; double t10364; double t10368; double t10370; double t10394; double t10395; double t10405; double t10421; double t10423; double t10431; double t10444; double t10453; double t10462; double t10471; double t10478; double t10480; double t10562; double t10569; double t10576; double t10579; double t10584; double t10597; double t10604; double t10614; double t10619; double t10620; double t10628; double t10630; double t10637; double t10526; double t10527; double t10531; double t10541; double t10543; double t10674; double t10677; double t10683; double t10699; double t10706; double t10719; double t10720; double t10728; double t10739; double t10742; double t10747; double t10749; double t10750; double t10757; double t10759; double t10760; double t10773; double t10783; double t10784; double t10825; double t10826; double t10832; double t10841; double t10848; double t10853; double t10854; double t10857; double t10862; double t10865; double t10878; double t10885; double t10894; double t10902; double t10903; double t10907; double t10909; double t10910; double t10911; double t10975; double t10976; double t10984; double t10986; double t10992; double t10993; double t10998; double t10957; double t10960; double t10963; double t10966; double t10967; double t11028; double t11029; double t11030; double t11034; double t11035; double t11039; double t11046; double t11050; double t11052; double t11053; double t11056; double t11058; double t11060; double t11087; double t11092; double t11093; double t11102; double t11103; double t11105; double t11106; double t11108; double t11109; double t11110; double t11113; double t11115; double t11120; double t11161; double t11163; double t4490; double t11148; double t11149; double t11150; double t11152; double t11154; double t11188; double t11189; double t11193; double t11202; double t11203; double t11206; double t11207; double t11229; double t11230; double t11231; double t11234; double t11235; double t11239; double t11241; double t11169; double t4497; double t4512; double t11270; double t11274; double t11278; double t11282; double t11290; double t11211; double t11308; double t11309; double t11310; double t11217; double t11246; double t11320; double t11321; double t11322; double t11255; t291 = Cos(var1[5]); t418 = Sin(var1[3]); t456 = Sin(var1[4]); t224 = Cos(var1[3]); t558 = Sin(var1[5]); t53 = Cos(var1[6]); t387 = -1.*t224*t291; t570 = -1.*t418*t456*t558; t644 = t387 + t570; t686 = -1.*t291*t418*t456; t743 = t224*t558; t747 = t686 + t743; t762 = Sin(var1[6]); t1061 = Cos(var1[7]); t1095 = -1.*t1061; t1102 = 1. + t1095; t1161 = Sin(var1[7]); t949 = t53*t644; t969 = t747*t762; t1015 = t949 + t969; t1286 = Cos(var1[4]); t1651 = Cos(var1[8]); t1698 = -1.*t1651; t1707 = 1. + t1698; t1758 = Sin(var1[8]); t1558 = -1.*t1286*t1061*t418; t1605 = t1015*t1161; t1614 = t1558 + t1605; t1835 = t53*t747; t1861 = -1.*t644*t762; t1872 = t1835 + t1861; t1965 = Cos(var1[9]); t1970 = -1.*t1965; t1982 = 1. + t1970; t2033 = Sin(var1[9]); t2180 = t1651*t1614; t2199 = t1872*t1758; t2245 = t2180 + t2199; t2412 = t1651*t1872; t2415 = -1.*t1614*t1758; t2422 = t2412 + t2415; t2446 = Cos(var1[10]); t2463 = -1.*t2446; t2481 = 1. + t2463; t2514 = Sin(var1[10]); t2626 = -1.*t2033*t2245; t2697 = t1965*t2422; t2698 = t2626 + t2697; t2821 = t1965*t2245; t2828 = t2033*t2422; t2839 = t2821 + t2828; t2852 = Cos(var1[11]); t2860 = -1.*t2852; t2868 = 1. + t2860; t2890 = Sin(var1[11]); t2948 = t2514*t2698; t2954 = t2446*t2839; t2956 = t2948 + t2954; t3039 = t2446*t2698; t3042 = -1.*t2514*t2839; t3067 = t3039 + t3042; t3118 = Cos(var1[12]); t3119 = -1.*t3118; t3176 = 1. + t3119; t3190 = Sin(var1[12]); t3243 = -1.*t2890*t2956; t3248 = t2852*t3067; t3260 = t3243 + t3248; t3326 = t2852*t2956; t3376 = t2890*t3067; t3377 = t3326 + t3376; t114 = -1.*t53; t149 = 1. + t114; t184 = 0.135*t149; t190 = 0. + t184; t817 = -0.135*t762; t854 = 0. + t817; t3555 = -1.*t291*t418; t3560 = t224*t456*t558; t3562 = t3555 + t3560; t3630 = t224*t291*t456; t3635 = t418*t558; t3636 = t3630 + t3635; t1132 = 0.135*t1102; t1191 = 0.049*t1161; t1218 = 0. + t1132 + t1191; t1287 = -0.049*t1102; t1396 = 0.135*t1161; t1419 = 0. + t1287 + t1396; t3711 = t53*t3562; t3732 = t3636*t762; t3737 = t3711 + t3732; t1733 = -0.049*t1707; t1761 = -0.09*t1758; t1805 = 0. + t1733 + t1761; t1875 = -0.09*t1707; t1882 = 0.049*t1758; t1906 = 0. + t1875 + t1882; t2019 = -0.049*t1982; t2035 = -0.21*t2033; t2173 = 0. + t2019 + t2035; t3829 = t224*t1286*t1061; t3852 = t3737*t1161; t3863 = t3829 + t3852; t3868 = t53*t3636; t3922 = -1.*t3562*t762; t3927 = t3868 + t3922; t2255 = -0.21*t1982; t2341 = 0.049*t2033; t2359 = 0. + t2255 + t2341; t2491 = -0.2707*t2481; t2578 = 0.0016*t2514; t2617 = 0. + t2491 + t2578; t3955 = t1651*t3863; t3972 = t3927*t1758; t3990 = t3955 + t3972; t4010 = t1651*t3927; t4022 = -1.*t3863*t1758; t4032 = t4010 + t4022; t2770 = -0.0016*t2481; t2781 = -0.2707*t2514; t2794 = 0. + t2770 + t2781; t2878 = 0.0184*t2868; t2907 = -0.7055*t2890; t2915 = 0. + t2878 + t2907; t4046 = -1.*t2033*t3990; t4055 = t1965*t4032; t4061 = t4046 + t4055; t4098 = t1965*t3990; t4151 = t2033*t4032; t4157 = t4098 + t4151; t2966 = -0.7055*t2868; t3016 = -0.0184*t2890; t3020 = 0. + t2966 + t3016; t3177 = -1.1135*t3176; t3218 = 0.0216*t3190; t3235 = 0. + t3177 + t3218; t4176 = t2514*t4061; t4181 = t2446*t4157; t4182 = t4176 + t4181; t4230 = t2446*t4061; t4258 = -1.*t2514*t4157; t4288 = t4230 + t4258; t3272 = -0.0216*t3176; t3289 = -1.1135*t3190; t3321 = 0. + t3272 + t3289; t4307 = -1.*t2890*t4182; t4318 = t2852*t4288; t4322 = t4307 + t4318; t4379 = t2852*t4182; t4387 = t2890*t4288; t4390 = t4379 + t4387; t4611 = t224*t1286*t53*t558; t4661 = t224*t1286*t291*t762; t4671 = t4611 + t4661; t4807 = -1.*t224*t1061*t456; t4831 = t4671*t1161; t4841 = t4807 + t4831; t4884 = t224*t1286*t291*t53; t4932 = -1.*t224*t1286*t558*t762; t4938 = t4884 + t4932; t4960 = t1651*t4841; t4967 = t4938*t1758; t4991 = t4960 + t4967; t5012 = t1651*t4938; t5038 = -1.*t4841*t1758; t5110 = t5012 + t5038; t5127 = -1.*t2033*t4991; t5133 = t1965*t5110; t5136 = t5127 + t5133; t5150 = t1965*t4991; t5157 = t2033*t5110; t5199 = t5150 + t5157; t5210 = t2514*t5136; t5212 = t2446*t5199; t5216 = t5210 + t5212; t5242 = t2446*t5136; t5255 = -1.*t2514*t5199; t5271 = t5242 + t5255; t5317 = -1.*t2890*t5216; t5320 = t2852*t5271; t5333 = t5317 + t5320; t5363 = t2852*t5216; t5367 = t2890*t5271; t5382 = t5363 + t5367; t5507 = t1286*t53*t418*t558; t5518 = t1286*t291*t418*t762; t5524 = t5507 + t5518; t5553 = -1.*t1061*t418*t456; t5559 = t5524*t1161; t5562 = t5553 + t5559; t5570 = t1286*t291*t53*t418; t5571 = -1.*t1286*t418*t558*t762; t5575 = t5570 + t5571; t5588 = t1651*t5562; t5599 = t5575*t1758; t5605 = t5588 + t5599; t5629 = t1651*t5575; t5636 = -1.*t5562*t1758; t5639 = t5629 + t5636; t5652 = -1.*t2033*t5605; t5655 = t1965*t5639; t5664 = t5652 + t5655; t5712 = t1965*t5605; t5719 = t2033*t5639; t5724 = t5712 + t5719; t5738 = t2514*t5664; t5767 = t2446*t5724; t5770 = t5738 + t5767; t5816 = t2446*t5664; t5820 = -1.*t2514*t5724; t5824 = t5816 + t5820; t5832 = -1.*t2890*t5770; t5853 = t2852*t5824; t5864 = t5832 + t5853; t5887 = t2852*t5770; t5888 = t2890*t5824; t5901 = t5887 + t5888; t6003 = -1.*t53*t456*t558; t6051 = -1.*t291*t456*t762; t6069 = t6003 + t6051; t6135 = -1.*t1286*t1061; t6136 = t6069*t1161; t6137 = t6135 + t6136; t6157 = -1.*t291*t53*t456; t6182 = t456*t558*t762; t6185 = t6157 + t6182; t6213 = t1651*t6137; t6219 = t6185*t1758; t6240 = t6213 + t6219; t6248 = t1651*t6185; t6280 = -1.*t6137*t1758; t6294 = t6248 + t6280; t6316 = -1.*t2033*t6240; t6320 = t1965*t6294; t6326 = t6316 + t6320; t6347 = t1965*t6240; t6358 = t2033*t6294; t6371 = t6347 + t6358; t6392 = t2514*t6326; t6396 = t2446*t6371; t6412 = t6392 + t6396; t6427 = t2446*t6326; t6431 = -1.*t2514*t6371; t6440 = t6427 + t6431; t6447 = -1.*t2890*t6412; t6453 = t2852*t6440; t6470 = t6447 + t6453; t6481 = t2852*t6412; t6487 = t2890*t6440; t6500 = t6481 + t6487; t6655 = t291*t418; t6662 = -1.*t224*t456*t558; t6665 = t6655 + t6662; t6692 = t6665*t762; t6702 = t3868 + t6692; t6732 = t53*t6665; t6746 = -1.*t3636*t762; t6760 = t6732 + t6746; t6764 = t1651*t6702*t1161; t6768 = t6760*t1758; t6769 = t6764 + t6768; t6794 = t1651*t6760; t6804 = -1.*t6702*t1161*t1758; t6813 = t6794 + t6804; t6816 = -1.*t2033*t6769; t6817 = t1965*t6813; t6819 = t6816 + t6817; t6829 = t1965*t6769; t6835 = t2033*t6813; t6839 = t6829 + t6835; t6854 = t2514*t6819; t6857 = t2446*t6839; t6859 = t6854 + t6857; t6879 = t2446*t6819; t6880 = -1.*t2514*t6839; t6882 = t6879 + t6880; t6897 = -1.*t2890*t6859; t6907 = t2852*t6882; t6910 = t6897 + t6907; t6917 = t2852*t6859; t6941 = t2890*t6882; t6955 = t6917 + t6941; t7046 = t291*t418*t456; t7059 = -1.*t224*t558; t7065 = t7046 + t7059; t7079 = t53*t7065; t7081 = t644*t762; t7095 = t7079 + t7081; t7119 = -1.*t7065*t762; t7120 = t949 + t7119; t7143 = t1651*t7095*t1161; t7151 = t7120*t1758; t7153 = t7143 + t7151; t7167 = t1651*t7120; t7176 = -1.*t7095*t1161*t1758; t7180 = t7167 + t7176; t7184 = -1.*t2033*t7153; t7195 = t1965*t7180; t7197 = t7184 + t7195; t7200 = t1965*t7153; t7206 = t2033*t7180; t7212 = t7200 + t7206; t7220 = t2514*t7197; t7227 = t2446*t7212; t7228 = t7220 + t7227; t7242 = t2446*t7197; t7258 = -1.*t2514*t7212; t7264 = t7242 + t7258; t7272 = -1.*t2890*t7228; t7276 = t2852*t7264; t7278 = t7272 + t7276; t7291 = t2852*t7228; t7299 = t2890*t7264; t7305 = t7291 + t7299; t7355 = t1286*t291*t53; t7360 = -1.*t1286*t558*t762; t7366 = t7355 + t7360; t7385 = -1.*t1286*t53*t558; t7392 = -1.*t1286*t291*t762; t7399 = t7385 + t7392; t7404 = t1651*t7366*t1161; t7407 = t7399*t1758; t7414 = t7404 + t7407; t7431 = t1651*t7399; t7441 = -1.*t7366*t1161*t1758; t7443 = t7431 + t7441; t7456 = -1.*t2033*t7414; t7476 = t1965*t7443; t7482 = t7456 + t7476; t7500 = t1965*t7414; t7503 = t2033*t7443; t7505 = t7500 + t7503; t7539 = t2514*t7482; t7553 = t2446*t7505; t7562 = t7539 + t7553; t7572 = t2446*t7482; t7585 = -1.*t2514*t7505; t7588 = t7572 + t7585; t7606 = -1.*t2890*t7562; t7608 = t2852*t7588; t7609 = t7606 + t7608; t7623 = t2852*t7562; t7628 = t2890*t7588; t7630 = t7623 + t7628; t7730 = -1.*t53*t3562; t7731 = t7730 + t6746; t7737 = t1651*t3927*t1161; t7739 = t7731*t1758; t7747 = t7737 + t7739; t7756 = t1651*t7731; t7760 = -1.*t3927*t1161*t1758; t7769 = t7756 + t7760; t7787 = -1.*t2033*t7747; t7791 = t1965*t7769; t7798 = t7787 + t7791; t7800 = t1965*t7747; t7806 = t2033*t7769; t7817 = t7800 + t7806; t7841 = t2514*t7798; t7847 = t2446*t7817; t7848 = t7841 + t7847; t7854 = t2446*t7798; t7868 = -1.*t2514*t7817; t7870 = t7854 + t7868; t7880 = -1.*t2890*t7848; t7891 = t2852*t7870; t7900 = t7880 + t7891; t7909 = t2852*t7848; t7911 = t2890*t7870; t7916 = t7909 + t7911; t7994 = t224*t291; t7995 = t418*t456*t558; t8011 = t7994 + t7995; t8023 = -1.*t8011*t762; t8036 = t7079 + t8023; t8069 = -1.*t53*t8011; t8073 = t8069 + t7119; t8087 = t1651*t8036*t1161; t8088 = t8073*t1758; t8094 = t8087 + t8088; t8115 = t1651*t8073; t8116 = -1.*t8036*t1161*t1758; t8117 = t8115 + t8116; t8121 = -1.*t2033*t8094; t8125 = t1965*t8117; t8130 = t8121 + t8125; t8137 = t1965*t8094; t8144 = t2033*t8117; t8149 = t8137 + t8144; t8163 = t2514*t8130; t8193 = t2446*t8149; t8229 = t8163 + t8193; t8251 = t2446*t8130; t8252 = -1.*t2514*t8149; t8283 = t8251 + t8252; t8306 = -1.*t2890*t8229; t8323 = t2852*t8283; t8339 = t8306 + t8323; t8378 = t2852*t8229; t8391 = t2890*t8283; t8395 = t8378 + t8391; t7373 = 0.1305*t1061*t7366; t7376 = t7366*t1218; t7377 = t7366*t1161*t1805; t7402 = t7399*t1906; t7424 = t2173*t7414; t7453 = t2359*t7443; t7487 = t2617*t7482; t7509 = t2794*t7505; t7567 = t2915*t7562; t7595 = t3020*t7588; t7611 = t3235*t7609; t7632 = t3321*t7630; t7634 = t3190*t7609; t7652 = t3118*t7630; t7653 = t7634 + t7652; t7656 = 0.0306*t7653; t7664 = t3118*t7609; t7671 = -1.*t3190*t7630; t7672 = t7664 + t7671; t7678 = -1.1312*t7672; t3769 = t1061*t3737; t3771 = -1.*t224*t1286*t1161; t3788 = t3769 + t3771; t8616 = -1.*t1651*t2033*t3788; t8617 = -1.*t1965*t3788*t1758; t8621 = t8616 + t8617; t8627 = t1965*t1651*t3788; t8631 = -1.*t2033*t3788*t1758; t8633 = t8627 + t8631; t8663 = t2514*t8621; t8674 = t2446*t8633; t8682 = t8663 + t8674; t8688 = t2446*t8621; t8693 = -1.*t2514*t8633; t8708 = t8688 + t8693; t8743 = -1.*t2890*t8682; t8744 = t2852*t8708; t8748 = t8743 + t8744; t8777 = t2852*t8682; t8783 = t2890*t8708; t8790 = t8777 + t8783; t8513 = 0.135*t1061; t8516 = -0.049*t1161; t8519 = t8513 + t8516; t8531 = 0.049*t1061; t8539 = t8531 + t1396; t8864 = t53*t8011; t8875 = t7065*t762; t8879 = t8864 + t8875; t8913 = t1061*t8879; t8920 = -1.*t1286*t418*t1161; t8929 = t8913 + t8920; t9013 = -1.*t1651*t2033*t8929; t9016 = -1.*t1965*t8929*t1758; t9021 = t9013 + t9016; t9053 = t1965*t1651*t8929; t9079 = -1.*t2033*t8929*t1758; t9081 = t9053 + t9079; t9103 = t2514*t9021; t9110 = t2446*t9081; t9112 = t9103 + t9110; t9121 = t2446*t9021; t9127 = -1.*t2514*t9081; t9130 = t9121 + t9127; t9155 = -1.*t2890*t9112; t9161 = t2852*t9130; t9162 = t9155 + t9161; t9199 = t2852*t9112; t9210 = t2890*t9130; t9212 = t9199 + t9210; t9278 = t1286*t53*t558; t9290 = t1286*t291*t762; t9305 = t9278 + t9290; t9315 = t1061*t9305; t9316 = t456*t1161; t9325 = t9315 + t9316; t9380 = -1.*t1651*t2033*t9325; t9388 = -1.*t1965*t9325*t1758; t9402 = t9380 + t9388; t9420 = t1965*t1651*t9325; t9427 = -1.*t2033*t9325*t1758; t9432 = t9420 + t9427; t9467 = t2514*t9402; t9468 = t2446*t9432; t9474 = t9467 + t9468; t9489 = t2446*t9402; t9496 = -1.*t2514*t9432; t9497 = t9489 + t9496; t9512 = -1.*t2890*t9474; t9525 = t2852*t9497; t9529 = t9512 + t9525; t9555 = t2852*t9474; t9558 = t2890*t9497; t9567 = t9555 + t9558; t9679 = -1.*t1651*t3863; t9686 = -1.*t3927*t1758; t9687 = t9679 + t9686; t9738 = t2033*t9687; t9742 = t9738 + t4055; t9766 = t1965*t9687; t9767 = -1.*t2033*t4032; t9777 = t9766 + t9767; t9802 = -1.*t2514*t9742; t9808 = t2446*t9777; t9813 = t9802 + t9808; t9824 = t2446*t9742; t9825 = t2514*t9777; t9834 = t9824 + t9825; t9847 = t2890*t9813; t9853 = t2852*t9834; t9855 = t9847 + t9853; t9861 = t2852*t9813; t9876 = -1.*t2890*t9834; t9878 = t9861 + t9876; t9647 = 0.049*t1651; t9657 = t9647 + t1761; t9663 = -0.09*t1651; t9664 = -0.049*t1758; t9669 = t9663 + t9664; t9941 = t1286*t1061*t418; t9951 = t8879*t1161; t9953 = t9941 + t9951; t9964 = -1.*t1651*t9953; t9979 = -1.*t8036*t1758; t9981 = t9964 + t9979; t9997 = t1651*t8036; t10016 = -1.*t9953*t1758; t10029 = t9997 + t10016; t10042 = t2033*t9981; t10043 = t1965*t10029; t10045 = t10042 + t10043; t10047 = t1965*t9981; t10058 = -1.*t2033*t10029; t10078 = t10047 + t10058; t10099 = -1.*t2514*t10045; t10123 = t2446*t10078; t10126 = t10099 + t10123; t10145 = t2446*t10045; t10149 = t2514*t10078; t10151 = t10145 + t10149; t10166 = t2890*t10126; t10171 = t2852*t10151; t10183 = t10166 + t10171; t10192 = t2852*t10126; t10195 = -1.*t2890*t10151; t10205 = t10192 + t10195; t10281 = -1.*t1061*t456; t10283 = t9305*t1161; t10284 = t10281 + t10283; t10297 = -1.*t1651*t10284; t10298 = -1.*t7366*t1758; t10302 = t10297 + t10298; t10308 = t1651*t7366; t10317 = -1.*t10284*t1758; t10323 = t10308 + t10317; t10338 = t2033*t10302; t10352 = t1965*t10323; t10357 = t10338 + t10352; t10364 = t1965*t10302; t10368 = -1.*t2033*t10323; t10370 = t10364 + t10368; t10394 = -1.*t2514*t10357; t10395 = t2446*t10370; t10405 = t10394 + t10395; t10421 = t2446*t10357; t10423 = t2514*t10370; t10431 = t10421 + t10423; t10444 = t2890*t10405; t10453 = t2852*t10431; t10462 = t10444 + t10453; t10471 = t2852*t10405; t10478 = -1.*t2890*t10431; t10480 = t10471 + t10478; t10562 = -1.*t1965*t3990; t10569 = t10562 + t9767; t10576 = -1.*t2514*t4061; t10579 = t2446*t10569; t10584 = t10576 + t10579; t10597 = t2514*t10569; t10604 = t4230 + t10597; t10614 = t2890*t10584; t10619 = t2852*t10604; t10620 = t10614 + t10619; t10628 = t2852*t10584; t10630 = -1.*t2890*t10604; t10637 = t10628 + t10630; t10526 = -0.21*t1965; t10527 = -0.049*t2033; t10531 = t10526 + t10527; t10541 = 0.049*t1965; t10543 = t10541 + t2035; t10674 = t1651*t9953; t10677 = t8036*t1758; t10683 = t10674 + t10677; t10699 = -1.*t2033*t10683; t10706 = t10699 + t10043; t10719 = -1.*t1965*t10683; t10720 = t10719 + t10058; t10728 = -1.*t2514*t10706; t10739 = t2446*t10720; t10742 = t10728 + t10739; t10747 = t2446*t10706; t10749 = t2514*t10720; t10750 = t10747 + t10749; t10757 = t2890*t10742; t10759 = t2852*t10750; t10760 = t10757 + t10759; t10773 = t2852*t10742; t10783 = -1.*t2890*t10750; t10784 = t10773 + t10783; t10825 = t1651*t10284; t10826 = t7366*t1758; t10832 = t10825 + t10826; t10841 = -1.*t2033*t10832; t10848 = t10841 + t10352; t10853 = -1.*t1965*t10832; t10854 = t10853 + t10368; t10857 = -1.*t2514*t10848; t10862 = t2446*t10854; t10865 = t10857 + t10862; t10878 = t2446*t10848; t10885 = t2514*t10854; t10894 = t10878 + t10885; t10902 = t2890*t10865; t10903 = t2852*t10894; t10907 = t10902 + t10903; t10909 = t2852*t10865; t10910 = -1.*t2890*t10894; t10911 = t10909 + t10910; t10975 = -1.*t2446*t4157; t10976 = t10576 + t10975; t10984 = t2890*t10976; t10986 = t10984 + t4318; t10992 = t2852*t10976; t10993 = -1.*t2890*t4288; t10998 = t10992 + t10993; t10957 = 0.0016*t2446; t10960 = t10957 + t2781; t10963 = -0.2707*t2446; t10966 = -0.0016*t2514; t10967 = t10963 + t10966; t11028 = t1965*t10683; t11029 = t2033*t10029; t11030 = t11028 + t11029; t11034 = -1.*t2446*t11030; t11035 = t10728 + t11034; t11039 = -1.*t2514*t11030; t11046 = t10747 + t11039; t11050 = t2890*t11035; t11052 = t2852*t11046; t11053 = t11050 + t11052; t11056 = t2852*t11035; t11058 = -1.*t2890*t11046; t11060 = t11056 + t11058; t11087 = t1965*t10832; t11092 = t2033*t10323; t11093 = t11087 + t11092; t11102 = -1.*t2446*t11093; t11103 = t10857 + t11102; t11105 = -1.*t2514*t11093; t11106 = t10878 + t11105; t11108 = t2890*t11103; t11109 = t2852*t11106; t11110 = t11108 + t11109; t11113 = t2852*t11103; t11115 = -1.*t2890*t11106; t11120 = t11113 + t11115; t11161 = -1.*t2852*t4182; t11163 = t11161 + t10993; t4490 = t3118*t4322; t11148 = -0.7055*t2852; t11149 = 0.0184*t2890; t11150 = t11148 + t11149; t11152 = -0.0184*t2852; t11154 = t11152 + t2907; t11188 = t2514*t10706; t11189 = t2446*t11030; t11193 = t11188 + t11189; t11202 = -1.*t2890*t11193; t11203 = t11202 + t11052; t11206 = -1.*t2852*t11193; t11207 = t11206 + t11058; t11229 = t2514*t10848; t11230 = t2446*t11093; t11231 = t11229 + t11230; t11234 = -1.*t2890*t11231; t11235 = t11234 + t11109; t11239 = -1.*t2852*t11231; t11241 = t11239 + t11115; t11169 = -1.*t3190*t4322; t4497 = -1.*t3190*t4390; t4512 = t4490 + t4497; t11270 = 0.0216*t3118; t11274 = t11270 + t3289; t11278 = -1.1135*t3118; t11282 = -0.0216*t3190; t11290 = t11278 + t11282; t11211 = -1.*t3190*t11203; t11308 = t2852*t11193; t11309 = t2890*t11046; t11310 = t11308 + t11309; t11217 = t3118*t11203; t11246 = -1.*t3190*t11235; t11320 = t2852*t11231; t11321 = t2890*t11106; t11322 = t11320 + t11321; t11255 = t3118*t11235; p_output1(0)=1.; p_output1(1)=0; p_output1(2)=0; p_output1(3)=0; p_output1(4)=1.; p_output1(5)=0; p_output1(6)=0; p_output1(7)=0; p_output1(8)=1.; p_output1(9)=t1015*t1218 + t1614*t1805 + t1872*t1906 + t2173*t2245 + t2359*t2422 + t2617*t2698 + t2794*t2839 + t2915*t2956 + t3020*t3067 + t3235*t3260 + t3321*t3377 + 0.0306*(t3190*t3260 + t3118*t3377) - 1.1312*(t3118*t3260 - 1.*t3190*t3377) - 1.*t1286*t1419*t418 + 0.1305*(t1015*t1061 + t1161*t1286*t418) + t190*t644 + t747*t854; p_output1(10)=t1286*t1419*t224 + t190*t3562 + t1218*t3737 + 0.1305*t3788 + t1805*t3863 + t1906*t3927 + t2173*t3990 + t2359*t4032 + t2617*t4061 + t2794*t4157 + t2915*t4182 + t3020*t4288 + t3235*t4322 + t3321*t4390 + 0.0306*(t3190*t4322 + t3118*t4390) - 1.1312*t4512 + t3636*t854; p_output1(11)=0; p_output1(12)=-1.*t1419*t224*t456 + t1218*t4671 + 0.1305*(t1161*t224*t456 + t1061*t4671) + t1805*t4841 + t1906*t4938 + t2173*t4991 + t2359*t5110 + t2617*t5136 + t2794*t5199 + t2915*t5216 + t3020*t5271 + t3235*t5333 + t3321*t5382 + 0.0306*(t3190*t5333 + t3118*t5382) - 1.1312*(t3118*t5333 - 1.*t3190*t5382) + t1286*t190*t224*t558 + t1286*t224*t291*t854; p_output1(13)=-1.*t1419*t418*t456 + t1218*t5524 + 0.1305*(t1161*t418*t456 + t1061*t5524) + t1805*t5562 + t1906*t5575 + t1286*t190*t418*t558 + t2173*t5605 + t2359*t5639 + t2617*t5664 + t2794*t5724 + t2915*t5770 + t3020*t5824 + t3235*t5864 + t3321*t5901 + 0.0306*(t3190*t5864 + t3118*t5901) - 1.1312*(t3118*t5864 - 1.*t3190*t5901) + t1286*t291*t418*t854; p_output1(14)=-1.*t1286*t1419 - 1.*t190*t456*t558 + t1218*t6069 + 0.1305*(t1161*t1286 + t1061*t6069) + t1805*t6137 + t1906*t6185 + t2173*t6240 + t2359*t6294 + t2617*t6326 + t2794*t6371 + t2915*t6412 + t3020*t6440 + t3235*t6470 + t3321*t6500 + 0.0306*(t3190*t6470 + t3118*t6500) - 1.1312*(t3118*t6470 - 1.*t3190*t6500) - 1.*t291*t456*t854; p_output1(15)=t190*t3636 + 0.1305*t1061*t6702 + t1218*t6702 + t1161*t1805*t6702 + t1906*t6760 + t2173*t6769 + t2359*t6813 + t2617*t6819 + t2794*t6839 + t2915*t6859 + t3020*t6882 + t3235*t6910 + t3321*t6955 + 0.0306*(t3190*t6910 + t3118*t6955) - 1.1312*(t3118*t6910 - 1.*t3190*t6955) + t6665*t854; p_output1(16)=t190*t7065 + 0.1305*t1061*t7095 + t1218*t7095 + t1161*t1805*t7095 + t1906*t7120 + t2173*t7153 + t2359*t7180 + t2617*t7197 + t2794*t7212 + t2915*t7228 + t3020*t7264 + t3235*t7278 + t3321*t7305 + 0.0306*(t3190*t7278 + t3118*t7305) - 1.1312*(t3118*t7278 - 1.*t3190*t7305) + t644*t854; p_output1(17)=t1286*t190*t291 + t7373 + t7376 + t7377 + t7402 + t7424 + t7453 + t7487 + t7509 + t7567 + t7595 + t7611 + t7632 + t7656 + t7678 - 1.*t1286*t558*t854; p_output1(18)=0.1305*t1061*t3927 + t1218*t3927 + t1161*t1805*t3927 - 0.135*t3636*t53 + 0.135*t3562*t762 + t1906*t7731 + t2173*t7747 + t2359*t7769 + t2617*t7798 + t2794*t7817 + t2915*t7848 + t3020*t7870 + t3235*t7900 + t3321*t7916 + 0.0306*(t3190*t7900 + t3118*t7916) - 1.1312*(t3118*t7900 - 1.*t3190*t7916); p_output1(19)=-0.135*t53*t7065 + 0.135*t762*t8011 + 0.1305*t1061*t8036 + t1218*t8036 + t1161*t1805*t8036 + t1906*t8073 + t2173*t8094 + t2359*t8117 + t2617*t8130 + t2794*t8149 + t2915*t8229 + t3020*t8283 + t3235*t8339 + t3321*t8395 + 0.0306*(t3190*t8339 + t3118*t8395) - 1.1312*(t3118*t8339 - 1.*t3190*t8395); p_output1(20)=-0.135*t1286*t291*t53 + t7373 + t7376 + t7377 + t7402 + t7424 + t7453 + t7487 + t7509 + t7567 + t7595 + t7611 + 0.135*t1286*t558*t762 + t7632 + t7656 + t7678; p_output1(21)=0.1305*(-1.*t1061*t1286*t224 - 1.*t1161*t3737) + t1805*t3788 + t1651*t2173*t3788 - 1.*t1758*t2359*t3788 + t1286*t224*t8519 + t3737*t8539 + t2617*t8621 + t2794*t8633 + t2915*t8682 + t3020*t8708 + t3235*t8748 + t3321*t8790 + 0.0306*(t3190*t8748 + t3118*t8790) - 1.1312*(t3118*t8748 - 1.*t3190*t8790); p_output1(22)=t1286*t418*t8519 + t8539*t8879 + 0.1305*(t1558 - 1.*t1161*t8879) + t1805*t8929 + t1651*t2173*t8929 - 1.*t1758*t2359*t8929 + t2617*t9021 + t2794*t9081 + t2915*t9112 + t3020*t9130 + t3235*t9162 + t3321*t9212 + 0.0306*(t3190*t9162 + t3118*t9212) - 1.1312*(t3118*t9162 - 1.*t3190*t9212); p_output1(23)=-1.*t456*t8519 + t8539*t9305 + 0.1305*(t1061*t456 - 1.*t1161*t9305) + t1805*t9325 + t1651*t2173*t9325 - 1.*t1758*t2359*t9325 + t2617*t9402 + t2794*t9432 + t2915*t9474 + t3020*t9497 + t3235*t9529 + t3321*t9567 + 0.0306*(t3190*t9529 + t3118*t9567) - 1.1312*(t3118*t9529 - 1.*t3190*t9567); p_output1(24)=t2173*t4032 + t3927*t9657 + t3863*t9669 + t2359*t9687 + t2794*t9742 + t2617*t9777 + t3020*t9813 + t2915*t9834 + t3321*t9855 + t3235*t9878 - 1.1312*(-1.*t3190*t9855 + t3118*t9878) + 0.0306*(t3118*t9855 + t3190*t9878); p_output1(25)=t10029*t2173 + t10078*t2617 + t10045*t2794 + t10151*t2915 + t10126*t3020 - 1.1312*(t10205*t3118 - 1.*t10183*t3190) + 0.0306*(t10183*t3118 + t10205*t3190) + t10205*t3235 + t10183*t3321 + t8036*t9657 + t9669*t9953 + t2359*t9981; p_output1(26)=t10323*t2173 + t10302*t2359 + t10370*t2617 + t10357*t2794 + t10431*t2915 + t10405*t3020 - 1.1312*(t10480*t3118 - 1.*t10462*t3190) + 0.0306*(t10462*t3118 + t10480*t3190) + t10480*t3235 + t10462*t3321 + t7366*t9657 + t10284*t9669; p_output1(27)=t10569*t2617 + t10604*t2915 + t10584*t3020 - 1.1312*(t10637*t3118 - 1.*t10620*t3190) + 0.0306*(t10620*t3118 + t10637*t3190) + t10637*t3235 + t10620*t3321 + t10531*t3990 + t10543*t4032 + t2794*t4061; p_output1(28)=t10029*t10543 + t10531*t10683 + t10720*t2617 + t10706*t2794 + t10750*t2915 + t10742*t3020 - 1.1312*(t10784*t3118 - 1.*t10760*t3190) + 0.0306*(t10760*t3118 + t10784*t3190) + t10784*t3235 + t10760*t3321; p_output1(29)=t10323*t10543 + t10531*t10832 + t10854*t2617 + t10848*t2794 + t10894*t2915 + t10865*t3020 - 1.1312*(t10911*t3118 - 1.*t10907*t3190) + 0.0306*(t10907*t3118 + t10911*t3190) + t10911*t3235 + t10907*t3321; p_output1(30)=t10976*t3020 - 1.1312*(t10998*t3118 - 1.*t10986*t3190) + 0.0306*(t10986*t3118 + t10998*t3190) + t10998*t3235 + t10986*t3321 + t10960*t4061 + t10967*t4157 + t2915*t4288; p_output1(31)=t10706*t10960 + t10967*t11030 + t11046*t2915 + t11035*t3020 - 1.1312*(t11060*t3118 - 1.*t11053*t3190) + 0.0306*(t11053*t3118 + t11060*t3190) + t11060*t3235 + t11053*t3321; p_output1(32)=t10848*t10960 + t10967*t11093 + t11106*t2915 + t11103*t3020 - 1.1312*(t11120*t3118 - 1.*t11110*t3190) + 0.0306*(t11110*t3118 + t11120*t3190) + t11120*t3235 + t11110*t3321; p_output1(33)=-1.1312*(t11169 + t11163*t3118) + t11163*t3235 + t11150*t4182 + t11154*t4288 + t3321*t4322 + 0.0306*(t11163*t3190 + t4490); p_output1(34)=t11046*t11154 + t11150*t11193 - 1.1312*(t11211 + t11207*t3118) + 0.0306*(t11217 + t11207*t3190) + t11207*t3235 + t11203*t3321; p_output1(35)=t11106*t11154 + t11150*t11231 - 1.1312*(t11246 + t11241*t3118) + 0.0306*(t11255 + t11241*t3190) + t11241*t3235 + t11235*t3321; p_output1(36)=t11274*t4322 + t11290*t4390 - 1.1312*(t11169 - 1.*t3118*t4390) + 0.0306*t4512; p_output1(37)=t11203*t11274 + t11290*t11310 - 1.1312*(t11211 - 1.*t11310*t3118) + 0.0306*(t11217 - 1.*t11310*t3190); p_output1(38)=t11235*t11274 + t11290*t11322 - 1.1312*(t11246 - 1.*t11322*t3118) + 0.0306*(t11255 - 1.*t11322*t3190); p_output1(39)=0; p_output1(40)=0; p_output1(41)=0; p_output1(42)=0; p_output1(43)=0; p_output1(44)=0; p_output1(45)=0; p_output1(46)=0; p_output1(47)=0; p_output1(48)=0; p_output1(49)=0; p_output1(50)=0; p_output1(51)=0; p_output1(52)=0; p_output1(53)=0; p_output1(54)=0; p_output1(55)=0; p_output1(56)=0; p_output1(57)=0; p_output1(58)=0; p_output1(59)=0; } Eigen::Matrix<double,3,20> Jp_LeftToeBottom(const Eigen::Matrix<double,20,1> &var1) //void Jp_LeftToeBottom(Eigen::Matrix<double,3,20> &p_output1, const Eigen::Matrix<double,20,1> &var1) { /* Call Subroutines */ Eigen::Matrix<double,3,20> p_output1; output1(p_output1, var1); return p_output1; }
roderickmackenzie/gpvdm
gpvdm_gui/gui/json_time_domain.py
<filename>gpvdm_gui/gui/json_time_domain.py # # General-purpose Photovoltaic Device Model - a drift diffusion base/Shockley-Read-Hall # model for 1st, 2nd and 3rd generation solar cells. # Copyright (C) 2008-2022 <NAME> r.c.i.m<EMAIL>ie at googlemail.com # # https://www.gpvdm.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License v2.0, as published by # the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # ## @package json_time_domain # Store the time domain json data # import sys import os import shutil import json from json_base import json_base class json_time_domain_mesh_segment(json_base): def __init__(self): json_base.__init__(self,"json_time_domain_mesh_segment") self.var_list=[] self.var_list.append(["len",10e-6]) self.var_list.append(["dt",0.01e-6]) self.var_list.append(["voltage_start",0.0]) self.var_list.append(["voltage_stop",0.0]) self.var_list.append(["mul",1.0]) self.var_list.append(["sun_start",0.0]) self.var_list.append(["sun_stop",0.0]) self.var_list.append(["laser_start",0.0]) self.var_list.append(["laser_stop",0.0]) self.var_list_build() class json_time_domain_mesh(json_base): def __init__(self): json_base.__init__(self,"mesh",segment_class=True) def load_from_json(self,json): self.segments=[] segs=json['segments'] for i in range(0,segs): a=json_time_domain_mesh_segment() segment_name="segment"+str(i) a.load_from_json(json[segment_name]) try: laser=json[segment_name]['laser'] a.laser_start=laser a.laser_stop=laser except: pass self.segments.append(a) class json_time_domain_config(json_base): def __init__(self): json_base.__init__(self,"config") self.var_list=[] self.var_list.append(["pulse_shift",5e-6]) self.var_list.append(["load_type","load"]) self.var_list.append(["pulse_L",0.0]) self.var_list.append(["Rload",50]) self.var_list.append(["pump_laser","green"]) self.var_list.append(["pulse_bias",0.0]) self.var_list.append(["pulse_light_efficiency",1.0]) self.var_list.append(["pulse_subtract_dc","false"]) self.var_list.append(["start_time",-4e-12]) self.var_list.append(["fs_laser_time",-1.0]) self.var_list.append(["dump_verbosity",1]) self.var_list_build() class json_time_domain_simulation(json_base): def __init__(self): json_base.__init__(self,"time_domain_segment") self.var_list=[] self.var_list.append(["english_name","celiv"]) self.var_list.append(["icon","celiv"]) self.var_list.append(["config",json_time_domain_config()]) self.var_list.append(["mesh",json_time_domain_mesh()]) self.var_list.append(["id",self.random_id()]) self.var_list_build() class json_time_domain(json_base): def __init__(self): json_base.__init__(self,"time_domain",segment_class=True,segment_example=json_time_domain_simulation())
tank59he/bjfu_exam
src/main/java/com/bjfu/exam/service/impl/AnswerServiceImpl.java
<filename>src/main/java/com/bjfu/exam/service/impl/AnswerServiceImpl.java<gh_stars>0 package com.bjfu.exam.service.impl; import com.bjfu.exam.dto.answer.PaperAnswerDTO; import com.bjfu.exam.dto.paper.ProblemDTO; import com.bjfu.exam.entity.answer.PaperAnswer; import com.bjfu.exam.entity.answer.ProblemAnswer; import com.bjfu.exam.entity.paper.Paper; import com.bjfu.exam.entity.paper.Problem; import com.bjfu.exam.entity.user.User; import com.bjfu.exam.enums.PaperAnswerStateEnum; import com.bjfu.exam.enums.PaperStateEnum; import com.bjfu.exam.enums.ProblemTypeEnum; import com.bjfu.exam.enums.ResultEnum; import com.bjfu.exam.exception.*; import com.bjfu.exam.repository.answer.PaperAnswerRepository; import com.bjfu.exam.repository.answer.ProblemAnswerRepository; import com.bjfu.exam.repository.paper.PaperRepository; import com.bjfu.exam.repository.user.UserRepository; import com.bjfu.exam.request.answer.PaperAnswerCreateRequest; import com.bjfu.exam.request.answer.ProblemAnswerSubmitRequest; import com.bjfu.exam.service.AnswerService; import com.bjfu.exam.util.DateUtil; import com.bjfu.exam.util.EntityConvertToDTOUtil; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.transaction.Transactional; import java.util.*; import java.util.stream.Collectors; @Service public class AnswerServiceImpl implements AnswerService { @Autowired private PaperAnswerRepository paperAnswerRepository; @Autowired private ProblemAnswerRepository problemAnswerRepository; @Autowired private PaperRepository paperRepository; @Autowired private UserRepository userRepository; @Override public List<PaperAnswerDTO> getPaperAnswers(Long userId) { Optional<User> userOptional = userRepository.findById(userId); if(userOptional.isEmpty()) { throw new UserNotExistExceptionExam(userId, ResultEnum.USER_NOT_EXIST); } User user = userOptional.get(); List<PaperAnswer> paperAnswers = paperAnswerRepository.findAllByUser(user); return paperAnswers.stream() .map(EntityConvertToDTOUtil::convertPaperAnswer) .collect(Collectors.toList()); } @Override @Transactional public PaperAnswerDTO createPaperAnswer(Long userId, PaperAnswerCreateRequest paperAnswerCreateRequest) { // 针对此用户加锁 Optional<User> userOptional = userRepository.findByIdForUpdate(userId); if(userOptional.isEmpty()) { throw new UserNotExistExceptionExam(userId, ResultEnum.USER_NOT_EXIST); } Optional<Paper> paperOptional = paperRepository.findById(paperAnswerCreateRequest.getPaperId()); if(paperOptional.isEmpty()) { throw new BadParamExceptionExam(ResultEnum.PAPER_NOT_EXIST); } Paper paper = paperOptional.get(); User user = userOptional.get(); // 判断此试卷当前是否可以作答 if(!paper.getState().equals(PaperStateEnum.ANSWERING.getState()) && !paper.getState().equals(PaperStateEnum.READY_TO_ANSWERING.getState())) { throw new NotAllowOperationExceptionExam(ResultEnum.PAPER_STATE_NOT_ANSWERING); } // 判断是否已经作答过此试卷 if(paperAnswerRepository.findByUserAndPaper(user, paper).isPresent()) { throw new NotAllowOperationExceptionExam(ResultEnum.ANSWER_TWICE); } // 更新试卷状态为作答中 if(paper.getState().equals(PaperStateEnum.READY_TO_ANSWERING.getState())) { paper.setState(PaperStateEnum.ANSWERING.getState()); paperRepository.save(paper); } PaperAnswer paperAnswer = new PaperAnswer(); paperAnswer.setUser(user); paperAnswer.setPaper(paper); paperAnswer.setState(PaperAnswerStateEnum.ANSWERING.getState()); // 设置下一题 Problem nextProblem = findNextProblem(paper, null); if(nextProblem != null) { paperAnswer.setNextProblem(nextProblem); } else { paperAnswer.setState(PaperAnswerStateEnum.FINISH.getState()); } BeanUtils.copyProperties(paperAnswerCreateRequest, paperAnswer); paperAnswer = paperAnswerRepository.save(paperAnswer); return EntityConvertToDTOUtil.convertPaperAnswer(paperAnswer); } @Override public ProblemDTO getNextProblem(Long userId, Long paperAnswerId) { Optional<PaperAnswer> paperAnswerOptional = paperAnswerRepository.findById(paperAnswerId); if(paperAnswerOptional.isEmpty()) { throw new BadParamExceptionExam(ResultEnum.PAPER_ANSWER_NOT_EXIST); } PaperAnswer paperAnswer = paperAnswerOptional.get(); Paper paper = paperAnswer.getPaper(); if(!paper.getState().equals(PaperStateEnum.ANSWERING.getState()) && !paper.getState().equals(PaperStateEnum.READY_TO_ANSWERING.getState())) { throw new NotAllowOperationExceptionExam(ResultEnum.PAPER_STATE_NOT_ANSWERING); } // 判断是否为自己的答卷 if(!paperAnswer.getUser().getId().equals(userId)) { throw new UnauthorizedOperationExceptionExam(userId, ResultEnum.ANSWER_OTHERS_PAPER); } return EntityConvertToDTOUtil.convertProblem(paperAnswer.getNextProblem()); } @Override @Transactional public void submitAnswer(Long userId, ProblemAnswerSubmitRequest problemAnswerSubmitRequest) { // 针对答卷加锁 Optional<PaperAnswer> paperAnswerOptional = paperAnswerRepository.findByIdForUpdate(problemAnswerSubmitRequest.getPaperAnswerId()); if(paperAnswerOptional.isEmpty()) { throw new BadParamExceptionExam(ResultEnum.PAPER_ANSWER_NOT_EXIST); } PaperAnswer paperAnswer = paperAnswerOptional.get(); // 判断是否为自己的答卷 if(!paperAnswer.getUser().getId().equals(userId)) { throw new UnauthorizedOperationExceptionExam(userId, ResultEnum.ANSWER_OTHERS_PAPER); } // 判断此试卷当前是否可以作答 if(!paperAnswer.getPaper().getState().equals(PaperStateEnum.ANSWERING.getState()) && !paperAnswer.getPaper().getState().equals(PaperStateEnum.READY_TO_ANSWERING.getState())) { throw new NotAllowOperationExceptionExam(ResultEnum.PAPER_STATE_NOT_ANSWERING); } // 保存作答题目 ProblemAnswer problemAnswer = new ProblemAnswer(); problemAnswer.setProblem(paperAnswer.getNextProblem()); problemAnswer.setPaperAnswer(paperAnswer); BeanUtils.copyProperties(problemAnswerSubmitRequest, problemAnswer); problemAnswerRepository.save(problemAnswer); // 为答卷设置需要答的下一道题 Problem nextProblem = findNextProblem(paperAnswer.getPaper(), paperAnswer.getNextProblem()); paperAnswer.setNextProblem(nextProblem); // 更新试卷最后作答时间 paperAnswer.setFinishTime(new Date()); // 更新试卷状态 int takeTime = DateUtil.calLastedTime(paperAnswer.getCreatedTime(), paperAnswer.getFinishTime()); boolean isOverTime = takeTime > paperAnswer.getPaper().getTime() * 60; if(isOverTime) { paperAnswer.setState(PaperAnswerStateEnum.OVERTIME.getState()); } else if(nextProblem == null) { paperAnswer.setState(PaperAnswerStateEnum.FINISH.getState()); } paperAnswerRepository.save(paperAnswer); } private Problem findNextProblem(Paper paper, Problem problem) { List<Problem> problemWithoutFatherProblemList = paper.getProblems().stream() .filter(problem1 -> !problem1.getType().equals(ProblemTypeEnum.FATHER_PROBLEM.getType())) .sorted((problem1, problem2) -> { Problem fatherProblem1 = problem1.getFatherProblem(); Problem fatherProblem2 = problem2.getFatherProblem(); if (fatherProblem1 == null && fatherProblem2 == null) { return problem1.getSort() - problem2.getSort(); } else if (fatherProblem1 == null) { return problem1.getSort() - fatherProblem2.getSort(); } else if (fatherProblem2 == null) { return fatherProblem1.getSort() - problem2.getSort(); } else { if (fatherProblem1.getSort().equals(fatherProblem2.getSort())) { return problem1.getSort() - problem2.getSort(); } else { return fatherProblem1.getSort() - fatherProblem2.getSort(); } } }) .collect(Collectors.toList()); boolean isNext = false; for (Problem problem1: problemWithoutFatherProblemList) { if(isNext || problem == null) { return problem1; } if (problem1.getId().equals(problem.getId())) { isNext = true; } } return null; } }
amanocha/cell_society
src/animation/navigation/Navigator.java
<gh_stars>0 package animation.navigation; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; import animation.navigation.menu.MainMenu; import animation.navigation.menu.SimulationMenu; import animation.navigation.menu.XmlMenu; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.stage.Stage; import readxml.XmlMapper; /** * This is the Navigator class which handles the logic for deciding which menu should be opened depending on * what the user chooses. * * @author <NAME> */ public class Navigator { private static final String STYLESHEET = "style.css"; private static final String LANGUAGE = "simulation"; private static Stage myStage; private Group root; private Scene myScene; private double width; private double height; private XmlMapper myInfo; private MainMenu mainMenu; private XmlMenu xmlMenu; private SimulationMenu simulationMenu; private ResourceBundle myResource; /** * Generates the constructor called from main with default simulation * @param s * @param w * @param h */ public Navigator(Stage s, double w, double h) { myInfo = new XmlMapper(); myResource = PropertyResourceBundle.getBundle(LANGUAGE); myInfo.mapXml(myResource.getString("DefaultSelection")); myStage = s; this.width = w; this.height = h; } /** * Generates the constructor for every other call to Navigator * @param scene * @param r * @param info */ public Navigator(Scene scene, Group r, XmlMapper info) { this.root = r; this.myScene = scene; myResource = PropertyResourceBundle.getBundle(LANGUAGE); this.myInfo = info; } /** * Initializes the scene and the stage (only called from main) */ public void init() { root = new Group(); myScene = new Scene(root, width, height, Color.DIMGRAY); myScene.getStylesheets().add(this.getClass() .getResource(STYLESHEET).toExternalForm()); myStage.setScene(myScene); myStage.show(); createMainMenu(); } /** * Instantiates the xml Menu class * @param The simulation selected */ public void createXmlMenu(String name) { xmlMenu = new XmlMenu(myScene, root, new GUIGenerator(myScene, root, myResource, myInfo), myInfo, myResource, name); xmlMenu.generateMenu(); } /** * Instantiates the simulation menu class */ public void createSimluationMenu() { simulationMenu = new SimulationMenu(myScene, root, myInfo, new GUIGenerator(myScene, root, myResource, myInfo), myResource); simulationMenu.generateMenu(); } /** * Instantiates the main menu class */ public void createMainMenu() { mainMenu = new MainMenu(root, new GUIGenerator(myScene, root, myResource, myInfo)); mainMenu.generateMenu(); } }
asdfghjjklllllaaa/infra
appengine/monorail/framework/test/permissions_test.py
<filename>appengine/monorail/framework/test/permissions_test.py # Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd """Tests for permissions.py.""" from __future__ import print_function from __future__ import division from __future__ import absolute_import import time import unittest import mox import settings from framework import authdata from framework import framework_constants from framework import framework_views from framework import permissions from proto import features_pb2 from proto import project_pb2 from proto import site_pb2 from proto import tracker_pb2 from proto import user_pb2 from proto import usergroup_pb2 from testing import fake from testing import testing_helpers from tracker import tracker_bizobj class PermissionSetTest(unittest.TestCase): def setUp(self): self.perms = permissions.PermissionSet(['A', 'b', 'Cc']) self.proj = project_pb2.Project() self.proj.contributor_ids.append(111) self.proj.contributor_ids.append(222) self.proj.extra_perms.append(project_pb2.Project.ExtraPerms( member_id=111, perms=['Cc', 'D', 'e', 'Ff'])) self.proj.extra_perms.append(project_pb2.Project.ExtraPerms( member_id=222, perms=['G', 'H'])) # user 3 used to be a member and had extra perms, but no longer in project. self.proj.extra_perms.append(project_pb2.Project.ExtraPerms( member_id=333, perms=['G', 'H'])) def testGetAttr(self): self.assertTrue(self.perms.a) self.assertTrue(self.perms.A) self.assertTrue(self.perms.b) self.assertTrue(self.perms.Cc) self.assertTrue(self.perms.CC) self.assertFalse(self.perms.z) self.assertFalse(self.perms.Z) def testCanUsePerm_Anonymous(self): effective_ids = set() self.assertTrue(self.perms.CanUsePerm('A', effective_ids, self.proj, [])) self.assertFalse(self.perms.CanUsePerm('D', effective_ids, self.proj, [])) self.assertFalse(self.perms.CanUsePerm('Z', effective_ids, self.proj, [])) def testCanUsePerm_SignedInNoGroups(self): effective_ids = {111} self.assertTrue(self.perms.CanUsePerm('A', effective_ids, self.proj, [])) self.assertTrue(self.perms.CanUsePerm('D', effective_ids, self.proj, [])) self.assertTrue(self.perms.CanUsePerm( 'D', effective_ids, self.proj, ['Restrict-D-A'])) self.assertFalse(self.perms.CanUsePerm('G', effective_ids, self.proj, [])) self.assertFalse(self.perms.CanUsePerm('Z', effective_ids, self.proj, [])) effective_ids = {222} self.assertTrue(self.perms.CanUsePerm('A', effective_ids, self.proj, [])) self.assertFalse(self.perms.CanUsePerm('D', effective_ids, self.proj, [])) self.assertTrue(self.perms.CanUsePerm('G', effective_ids, self.proj, [])) self.assertFalse(self.perms.CanUsePerm('Z', effective_ids, self.proj, [])) self.assertFalse(self.perms.CanUsePerm( 'Z', effective_ids, self.proj, ['Restrict-Z-A'])) def testCanUsePerm_SignedInWithGroups(self): effective_ids = {111, 222, 333} self.assertTrue(self.perms.CanUsePerm('A', effective_ids, self.proj, [])) self.assertTrue(self.perms.CanUsePerm('D', effective_ids, self.proj, [])) self.assertTrue(self.perms.CanUsePerm('G', effective_ids, self.proj, [])) self.assertTrue(self.perms.CanUsePerm( 'G', effective_ids, self.proj, ['Restrict-G-D'])) self.assertFalse(self.perms.CanUsePerm('Z', effective_ids, self.proj, [])) self.assertFalse(self.perms.CanUsePerm( 'G', effective_ids, self.proj, ['Restrict-G-Z'])) def testCanUsePerm_FormerMember(self): effective_ids = {333} self.assertTrue(self.perms.CanUsePerm('A', effective_ids, self.proj, [])) self.assertFalse(self.perms.CanUsePerm('D', effective_ids, self.proj, [])) self.assertFalse(self.perms.CanUsePerm('G', effective_ids, self.proj, [])) self.assertFalse(self.perms.CanUsePerm('Z', effective_ids, self.proj, [])) def testHasPerm_InPermSet(self): self.assertTrue(self.perms.HasPerm('a', 0, None)) self.assertTrue(self.perms.HasPerm('a', 0, self.proj)) self.assertTrue(self.perms.HasPerm('A', 0, None)) self.assertTrue(self.perms.HasPerm('A', 0, self.proj)) self.assertFalse(self.perms.HasPerm('Z', 0, None)) self.assertFalse(self.perms.HasPerm('Z', 0, self.proj)) def testHasPerm_InExtraPerms(self): self.assertTrue(self.perms.HasPerm('d', 111, self.proj)) self.assertTrue(self.perms.HasPerm('D', 111, self.proj)) self.assertTrue(self.perms.HasPerm('Cc', 111, self.proj)) self.assertTrue(self.perms.HasPerm('CC', 111, self.proj)) self.assertFalse(self.perms.HasPerm('Z', 111, self.proj)) self.assertFalse(self.perms.HasPerm('d', 222, self.proj)) self.assertFalse(self.perms.HasPerm('D', 222, self.proj)) # Only current members can have extra permissions self.proj.contributor_ids = [] self.assertFalse(self.perms.HasPerm('d', 111, self.proj)) # TODO(jrobbins): also test consider_restrictions=False and # restriction labels directly in this class. def testHasPerm_OverrideExtraPerms(self): # D is an extra perm for 111... self.assertTrue(self.perms.HasPerm('d', 111, self.proj)) self.assertTrue(self.perms.HasPerm('D', 111, self.proj)) # ...unless we tell HasPerm it isn't. self.assertFalse(self.perms.HasPerm('d', 111, self.proj, [])) self.assertFalse(self.perms.HasPerm('D', 111, self.proj, [])) # Perms in self.perms are still considered self.assertTrue(self.perms.HasPerm('Cc', 111, self.proj, [])) self.assertTrue(self.perms.HasPerm('CC', 111, self.proj, [])) # Z is not an extra perm... self.assertFalse(self.perms.HasPerm('Z', 111, self.proj)) # ...unless we tell HasPerm it is. self.assertTrue(self.perms.HasPerm('Z', 111, self.proj, ['z'])) def testHasPerm_GrantedPerms(self): self.assertTrue(self.perms.CanUsePerm( 'A', {111}, self.proj, [], granted_perms=['z'])) self.assertTrue(self.perms.CanUsePerm( 'a', {111}, self.proj, [], granted_perms=['z'])) self.assertTrue(self.perms.CanUsePerm( 'a', {111}, self.proj, [], granted_perms=['a'])) self.assertTrue(self.perms.CanUsePerm( 'Z', {111}, self.proj, [], granted_perms=['y', 'z'])) self.assertTrue(self.perms.CanUsePerm( 'z', {111}, self.proj, [], granted_perms=['y', 'z'])) self.assertFalse(self.perms.CanUsePerm( 'z', {111}, self.proj, [], granted_perms=['y'])) def testDebugString(self): self.assertEqual('PermissionSet()', permissions.PermissionSet([]).DebugString()) self.assertEqual('PermissionSet(a)', permissions.PermissionSet(['A']).DebugString()) self.assertEqual('PermissionSet(a, b, cc)', self.perms.DebugString()) def testRepr(self): self.assertEqual('PermissionSet(frozenset([]))', permissions.PermissionSet([]).__repr__()) self.assertEqual('PermissionSet(frozenset([\'a\']))', permissions.PermissionSet(['A']).__repr__()) class PermissionsTest(unittest.TestCase): NOW = 1277762224 # Any timestamp will do, we only compare it to itself +/- 1 COMMITTER_USER_ID = 111 OWNER_USER_ID = 222 CONTRIB_USER_ID = 333 SITE_ADMIN_USER_ID = 444 def MakeProject(self, project_name, state, add_members=True, access=None): args = dict(project_name=project_name, state=state) if add_members: args.update(owner_ids=[self.OWNER_USER_ID], committer_ids=[self.COMMITTER_USER_ID], contributor_ids=[self.CONTRIB_USER_ID]) if access: args.update(access=access) return fake.Project(**args) def setUp(self): self.live_project = self.MakeProject('live', project_pb2.ProjectState.LIVE) self.archived_project = self.MakeProject( 'archived', project_pb2.ProjectState.ARCHIVED) self.other_live_project = self.MakeProject( 'other_live', project_pb2.ProjectState.LIVE, add_members=False) self.members_only_project = self.MakeProject( 's3kr3t', project_pb2.ProjectState.LIVE, access=project_pb2.ProjectAccess.MEMBERS_ONLY) self.nonmember = user_pb2.User() self.member = user_pb2.User() self.owner = user_pb2.User() self.contrib = user_pb2.User() self.site_admin = user_pb2.User() self.site_admin.is_site_admin = True self.borg_user = user_pb2.User(email=settings.borg_service_account) self.normal_artifact = tracker_pb2.Issue() self.normal_artifact.labels.extend(['hot', 'Key-Value']) self.normal_artifact.reporter_id = 111 # Two PermissionSets w/ permissions outside of any project. self.normal_user_perms = permissions.GetPermissions( None, {111}, None) self.admin_perms = permissions.PermissionSet( [permissions.ADMINISTER_SITE, permissions.CREATE_PROJECT]) self.mox = mox.Mox() def tearDown(self): self.mox.UnsetStubs() def testGetPermissions_Admin(self): self.assertEqual( permissions.ADMIN_PERMISSIONSET, permissions.GetPermissions(self.site_admin, None, None)) def testGetPermissions_BorgServiceAccount(self): self.assertEqual( permissions.GROUP_IMPORT_BORG_PERMISSIONSET, permissions.GetPermissions(self.borg_user, None, None)) def CheckPermissions(self, perms, expected_list): expect_view, expect_commit, expect_edit_project = expected_list self.assertEqual( expect_view, perms.HasPerm(permissions.VIEW, None, None)) self.assertEqual( expect_commit, perms.HasPerm(permissions.COMMIT, None, None)) self.assertEqual( expect_edit_project, perms.HasPerm(permissions.EDIT_PROJECT, None, None)) def testAnonPermissions(self): perms = permissions.GetPermissions(None, set(), self.live_project) self.CheckPermissions(perms, [True, False, False]) perms = permissions.GetPermissions(None, set(), self.members_only_project) self.CheckPermissions(perms, [False, False, False]) def testNonmemberPermissions(self): perms = permissions.GetPermissions( self.nonmember, {123}, self.live_project) self.CheckPermissions(perms, [True, False, False]) perms = permissions.GetPermissions( self.nonmember, {123}, self.members_only_project) self.CheckPermissions(perms, [False, False, False]) def testMemberPermissions(self): perms = permissions.GetPermissions( self.member, {self.COMMITTER_USER_ID}, self.live_project) self.CheckPermissions(perms, [True, True, False]) perms = permissions.GetPermissions( self.member, {self.COMMITTER_USER_ID}, self.other_live_project) self.CheckPermissions(perms, [True, False, False]) perms = permissions.GetPermissions( self.member, {self.COMMITTER_USER_ID}, self.members_only_project) self.CheckPermissions(perms, [True, True, False]) def testOwnerPermissions(self): perms = permissions.GetPermissions( self.owner, {self.OWNER_USER_ID}, self.live_project) self.CheckPermissions(perms, [True, True, True]) perms = permissions.GetPermissions( self.owner, {self.OWNER_USER_ID}, self.other_live_project) self.CheckPermissions(perms, [True, False, False]) perms = permissions.GetPermissions( self.owner, {self.OWNER_USER_ID}, self.members_only_project) self.CheckPermissions(perms, [True, True, True]) def testContributorPermissions(self): perms = permissions.GetPermissions( self.contrib, {self.CONTRIB_USER_ID}, self.live_project) self.CheckPermissions(perms, [True, False, False]) perms = permissions.GetPermissions( self.contrib, {self.CONTRIB_USER_ID}, self.other_live_project) self.CheckPermissions(perms, [True, False, False]) perms = permissions.GetPermissions( self.contrib, {self.CONTRIB_USER_ID}, self.members_only_project) self.CheckPermissions(perms, [True, False, False]) def testLookupPermset_ExactMatch(self): self.assertEqual( permissions.USER_PERMISSIONSET, permissions._LookupPermset( permissions.USER_ROLE, project_pb2.ProjectState.LIVE, project_pb2.ProjectAccess.ANYONE)) def testLookupPermset_WildcardAccess(self): self.assertEqual( permissions.OWNER_ACTIVE_PERMISSIONSET, permissions._LookupPermset( permissions.OWNER_ROLE, project_pb2.ProjectState.LIVE, project_pb2.ProjectAccess.MEMBERS_ONLY)) def testGetPermissionKey_AnonUser(self): self.assertEqual( (permissions.ANON_ROLE, permissions.UNDEFINED_STATUS, permissions.UNDEFINED_ACCESS), permissions._GetPermissionKey(None, None)) self.assertEqual( (permissions.ANON_ROLE, project_pb2.ProjectState.LIVE, project_pb2.ProjectAccess.ANYONE), permissions._GetPermissionKey(None, self.live_project)) def testGetPermissionKey_ExpiredProject(self): self.archived_project.delete_time = self.NOW # In an expired project, the user's committe role does not count. self.assertEqual( (permissions.USER_ROLE, project_pb2.ProjectState.ARCHIVED, project_pb2.ProjectAccess.ANYONE), permissions._GetPermissionKey( self.COMMITTER_USER_ID, self.archived_project, expired_before=self.NOW + 1)) # If not expired yet, the user's committe role still counts. self.assertEqual( (permissions.COMMITTER_ROLE, project_pb2.ProjectState.ARCHIVED, project_pb2.ProjectAccess.ANYONE), permissions._GetPermissionKey( self.COMMITTER_USER_ID, self.archived_project, expired_before=self.NOW - 1)) def testGetPermissionKey_DefinedRoles(self): self.assertEqual( (permissions.OWNER_ROLE, project_pb2.ProjectState.LIVE, project_pb2.ProjectAccess.ANYONE), permissions._GetPermissionKey( self.OWNER_USER_ID, self.live_project)) self.assertEqual( (permissions.COMMITTER_ROLE, project_pb2.ProjectState.LIVE, project_pb2.ProjectAccess.ANYONE), permissions._GetPermissionKey( self.COMMITTER_USER_ID, self.live_project)) self.assertEqual( (permissions.CONTRIBUTOR_ROLE, project_pb2.ProjectState.LIVE, project_pb2.ProjectAccess.ANYONE), permissions._GetPermissionKey( self.CONTRIB_USER_ID, self.live_project)) def testGetPermissionKey_Nonmember(self): self.assertEqual( (permissions.USER_ROLE, project_pb2.ProjectState.LIVE, project_pb2.ProjectAccess.ANYONE), permissions._GetPermissionKey( 999, self.live_project)) def testPermissionsImmutable(self): self.assertTrue(isinstance( permissions.EMPTY_PERMISSIONSET.perm_names, frozenset)) self.assertTrue(isinstance( permissions.READ_ONLY_PERMISSIONSET.perm_names, frozenset)) self.assertTrue(isinstance( permissions.COMMITTER_ACTIVE_PERMISSIONSET.perm_names, frozenset)) self.assertTrue(isinstance( permissions.OWNER_ACTIVE_PERMISSIONSET.perm_names, frozenset)) def testGetExtraPerms(self): project = project_pb2.Project() project.committer_ids.append(222) # User 1 is a former member with left-over extra perms that don't count. project.extra_perms.append(project_pb2.Project.ExtraPerms( member_id=111, perms=['a', 'b', 'c'])) project.extra_perms.append(project_pb2.Project.ExtraPerms( member_id=222, perms=['a', 'b', 'c'])) self.assertListEqual( [], permissions.GetExtraPerms(project, 111)) self.assertListEqual( ['a', 'b', 'c'], permissions.GetExtraPerms(project, 222)) self.assertListEqual( [], permissions.GetExtraPerms(project, 333)) def testCanDeleteComment_NoPermissionSet(self): """Test that if no PermissionSet is given, we can't delete comments.""" comment = tracker_pb2.IssueComment() commenter = user_pb2.User() # If no PermissionSet is given, the user cannot delete the comment. self.assertFalse(permissions.CanDeleteComment( comment, commenter, 111, None)) # Same, with no user specified. self.assertFalse(permissions.CanDeleteComment( comment, commenter, framework_constants.NO_USER_SPECIFIED, None)) def testCanDeleteComment_AnonUsersCannotDelete(self): """Test that anon users can't delete comments.""" comment = tracker_pb2.IssueComment() commenter = user_pb2.User() perms = permissions.PermissionSet([permissions.DELETE_ANY]) # No logged in user, even with perms from somewhere. self.assertFalse(permissions.CanDeleteComment( comment, commenter, framework_constants.NO_USER_SPECIFIED, perms)) # No logged in user, even if artifact was already deleted. comment.deleted_by = 111 self.assertFalse(permissions.CanDeleteComment( comment, commenter, framework_constants.NO_USER_SPECIFIED, perms)) def testCanDeleteComment_DeleteAny(self): """Test that users with DeleteAny permission can delete any comment. Except for spam comments or comments by banned users. """ comment = tracker_pb2.IssueComment(user_id=111) commenter = user_pb2.User() perms = permissions.PermissionSet([permissions.DELETE_ANY]) # Users with DeleteAny permission can delete their own comments. self.assertTrue(permissions.CanDeleteComment( comment, commenter, 111, perms)) # And also comments by other users comment.user_id = 999 self.assertTrue(permissions.CanDeleteComment( comment, commenter, 111, perms)) # As well as undelete comments they deleted. comment.deleted_by = 111 self.assertTrue(permissions.CanDeleteComment( comment, commenter, 111, perms)) # Or that other users deleted. comment.deleted_by = 222 self.assertTrue(permissions.CanDeleteComment( comment, commenter, 111, perms)) def testCanDeleteComment_DeleteOwn(self): """Test that users with DeleteOwn permission can delete any comment. Except for spam comments or comments by banned users. """ comment = tracker_pb2.IssueComment(user_id=111) commenter = user_pb2.User() perms = permissions.PermissionSet([permissions.DELETE_OWN]) # Users with DeleteOwn permission can delete their own comments. self.assertTrue(permissions.CanDeleteComment( comment, commenter, 111, perms)) # But not comments by other users comment.user_id = 999 self.assertFalse(permissions.CanDeleteComment( comment, commenter, 111, perms)) # They can undelete comments they deleted. comment.user_id = 111 comment.deleted_by = 111 self.assertTrue(permissions.CanDeleteComment( comment, commenter, 111, perms)) # But not comments that other users deleted. comment.deleted_by = 222 self.assertFalse(permissions.CanDeleteComment( comment, commenter, 111, perms)) def testCanDeleteComment_CannotDeleteSpamComments(self): """Test that nobody can (un)delete comments marked as spam.""" comment = tracker_pb2.IssueComment(user_id=111, is_spam=True) commenter = user_pb2.User() # Nobody can delete comments marked as spam. self.assertFalse(permissions.CanDeleteComment( comment, commenter, 111, permissions.PermissionSet([permissions.DELETE_OWN]))) self.assertFalse(permissions.CanDeleteComment( comment, commenter, 222, permissions.PermissionSet([permissions.DELETE_ANY]))) # Nobody can undelete comments marked as spam. comment.deleted_by = 222 self.assertFalse(permissions.CanDeleteComment( comment, commenter, 111, permissions.PermissionSet([permissions.DELETE_OWN]))) self.assertFalse(permissions.CanDeleteComment( comment, commenter, 222, permissions.PermissionSet([permissions.DELETE_ANY]))) def testCanDeleteComment_CannotDeleteCommentsByBannedUser(self): """Test that nobody can (un)delete comments by banned users.""" comment = tracker_pb2.IssueComment(user_id=111) commenter = user_pb2.User(banned='Some reason') # Nobody can delete comments by banned users. self.assertFalse(permissions.CanDeleteComment( comment, commenter, 111, permissions.PermissionSet([permissions.DELETE_OWN]))) self.assertFalse(permissions.CanDeleteComment( comment, commenter, 222, permissions.PermissionSet([permissions.DELETE_ANY]))) # Nobody can undelete comments by banned users. comment.deleted_by = 222 self.assertFalse(permissions.CanDeleteComment( comment, commenter, 111, permissions.PermissionSet([permissions.DELETE_OWN]))) self.assertFalse(permissions.CanDeleteComment( comment, commenter, 222, permissions.PermissionSet([permissions.DELETE_ANY]))) def testCanFlagComment_FlagSpamCanReport(self): """Test that users with FlagSpam permissions can report comments.""" comment = tracker_pb2.IssueComment() commenter = user_pb2.User() can_flag, is_flagged = permissions.CanFlagComment( comment, commenter, [], 111, permissions.PermissionSet([permissions.FLAG_SPAM])) self.assertTrue(can_flag) self.assertFalse(is_flagged) def testCanFlagComment_FlagSpamCanUnReportOwn(self): """Test that users with FlagSpam permission can un-report comments they previously reported.""" comment = tracker_pb2.IssueComment() commenter = user_pb2.User() can_flag, is_flagged = permissions.CanFlagComment( comment, commenter, [111], 111, permissions.PermissionSet([permissions.FLAG_SPAM])) self.assertTrue(can_flag) self.assertTrue(is_flagged) def testCanFlagComment_FlagSpamCannotUnReportOthers(self): """Test that users with FlagSpam permission doesn't know if other users have reported a comment as spam.""" comment = tracker_pb2.IssueComment() commenter = user_pb2.User() can_flag, is_flagged = permissions.CanFlagComment( comment, commenter, [222], 111, permissions.PermissionSet([permissions.FLAG_SPAM])) self.assertTrue(can_flag) self.assertFalse(is_flagged) def testCanFlagComment_FlagSpamCannotUnFlag(self): comment = tracker_pb2.IssueComment(is_spam=True) commenter = user_pb2.User() can_flag, is_flagged = permissions.CanFlagComment( comment, commenter, [111], 111, permissions.PermissionSet([permissions.FLAG_SPAM])) self.assertFalse(can_flag) self.assertTrue(is_flagged) def testCanFlagComment_VerdictSpamCanFlag(self): """Test that users with FlagSpam permissions can flag comments.""" comment = tracker_pb2.IssueComment() commenter = user_pb2.User() can_flag, is_flagged = permissions.CanFlagComment( comment, commenter, [], 111, permissions.PermissionSet([permissions.VERDICT_SPAM])) self.assertTrue(can_flag) self.assertFalse(is_flagged) def testCanFlagComment_VerdictSpamCanUnFlag(self): """Test that users with FlagSpam permissions can un-flag comments.""" comment = tracker_pb2.IssueComment(is_spam=True) commenter = user_pb2.User() can_flag, is_flagged = permissions.CanFlagComment( comment, commenter, [], 111, permissions.PermissionSet([permissions.VERDICT_SPAM])) self.assertTrue(can_flag) self.assertTrue(is_flagged) def testCanFlagComment_CannotFlagNoPermission(self): """Test that users without permission cannot flag comments.""" comment = tracker_pb2.IssueComment() commenter = user_pb2.User() can_flag, is_flagged = permissions.CanFlagComment( comment, commenter, [], 111, permissions.PermissionSet([permissions.DELETE_ANY])) self.assertFalse(can_flag) self.assertFalse(is_flagged) def testCanFlagComment_CannotUnFlagNoPermission(self): """Test that users without permission cannot un-flag comments.""" comment = tracker_pb2.IssueComment(is_spam=True) commenter = user_pb2.User() can_flag, is_flagged = permissions.CanFlagComment( comment, commenter, [], 111, # Users need the VerdictSpam permission to be able to un-flag comments. permissions.PermissionSet([ permissions.DELETE_ANY, permissions.FLAG_SPAM])) self.assertFalse(can_flag) self.assertTrue(is_flagged) def testCanFlagComment_CannotFlagCommentByBannedUser(self): """Test that nobady can flag comments by banned users.""" comment = tracker_pb2.IssueComment() commenter = user_pb2.User(banned='Some reason') can_flag, is_flagged = permissions.CanFlagComment( comment, commenter, [], 111, permissions.PermissionSet([ permissions.FLAG_SPAM, permissions.VERDICT_SPAM])) self.assertFalse(can_flag) self.assertFalse(is_flagged) def testCanFlagComment_CannotUnFlagCommentByBannedUser(self): """Test that nobady can un-flag comments by banned users.""" comment = tracker_pb2.IssueComment(is_spam=True) commenter = user_pb2.User(banned='Some reason') can_flag, is_flagged = permissions.CanFlagComment( comment, commenter, [], 111, permissions.PermissionSet([ permissions.FLAG_SPAM, permissions.VERDICT_SPAM])) self.assertFalse(can_flag) self.assertTrue(is_flagged) def testCanFlagComment_CanUnFlagDeletedSpamComment(self): """Test that we can un-flag a deleted comment that is spam.""" comment = tracker_pb2.IssueComment(is_spam=True, deleted_by=111) commenter = user_pb2.User() can_flag, is_flagged = permissions.CanFlagComment( comment, commenter, [], 222, permissions.PermissionSet([permissions.VERDICT_SPAM])) self.assertTrue(can_flag) self.assertTrue(is_flagged) def testCanFlagComment_CannotFlagDeletedComment(self): """Test that nobody can flag a deleted comment that is not spam.""" comment = tracker_pb2.IssueComment(deleted_by=111) commenter = user_pb2.User() can_flag, is_flagged = permissions.CanFlagComment( comment, commenter, [], 111, permissions.PermissionSet([ permissions.FLAG_SPAM, permissions.VERDICT_SPAM, permissions.DELETE_ANY, permissions.DELETE_OWN])) self.assertFalse(can_flag) self.assertFalse(is_flagged) def testCanViewComment_Normal(self): """Test that we can view comments.""" comment = tracker_pb2.IssueComment() commenter = user_pb2.User() # We assume that CanViewIssue was already called. There are no further # restrictions to view this comment. self.assertTrue(permissions.CanViewComment( comment, commenter, 111, None)) def testCanViewComment_CannotViewCommentsByBannedUser(self): """Test that nobody can view comments by banned users.""" comment = tracker_pb2.IssueComment(user_id=111) commenter = user_pb2.User(banned='Some reason') # Nobody can view comments by banned users. self.assertFalse(permissions.CanViewComment( comment, commenter, 111, permissions.ADMIN_PERMISSIONSET)) def testCanViewComment_OnlyModeratorsCanViewSpamComments(self): """Test that only users with VerdictSpam can view spam comments.""" comment = tracker_pb2.IssueComment(user_id=111, is_spam=True) commenter = user_pb2.User() # Users with VerdictSpam permission can view comments marked as spam. self.assertTrue(permissions.CanViewComment( comment, commenter, 222, permissions.PermissionSet([permissions.VERDICT_SPAM]))) # Other users cannot view comments marked as spam, even if it is their own # comment. self.assertFalse(permissions.CanViewComment( comment, commenter, 111, permissions.PermissionSet([ permissions.FLAG_SPAM, permissions.DELETE_ANY, permissions.DELETE_OWN]))) def testCanViewComment_DeletedComment(self): """Test that for deleted comments, only the users that can undelete it can view it. """ comment = tracker_pb2.IssueComment(user_id=111, deleted_by=222) commenter = user_pb2.User() # Users with DeleteAny permission can view all deleted comments. self.assertTrue(permissions.CanViewComment( comment, commenter, 333, permissions.PermissionSet([permissions.DELETE_ANY]))) # Users with DeleteOwn permissions can only see their own comments if they # deleted them. comment.user_id = comment.deleted_by = 333 self.assertTrue(permissions.CanViewComment( comment, commenter, 333, permissions.PermissionSet([permissions.DELETE_OWN]))) # But not comments they didn't delete. comment.deleted_by = 111 self.assertFalse(permissions.CanViewComment( comment, commenter, 333, permissions.PermissionSet([permissions.DELETE_OWN]))) def testCanViewInboundMessage(self): comment = tracker_pb2.IssueComment(user_id=111) # Users can view their own inbound messages self.assertTrue(permissions.CanViewInboundMessage( comment, 111, permissions.EMPTY_PERMISSIONSET)) # Users with the ViewInboundMessages permissions can view inbound messages. self.assertTrue(permissions.CanViewInboundMessage( comment, 333, permissions.PermissionSet([permissions.VIEW_INBOUND_MESSAGES]))) # Other users cannot view inbound messages. self.assertFalse(permissions.CanViewInboundMessage( comment, 333, permissions.PermissionSet([permissions.VIEW]))) def testCanViewNormalArifact(self): # Anyone can view a non-restricted artifact. self.assertTrue(permissions.CanView( {111}, permissions.READ_ONLY_PERMISSIONSET, self.live_project, [])) def testCanCreateProject_NoPerms(self): """Signed out users cannot create projects.""" self.assertFalse(permissions.CanCreateProject( permissions.EMPTY_PERMISSIONSET)) self.assertFalse(permissions.CanCreateProject( permissions.READ_ONLY_PERMISSIONSET)) def testCanCreateProject_Admin(self): """Site admins can create projects.""" self.assertTrue(permissions.CanCreateProject( permissions.ADMIN_PERMISSIONSET)) def testCanCreateProject_RegularUser(self): """Signed in non-admins can create a project if settings allow ANYONE.""" try: orig_restriction = settings.project_creation_restriction ANYONE = site_pb2.UserTypeRestriction.ANYONE ADMIN_ONLY = site_pb2.UserTypeRestriction.ADMIN_ONLY NO_ONE = site_pb2.UserTypeRestriction.NO_ONE perms = permissions.PermissionSet([permissions.CREATE_PROJECT]) settings.project_creation_restriction = ANYONE self.assertTrue(permissions.CanCreateProject(perms)) settings.project_creation_restriction = ADMIN_ONLY self.assertFalse(permissions.CanCreateProject(perms)) settings.project_creation_restriction = NO_ONE self.assertFalse(permissions.CanCreateProject(perms)) self.assertFalse(permissions.CanCreateProject( permissions.ADMIN_PERMISSIONSET)) finally: settings.project_creation_restriction = orig_restriction def testCanCreateGroup_AnyoneWithCreateGroup(self): orig_setting = settings.group_creation_restriction try: settings.group_creation_restriction = site_pb2.UserTypeRestriction.ANYONE self.assertTrue(permissions.CanCreateGroup( permissions.PermissionSet([permissions.CREATE_GROUP]))) self.assertFalse(permissions.CanCreateGroup( permissions.PermissionSet([]))) finally: settings.group_creation_restriction = orig_setting def testCanCreateGroup_AdminOnly(self): orig_setting = settings.group_creation_restriction try: ADMIN_ONLY = site_pb2.UserTypeRestriction.ADMIN_ONLY settings.group_creation_restriction = ADMIN_ONLY self.assertTrue(permissions.CanCreateGroup( permissions.PermissionSet([permissions.ADMINISTER_SITE]))) self.assertFalse(permissions.CanCreateGroup( permissions.PermissionSet([permissions.CREATE_GROUP]))) self.assertFalse(permissions.CanCreateGroup( permissions.PermissionSet([]))) finally: settings.group_creation_restriction = orig_setting def testCanCreateGroup_UnspecifiedSetting(self): orig_setting = settings.group_creation_restriction try: settings.group_creation_restriction = None self.assertFalse(permissions.CanCreateGroup( permissions.PermissionSet([permissions.ADMINISTER_SITE]))) self.assertFalse(permissions.CanCreateGroup( permissions.PermissionSet([permissions.CREATE_GROUP]))) self.assertFalse(permissions.CanCreateGroup( permissions.PermissionSet([]))) finally: settings.group_creation_restriction = orig_setting def testCanEditGroup_HasPerm(self): self.assertTrue(permissions.CanEditGroup( permissions.PermissionSet([permissions.EDIT_GROUP]), None, None)) def testCanEditGroup_IsOwner(self): self.assertTrue(permissions.CanEditGroup( permissions.PermissionSet([]), {111}, {111})) def testCanEditGroup_Otherwise(self): self.assertFalse(permissions.CanEditGroup( permissions.PermissionSet([]), {111}, {222})) def testCanViewGroupMembers_HasPerm(self): self.assertTrue(permissions.CanViewGroupMembers( permissions.PermissionSet([permissions.VIEW_GROUP]), None, None, None, None, None)) def testCanViewGroupMembers_IsMemberOfFriendProject(self): group_settings = usergroup_pb2.MakeSettings('owners', friend_projects=[890]) self.assertFalse(permissions.CanViewGroupMembers( permissions.PermissionSet([]), {111}, group_settings, {222}, {333}, {789})) self.assertTrue(permissions.CanViewGroupMembers( permissions.PermissionSet([]), {111}, group_settings, {222}, {333}, {789, 890})) def testCanViewGroupMembers_VisibleToOwner(self): group_settings = usergroup_pb2.MakeSettings('owners') self.assertFalse(permissions.CanViewGroupMembers( permissions.PermissionSet([]), {111}, group_settings, {222}, {333}, {789})) self.assertFalse(permissions.CanViewGroupMembers( permissions.PermissionSet([]), {222}, group_settings, {222}, {333}, {789})) self.assertTrue(permissions.CanViewGroupMembers( permissions.PermissionSet([]), {333}, group_settings, {222}, {333}, {789})) def testCanViewGroupMembers_IsVisibleToMember(self): group_settings = usergroup_pb2.MakeSettings('members') self.assertFalse(permissions.CanViewGroupMembers( permissions.PermissionSet([]), {111}, group_settings, {222}, {333}, {789})) self.assertTrue(permissions.CanViewGroupMembers( permissions.PermissionSet([]), {222}, group_settings, {222}, {333}, {789})) self.assertTrue(permissions.CanViewGroupMembers( permissions.PermissionSet([]), {333}, group_settings, {222}, {333}, {789})) def testCanViewGroupMembers_AnyoneCanView(self): group_settings = usergroup_pb2.MakeSettings('anyone') self.assertTrue(permissions.CanViewGroupMembers( permissions.PermissionSet([]), {111}, group_settings, {222}, {333}, {789})) def testIsBanned_AnonUser(self): user_view = framework_views.StuffUserView(None, None, True) self.assertFalse(permissions.IsBanned(None, user_view)) def testIsBanned_NormalUser(self): user = user_pb2.User() user_view = framework_views.StuffUserView(None, None, True) self.assertFalse(permissions.IsBanned(user, user_view)) def testIsBanned_BannedUser(self): user = user_pb2.User() user.banned = 'spammer' user_view = framework_views.StuffUserView(None, None, True) self.assertTrue(permissions.IsBanned(user, user_view)) def testIsBanned_BadDomainUser(self): user = user_pb2.User() self.assertFalse(permissions.IsBanned(user, None)) user_view = framework_views.StuffUserView(None, None, True) user_view.domain = 'spammer.com' self.assertFalse(permissions.IsBanned(user, user_view)) orig_banned_user_domains = settings.banned_user_domains settings.banned_user_domains = ['spammer.com', 'phisher.com'] self.assertTrue(permissions.IsBanned(user, user_view)) settings.banned_user_domains = orig_banned_user_domains def testIsBanned_PlusAddressUser(self): """We don't allow users who have + in their email address.""" user = user_pb2.User(email='<EMAIL>') self.assertFalse(permissions.IsBanned(user, None)) user.email = '<EMAIL>' self.assertTrue(permissions.IsBanned(user, None)) def testGetCustomPermissions(self): project = project_pb2.Project() self.assertListEqual([], permissions.GetCustomPermissions(project)) project.extra_perms.append(project_pb2.Project.ExtraPerms( perms=['Core', 'Elite', 'Gold'])) self.assertListEqual(['Core', 'Elite', 'Gold'], permissions.GetCustomPermissions(project)) project.extra_perms.append(project_pb2.Project.ExtraPerms( perms=['Silver', 'Gold', 'Bronze'])) self.assertListEqual(['Bronze', 'Core', 'Elite', 'Gold', 'Silver'], permissions.GetCustomPermissions(project)) # View is not returned because it is a starndard permission. project.extra_perms.append(project_pb2.Project.ExtraPerms( perms=['Bronze', permissions.VIEW])) self.assertListEqual(['Bronze', 'Core', 'Elite', 'Gold', 'Silver'], permissions.GetCustomPermissions(project)) def testUserCanViewProject(self): self.mox.StubOutWithMock(time, 'time') for _ in range(8): time.time().AndReturn(self.NOW) self.mox.ReplayAll() self.assertTrue(permissions.UserCanViewProject( self.member, {self.COMMITTER_USER_ID}, self.live_project)) self.assertTrue(permissions.UserCanViewProject( None, None, self.live_project)) self.archived_project.delete_time = self.NOW + 1 self.assertFalse(permissions.UserCanViewProject( None, None, self.archived_project)) self.assertTrue(permissions.UserCanViewProject( self.owner, {self.OWNER_USER_ID}, self.archived_project)) self.assertTrue(permissions.UserCanViewProject( self.site_admin, {self.SITE_ADMIN_USER_ID}, self.archived_project)) self.archived_project.delete_time = self.NOW - 1 self.assertFalse(permissions.UserCanViewProject( None, None, self.archived_project)) self.assertFalse(permissions.UserCanViewProject( self.owner, {self.OWNER_USER_ID}, self.archived_project)) self.assertTrue(permissions.UserCanViewProject( self.site_admin, {self.SITE_ADMIN_USER_ID}, self.archived_project)) self.mox.VerifyAll() def CheckExpired(self, state, expected_to_be_reapable): proj = project_pb2.Project() proj.state = state proj.delete_time = self.NOW + 1 self.assertFalse(permissions.IsExpired(proj)) proj.delete_time = self.NOW - 1 self.assertEqual(expected_to_be_reapable, permissions.IsExpired(proj)) proj.delete_time = self.NOW - 1 self.assertFalse(permissions.IsExpired(proj, expired_before=self.NOW - 2)) def testIsExpired_Live(self): self.CheckExpired(project_pb2.ProjectState.LIVE, False) def testIsExpired_Archived(self): self.mox.StubOutWithMock(time, 'time') for _ in range(2): time.time().AndReturn(self.NOW) self.mox.ReplayAll() self.CheckExpired(project_pb2.ProjectState.ARCHIVED, True) self.mox.VerifyAll() class PermissionsCheckTest(unittest.TestCase): def setUp(self): self.perms = permissions.PermissionSet(['a', 'b', 'c']) self.proj = project_pb2.Project() self.proj.committer_ids.append(111) self.proj.extra_perms.append(project_pb2.Project.ExtraPerms( member_id=111, perms=['d'])) # Note: z is an example of a perm that the user does not have. # Note: q is an example of an irrelevant perm that the user does not have. def DoCanUsePerm(self, perm, project='default', user_id=None, restrict=''): """Wrapper function to call CanUsePerm().""" if project == 'default': project = self.proj return self.perms.CanUsePerm( perm, {user_id or 111}, project, restrict.split()) def testHasPermNoRestrictions(self): self.assertTrue(self.DoCanUsePerm('a')) self.assertTrue(self.DoCanUsePerm('A')) self.assertFalse(self.DoCanUsePerm('z')) self.assertTrue(self.DoCanUsePerm('d')) self.assertFalse(self.DoCanUsePerm('d', user_id=222)) self.assertFalse(self.DoCanUsePerm('d', project=project_pb2.Project())) def testHasPermOperationRestrictions(self): self.assertTrue(self.DoCanUsePerm('a', restrict='Restrict-a-b')) self.assertTrue(self.DoCanUsePerm('a', restrict='Restrict-b-z')) self.assertTrue(self.DoCanUsePerm('a', restrict='Restrict-a-d')) self.assertTrue(self.DoCanUsePerm('d', restrict='Restrict-d-a')) self.assertTrue(self.DoCanUsePerm( 'd', restrict='Restrict-q-z Restrict-q-d Restrict-d-a')) self.assertFalse(self.DoCanUsePerm('a', restrict='Restrict-a-z')) self.assertFalse(self.DoCanUsePerm('d', restrict='Restrict-d-z')) self.assertFalse(self.DoCanUsePerm( 'd', restrict='Restrict-d-a Restrict-d-z')) def testHasPermOutsideProjectScope(self): self.assertTrue(self.DoCanUsePerm('a', project=None)) self.assertTrue(self.DoCanUsePerm( 'a', project=None, restrict='Restrict-a-c')) self.assertTrue(self.DoCanUsePerm( 'a', project=None, restrict='Restrict-q-z')) self.assertFalse(self.DoCanUsePerm('z', project=None)) self.assertFalse(self.DoCanUsePerm( 'a', project=None, restrict='Restrict-a-d')) class CanViewProjectContributorListTest(unittest.TestCase): def testCanViewProjectContributorList_NoProject(self): mr = testing_helpers.MakeMonorailRequest(path='/') self.assertFalse(permissions.CanViewContributorList(mr, mr.project)) def testCanViewProjectContributorList_NormalProject(self): project = project_pb2.Project() mr = testing_helpers.MakeMonorailRequest( path='/p/proj/', project=project) self.assertTrue(permissions.CanViewContributorList(mr, mr.project)) def testCanViewProjectContributorList_ProjectWithOptionSet(self): project = project_pb2.Project() project.only_owners_see_contributors = True for perms in [permissions.READ_ONLY_PERMISSIONSET, permissions.CONTRIBUTOR_ACTIVE_PERMISSIONSET, permissions.CONTRIBUTOR_INACTIVE_PERMISSIONSET]: mr = testing_helpers.MakeMonorailRequest( path='/p/proj/', project=project, perms=perms) self.assertFalse(permissions.CanViewContributorList(mr, mr.project)) for perms in [permissions.COMMITTER_ACTIVE_PERMISSIONSET, permissions.COMMITTER_INACTIVE_PERMISSIONSET, permissions.OWNER_ACTIVE_PERMISSIONSET, permissions.OWNER_INACTIVE_PERMISSIONSET, permissions.ADMIN_PERMISSIONSET]: mr = testing_helpers.MakeMonorailRequest( path='/p/proj/', project=project, perms=perms) self.assertTrue(permissions.CanViewContributorList(mr, mr.project)) class ShouldCheckForAbandonmentTest(unittest.TestCase): def setUp(self): self.mr = testing_helpers.Blank( project=project_pb2.Project(), auth=authdata.AuthData()) def testOwner(self): self.mr.auth.effective_ids = {111} self.mr.perms = permissions.OWNER_ACTIVE_PERMISSIONSET self.assertTrue(permissions.ShouldCheckForAbandonment(self.mr)) def testNonOwner(self): self.mr.auth.effective_ids = {222} self.mr.perms = permissions.COMMITTER_ACTIVE_PERMISSIONSET self.assertFalse(permissions.ShouldCheckForAbandonment(self.mr)) self.mr.perms = permissions.CONTRIBUTOR_ACTIVE_PERMISSIONSET self.assertFalse(permissions.ShouldCheckForAbandonment(self.mr)) self.mr.perms = permissions.USER_PERMISSIONSET self.assertFalse(permissions.ShouldCheckForAbandonment(self.mr)) self.mr.perms = permissions.EMPTY_PERMISSIONSET self.assertFalse(permissions.ShouldCheckForAbandonment(self.mr)) def testSiteAdmin(self): self.mr.auth.effective_ids = {111} self.mr.perms = permissions.ADMIN_PERMISSIONSET self.assertFalse(permissions.ShouldCheckForAbandonment(self.mr)) class RestrictionLabelsTest(unittest.TestCase): ORIG_SUMMARY = 'this is the orginal summary' ORIG_LABELS = ['one', 'two'] def testIsRestrictLabel(self): self.assertFalse(permissions.IsRestrictLabel('Usability')) self.assertTrue(permissions.IsRestrictLabel('Restrict-View-CoreTeam')) # Doing it again will test the cached results. self.assertFalse(permissions.IsRestrictLabel('Usability')) self.assertTrue(permissions.IsRestrictLabel('Restrict-View-CoreTeam')) self.assertFalse(permissions.IsRestrictLabel('Usability', perm='View')) self.assertTrue(permissions.IsRestrictLabel( 'Restrict-View-CoreTeam', perm='View')) # This one is a restriction label, but not the kind that we want. self.assertFalse(permissions.IsRestrictLabel( 'Restrict-View-CoreTeam', perm='Delete')) def testGetRestrictions_NoIssue(self): self.assertEqual([], permissions.GetRestrictions(None)) def testGetRestrictions(self): art = fake.MakeTestIssue( 789, 1, self.ORIG_SUMMARY, 'New', 0, labels=self.ORIG_LABELS) self.assertEquals([], permissions.GetRestrictions(art)) art = fake.MakeTestIssue( 789, 1, self.ORIG_SUMMARY, 'New', 0, labels=['Restrict-MissingThirdPart', 'Hot']) self.assertEquals([], permissions.GetRestrictions(art)) art = fake.MakeTestIssue( 789, 1, self.ORIG_SUMMARY, 'New', 0, labels=['Restrict-View-Core', 'Hot']) self.assertEquals(['restrict-view-core'], permissions.GetRestrictions(art)) art = fake.MakeTestIssue( 789, 1, self.ORIG_SUMMARY, 'New', 0, labels=['Restrict-View-Core', 'Hot'], derived_labels=['Color-Red', 'Restrict-EditIssue-GoldMembers']) self.assertEquals( ['restrict-view-core', 'restrict-editissue-goldmembers'], permissions.GetRestrictions(art)) art = fake.MakeTestIssue( 789, 1, self.ORIG_SUMMARY, 'New', 0, labels=['restrict-view-core', 'hot'], derived_labels=['Color-Red', 'RESTRICT-EDITISSUE-GOLDMEMBERS']) self.assertEquals( ['restrict-view-core', 'restrict-editissue-goldmembers'], permissions.GetRestrictions(art)) REPORTER_ID = 111 OWNER_ID = 222 CC_ID = 333 OTHER_ID = 444 APPROVER_ID = 555 class IssuePermissionsTest(unittest.TestCase): REGULAR_ISSUE = tracker_pb2.Issue() REGULAR_ISSUE.reporter_id = REPORTER_ID DELETED_ISSUE = tracker_pb2.Issue() DELETED_ISSUE.deleted = True DELETED_ISSUE.reporter_id = REPORTER_ID RESTRICTED_ISSUE = tracker_pb2.Issue() RESTRICTED_ISSUE.reporter_id = REPORTER_ID RESTRICTED_ISSUE.owner_id = OWNER_ID RESTRICTED_ISSUE.cc_ids.append(CC_ID) RESTRICTED_ISSUE.approval_values.append( tracker_pb2.ApprovalValue(approver_ids=[APPROVER_ID]) ) RESTRICTED_ISSUE.labels.append('Restrict-View-Commit') RESTRICTED_ISSUE2 = tracker_pb2.Issue() RESTRICTED_ISSUE2.reporter_id = REPORTER_ID # RESTRICTED_ISSUE2 has no owner RESTRICTED_ISSUE2.cc_ids.append(CC_ID) RESTRICTED_ISSUE2.labels.append('Restrict-View-Commit') RESTRICTED_ISSUE3 = tracker_pb2.Issue() RESTRICTED_ISSUE3.reporter_id = REPORTER_ID RESTRICTED_ISSUE3.owner_id = OWNER_ID # Restrict to a permission that no one has. RESTRICTED_ISSUE3.labels.append('Restrict-EditIssue-Foo') PROJECT = project_pb2.Project() ADMIN_PERMS = permissions.ADMIN_PERMISSIONSET PERMS = permissions.EMPTY_PERMISSIONSET def testUpdateIssuePermissions_Normal(self): perms = permissions.UpdateIssuePermissions( permissions.COMMITTER_ACTIVE_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE, {}) self.assertEqual( ['addissuecomment', 'commit', 'createissue', 'deleteown', 'editissue', 'flagspam', 'setstar', 'verdictspam', 'view', 'viewcontributorlist', 'viewinboundmessages', 'viewquota'], sorted(perms.perm_names)) def testUpdateIssuePermissions_FromConfig(self): config = tracker_pb2.ProjectIssueConfig( field_defs=[tracker_pb2.FieldDef(field_id=123, grants_perm='Granted')]) issue = tracker_pb2.Issue( field_values=[tracker_pb2.FieldValue(field_id=123, user_id=111)]) perms = permissions.UpdateIssuePermissions( permissions.USER_PERMISSIONSET, self.PROJECT, issue, {111}, config=config) self.assertIn('granted', perms.perm_names) def testUpdateIssuePermissions_ExtraPerms(self): project = project_pb2.Project() project.committer_ids.append(999) project.extra_perms.append( project_pb2.Project.ExtraPerms(member_id=999, perms=['EditIssue'])) perms = permissions.UpdateIssuePermissions( permissions.USER_PERMISSIONSET, project, self.REGULAR_ISSUE, {999}) self.assertIn('editissue', perms.perm_names) def testUpdateIssuePermissions_ExtraPermsAreSubjectToRestrictions(self): project = project_pb2.Project() project.committer_ids.append(999) project.extra_perms.append( project_pb2.Project.ExtraPerms(member_id=999, perms=['EditIssue'])) perms = permissions.UpdateIssuePermissions( permissions.USER_PERMISSIONSET, project, self.RESTRICTED_ISSUE3, {999}) self.assertNotIn('editissue', perms.perm_names) def testUpdateIssuePermissions_GrantedPermsAreNotSubjectToRestrictions(self): perms = permissions.UpdateIssuePermissions( permissions.USER_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE3, {}, granted_perms=['EditIssue']) self.assertIn('editissue', perms.perm_names) def testUpdateIssuePermissions_RespectConsiderRestrictions(self): perms = permissions.UpdateIssuePermissions( permissions.ADMIN_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE3, {}) self.assertIn('editissue', perms.perm_names) def testUpdateIssuePermissions_RestrictionsAreConsideredIndividually(self): issue = tracker_pb2.Issue( labels=[ 'Restrict-Perm1-Perm2', 'Restrict-Perm2-Perm3']) perms = permissions.UpdateIssuePermissions( permissions.PermissionSet(['Perm1', 'Perm2', 'View']), self.PROJECT, issue, {}) self.assertIn('perm1', perms.perm_names) self.assertNotIn('perm2', perms.perm_names) def testUpdateIssuePermissions_DeletedNoPermissions(self): issue = tracker_pb2.Issue( labels=['Restrict-View-Foo'], deleted=True) perms = permissions.UpdateIssuePermissions( permissions.COMMITTER_ACTIVE_PERMISSIONSET, self.PROJECT, issue, {}) self.assertEqual([], sorted(perms.perm_names)) def testUpdateIssuePermissions_ViewDeleted(self): perms = permissions.UpdateIssuePermissions( permissions.COMMITTER_ACTIVE_PERMISSIONSET, self.PROJECT, self.DELETED_ISSUE, {}) self.assertEqual(['view'], sorted(perms.perm_names)) def testUpdateIssuePermissions_ViewAndDeleteDeleted(self): perms = permissions.UpdateIssuePermissions( permissions.OWNER_ACTIVE_PERMISSIONSET, self.PROJECT, self.DELETED_ISSUE, {}) self.assertEqual(['deleteissue', 'view'], sorted(perms.perm_names)) def testUpdateIssuePermissions_ViewRestrictions(self): perms = permissions.UpdateIssuePermissions( permissions.USER_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE, {}) self.assertNotIn('view', perms.perm_names) def testUpdateIssuePermissions_RolesBypassViewRestrictions(self): for role in {OWNER_ID, REPORTER_ID, CC_ID, APPROVER_ID}: perms = permissions.UpdateIssuePermissions( permissions.USER_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE, {role}) self.assertIn('view', perms.perm_names) def testUpdateIssuePermissions_RolesAllowViewingDeleted(self): issue = tracker_pb2.Issue( reporter_id=REPORTER_ID, owner_id=OWNER_ID, cc_ids=[CC_ID], approval_values=[tracker_pb2.ApprovalValue(approver_ids=[APPROVER_ID])], labels=['Restrict-View-Foo'], deleted=True) for role in {OWNER_ID, REPORTER_ID, CC_ID, APPROVER_ID}: perms = permissions.UpdateIssuePermissions( permissions.USER_PERMISSIONSET, self.PROJECT, issue, {role}) self.assertIn('view', perms.perm_names) def testUpdateIssuePermissions_GrantedViewPermission(self): perms = permissions.UpdateIssuePermissions( permissions.USER_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE, {}, ['commit']) self.assertIn('view', perms.perm_names) def testUpdateIssuePermissions_EditRestrictions(self): perms = permissions.UpdateIssuePermissions( permissions.COMMITTER_ACTIVE_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE3, {REPORTER_ID, CC_ID, APPROVER_ID}) self.assertNotIn('editissue', perms.perm_names) def testUpdateIssuePermissions_OwnerBypassEditRestrictions(self): perms = permissions.UpdateIssuePermissions( permissions.COMMITTER_ACTIVE_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE3, {OWNER_ID}) self.assertIn('editissue', perms.perm_names) def testUpdateIssuePermissions_CustomPermissionGrantsEditPermission(self): project = project_pb2.Project() project.committer_ids.append(999) project.extra_perms.append( project_pb2.Project.ExtraPerms(member_id=999, perms=['Foo'])) perms = permissions.UpdateIssuePermissions( permissions.COMMITTER_ACTIVE_PERMISSIONSET, project, self.RESTRICTED_ISSUE3, {999}) self.assertIn('editissue', perms.perm_names) def testCanViewIssue_Deleted(self): self.assertFalse(permissions.CanViewIssue( {REPORTER_ID}, permissions.OWNER_ACTIVE_PERMISSIONSET, self.PROJECT, self.DELETED_ISSUE)) self.assertTrue(permissions.CanViewIssue( {REPORTER_ID}, permissions.OWNER_ACTIVE_PERMISSIONSET, self.PROJECT, self.DELETED_ISSUE, allow_viewing_deleted=True)) self.assertTrue(permissions.CanViewIssue( {REPORTER_ID}, permissions.OWNER_ACTIVE_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) def testCanViewIssue_Regular(self): self.assertTrue(permissions.CanViewIssue( {REPORTER_ID}, permissions.OWNER_ACTIVE_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) self.assertTrue(permissions.CanViewIssue( {REPORTER_ID}, permissions.COMMITTER_ACTIVE_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) self.assertTrue(permissions.CanViewIssue( {REPORTER_ID}, permissions.CONTRIBUTOR_ACTIVE_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) self.assertTrue(permissions.CanViewIssue( {REPORTER_ID}, permissions.USER_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) self.assertTrue(permissions.CanViewIssue( {REPORTER_ID}, permissions.READ_ONLY_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) self.assertTrue(permissions.CanViewIssue( set(), permissions.READ_ONLY_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) def testCanViewIssue_Restricted(self): # Project owner can always view issue. self.assertTrue(permissions.CanViewIssue( {OTHER_ID}, permissions.OWNER_ACTIVE_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE)) # Member can view because they have Commit perm. self.assertTrue(permissions.CanViewIssue( {OTHER_ID}, permissions.COMMITTER_ACTIVE_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE)) # Contributors normally do not have Commit perm. self.assertFalse(permissions.CanViewIssue( {OTHER_ID}, permissions.CONTRIBUTOR_ACTIVE_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE)) # Non-members do not have Commit perm. self.assertFalse(permissions.CanViewIssue( {OTHER_ID}, permissions.USER_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE)) # Anon user's do not have Commit perm. self.assertFalse(permissions.CanViewIssue( set(), permissions.READ_ONLY_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE)) def testCanViewIssue_RestrictedParticipants(self): # Reporter can always view issue self.assertTrue(permissions.CanViewIssue( {REPORTER_ID}, permissions.READ_ONLY_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE)) # Issue owner can always view issue self.assertTrue(permissions.CanViewIssue( {OWNER_ID}, permissions.READ_ONLY_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE)) # CC'd user can always view issue self.assertTrue(permissions.CanViewIssue( {CC_ID}, permissions.READ_ONLY_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE)) # Non-participants cannot view issue if they don't have the needed perm. self.assertFalse(permissions.CanViewIssue( {OTHER_ID}, permissions.READ_ONLY_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE)) # Anon user's do not have Commit perm. self.assertFalse(permissions.CanViewIssue( set(), permissions.READ_ONLY_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE)) # Anon user's cannot match owner 0. self.assertFalse(permissions.CanViewIssue( set(), permissions.READ_ONLY_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE2)) # Approvers can always view issue self.assertTrue(permissions.CanViewIssue( {APPROVER_ID}, permissions.READ_ONLY_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE)) def testCannotViewIssueIfCannotViewProject(self): """Cross-project search should not be a backdoor to viewing issues.""" # Reporter cannot view issue if they not long have access to the project. self.assertFalse(permissions.CanViewIssue( {REPORTER_ID}, permissions.EMPTY_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) # Issue owner cannot always view issue self.assertFalse(permissions.CanViewIssue( {OWNER_ID}, permissions.EMPTY_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) # CC'd user cannot always view issue self.assertFalse(permissions.CanViewIssue( {CC_ID}, permissions.EMPTY_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) # Non-participants cannot view issue if they don't have the needed perm. self.assertFalse(permissions.CanViewIssue( {OTHER_ID}, permissions.EMPTY_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) # Anon user's do not have Commit perm. self.assertFalse(permissions.CanViewIssue( set(), permissions.EMPTY_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) # Anon user's cannot match owner 0. self.assertFalse(permissions.CanViewIssue( set(), permissions.EMPTY_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) def testCanEditIssue(self): # Anon users cannot edit issues. self.assertFalse(permissions.CanEditIssue( {}, permissions.READ_ONLY_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) # Non-members and contributors cannot edit issues, # even if they reported them. self.assertFalse(permissions.CanEditIssue( {REPORTER_ID}, permissions.READ_ONLY_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) self.assertFalse(permissions.CanEditIssue( {REPORTER_ID}, permissions.CONTRIBUTOR_ACTIVE_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) # Project committers and project owners can edit issues, regardless # of their role in the issue. self.assertTrue(permissions.CanEditIssue( {REPORTER_ID}, permissions.COMMITTER_ACTIVE_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) self.assertTrue(permissions.CanEditIssue( {REPORTER_ID}, permissions.OWNER_ACTIVE_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) self.assertTrue(permissions.CanEditIssue( {OWNER_ID}, permissions.COMMITTER_ACTIVE_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) self.assertTrue(permissions.CanEditIssue( {OWNER_ID}, permissions.OWNER_ACTIVE_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) self.assertTrue(permissions.CanEditIssue( {OTHER_ID}, permissions.COMMITTER_ACTIVE_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) self.assertTrue(permissions.CanEditIssue( {OTHER_ID}, permissions.OWNER_ACTIVE_PERMISSIONSET, self.PROJECT, self.REGULAR_ISSUE)) def testCanEditIssue_Restricted(self): # Anon users cannot edit restricted issues. self.assertFalse(permissions.CanEditIssue( {}, permissions.COMMITTER_ACTIVE_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE3)) # Project committers cannot edit issues with a restriction to a custom # permission that they don't have. self.assertFalse(permissions.CanEditIssue( {OTHER_ID}, permissions.COMMITTER_ACTIVE_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE3)) # *Issue* owners can always edit the issues that they own, even if # those issues are restricted to perms that they don't have. self.assertTrue(permissions.CanEditIssue( {OWNER_ID}, permissions.CONTRIBUTOR_ACTIVE_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE3)) # Project owners can always edit, they cannot lock themselves out. self.assertTrue(permissions.CanEditIssue( {OTHER_ID}, permissions.OWNER_ACTIVE_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE3)) # A committer with edit permission but not view permission # should not be able to edit the issue. self.assertFalse(permissions.CanEditIssue( {OTHER_ID}, permissions.CONTRIBUTOR_ACTIVE_PERMISSIONSET, self.PROJECT, self.RESTRICTED_ISSUE2)) def testCanCommentIssue_HasPerm(self): self.assertTrue(permissions.CanCommentIssue( {111}, permissions.PermissionSet([permissions.ADD_ISSUE_COMMENT]), None, None)) self.assertFalse(permissions.CanCommentIssue( {111}, permissions.PermissionSet([]), None, None)) def testCanCommentIssue_HasExtraPerm(self): project = project_pb2.Project() project.committer_ids.append(111) extra_perm = project_pb2.Project.ExtraPerms( member_id=111, perms=[permissions.ADD_ISSUE_COMMENT]) project.extra_perms.append(extra_perm) self.assertTrue(permissions.CanCommentIssue( {111}, permissions.PermissionSet([]), project, None)) self.assertFalse(permissions.CanCommentIssue( {222}, permissions.PermissionSet([]), project, None)) def testCanCommentIssue_Restricted(self): issue = tracker_pb2.Issue(labels=['Restrict-AddIssueComment-CoreTeam']) # User is granted exactly the perm they need specifically in this issue. self.assertTrue(permissions.CanCommentIssue( {111}, permissions.PermissionSet([]), None, issue, granted_perms=['addissuecomment'])) # User is granted CoreTeam, which satifies the restriction, and allows # them to use the AddIssueComment permission that they have and would # normally be able to use in an unrestricted issue. self.assertTrue(permissions.CanCommentIssue( {111}, permissions.PermissionSet([permissions.ADD_ISSUE_COMMENT]), None, issue, granted_perms=['coreteam'])) # User was granted CoreTeam, but never had AddIssueComment. self.assertFalse(permissions.CanCommentIssue( {111}, permissions.PermissionSet([]), None, issue, granted_perms=['coreteam'])) # User has AddIssueComment, but cannot satisfy restriction. self.assertFalse(permissions.CanCommentIssue( {111}, permissions.PermissionSet([permissions.ADD_ISSUE_COMMENT]), None, issue)) def testCanCommentIssue_Granted(self): self.assertTrue(permissions.CanCommentIssue( {111}, permissions.PermissionSet([]), None, None, granted_perms=['addissuecomment'])) self.assertFalse(permissions.CanCommentIssue( {111}, permissions.PermissionSet([]), None, None)) def testCanUpdateApprovalStatus_Approver(self): # restricted status self.assertTrue(permissions.CanUpdateApprovalStatus( {111, 222}, permissions.PermissionSet([]), self.PROJECT, [222], tracker_pb2.ApprovalStatus.APPROVED)) # non-restricted status self.assertTrue(permissions.CanUpdateApprovalStatus( {111, 222}, permissions.PermissionSet([]), self.PROJECT, [222], tracker_pb2.ApprovalStatus.NEEDS_REVIEW)) def testCanUpdateApprovalStatus_SiteAdmin(self): # restricted status self.assertTrue(permissions.CanUpdateApprovalStatus( {444}, permissions.PermissionSet([permissions.EDIT_ISSUE_APPROVAL]), self.PROJECT, [222], tracker_pb2.ApprovalStatus.NOT_APPROVED)) # non-restricted status self.assertTrue(permissions.CanUpdateApprovalStatus( {444}, permissions.PermissionSet([permissions.EDIT_ISSUE_APPROVAL]), self.PROJECT, [222], tracker_pb2.ApprovalStatus.NEEDS_REVIEW)) def testCanUpdateApprovalStatus_NonApprover(self): # non-restricted status self.assertTrue(permissions.CanUpdateApprovalStatus( {111, 222}, permissions.PermissionSet([]), self.PROJECT, [333], tracker_pb2.ApprovalStatus.NEED_INFO)) # restricted status self.assertFalse(permissions.CanUpdateApprovalStatus( {111, 222}, permissions.PermissionSet([]), self.PROJECT, [333], tracker_pb2.ApprovalStatus.NA)) def testCanUpdateApprovers_Approver(self): self.assertTrue(permissions.CanUpdateApprovers( {111, 222}, permissions.PermissionSet([]), self.PROJECT, [222])) def testCanUpdateApprovers_SiteAdmins(self): self.assertTrue(permissions.CanUpdateApprovers( {444}, permissions.PermissionSet([permissions.EDIT_ISSUE_APPROVAL]), self.PROJECT, [222])) def testCanUpdateApprovers_NonApprover(self): self.assertFalse(permissions.CanUpdateApprovers( {111, 222}, permissions.PermissionSet([]), self.PROJECT, [333])) def testCanViewComponentDef_ComponentAdmin(self): cd = tracker_pb2.ComponentDef(admin_ids=[111]) perms = permissions.PermissionSet([]) self.assertTrue(permissions.CanViewComponentDef( {111}, perms, None, cd)) self.assertFalse(permissions.CanViewComponentDef( {999}, perms, None, cd)) def testCanViewComponentDef_NormalUser(self): cd = tracker_pb2.ComponentDef() self.assertTrue(permissions.CanViewComponentDef( {111}, permissions.PermissionSet([permissions.VIEW]), None, cd)) self.assertFalse(permissions.CanViewComponentDef( {111}, permissions.PermissionSet([]), None, cd)) def testCanEditComponentDef_ComponentAdmin(self): cd = tracker_pb2.ComponentDef(admin_ids=[111], path='Whole') sub_cd = tracker_pb2.ComponentDef(admin_ids=[222], path='Whole>Part') config = tracker_bizobj.MakeDefaultProjectIssueConfig(789) config.component_defs.append(cd) config.component_defs.append(sub_cd) perms = permissions.PermissionSet([]) self.assertTrue(permissions.CanEditComponentDef( {111}, perms, None, cd, config)) self.assertFalse(permissions.CanEditComponentDef( {222}, perms, None, cd, config)) self.assertFalse(permissions.CanEditComponentDef( {999}, perms, None, cd, config)) self.assertTrue(permissions.CanEditComponentDef( {111}, perms, None, sub_cd, config)) self.assertTrue(permissions.CanEditComponentDef( {222}, perms, None, sub_cd, config)) self.assertFalse(permissions.CanEditComponentDef( {999}, perms, None, sub_cd, config)) def testCanEditComponentDef_ProjectOwners(self): cd = tracker_pb2.ComponentDef(path='Whole') config = tracker_bizobj.MakeDefaultProjectIssueConfig(789) config.component_defs.append(cd) self.assertTrue(permissions.CanEditComponentDef( {111}, permissions.PermissionSet([permissions.EDIT_PROJECT]), None, cd, config)) self.assertFalse(permissions.CanEditComponentDef( {111}, permissions.PermissionSet([]), None, cd, config)) def testCanViewFieldDef_FieldAdmin(self): fd = tracker_pb2.FieldDef(admin_ids=[111]) perms = permissions.PermissionSet([]) self.assertTrue(permissions.CanViewFieldDef( {111}, perms, None, fd)) self.assertFalse(permissions.CanViewFieldDef( {999}, perms, None, fd)) def testCanViewFieldDef_NormalUser(self): fd = tracker_pb2.FieldDef() self.assertTrue(permissions.CanViewFieldDef( {111}, permissions.PermissionSet([permissions.VIEW]), None, fd)) self.assertFalse(permissions.CanViewFieldDef( {111}, permissions.PermissionSet([]), None, fd)) def testCanEditFieldDef_FieldAdmin(self): fd = tracker_pb2.FieldDef(admin_ids=[111]) perms = permissions.PermissionSet([]) self.assertTrue(permissions.CanEditFieldDef( {111}, perms, None, fd)) self.assertFalse(permissions.CanEditFieldDef( {999}, perms, None, fd)) def testCanEditFieldDef_ProjectOwners(self): fd = tracker_pb2.FieldDef() self.assertTrue(permissions.CanEditFieldDef( {111}, permissions.PermissionSet([permissions.EDIT_PROJECT]), None, fd)) self.assertFalse(permissions.CanEditFieldDef( {111}, permissions.PermissionSet([]), None, fd)) def testCanViewTemplate_TemplateAdmin(self): td = tracker_pb2.TemplateDef(admin_ids=[111]) perms = permissions.PermissionSet([]) self.assertTrue(permissions.CanViewTemplate( {111}, perms, None, td)) self.assertFalse(permissions.CanViewTemplate( {999}, perms, None, td)) def testCanViewTemplate_MembersOnly(self): td = tracker_pb2.TemplateDef(members_only=True) project = project_pb2.Project(committer_ids=[111]) self.assertTrue(permissions.CanViewTemplate( {111}, permissions.PermissionSet([]), project, td)) self.assertFalse(permissions.CanViewTemplate( {999}, permissions.PermissionSet([]), project, td)) def testCanViewTemplate_AnyoneWhoCanViewProject(self): td = tracker_pb2.TemplateDef() self.assertTrue(permissions.CanViewTemplate( {111}, permissions.PermissionSet([permissions.VIEW]), None, td)) self.assertFalse(permissions.CanViewTemplate( {111}, permissions.PermissionSet([]), None, td)) def testCanEditTemplate_TemplateAdmin(self): td = tracker_pb2.TemplateDef(admin_ids=[111]) perms = permissions.PermissionSet([]) self.assertTrue(permissions.CanEditTemplate( {111}, perms, None, td)) self.assertFalse(permissions.CanEditTemplate( {999}, perms, None, td)) def testCanEditTemplate_ProjectOwners(self): td = tracker_pb2.TemplateDef() self.assertTrue(permissions.CanEditTemplate( {111}, permissions.PermissionSet([permissions.EDIT_PROJECT]), None, td)) self.assertFalse(permissions.CanEditTemplate( {111}, permissions.PermissionSet([]), None, td)) def testCanViewHotlist_Private(self): hotlist = features_pb2.Hotlist() hotlist.is_private = True hotlist.owner_ids.append(111) hotlist.editor_ids.append(222) self.assertTrue(permissions.CanViewHotlist({222}, self.PERMS, hotlist)) self.assertTrue(permissions.CanViewHotlist({111, 333}, self.PERMS, hotlist)) self.assertTrue( permissions.CanViewHotlist({111, 333}, self.ADMIN_PERMS, hotlist)) self.assertFalse( permissions.CanViewHotlist({333, 444}, self.PERMS, hotlist)) self.assertTrue( permissions.CanViewHotlist({333, 444}, self.ADMIN_PERMS, hotlist)) def testCanViewHotlist_Public(self): hotlist = features_pb2.Hotlist() hotlist.is_private = False hotlist.owner_ids.append(111) hotlist.editor_ids.append(222) self.assertTrue(permissions.CanViewHotlist({222}, self.PERMS, hotlist)) self.assertTrue(permissions.CanViewHotlist({111, 333}, self.PERMS, hotlist)) self.assertTrue(permissions.CanViewHotlist({333, 444}, self.PERMS, hotlist)) self.assertTrue( permissions.CanViewHotlist({333, 444}, self.ADMIN_PERMS, hotlist)) def testCanEditHotlist(self): hotlist = features_pb2.Hotlist() hotlist.owner_ids.append(111) hotlist.editor_ids.append(222) self.assertTrue(permissions.CanEditHotlist({222}, self.PERMS, hotlist)) self.assertTrue(permissions.CanEditHotlist({111, 333}, self.PERMS, hotlist)) self.assertTrue( permissions.CanEditHotlist({111, 333}, self.ADMIN_PERMS, hotlist)) self.assertFalse( permissions.CanEditHotlist({333, 444}, self.PERMS, hotlist)) self.assertTrue( permissions.CanEditHotlist({333, 444}, self.ADMIN_PERMS, hotlist)) def testCanAdministerHotlist(self): hotlist = features_pb2.Hotlist() hotlist.owner_ids.append(111) hotlist.editor_ids.append(222) self.assertFalse( permissions.CanAdministerHotlist({222}, self.PERMS, hotlist)) self.assertTrue( permissions.CanAdministerHotlist({111, 333}, self.PERMS, hotlist)) self.assertTrue( permissions.CanAdministerHotlist({111, 333}, self.ADMIN_PERMS, hotlist)) self.assertFalse( permissions.CanAdministerHotlist({333, 444}, self.PERMS, hotlist)) self.assertTrue( permissions.CanAdministerHotlist({333, 444}, self.ADMIN_PERMS, hotlist))
gauthiersiri/instana-openshift
src/services/ui/frontend/src/redux/reducer.js
import produce from "immer"; import { types } from "./actions"; import queryString from "query-string"; import { queryToServiceFilterMap } from "./init"; import globalHistory from "globalHistory"; const arrayify = (maybeArray) => { const _maybeArray = maybeArray || []; if (Array.isArray(_maybeArray)) { return _maybeArray; } return [_maybeArray]; }; const reducer = produce((draft, action) => { switch (action.type) { case types.setLocation: { const q = queryString.parse(action.payload.search); for (let key of Object.keys(queryToServiceFilterMap)) { const { service, filter, type, default: d } = queryToServiceFilterMap[ key ]; switch (type) { case "array": { draft[service][filter] = arrayify(q[key] || d); break; } case "number": { draft[service][filter] = parseInt(q[key] || d, 10); break; } // NOTE: date might be needed as a case default: { draft[service][filter] = q[key] || d; break; } } } break; } case types.addCarsToCart: { console.log("REDUCER", action.payload); draft.cars.push(action.payload); localStorage.setItem("cars", JSON.stringify(draft.cars)); break; } case types.addHotelsToCart: { draft.hotels.push(action.payload); localStorage.setItem("hotels", JSON.stringify(draft.hotels)); break; } case types.addFlightsToCart: { draft.hotels.push(action.payload); localStorage.setItem("flights", JSON.stringify(draft.flights)); break; } case types.removeCarsFromCart: { const {payload} = action; const compare = (store) => store.id === payload.id && store.dateFrom === payload.dateFrom && store.dateTo === payload.dateTo; const index = draft.cars.findIndex(compare); if (index > -1) { draft.cars.splice(index, 1); } localStorage.setItem("cars", JSON.stringify(draft.cars)); break; } case types.removeHotelsFromCart: { const {payload} = action; const compare = (store) => store.id === payload.id && store.dateFrom === payload.dateFrom && store.dateTo === payload.dateTo; const index = draft.hotels.findIndex(compare); if (index > -1) { draft.hotels.splice(index, 1); } localStorage.setItem("hotels", JSON.stringify(draft.hotels)); break; } case types.removeFlightsFromCart: { const index = draft.flights.indexOf(action.payload); if (index > -1) { draft.flights.splice(index, 1); } localStorage.setItem("flights", JSON.stringify(draft.flights)); break; } case types.setFilters: { const { service, filter, value } = action.payload; draft[service][filter] = value; let queryObj = {}; for (let [key, val] of Object.entries(draft.hotelFilters)) { const [key2] = Object.entries(queryToServiceFilterMap).find( ([_k, v]) => v.service === "hotelFilters" && v.filter === key ); queryObj[key2] = val; } for (let [key, val] of Object.entries(draft.carFilters)) { const [key2] = Object.entries(queryToServiceFilterMap).find( ([_k, v]) => v.service === "carFilters" && v.filter === key ); queryObj[key2] = val; } for (let [key, val] of Object.entries(draft.flightFilters)) { const [key2] = Object.entries(queryToServiceFilterMap).find( ([_k, v]) => v.service === "flightFilters" && v.filter === key ); queryObj[key2] = val; } const query = queryString.stringify(queryObj); globalHistory.push(`${globalHistory.location.pathname}?${query}`); break; } case types.setMinMaxFilters: { const { service, value } = action.payload; // NOTE: not setting the url // some bug with redux dispatch unsubscribe draft[service].minPrice = value[0]; draft[service].maxPrice = value[1]; break; } default: break; } }); export default reducer;
efluid/datagate
efluid-datagate-app/src/main/java/fr/uem/efluid/tools/diff/ManagedQueriesGenerator.java
<filename>efluid-datagate-app/src/main/java/fr/uem/efluid/tools/diff/ManagedQueriesGenerator.java package fr.uem.efluid.tools.diff; import fr.uem.efluid.ColumnType; import fr.uem.efluid.model.entities.DictionaryEntry; import fr.uem.efluid.model.entities.TableLink; import fr.uem.efluid.services.types.Value; import fr.uem.efluid.utils.ApplicationException; import fr.uem.efluid.utils.ErrorType; import fr.uem.efluid.utils.FormatUtils; import fr.uem.efluid.utils.SelectClauseGenerator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import java.util.stream.Stream; import static fr.uem.efluid.ColumnType.NULL; import static fr.uem.efluid.services.types.Value.TYPED_STRING_PROTECT; import static fr.uem.efluid.tools.diff.ManagedValueConverter.NULL_KEY; /** * <p> * Tools for query build used in Managed database access. Contains query building * processes for managed value extraction. Some helpers provides also solution for * building stored part of the Managed source details. * </p> * <p> * <b>All query items can be "protected" with double quotes</b> (validated as default rule * for Postgres, and supported on Oracle and MS SQL Server). So a select is always like * this : <code>select "colA", "colB", "colC" from "Table" where "colA"='truc'</code>. * This feature is optional : all behaviors are specified from available * <tt>QueryGenerationRules</tt> initialized in Spring context * </p> * <p> * For mapping, a dedicated generation is used when the linked table is itself a parameter * table. * </p> * * @author elecomte * @version 1 * @since v0.0.1 */ @Component public class ManagedQueriesGenerator extends SelectClauseGenerator { private static final Logger LOGGER = LoggerFactory.getLogger(ManagedQueriesGenerator.class); public static final String NULL_KEY_VALUE = String.valueOf(NULL_KEY); private static final String AFFECT = "="; private static final String NULL_SELECT = " IS "; private static final String WHERE_CLAUSE_SEP = " AND "; private static final String WHERE_CLAUSE_SUB_START = " ( "; private static final String WHERE_CLAUSE_SUB_END = " ) "; private static final DateTimeFormatter INTERNAL_LDT_FORMATTER = DateTimeFormatter.ofPattern(FormatUtils.DATE_TIME_FORMAT); private static final String INJECT_OF_LOB = "?"; private static final String NULL_VALUE = "null"; private String selectQueryModel; private String countQueryModel; private String insertQueryModel; private String updateQueryModel; private String deleteQueryModel; private String unicityQueryModel; private String checkFilterQueryModel; private String joinSubQueryModel; private String updateOrInsertLinkedSubQueryModel; private String missingLinkClauseModel; private String dateValueConvertFormat; private DateTimeFormatter dbDateFormater; private boolean addNullableJoinKeyJoinClause; /** * Prepare generator regarding the specified rules * * @param rules the fixed query generation rules */ public ManagedQueriesGenerator(@Autowired QueryGenerationRules rules) { super(); update(rules); } /** * Allows apply of new rules * * @param rules QueryGenerationRules to apply for generator configuration */ public void update(QueryGenerationRules rules) { super.update(rules.isColumnNamesProtected()); // Prepare templates for query generation this.countQueryModel = generateCountQueryTemplate(rules); this.selectQueryModel = generateSelectQueryTemplate(rules); this.insertQueryModel = generateInsertQueryTemplate(rules); this.updateQueryModel = generateUpdateQueryTemplate(rules); this.deleteQueryModel = generateDeleteQueryTemplate(rules); this.unicityQueryModel = generateUnicityQueryTemplate(rules); this.checkFilterQueryModel = generateFilterCheckQueryTemplate(rules); this.joinSubQueryModel = generateJoinSubQueryTemplate(rules); this.updateOrInsertLinkedSubQueryModel = generateUpdateOrInsertLinkedSubQueryTemplate(rules); this.missingLinkClauseModel = generateSelectMissingLinkWhereClausePartTemplate(rules); this.dbDateFormater = DateTimeFormatter.ofPattern(rules.getDatabaseDateFormat()); this.addNullableJoinKeyJoinClause = rules.isJoinOnNullableKeys(); this.dateValueConvertFormat = rules.getTemplates().getDateConvert(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Initialized query generator with models :"); LOGGER.debug(" -> countQueryModel => {}", this.countQueryModel); LOGGER.debug(" -> selectQueryModel => {}", this.selectQueryModel); LOGGER.debug(" -> insertQueryModel => {}", this.insertQueryModel); LOGGER.debug(" -> updateQueryModel => {}", this.updateQueryModel); LOGGER.debug(" -> deleteQueryModel => {}", this.deleteQueryModel); LOGGER.debug(" -> unicityQueryModel => {}", this.unicityQueryModel); LOGGER.debug(" -> joinSubQueryModel => {}", this.joinSubQueryModel); LOGGER.debug(" -> updateOrInsertLinkedSubQueryModel => {}", this.updateOrInsertLinkedSubQueryModel); LOGGER.debug(" -> missingLinkClauseModel => {}", this.missingLinkClauseModel); LOGGER.debug(" -> dateValueConvertFormat => {}", this.dateValueConvertFormat); } } /** * Generates the query for "select the current content for a parameter table" * * @param parameterEntry the current parameter table spec * @return query for the specified parameter table */ public String producesSelectParameterQuery( DictionaryEntry parameterEntry, Collection<TableLink> links, Map<String, DictionaryEntry> allEntries) { // Need clean select for uses String selectClause = consolidateSelectClause(parameterEntry); // For inner linked (select contains them already) String joinClauses = prepareJoinLinks(links, allEntries, JoinType.INCLUDE); return String.format(this.selectQueryModel, selectClause, parameterEntry.getTableName(), joinClauses, parameterEntry.getWhereClause(), parameterEntry.getKeyName()); } /** * Generates the query for "get the linked entries for a parameter table" * * @param parameterEntry the current parameter table spec * @return query for the specified parameter table */ public String producesCountFilteredParameterQuery( DictionaryEntry parameterEntry, List<TableLink> links, Map<String, DictionaryEntry> allEntries) { // For inner linked (select contains them already) String joinClauses = prepareJoinLinks(links, allEntries, JoinType.MISSING); return String.format(this.countQueryModel, parameterEntry.getTableName(), joinClauses, parameterEntry.getWhereClause()); } /** * Generates the query for a count of all items in a parameter table (without filter) * * @param parameterEntry the current parameter table spec * @return query for the specified parameter table */ public String producesCountAllParameterQuery( DictionaryEntry parameterEntry, List<TableLink> links, Map<String, DictionaryEntry> allEntries) { // For inner linked (select contains them already) String joinClauses = prepareJoinLinks(links, allEntries, JoinType.MISSING); return String.format(this.countQueryModel, parameterEntry.getTableName(), joinClauses, DEFAULT_WHERE_CLAUSE); } /** * Generates the query for "get the missing linked entries for a parameter table" for 1 specified link. Link column will be named "LINK" in payload * * @param parameterEntry the current parameter table spec * @return query for the specified parameter table */ public String producesSelectMissingParameterQuery( DictionaryEntry parameterEntry, TableLink link, Map<String, DictionaryEntry> allEntries) { // Need clean select for uses String selectClause = consolidateSelectClauseForMissingLink(parameterEntry, link); List<TableLink> links = List.of(link); // For inner linked (select contains them already) String joinClauses = prepareJoinLinks(links, allEntries, JoinType.MISSING); // Custom where clause with reversed select String whereClause = prepareReverseJoinLinksWhereClause(parameterEntry.getWhereClause(), links, allEntries); return String.format(this.selectQueryModel, selectClause, parameterEntry.getTableName(), joinClauses, whereClause, parameterEntry.getKeyName()); } /** * Generates the query for "update the parameter table with a content addition" * * @param parameterEntry the current parameter table spec * @param keyValue * @param values * @return query for the specified parameter table */ public String producesApplyAddQuery( DictionaryEntry parameterEntry, String keyValue, List<Value> values, List<String> referedLobs, List<TableLink> links, Map<String, DictionaryEntry> allEntries) { // INSERT INTO %s (%) VALUES (%) List<Value> combined = new ArrayList<>(); // Custom behavior for composite if (parameterEntry.isCompositeKey()) { combined.addAll(prepareKeyValues(parameterEntry, keyValue)); } // Else use standard direct key set else { combined.add(new KeyValue(parameterEntry.getKeyName(), parameterEntry.getKeyType(), keyValue)); } combined.addAll(values); return String.format(this.insertQueryModel, parameterEntry.getTableName(), allNames(combined, links, allEntries), allValues(combined, referedLobs, links, allEntries)); } /** * Generates the query for "update the parameter table with a content removal" * * @param parameterEntry the current parameter table spec * @param keyValue * @return query for the specified parameter table */ public String producesApplyRemoveQuery(DictionaryEntry parameterEntry, String keyValue) { // DELETE FROM %s WHERE %s String keyWhere; // Dedicated "heavy" process for composite if (parameterEntry.isCompositeKey()) { keyWhere = combinedKeyWhere(prepareKeyValues(parameterEntry, keyValue)); } // Standard process for single (common) key else { keyWhere = keyCondition(new KeyValue(parameterEntry.getKeyName(), parameterEntry.getKeyType(), keyValue)); } return String.format(this.deleteQueryModel, parameterEntry.getTableName(), keyWhere); } /** * Generates the query for "update the parameter table with a content update" * * @param parameterEntry the current parameter table spec * @param keyValue * @param values * @return query for the specified parameter table */ public String producesApplyUpdateQuery( DictionaryEntry parameterEntry, String keyValue, List<Value> values, List<String> referedLobs, List<TableLink> links, Map<String, DictionaryEntry> allEntries) { // UPDATE %s SET %s WHERE %s String keyWhere; // Dedicated "heavy" process for composite if (parameterEntry.isCompositeKey()) { keyWhere = combinedKeyWhere(prepareKeyValues(parameterEntry, keyValue)); } // Standard process for single (common) key else { keyWhere = keyCondition(new KeyValue(parameterEntry.getKeyName(), parameterEntry.getKeyType(), keyValue)); } return String.format(this.updateQueryModel, parameterEntry.getTableName(), allValuesAffect(values, referedLobs, links, allEntries, true), keyWhere); } /** * Generates the query for "get one specified content from a parameter table for a given key" * * @param parameterEntry * @param keyValue * @return query for the specified parameter table */ public String producesGetOneQuery(DictionaryEntry parameterEntry, String keyValue) { // SELECT %s FROM %s WHERE %s ORDER BY %s (reused query) String keyWhere; // Dedicated "heavy" process for composite if (parameterEntry.isCompositeKey()) { keyWhere = combinedKeyWhere(prepareKeyValues(parameterEntry, keyValue)); } // Standard process for single (common) key else { keyWhere = keyCondition(new KeyValue(parameterEntry.getKeyName(), parameterEntry.getKeyType(), keyValue)); } // Ordering by 1st key only return String.format(this.selectQueryModel, "1", parameterEntry.getTableName(), "", keyWhere, parameterEntry.getKeyName()); } /** * To check unicity on parameter key (support for composite) * * @param tablename * @param columnNames * @param filterClause * @return query for the specified parameter table */ public String producesUnicityQuery(String tablename, Collection<String> columnNames, String filterClause) { // select 1 from "TTYPEMATERIEL" cur where cur."ID"<50 group by "SERIE" HAVING COUNT("SERIE") > 1 ; return String.format(this.unicityQueryModel, tablename, filterClause, prepareSimpleSelectPart(columnNames)); } /** * To check if the filter is valid for table. Simply count for items. Fails if filter not valid. * * @param tablename request table to check * @param filterClause filtering clause * @return query for the specified parameter table */ public String producesCheckFilterQuery(String tablename, String filterClause) { // select COUNT(*) from "TTYPEMATERIEL" cur where [filter] ; return String.format(this.checkFilterQueryModel, tablename, filterClause); } /** * @param value * @param lobsKey for affect of binary (LOB). Can be null if LOB is not used in value * @return */ private String valueAffect(Value value, List<String> lobsKey) { if (this.protectColumns) { return ITEM_PROTECT + value.getName() + ITEM_PROTECT + AFFECT + getTypedValue(value, lobsKey); } return value.getName() + AFFECT + getTypedValue(value, lobsKey); } /** * @param key * @return */ private String keyCondition(KeyValue key) { String affect = key.isNull() ? NULL_SELECT : AFFECT; if (this.protectColumns) { return ITEM_PROTECT + key.getName() + ITEM_PROTECT + affect + getTypedValue(key, null); } return key.getName() + affect + getTypedValue(key, null); } /** * @param values * @return */ private String allNames( List<Value> values, List<TableLink> links, Map<String, DictionaryEntry> allEntries) { Stream<String> names; // Dedicated when mapped links exist if (hasMappedLinks(links, allEntries)) { names = values.stream().map(v -> { int lnStart = v.getName().indexOf(LINK_TAB_REFLAP); if (lnStart >= 0) { String propName = v.getName().substring(lnStart + LINK_TAB_REFLAP.length()); // Has a link for propName : correct link attribute Optional<TableLink> link = links.stream().filter(l -> l.getColumnFrom().equals(propName)).findFirst(); if (link.isPresent()) { return propName; } } return v.getName(); }); } else { names = values.stream().map(Value::getName); } if (this.protectColumns) { return ITEM_PROTECT + names.collect(Collectors.joining(SELECT_CLAUSE_SEP_PROTECT)) + ITEM_PROTECT; } return names.collect(Collectors.joining(SELECT_CLAUSE_SEP)); } /** * @param values * @return */ private String allValuesAffect( List<Value> values, List<String> lobKeys, List<TableLink> links, Map<String, DictionaryEntry> allEntries, boolean update) { // col = val // Dedicated when mapped links exist if (hasMappedLinks(links, allEntries)) { return values.stream().map(v -> { int lnStart = v.getName().indexOf(LINK_TAB_REFLAP); if (lnStart >= 0) { String propName = v.getName().substring(lnStart + LINK_TAB_REFLAP.length()); return propName + AFFECT + linkValueSubSelect(propName, v.getValueAsString(), links, allEntries); } return valueAffect(v, lobKeys); }).collect(Collectors.joining(SELECT_CLAUSE_SEP)); } return values.stream().map(v -> valueAffect(v, lobKeys)).collect(Collectors.joining(SELECT_CLAUSE_SEP)); } /** * @param keys * @return */ private String combinedKeyWhere(List<KeyValue> keys) { return WHERE_CLAUSE_SUB_START + keys.stream().map(this::keyCondition).collect(Collectors.joining(WHERE_CLAUSE_SEP)) + WHERE_CLAUSE_SUB_END; } /** * @param values * @return */ private String allValues( List<Value> values, List<String> lobKeys, List<TableLink> links, Map<String, DictionaryEntry> allEntries) { // Dedicated when mapped links exist if (hasMappedLinks(links, allEntries)) { return values.stream().map(v -> { int lnStart = v.getName().indexOf(LINK_TAB_REFLAP); if (lnStart >= 0) { return linkValueSubSelect(v.getName().substring(lnStart + LINK_TAB_REFLAP.length()), v.getValueAsString(), links, allEntries); } return getTypedValue(v, lobKeys); }).collect(Collectors.joining(SELECT_CLAUSE_SEP)); } return values.stream().map(v -> getTypedValue(v, lobKeys)).collect(Collectors.joining(SELECT_CLAUSE_SEP)); } /** * @param linkedAttr * @param value * @param links * @param allEntries * @return */ private String linkValueSubSelect( String linkedAttr, String value, List<TableLink> links, Map<String, DictionaryEntry> allEntries) { TableLink link = links.stream().filter(l -> l.getColumnFrom().equals(linkedAttr)).findFirst().orElseThrow( () -> new ApplicationException(ErrorType.REFER_MISS_LINK, "Unknown value link : " + linkedAttr, linkedAttr)); DictionaryEntry dic = allEntries.get(link.getTableTo()); String keyWhere; // Dedicated "heavy" process for composite if (dic.isCompositeKey()) { keyWhere = combinedKeyWhere(prepareKeyValues(dic, value)); } // Standard process for single (common) key else { keyWhere = keyCondition(new KeyValue(dic.getKeyName(), dic.getKeyType(), value)); } // (SELECT "%s" FROM "%s" WHERE %s) return String.format(this.updateOrInsertLinkedSubQueryModel, link.getColumnTo(), dic.getTableName(), keyWhere); } /** * @param parameterEntry * @return */ private String consolidateSelectClause(DictionaryEntry parameterEntry) { // Basic consolidate => Select all if (DEFAULT_SELECT_CLAUSE.equals(parameterEntry.getSelectClause())) { return DEFAULT_SELECT_CLAUSE; } // Clean search for key String keyRef = createKeysRef(parameterEntry).trim(); // If keyname not in select clause, need to add it if (parameterEntry.getSelectClause() == null || !parameterEntry.getSelectClause().contains(keyRef)) { // Need to remove last comma from key select if (parameterEntry.getSelectClause() == null && keyRef.endsWith(",")) { return keyRef.substring(0, keyRef.length() - 1); } return keyRef + parameterEntry.getSelectClause(); } return "DISTINCT " + (parameterEntry.getSelectClause() != null ? parameterEntry.getSelectClause() : ""); } /** * @param parameterEntry * @return */ private String createKeysRef(DictionaryEntry parameterEntry) { // For most case, use simple key build if (!parameterEntry.isCompositeKey()) { return this.protectColumns ? CURRENT_TAB_ALIAS + ITEM_PROTECT + parameterEntry.getKeyName() + ITEM_PROTECT + SELECT_CLAUSE_SEP : CURRENT_TAB_ALIAS + parameterEntry.getKeyName() + SELECT_CLAUSE_SEP; } // For composite, use advanced building from iterator return parameterEntry.keyNames() .map(k -> this.protectColumns ? CURRENT_TAB_ALIAS + ITEM_PROTECT + k + ITEM_PROTECT : CURRENT_TAB_ALIAS + k) .collect(Collectors.joining(SELECT_CLAUSE_SEP)) + SELECT_CLAUSE_SEP; } /** * @param parameterEntry * @return */ private String consolidateSelectClauseForMissingLink(DictionaryEntry parameterEntry, TableLink link) { return consolidateSelectClause(parameterEntry) + ", " + ((this.protectColumns) ? CURRENT_TAB_ALIAS + ITEM_PROTECT + link.getColumnFrom() + ITEM_PROTECT : CURRENT_TAB_ALIAS + link.getColumnFrom()) + " as LINK"; } /** * @param links * @param allEntries * @return */ private String prepareJoinLinks(Collection<TableLink> links, Map<String, DictionaryEntry> allEntries, JoinType type) { AtomicInteger pos = new AtomicInteger(0); return links.stream() .filter(l -> allEntries.containsKey(l.getTableTo())).sorted(linkOrder()) .map(l -> { DictionaryEntry dic = allEntries.get(l.getTableTo()); String alias = LINK_TAB_ALIAS + pos.incrementAndGet(); // INNER JOIN "%s" %s on %s."%s" = cur."%s" // or for test : LEFT OUTER JOIN .... // or whatever join type is required // "%s JOIN " + (rules.isTableNamesProtected() ? "\"%s\"" : "%s") + " %s ON %s"; return String.format( this.joinSubQueryModel, type.getValue(), dic.getTableName(), alias, linkJoinOn(alias, l) + ( this.addNullableJoinKeyJoinClause ? String.format(" OR COALESCE(%s) IS NULL", nullableKeyJoinSupportParams(alias, l)) : "") ); }).collect(Collectors.joining(" ")); } /** * <p> * Inner part of join, with support for composite key links * </p> * * @param alias * @param link * @return */ private String linkJoinOn(String alias, TableLink link) { // Default - standard single key if (!link.isCompositeKey()) { return this.protectColumns ? alias + ".\"" + link.getColumnTo() + "\" = cur.\"" + link.getColumnFrom() + "\"" : alias + "." + link.getColumnTo() + " = cur." + link.getColumnFrom(); } // Rare - composite key link int max = (int) link.columnFroms().count(); StringBuilder joinOn = new StringBuilder(); for (int i = 0; i < max; i++) { if (this.protectColumns) { joinOn.append(alias).append(".\"").append(link.getColumnTo(i)).append("\" = cur.\"").append(link.getColumnFrom(i)) .append("\""); } else { joinOn.append(alias).append(".").append(link.getColumnTo(i)).append(" = cur.").append(link.getColumnFrom(i)); } if (i < max - 1) { joinOn.append(" AND "); } } return joinOn.toString(); } private String nullableKeyJoinSupportParams(String alias, TableLink link) { // Default - standard single key if (!link.isCompositeKey()) { return (this.protectColumns ? alias + ".\"" + link.getColumnTo() + "\"" : alias + "." + link.getColumnTo()) + ", " + (this.protectColumns ? "cur.\"" + link.getColumnFrom() + "\"" : "cur." + link.getColumnFrom()); } // Rare - composite key link int max = (int) link.columnFroms().count(); StringBuilder linkAlias = new StringBuilder(); for (int i = 0; i < max; i++) { if (this.protectColumns) { linkAlias.append(alias).append(".\"").append(link.getColumnTo(i)).append("\", cur.\"").append(link.getColumnFrom(i)) .append("\""); } else { linkAlias.append(alias).append(".").append(link.getColumnTo(i)).append(", cur.").append(link.getColumnFrom(i)); } if (i < max - 1) { linkAlias.append(", "); } } return linkAlias.toString(); } /** * @param links * @param allEntries * @return */ private String prepareReverseJoinLinksWhereClause( String existingWhereClause, List<TableLink> links, Map<String, DictionaryEntry> allEntries) { AtomicInteger pos = new AtomicInteger(0); return existingWhereClause + " AND (" + links.stream() .filter(l -> allEntries.containsKey(l.getTableTo())).sorted(linkOrder()).map(l -> { String destKey = allEntries.get(l.getTableTo()).getKeyName(); String alias = LINK_TAB_ALIAS + pos.incrementAndGet(); return String.format(this.missingLinkClauseModel, alias, destKey) + (this.addNullableJoinKeyJoinClause ? String.format(" AND COALESCE(%s) IS NOT NULL ", nullableKeyJoinSupportParams(alias, l)) : ""); // l.getColumnTo()); }).collect(Collectors.joining(" OR ")) + ")"; } /** * Convert a <tt>Value</tt> to a typed criterion value for query use * * @param value the <tt>Value</tt> to output for select query * @param lobKeys current lobs * @return criterion value for sql query use */ private String getTypedValue(Value value, List<String> lobKeys) { switch (value.getType()) { case NULL: return NULL_VALUE; case STRING: case PK_STRING: // Support for null key String valueStr = value.getValueAsString(); return valueStr != null ? TYPED_STRING_PROTECT + valueStr.replace("'", "''") + TYPED_STRING_PROTECT : NULL_VALUE; case TEMPORAL: LocalDateTime internal = LocalDateTime.parse(value.getValueAsString(), INTERNAL_LDT_FORMATTER); return this.dateValueConvertFormat.formatted(TYPED_STRING_PROTECT + this.dbDateFormater.format(internal) + TYPED_STRING_PROTECT); case BINARY: case TEXT: if (lobKeys != null) { lobKeys.add(value.getValueAsString()); return INJECT_OF_LOB; } default: return value.getValueAsString(); } } /** * @param combinedKeyValue * @return */ private static List<String> revertCombinedKeyValue(String combinedKeyValue) { return Stream.of(combinedKeyValue.split(KEY_JOIN_SPLITER, -1)).toList(); } /** * <p> * Produces the keys for a <tt>DictionaryEntry</tt> as item <tt>KeyValue</tt> * </p> * <p> * Not optimized, should be used only for composite key tables (which is a rare * condition) * </p> * * @param parameterEntry * @param combinedKeyValue * @return */ private static List<KeyValue> prepareKeyValues(DictionaryEntry parameterEntry, String combinedKeyValue) { // 3 ordered source of data for key items List<String> values = revertCombinedKeyValue(combinedKeyValue); List<String> keyNames = parameterEntry.keyNames().toList(); List<ColumnType> keyTypes = parameterEntry.keyTypes().toList(); List<KeyValue> result = new ArrayList<>(); for (int i = 0; i < keyNames.size(); i++) { result.add(new KeyValue(keyNames.get(i), keyTypes.get(i), values.get(i))); } return result; } /** * Generate the template regarding the rules on protect / not protected * * @param rules * @return */ private static String generateCountQueryTemplate(QueryGenerationRules rules) { return "SELECT count(*) FROM " + (rules.isTableNamesProtected() ? "\"%s\"" : "%s") + " cur %s WHERE %s"; } /** * Generate the template regarding the rules on protect / not protected * * @param rules * @return */ private static String generateSelectQueryTemplate(QueryGenerationRules rules) { return "SELECT %s FROM " + (rules.isTableNamesProtected() ? "\"%s\"" : "%s") + " cur %s WHERE %s ORDER BY cur." + (rules.isColumnNamesProtected() ? "\"%s\"" : "%s"); } /** * Generate the template regarding the rules on protect / not protected * * @param rules * @return */ private static String generateUpdateQueryTemplate(QueryGenerationRules rules) { return "UPDATE " + (rules.isTableNamesProtected() ? "\"%s\"" : "%s") + " SET %s WHERE %s"; } /** * Generate the template regarding the rules on protect / not protected * * @param rules * @return */ private static String generateDeleteQueryTemplate(QueryGenerationRules rules) { return "DELETE FROM " + (rules.isTableNamesProtected() ? "\"%s\"" : "%s") + " WHERE %s "; } /** * Prepare join part for linked properties on select queries * * @param rules * @return */ private static String generateJoinSubQueryTemplate(QueryGenerationRules rules) { // Join type specified on call return "%s JOIN " + (rules.isTableNamesProtected() ? "\"%s\"" : "%s") + " %s ON %s"; } /** * Prepare sub select used for value gathered from linked table on insert or update * queries * * @param rules * @return */ private static String generateUpdateOrInsertLinkedSubQueryTemplate(QueryGenerationRules rules) { return "(SELECT " + (rules.isColumnNamesProtected() ? "\"%s\"" : "%s") + " FROM " + (rules.isTableNamesProtected() ? "\"%s\"" : "%s") + " WHERE %s)"; } /** * Generate the template regarding the rules on protect / not protected * * @param rules * @return */ private static String generateUnicityQueryTemplate(QueryGenerationRules rules) { return "SELECT 1 FROM " + (rules.isTableNamesProtected() ? "\"%s\"" : "%s") + " cur WHERE %s GROUP BY %s HAVING COUNT(*) > 1"; } /** * Generate the template for basic filter run * * @param rules * @return */ private static String generateFilterCheckQueryTemplate(QueryGenerationRules rules) { return "SELECT COUNT(*) FROM " + (rules.isTableNamesProtected() ? "\"%s\"" : "%s") + " cur WHERE %s "; } /** * Generate the template regarding the rules on protect / not protected * * @param rules * @return */ private static String generateInsertQueryTemplate(QueryGenerationRules rules) { return "INSERT INTO " + (rules.isTableNamesProtected() ? "\"%s\"" : "%s") + " (%s) VALUES (%s)"; } /** * <p> * For select on excluded content on missing ref * </p> * * @param rules * @return */ private static String generateSelectMissingLinkWhereClausePartTemplate(QueryGenerationRules rules) { return " %s." + (rules.isTableNamesProtected() ? "\"%s\"" : "%s") + " IS NULL "; } /** * @author elecomte * @version 1 * @since v0.0.8 */ private enum JoinType { INCLUDE("INNER"), MISSING("LEFT OUTER"); private final String value; JoinType(String value) { this.value = value; } String getValue() { return this.value; } } /** * <p> * Specific model for key : allows to easily specify chained values when the key need * to be added * </p> * * @author elecomte * @version 1 * @since v0.0.1 */ private static class KeyValue implements Value { private final String keyName; private final ColumnType keyType; private final String keyValue; /** * @param keyName * @param keyType * @param keyValue */ KeyValue(String keyName, ColumnType keyType, String keyValue) { super(); this.keyName = keyName; this.keyType = keyType; this.keyValue = keyValue; } /** * @return * @see fr.uem.efluid.services.types.Value#getName() */ @Override public String getName() { return this.keyName; } /** * @return * @see fr.uem.efluid.services.types.Value#getValue() */ @Override public byte[] getValue() { // Not used here. return null; } /** * @return * @see fr.uem.efluid.services.types.Value#getType() */ @Override public ColumnType getType() { return isNull() ? NULL : this.keyType; } /** * @return * @see fr.uem.efluid.services.types.Value#getValueAsString() */ @Override public String getValueAsString() { return this.keyValue; } @Override public boolean isNull() { return NULL_KEY_VALUE.equals(this.keyValue); } } /** * <p> * Specify the options for query generation : allows to adapt behavior with precise * rules when the DB type needs it. Rules can be configuration-based or preselected * from the DB vendor * </p> * * @author elecomte * @version 2 * @since v0.0.1 */ public interface QueryGenerationRules { /** * <p> * Do we need to put double quote to protect the column name in SQL query? * </p> * * @return */ boolean isColumnNamesProtected(); /** * <p> * Do we need to put double quote to protect the table name in SQL query ? * </p> * * @return */ boolean isTableNamesProtected(); /** * <p> * The specified date format compliant with managed database for string-based * injection * </p> * * @return */ String getDatabaseDateFormat(); /** * @return true if the database use business key with support for null values */ boolean isJoinOnNullableKeys(); /** * For advanced formatting : can specify some db-dependent templates * * @return all templates, for current DB type */ Templates getTemplates(); interface Templates { /** * Template for date value convert * * @return template for date value convert */ String getDateConvert(); } } }
Mozilla-GitHub-Standards/54c69db06ef83bda60e995a6c34ecfd168ca028994e40ce817295415bb409f0c
make_mozilla/events/models.py
<reponame>Mozilla-GitHub-Standards/54c69db06ef83bda60e995a6c34ecfd168ca028994e40ce817295415bb409f0c<gh_stars>1-10 from django.conf import settings from django.contrib.gis.db import models from django.contrib.gis import geos, measure from django_countries import CountryField from django.utils.safestring import mark_safe from django.core.files.storage import FileSystemStorage from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from datetime import datetime from tower import ugettext_lazy as _ from make_mozilla.base.html import bleached import hashlib class Venue(models.Model): name = models.CharField(max_length=255) street_address = models.TextField() country = CountryField() location = models.PointField(blank=True) objects = models.GeoManager() def __init__(self, *args, **kwargs): super(Venue, self).__init__(*args, **kwargs) if self.location is None: longitude = float(kwargs.get('longitude', '0')) latitude = float(kwargs.get('latitude', '0')) self.location = geos.Point(longitude, latitude) def __unicode__(self): return '%s - %s, %s' % (self.name, self.street_address, self.country) @property def latitude(self): return self.location.y @latitude.setter def latitude(self, value): self.location.y = value @property def longitude(self): return self.location.x @longitude.setter def longitude(self, value): self.location.x = value class Event(models.Model): name = models.CharField(max_length = 255) url_hash = models.CharField(max_length = 20, blank = True) description = models.TextField() event_url = models.URLField(blank = True) venue = models.ForeignKey(Venue) start = models.DateTimeField(null = True, blank = True) end = models.DateTimeField(null = True, blank = True) source = models.CharField(max_length = 255, blank = True) source_id = models.CharField(max_length = 255, blank = True) organiser_email = models.EmailField(max_length = 255) campaign = models.ForeignKey('Campaign', null = True, blank=True) kind = models.ForeignKey('EventKind', null = True) verified = models.BooleanField(default = False) official = models.BooleanField(default = False) public = models.BooleanField(default = False) pending_deletion = models.BooleanField(default = False) objects = models.GeoManager() def save(self, *args, **kwargs): super(Event, self).save(*args, **kwargs) if not self.url_hash: # We have to do this after a save, because we need an ID from the DB self.url_hash = hashlib.sha224('%d' % self.id).hexdigest()[:9] self.save() def __unicode__(self): return self.name def get_absolute_url(self): if self.bsd_hosted(): return self.event_url else: return reverse('event', kwargs={'event_hash': self.hash}) @property def hash(self): if not self.url_hash: self.save() return self.url_hash @property def bleached_description(self): return bleached(self.description) def bsd_hosted(self): return self.source == 'bsd' def verify_ownership(self, user): return user.email == self.organiser_email @classmethod def all_upcoming(cls, sort='start'): resultset = cls.objects.filter(start__gte = datetime.now()).order_by(sort) return resultset @classmethod def upcoming(cls, sort='start', include_private=False): resultset = cls.all_upcoming(sort).filter(verified = True, pending_deletion = False) if not include_private: resultset = resultset.filter(public=True) return resultset @classmethod def near(cls, latitude, longitude, sort='start', include_private=False): point = geos.Point(float(longitude), float(latitude)) return cls.upcoming(sort, include_private).filter(venue__location__distance_lte=(point, measure.D(mi=50))) @classmethod def all_user_non_bsd(cls, user): return cls.objects.filter(organiser_email = user.email).exclude(source = 'bsd').order_by('start') @classmethod def all_user_bsd(cls, user): return cls.objects.filter(organiser_email = user.email, source = 'bsd').order_by('start') @classmethod def all_upcoming_bsd(cls): return cls.all_upcoming().filter(source = 'bsd') class EventAndVenueUpdater(object): @classmethod def update(cls, event, new_event, venue, new_venue): if not cls.are_model_instances_identical(venue, new_venue): venue = new_venue venue.save() if not cls.are_model_instances_identical(event, new_event): if event.id: new_event.id = event.id event = new_event event.venue = venue event.save() @classmethod def are_model_instances_identical(cls, instance1, instance2): if not (type(instance1) == type(instance2)): return False local_fields = [f for f in instance1._meta.local_fields if not f.primary_key] def comparator(initial, field): return initial and (field.value_from_object(instance1) == field.value_from_object(instance2)) return reduce(comparator, local_fields, True) class Campaign(models.Model): name = models.CharField(max_length = 255) description = models.TextField() logo = models.ImageField(upload_to = 'campaigns', storage = FileSystemStorage(**settings.UPLOADED_IMAGES)) slug = models.SlugField() start = models.DateField() end = models.DateField() # campaign logo's were being a pain, hopefully less so now def check_logo(self): return self.logo.storage.exists(self.logo.name) @classmethod def current(self): today = datetime.today().date() try: return self.objects.filter(start__lte=today, end__gte=today).order_by('start').get() except ObjectDoesNotExist: return None def __unicode__(self): return '%s - %s to %s' % (self.name, self.start, self.end) class EventKind(models.Model): name = models.CharField(max_length = 255) description = models.TextField() figures = models.TextField(blank=True, null=True) additional = models.TextField(blank=True, null=True) slug = models.SlugField() def __unicode__(self): return mark_safe(u'%s' % (self.name)) class Partner(models.Model): name = models.CharField(max_length=255) website = models.URLField() logo = models.ImageField( upload_to='partners', storage=FileSystemStorage(**settings.UPLOADED_IMAGES) ) featured = models.BooleanField(default=False, help_text=_(u'Featured partners are displayed on the home and campaign page')) for_campaign = models.ForeignKey(Campaign) def __unicode__(self): return self.name class Meta: ordering = ('name',)
MikeSmvl/travelingstrategy
client/src/components/HealthCard/HealthCard.js
<reponame>MikeSmvl/travelingstrategy import React from 'react'; import { Row, Table } from 'react-bootstrap'; import { Card, CardBody } from '../Card/Card'; import { compareSingle, compareDouble, percentDiffColor } from '../../utils/healthComparison'; const HealthCard = (props) => { const { destinationHealth = {}, originHealth = {}, destinationCountry = '' } = props; return ( <> <Card data-aos="zoom-out-down" header="General Health" footer={<Row className="justify-content-center"><a href={`https://data.un.org/en/iso/${destinationCountry}.html`} target="_blank" rel="noopener noreferrer"><i className="fa fa-globe" /> Reference </a></Row>}> <CardBody> <Table striped bordered hover> <tbody> <tr> <td> <strong>Homicide Rate</strong> </td> <td> {destinationHealth.homicideRate}{' '} <span style={{ color: percentDiffColor( String(destinationHealth.homicideRate), String(originHealth.homicideRate) ) }} > {compareSingle( String(destinationHealth.homicideRate), String(originHealth.homicideRate) )} </span> </td> </tr> <tr> <td> <strong>Infant Mortality (Per 1000)</strong> </td> <td> {destinationHealth.infantMortality}{' '} <span style={{ color: percentDiffColor( String(destinationHealth.infantMortality), String(originHealth.infantMortality) ) }} > {compareSingle( String(destinationHealth.infantMortality), String(originHealth.infantMortality) )} </span> </td> </tr> <tr> <td> <strong>Life Expectancy (f/m, years)</strong> </td> <td> {destinationHealth.lifeExpectancy}{' '} <span style={{ color: 'blue' }}> {compareDouble( destinationHealth.lifeExpectancy, originHealth.lifeExpectancy )} </span> </td> </tr> <tr> <td> <strong>Number of physicians (Per 1000)</strong> </td> <td> {destinationHealth.nbOfPhysicians}{' '} <span style={{ color: percentDiffColor( String(destinationHealth.nbOfPhysicians), String(originHealth.nbOfPhysicians) ) }} > {compareSingle( String(destinationHealth.nbOfPhysicians), String(originHealth.nbOfPhysicians) )} </span> </td> </tr> <tr> <td> <strong>Sanitation (urban/rural, %)</strong> </td> <td> {destinationHealth.sanitation}{' '} <span style={{ color: 'blue' }}> {compareDouble( destinationHealth.sanitation, originHealth.sanitation )} </span> </td> </tr> <tr> <td> <strong>Water (urban/rural, %)</strong> </td> <td> {destinationHealth.water}{' '} <span style={{ color: 'blue' }}> {compareDouble( destinationHealth.water, originHealth.water )} </span> </td> </tr> </tbody> </Table> </CardBody> </Card> </> ); }; export default HealthCard;
Automedon/CodeWars-7-kata
Array Mappings.js
/* Description: Array Mappings Oh no, the map method for arrays has been disabled. Can you fix it? In case you haven't come across the map method for arrays, here is how it works: [1,2,3].map(x => x ** 2) === [1,4,9] [1,2,3].map(x => 2 * x) === [2,4,6] [1,2,3].map(x => 2 ** x) === [2,4,8] [1,2,3].map(x => x.toString()) === ["1","2","3"] ["1","2","3"].map(x => parseInt(x)) === [1,2,3] ["random","array","to","be","mapped"].map(x => mapping(x)) === [mapping("random"),mapping("array"),mapping("to"),mapping("be"),mapping("mapped")] The map method does not mutate the original array. */ Array.prototype.map = function(callback/*, thisArg*/) { var T, A, k; if (this == null) { throw new TypeError('this is null or not defined');} var O = Object(this); var len = O.length >>> 0; if (typeof callback !== 'function') { throw new TypeError(callback + ' is not a function');} if (arguments.length > 1) { T = arguments[1];} A = new Array(len); k = 0; while (k < len) { var kValue, mappedValue; if (k in O) { kValue = O[k]; mappedValue = callback.call(T, kValue, k, O); A[k] = mappedValue; } k++; } return A; };
0lOveLycaT0/IT-PROJECT-EXTRA-PACK
IT-PROJECT EXTRA PACK PE/jni/mcpe/locale/SkinPack.h
#pragma once #include <string> #include <vector> // Size : 32 class SkinPack { public: enum SkinPackType { DEFAULT, PACK }; std::string serializableName; // 0 std::string name; // 4 std::string price; // 8 bool unlocked; // 12 std::vector<Skin> skins; // 16 SkinPackType type; // 28 SkinPack(SkinPackType type, std::string const &serializableName, std::string name, bool unlocked, std::initializer_list<Skin> const &skins); const std::string &getSerializableName() const; const std::string &getPrice() const; void setPrice(std::string const &); bool isPremiumUnlocked() const; bool setPremiumUnlocked(bool); const std::string &getName() const; const std::vector<Skin> &getSkins() const; SkinPackType getSkinPackType() const; bool operator==(SkinPack const &) const; };
suhanime/installer
vendor/github.com/tombuildsstuff/giovanni/storage/2018-11-09/file/directories/get.go
package directories import ( "context" "net/http" "strings" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" "github.com/tombuildsstuff/giovanni/storage/internal/endpoints" "github.com/tombuildsstuff/giovanni/storage/internal/metadata" ) type GetResult struct { autorest.Response // A set of name-value pairs that contain metadata for the directory. MetaData map[string]string // The value of this header is set to true if the directory metadata is completely // encrypted using the specified algorithm. Otherwise, the value is set to false. DirectoryMetaDataEncrypted bool } // Get returns all system properties for the specified directory, // and can also be used to check the existence of a directory. func (client Client) Get(ctx context.Context, accountName, shareName, path string) (result GetResult, err error) { if accountName == "" { return result, validation.NewError("directories.Client", "Get", "`accountName` cannot be an empty string.") } if shareName == "" { return result, validation.NewError("directories.Client", "Get", "`shareName` cannot be an empty string.") } if strings.ToLower(shareName) != shareName { return result, validation.NewError("directories.Client", "Get", "`shareName` must be a lower-cased string.") } if path == "" { return result, validation.NewError("directories.Client", "Get", "`path` cannot be an empty string.") } req, err := client.GetPreparer(ctx, accountName, shareName, path) if err != nil { err = autorest.NewErrorWithError(err, "directories.Client", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "directories.Client", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "directories.Client", "Get", resp, "Failure responding to request") return } return } // GetPreparer prepares the Get request. func (client Client) GetPreparer(ctx context.Context, accountName, shareName, path string) (*http.Request, error) { pathParameters := map[string]interface{}{ "shareName": autorest.Encode("path", shareName), "directory": autorest.Encode("path", path), } queryParameters := map[string]interface{}{ "restype": autorest.Encode("query", "directory"), } headers := map[string]interface{}{ "x-ms-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/xml; charset=utf-8"), autorest.AsGet(), autorest.WithBaseURL(endpoints.GetFileEndpoint(client.BaseURI, accountName)), autorest.WithPathParameters("/{shareName}/{directory}", pathParameters), autorest.WithQueryParameters(queryParameters), autorest.WithHeaders(headers)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client Client) GetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client Client) GetResponder(resp *http.Response) (result GetResult, err error) { if resp != nil && resp.Header != nil { result.MetaData = metadata.ParseFromHeaders(resp.Header) result.DirectoryMetaDataEncrypted = strings.EqualFold(resp.Header.Get("x-ms-server-encrypted"), "true") } err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return }
lilinor/Detox
detox/src/devices/drivers/android/genycloud/services/GenyInstanceNaming.js
<reponame>lilinor/Detox<gh_stars>1000+ const getWorkerId = require('../../../../../utils/getWorkerId'); class GenyInstanceNaming { constructor(nowProvider = () => new Date().getTime()) { this.uniqueSessionId = Number(process.env.DETOX_START_TIMESTAMP); this.nowProvider = nowProvider; this._workerId = getWorkerId() || (this.nowProvider() - this.uniqueSessionId); } generateName() { return `Detox-${this.uniqueSessionId}.${this._workerId}`; } isFamilial(name) { return name.startsWith(`Detox-${this.uniqueSessionId}.${this._workerId}`); } } module.exports = GenyInstanceNaming;
toninoes/tfg-heridas-rest-servicio-web-spring
src/main/java/rha/service/DiagnosticoService.java
package rha.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import rha.exception.ErrorInternoServidorException; import rha.exception.RecursoNoEncontradoException; import rha.model.Diagnostico; import rha.model.Grupodiagnostico; import rha.repository.DiagnosticoRepository; import rha.repository.GrupodiagnosticoRepository; @Service public class DiagnosticoService { @Autowired private DiagnosticoRepository diagnosticoRepository; @Autowired private GrupodiagnosticoRepository grupoRepository; //@Cacheable("diagnosticos") public List<Diagnostico> findAll() { return diagnosticoRepository.findAll(); } public List<Diagnostico> findByFiltro(String texto) { return diagnosticoRepository.findByFiltroContainingIgnoreCase(texto); } public List<Diagnostico> findByGrupoDiagnostico(long id) { Grupodiagnostico grupodiagnostico = grupoRepository.findById(id) .orElseThrow(() -> new RecursoNoEncontradoException("Grupodiagnostico", "id", id)); return diagnosticoRepository.findByGrupodiagnostico(grupodiagnostico); } //@Cacheable("diagnostico") public Diagnostico findById(long id) { return diagnosticoRepository.findById(id) .orElseThrow(() -> new RecursoNoEncontradoException("Diagnostico", "id", id)); } public ResponseEntity<Diagnostico> create(Diagnostico d) { Grupodiagnostico grupodiagnostico = grupoRepository.findById(d.getGrupodiagnostico().getId()) .orElseThrow(() -> new RecursoNoEncontradoException("Grupodiagnostico", "id", d.getGrupodiagnostico().getId())); d.setGrupodiagnostico(grupodiagnostico); try { return new ResponseEntity<Diagnostico>(diagnosticoRepository.save(d), HttpStatus.CREATED); } catch (Exception e) { throw new ErrorInternoServidorException("guardar", "Diagnostico", d.getId(), e.getMessage()); } } public ResponseEntity<Diagnostico> update(long id, Diagnostico d) { Diagnostico diagnostico = diagnosticoRepository.findById(id) .orElseThrow(() -> new RecursoNoEncontradoException("Diagnostico", "id", id)); try { diagnostico.setCodigo(d.getCodigo()); diagnostico.setNombre(d.getNombre()); diagnostico.setGrupodiagnostico(d.getGrupodiagnostico()); return new ResponseEntity<Diagnostico>(diagnosticoRepository.save(diagnostico), HttpStatus.OK); } catch (Exception e) { throw new ErrorInternoServidorException("actualizar", "Diagnostico", id, e.getMessage()); } } public ResponseEntity<?> delete(long id) { Diagnostico diagnostico = diagnosticoRepository.findById(id) .orElseThrow(() -> new RecursoNoEncontradoException("Diagnostico", "id", id)); try { diagnosticoRepository.delete(diagnostico); } catch (Exception e) { throw new ErrorInternoServidorException("borrar", "Diagnostico", id, e.getMessage()); } return new ResponseEntity<>(HttpStatus.NO_CONTENT); } }
shahzaibkhalid/shaizei
packages/scripts/scripts/lint.js
const lint = () => { const { sync } = require('cross-spawn'); const { standardFiles: { src } } = require('@shaizei/helpers'); const spawnOptions = require('../lib/spawnOptions'); const childProcess = sync( `./node_modules/@shaizei/eslint-config/node_modules/.bin/eslint --ext .js --ext .jsx --ext .ts --ext .tsx '${src}/'`, spawnOptions ); if (childProcess.status === 1) process.exit(1); }; module.exports = lint;
ZLW07/RobWork
RobWorkSim/src/rwsimlibs/bullet/BtDebugRender.cpp
<filename>RobWorkSim/src/rwsimlibs/bullet/BtDebugRender.cpp /******************************************************************************** * Copyright 2015 The Robotics Group, The Maersk Mc-Kinney Moller Institute, * Faculty of Engineering, University of Southern Denmark * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ********************************************************************************/ #include "BtDebugRender.hpp" #include "BtSimulator.hpp" using namespace rw::graphics; using namespace rwsimlibs::bullet; BtDebugRender::BtDebugRender (BtSimulator* sim) : _sim (sim), _drawMask (0) { //_debugDrawer = new GLDebugDrawer(); //_debugDrawer->setDebugMode(1+2+4+8); //_sim->getBtWorld()->setDebugDrawer(_debugDrawer); } BtDebugRender::~BtDebugRender () {} void BtDebugRender::draw (const DrawableNode::RenderInfo& info, DrawType draw, double alpha) const { //_sim->getBtWorld()->debugDrawWorld(); } void BtDebugRender::setDrawMask (unsigned int mask) { _drawMask = mask; }
jhwsx/Think4JavaExamples
codes/src/generics/Holder3.java
<filename>codes/src/generics/Holder3.java package generics; /** * @author wangzhichao * @since 2019/12/08 */ public class Holder3<T> { private T a; public Holder3(T a) { this.a = a; } public T get() { return a; } public void set(T a) { this.a = a; } public static void main(String[] args) { Holder3<Automobile> h3 = new Holder3<>(new Automobile()); // 无需强转 Automobile a = h3.get(); // 编译不通过,类型不匹配 // h3.set("Not an Automobile"); // h3.set(1); } }
mfkiwl/coast-compilerAssistedSoftwareFaultTolerance
tests/TMRregression/unitTests/returnPointer.c
<reponame>mfkiwl/coast-compilerAssistedSoftwareFaultTolerance /* returnPointer.c Unit test designed to exercise returning pointer types. Notes: Possible compilation error when run with DWC */ #include <stdio.h> int* something(int* x) { if (*x >= 0) *x += 1; else *x -= 1; return x; } int main() { int x = 0; int* y = something(&x); x = *y; printf("x = %d\n", x); //expected results: x == 1 if (x == 1) { printf("Success!\n"); return 0; } else { printf("Error!\n"); return -1; } return 0; }
pengdu/bubblefs
src/utils/slash_random.h
// slash/slash/include/random.h #ifndef BUBBLEFS_UTILS_SLASH_RANDOM_H_ #define BUBBLEFS_UTILS_SLASH_RANDOM_H_ #include <stdlib.h> #include <time.h> namespace bubblefs { namespace myslash { class Random { public: Random() { srand(time(NULL)); } /* * return Random number in [1...n] */ static uint32_t Uniform(int n) { return (random() % n) + 1; } }; } // namespace myslash } // namespace bubblefs #endif // BUBBLEFS_UTILS_SLASH_RANDOM_H_
lileding/baetyl-cloud
api/api.go
<reponame>lileding/baetyl-cloud<filename>api/api.go package api import ( "github.com/baetyl/baetyl-go/v2/log" "github.com/baetyl/baetyl-cloud/v2/common" "github.com/baetyl/baetyl-cloud/v2/config" "github.com/baetyl/baetyl-cloud/v2/facade" "github.com/baetyl/baetyl-cloud/v2/service" ) // API baetyl api server type API struct { NS service.NamespaceService Node service.NodeService Index service.IndexService Func service.FunctionService Obj service.ObjectService PKI service.PKIService Auth service.AuthService Prop service.PropertyService Module service.ModuleService Init service.InitService License service.LicenseService Template service.TemplateService Task service.TaskService Locker service.LockerService SysApp service.SystemAppService Sign service.SignService Wrapper service.WrapperService Facade facade.Facade *service.AppCombinedService log *log.Logger } // NewAPI NewAPI func NewAPI(config *config.CloudConfig) (*API, error) { acs, err := service.NewAppCombinedService(config) if err != nil { return nil, err } nodeService, err := service.NewNodeService(config) if err != nil { return nil, err } namespaceService, err := service.NewNamespaceService(config) if err != nil { return nil, err } indexService, err := service.NewIndexService(config) if err != nil { return nil, err } functionService, err := service.NewFunctionService(config) if err != nil { return nil, err } objectService, err := service.NewObjectService(config) if err != nil { return nil, err } pkiService, err := service.NewPKIService(config) if err != nil { return nil, err } authService, err := service.NewAuthService(config) if err != nil { return nil, err } signService, err := service.NewSignService(config) if err != nil { return nil, err } propertyService, err := service.NewPropertyService(config) if err != nil { return nil, err } moduleService, err := service.NewModuleService(config) if err != nil { return nil, err } initService, err := service.NewInitService(config) if err != nil { return nil, err } licenseService, err := service.NewLicenseService(config) if err != nil { return nil, err } templateService, err := service.NewTemplateService(config, map[string]interface{}{ "GetProperty": propertyService.GetPropertyValue, "RandString": common.RandString, "GetModuleImage": moduleService.GetLatestModuleImage, "GetModuleProgram": moduleService.GetLatestModuleProgram, }) if err != nil { return nil, err } taskService, err := service.NewTaskService(config) if err != nil { return nil, err } lockerService, err := service.NewLockerService(config) if err != nil { return nil, err } sysApp, err := service.NewSystemAppService(config) if err != nil { return nil, err } wrapper, err := service.NewWrapperService(config) if err != nil { return nil, err } appFacade, err := facade.NewFacade(config) if err != nil { return nil, err } return &API{ NS: namespaceService, Node: nodeService, Index: indexService, Obj: objectService, Func: functionService, PKI: pkiService, Auth: authService, Sign: signService, Prop: propertyService, Module: moduleService, Init: initService, License: licenseService, Template: templateService, Task: taskService, Locker: lockerService, SysApp: sysApp, Wrapper: wrapper, AppCombinedService: acs, Facade: appFacade, log: log.L().With(log.Any("api", "admin")), }, nil }
reeteshranjan/cross-browser-tests-runner
tests/integration/browserstack.js
describe('Integration Tests', function() { require('./tests/server-browserstack') require('./tests/hooks-browserstack') })
aiHiNiHao/wg_vpn
tunnel/tools/wireguard-tools/src/ipc-openbsd.h
// SPDX-License-Identifier: MIT /* * Copyright (C) 2015-2020 <NAME> <<EMAIL>>. All Rights Reserved. */ #include <errno.h> #include <stddef.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <sys/sockio.h> #include <sys/types.h> #include <net/if.h> #include <net/if_wg.h> #include <netinet/in.h> #include "containers.h" #define IPC_SUPPORTS_KERNEL_INTERFACE static int get_dgram_socket(void) { static int sock = -1; if (sock < 0) sock = socket(AF_INET, SOCK_DGRAM, 0); return sock; } static int kernel_get_wireguard_interfaces(struct string_list *list) { struct ifgroupreq ifgr = { .ifgr_name = "wg" }; struct ifg_req *ifg; int s = get_dgram_socket(), ret = 0; if (s < 0) return -errno; if (ioctl(s, SIOCGIFGMEMB, (caddr_t)&ifgr) < 0) return errno == ENOENT ? 0 : -errno; ifgr.ifgr_groups = calloc(1, ifgr.ifgr_len); if (!ifgr.ifgr_groups) return -errno; if (ioctl(s, SIOCGIFGMEMB, (caddr_t)&ifgr) < 0) { ret = -errno; goto out; } for (ifg = ifgr.ifgr_groups; ifg && ifgr.ifgr_len > 0; ++ifg) { if ((ret = string_list_add(list, ifg->ifgrq_member)) < 0) goto out; ifgr.ifgr_len -= sizeof(struct ifg_req); } out: free(ifgr.ifgr_groups); return ret; } static int kernel_get_device(struct wgdevice **device, const char *iface) { struct wg_data_io wgdata = { .wgd_size = 0 }; struct wg_interface_io *wg_iface; struct wg_peer_io *wg_peer; struct wg_aip_io *wg_aip; struct wgdevice *dev; struct wgpeer *peer; struct wgallowedip *aip; int s = get_dgram_socket(), ret; if (s < 0) return -errno; *device = NULL; strlcpy(wgdata.wgd_name, iface, sizeof(wgdata.wgd_name)); for (size_t last_size = wgdata.wgd_size;; last_size = wgdata.wgd_size) { if (ioctl(s, SIOCGWG, (caddr_t)&wgdata) < 0) goto out; if (last_size >= wgdata.wgd_size) break; wgdata.wgd_interface = realloc(wgdata.wgd_interface, wgdata.wgd_size); if (!wgdata.wgd_interface) goto out; } wg_iface = wgdata.wgd_interface; dev = calloc(1, sizeof(*dev)); if (!dev) goto out; strlcpy(dev->name, iface, sizeof(dev->name)); if (wg_iface->i_flags & WG_INTERFACE_HAS_RTABLE) { dev->fwmark = wg_iface->i_rtable; dev->flags |= WGDEVICE_HAS_FWMARK; } if (wg_iface->i_flags & WG_INTERFACE_HAS_PORT) { dev->listen_port = wg_iface->i_port; dev->flags |= WGDEVICE_HAS_LISTEN_PORT; } if (wg_iface->i_flags & WG_INTERFACE_HAS_PUBLIC) { memcpy(dev->public_key, wg_iface->i_public, sizeof(dev->public_key)); dev->flags |= WGDEVICE_HAS_PUBLIC_KEY; } if (wg_iface->i_flags & WG_INTERFACE_HAS_PRIVATE) { memcpy(dev->private_key, wg_iface->i_private, sizeof(dev->private_key)); dev->flags |= WGDEVICE_HAS_PRIVATE_KEY; } wg_peer = &wg_iface->i_peers[0]; for (size_t i = 0; i < wg_iface->i_peers_count; ++i) { peer = calloc(1, sizeof(*peer)); if (!peer) goto out; if (dev->first_peer == NULL) dev->first_peer = peer; else dev->last_peer->next_peer = peer; dev->last_peer = peer; if (wg_peer->p_flags & WG_PEER_HAS_PUBLIC) { memcpy(peer->public_key, wg_peer->p_public, sizeof(peer->public_key)); peer->flags |= WGPEER_HAS_PUBLIC_KEY; } if (wg_peer->p_flags & WG_PEER_HAS_PSK) { memcpy(peer->preshared_key, wg_peer->p_psk, sizeof(peer->preshared_key)); peer->flags |= WGPEER_HAS_PRESHARED_KEY; } if (wg_peer->p_flags & WG_PEER_HAS_PKA) { peer->persistent_keepalive_interval = wg_peer->p_pka; peer->flags |= WGPEER_HAS_PERSISTENT_KEEPALIVE_INTERVAL; } if (wg_peer->p_flags & WG_PEER_HAS_ENDPOINT && wg_peer->p_sa.sa_len <= sizeof(peer->endpoint.addr)) memcpy(&peer->endpoint.addr, &wg_peer->p_sa, wg_peer->p_sa.sa_len); peer->rx_bytes = wg_peer->p_rxbytes; peer->tx_bytes = wg_peer->p_txbytes; peer->last_handshake_time.tv_sec = wg_peer->p_last_handshake.tv_sec; peer->last_handshake_time.tv_nsec = wg_peer->p_last_handshake.tv_nsec; wg_aip = &wg_peer->p_aips[0]; for (size_t j = 0; j < wg_peer->p_aips_count; ++j) { aip = calloc(1, sizeof(*aip)); if (!aip) goto out; if (peer->first_allowedip == NULL) peer->first_allowedip = aip; else peer->last_allowedip->next_allowedip = aip; peer->last_allowedip = aip; aip->family = wg_aip->a_af; if (wg_aip->a_af == AF_INET) { memcpy(&aip->ip4, &wg_aip->a_ipv4, sizeof(aip->ip4)); aip->cidr = wg_aip->a_cidr; } else if (wg_aip->a_af == AF_INET6) { memcpy(&aip->ip6, &wg_aip->a_ipv6, sizeof(aip->ip6)); aip->cidr = wg_aip->a_cidr; } ++wg_aip; } wg_peer = (struct wg_peer_io *)wg_aip; } *device = dev; errno = 0; out: ret = -errno; free(wgdata.wgd_interface); return ret; } static int kernel_set_device(struct wgdevice *dev) { struct wg_data_io wgdata = { .wgd_size = sizeof(struct wg_interface_io) }; struct wg_interface_io *wg_iface; struct wg_peer_io *wg_peer; struct wg_aip_io *wg_aip; struct wgpeer *peer; struct wgallowedip *aip; int s = get_dgram_socket(), ret; size_t peer_count, aip_count; if (s < 0) return -errno; for_each_wgpeer(dev, peer) { wgdata.wgd_size += sizeof(struct wg_peer_io); for_each_wgallowedip(peer, aip) wgdata.wgd_size += sizeof(struct wg_aip_io); } wg_iface = wgdata.wgd_interface = calloc(1, wgdata.wgd_size); if (!wgdata.wgd_interface) return -errno; strlcpy(wgdata.wgd_name, dev->name, sizeof(wgdata.wgd_name)); if (dev->flags & WGDEVICE_HAS_PRIVATE_KEY) { memcpy(wg_iface->i_private, dev->private_key, sizeof(wg_iface->i_private)); wg_iface->i_flags |= WG_INTERFACE_HAS_PRIVATE; } if (dev->flags & WGDEVICE_HAS_LISTEN_PORT) { wg_iface->i_port = dev->listen_port; wg_iface->i_flags |= WG_INTERFACE_HAS_PORT; } if (dev->flags & WGDEVICE_HAS_FWMARK) { wg_iface->i_rtable = dev->fwmark; wg_iface->i_flags |= WG_INTERFACE_HAS_RTABLE; } if (dev->flags & WGDEVICE_REPLACE_PEERS) wg_iface->i_flags |= WG_INTERFACE_REPLACE_PEERS; peer_count = 0; wg_peer = &wg_iface->i_peers[0]; for_each_wgpeer(dev, peer) { wg_peer->p_flags = WG_PEER_HAS_PUBLIC; memcpy(wg_peer->p_public, peer->public_key, sizeof(wg_peer->p_public)); if (peer->flags & WGPEER_HAS_PRESHARED_KEY) { memcpy(wg_peer->p_psk, peer->preshared_key, sizeof(wg_peer->p_psk)); wg_peer->p_flags |= WG_PEER_HAS_PSK; } if (peer->flags & WGPEER_HAS_PERSISTENT_KEEPALIVE_INTERVAL) { wg_peer->p_pka = peer->persistent_keepalive_interval; wg_peer->p_flags |= WG_PEER_HAS_PKA; } if ((peer->endpoint.addr.sa_family == AF_INET || peer->endpoint.addr.sa_family == AF_INET6) && peer->endpoint.addr.sa_len <= sizeof(wg_peer->p_endpoint)) { memcpy(&wg_peer->p_endpoint, &peer->endpoint.addr, peer->endpoint.addr.sa_len); wg_peer->p_flags |= WG_PEER_HAS_ENDPOINT; } if (peer->flags & WGPEER_REPLACE_ALLOWEDIPS) wg_peer->p_flags |= WG_PEER_REPLACE_AIPS; if (peer->flags & WGPEER_REMOVE_ME) wg_peer->p_flags |= WG_PEER_REMOVE; aip_count = 0; wg_aip = &wg_peer->p_aips[0]; for_each_wgallowedip(peer, aip) { wg_aip->a_af = aip->family; wg_aip->a_cidr = aip->cidr; if (aip->family == AF_INET) { memcpy(&wg_aip->a_ipv4, &aip->ip4, sizeof(wg_aip->a_ipv4)); } else if (aip->family == AF_INET6) { memcpy(&wg_aip->a_ipv6, &aip->ip6, sizeof(wg_aip->a_ipv6)); } else { continue; } ++aip_count; ++wg_aip; } wg_peer->p_aips_count = aip_count; ++peer_count; wg_peer = (struct wg_peer_io *)wg_aip; } wg_iface->i_peers_count = peer_count; if (ioctl(s, SIOCSWG, (caddr_t)&wgdata) < 0) goto out; errno = 0; out: ret = -errno; free(wgdata.wgd_interface); return ret; }
JazzleWare/stript.js
src/op-gt@Parser.js
<gh_stars>0 this.readOp_gt = function() { var op = TOKEN_NONE, c = this.c, len = this.src.length; c++; // the > if (c < len) { var ch = this.ch(c); if (ch === CH_EQUALITY_SIGN) { // >= c++; op = TOKEN_BINARY; this.prec = PREC_COMP; } else if (ch === CH_GREATER_THAN) { // >> c++; if (c < len) { ch = this.ch(c); if (ch === CH_EQUALITY_SIGN) { // >>= c++; op = TOKEN_OP_ASSIG; this.prec = PREC_ASSIG; } else if (ch === CH_GREATER_THAN) { // >>> c++; if (c < len) { if (this.ch(c) === CH_EQUALITY_SIGN) { c++; op = TOKEN_OP_ASSIG; this.prec = PREC_ASSIG; } } if (op === TOKEN_NONE) { op = TOKEN_BINARY; this.prec = PREC_SH; } } } if (op === TOKEN_NONE) { op = TOKEN_BINARY; this.prec = PREC_SH; } } } if (op === TOKEN_NONE) { op = TOKEN_BINARY; this.prec = PREC_COMP; } this.setoff(c); this.ttype = op; this.traw = this.c0_to_c(); };
wsun23/ncstate_ece566_spring2022
projects/p1/C/tests/slice.c
<reponame>wsun23/ncstate_ece566_spring2022<filename>projects/p1/C/tests/slice.c<gh_stars>1-10 #include <stdio.h> int bit(int d, int bit) { return (d >> bit)&0x1; } int set_bit(int d, int bit) { return d | (1 << (bit)); } int clear_bit(int d, int bit) { return d & (~(1 << (bit))); } int myslice(int a) { a = set_bit(a,10); a = set_bit(a,6); a = set_bit(a,4); a = clear_bit(a,1); return a; } int slice(int); int main() { for(int i=-999;i<20000; i++) { if (slice(i) != myslice(i)) { printf("slice(%d) produced %d but %d was expected.\n",i,slice(i),myslice(i)); return 1; } } return 0; }
yearnfar/nanoserver
protocol/stats.go
package protocol type AppStatsRequest struct { AppID string `json:"app_id"` ChannelID string `json:"channel_id"` Remote string `json:"remote"` Event string `json:"event"` Extra string `json:"extra"` Device *Device `json:"device"` } type ChannelAndAppStatsSummaryRequest struct { AppIds []string `json:"app_ids"` ChannelIds []string `json:"channel_ids"` Start int64 `json:"start"` End int64 `json:"end"` SortBy byte `json:"sort_by"` } type UserStatsSummaryRequest struct { AppIds []string `json:"app_ids"` ChannelIds []string `json:"channel_ids"` Role byte `json:"role"` //账号类型 Uid int64 `json:"uid"` Start int64 `json:"start"` //注册起始时间 End int64 `json:"end"` //注册结束时间 SortBy byte `json:"sort_by"` } type ChannelAndAPPStatsSummary struct { Start int64 `json:"start"` AppId string `json:"app_id"` ChannelId string `json:"channel_id"` AppName string `json:"app_name"` ChannelName string `json:"channel_name"` AccountInc int64 `json:"account_inc"` //新增用户 DeviceInc int64 `json:"device_inc"` //新增设备 TotalRecharge int64 `json:"total_recharge"` //总充值 TotalRechargeAccount int64 `json:"total_recharge_account"` //总充值人数 PaidAccountInc int64 `json:"paid_account_inc"` //新增付费用户 PaidTotalRechargeInc int64 `json:"paid_total_recharge_inc"` //新增付费总额 RegPaidAccountInc int64 `json:"reg_paid_account_inc"` //新增注册并付费用户 RegPaidTotalRechargeInc int64 `json:"reg_paid_total_recharge_inc"` //新增注册并付费总额 //PaidAccountIncRate float32 `json:"paid_account_inc_rate"` //新增用户付费率 RegPaidAccountIncRate string `json:"reg_paid_account_inc_rate"` //新增注册用户付费率 } type UserStatsSummary struct { Name string `json:"name"` //名字 Uid int64 `json:"uid"` //uid Role byte `json:"role"` //角色 AppID string `json:"app_id"` //appid ChannelID string `json:"channel_id"` //channel id OS string `json:"os"` IP string `json:"ip"` //最后登录ip Device string `json:"deivce"` //最后登录设备 LoginAt int64 `json:"login_at"` //最后登录时间 RegisterAt int64 `json:"register_at"` //注册时间 LoginNum int64 `json:"login_num"` //登录次数 RechargeNum int64 `json:"recharge_num"` //充值次数 RechargeTotal int64 `json:"total_recharge"` //充值总金额 } type ChannelAndAPPStatsSummaryResponse struct { Code int `json:"code"` //状态码 Data []*ChannelAndAPPStatsSummary `json:"data"` // Total int `json:"total"` //总数量 } type UserStatsSummaryResponse struct { Code int `json:"code"` //状态码 Data []*UserStatsSummary `json:"data"` Total int `json:"total"` //总数量 } type RetentionLite struct { Login int64 `json:"login"` Rate string `json:"rate"` } type Retention struct { Date int `json:"date"` Register int64 `json:"register"` Retention_1 RetentionLite `json:"retention_1"` //次日 Retention_2 RetentionLite `json:"retention_2"` //2日 Retention_3 RetentionLite `json:"retention_3"` //3日 Retention_7 RetentionLite `json:"retention_7"` //7日 Retention_14 RetentionLite `json:"retention_14"` //14日 Retention_30 RetentionLite `json:"retention_30"` //30日 } type RetentionResponse struct { Code int `json:"code"` Data interface{} `json:"data"` } type RetentionListRequest struct { Start int `json:"start"` End int `json:"end"` } type Rank struct { Uid int64 `json:"uid"` Name string `json:"name"` Value int64 `json:"value"` } type CommonStatsItem struct { Date int64 `json:"date"` Value int64 `json:"value"` } //房卡消耗 type CardConsume CommonStatsItem //活跃用户 type ActivationUser CommonStatsItem
lechium/iPhoneOS_12.1.1_Headers
System/Library/Frameworks/WatchConnectivity.framework/WCXPCManager.h
/* * This header is generated by classdump-dyld 1.0 * on Saturday, June 1, 2019 at 6:50:29 PM Mountain Standard Time * Operating System: Version 12.1.1 (Build 16C5050a) * Image Source: /System/Library/Frameworks/WatchConnectivity.framework/WatchConnectivity * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by <NAME>. */ #import <libobjc.A.dylib/NSXPCConnectionDelegate.h> #import <libobjc.A.dylib/WCXPCManagerClientProtocol.h> #import <libobjc.A.dylib/WCXPCManagerDaemonProtocol.h> @protocol WCXPCManagerDelegate, OS_dispatch_queue; @class NSXPCConnection, NSObject, NSString; @interface WCXPCManager : NSObject <NSXPCConnectionDelegate, WCXPCManagerClientProtocol, WCXPCManagerDaemonProtocol> { BOOL _connectionInvalidated; BOOL _reconnectFailed; int _listenerResumedToken; NSXPCConnection* _connection; NSObject*<WCXPCManagerDelegate> _delegate; NSObject*<OS_dispatch_queue> _workQueue; unsigned long long _reconnectRetryCount; } @property (readonly) NSObject*<OS_dispatch_queue> workQueue; //@synthesize workQueue=_workQueue - In the implementation block @property (assign) int listenerResumedToken; //@synthesize listenerResumedToken=_listenerResumedToken - In the implementation block @property (assign) BOOL connectionInvalidated; //@synthesize connectionInvalidated=_connectionInvalidated - In the implementation block @property (assign) BOOL reconnectFailed; //@synthesize reconnectFailed=_reconnectFailed - In the implementation block @property (assign) unsigned long long reconnectRetryCount; //@synthesize reconnectRetryCount=_reconnectRetryCount - In the implementation block @property (readonly) NSXPCConnection * connection; //@synthesize connection=_connection - In the implementation block @property (__weak) NSObject*<WCXPCManagerDelegate> delegate; //@synthesize delegate=_delegate - In the implementation block @property (readonly) unsigned long long hash; @property (readonly) Class superclass; @property (copy,readonly) NSString * description; @property (copy,readonly) NSString * debugDescription; +(id)clientInterface; +(id)daemonInterface; +(void)initialize; +(id)sharedManager; -(NSObject*<OS_dispatch_queue>)workQueue; -(void)handleResponse:(id)arg1 ; -(void)setupConnection; -(int)listenerResumedToken; -(void)setListenerResumedToken:(int)arg1 ; -(void)invalidateConnection; -(BOOL)connectionInvalidated; -(void)sessionReadyForInitialStateForClientPairingID:(id)arg1 supportsActiveDeviceSwitch:(BOOL)arg2 withErrorHandler:(/*^block*/id)arg3 ; -(void)updateApplicationContext:(id)arg1 clientPairingID:(id)arg2 errorHandler:(/*^block*/id)arg3 ; -(void)transferFile:(id)arg1 sandboxToken:(id)arg2 clientPairingID:(id)arg3 errorHandler:(/*^block*/id)arg4 ; -(void)cancelSendWithIdentifier:(id)arg1 ; -(void)transferUserInfo:(id)arg1 withURL:(id)arg2 clientPairingID:(id)arg3 errorHandler:(/*^block*/id)arg4 ; -(void)handleSentMessageWithIdentifier:(id)arg1 error:(id)arg2 ; -(void)acknowledgeFileIndexWithIdentifier:(id)arg1 clientPairingID:(id)arg2 ; -(void)acknowledgeFileResultIndexWithIdentifier:(id)arg1 clientPairingID:(id)arg2 ; -(void)acknowledgeUserInfoIndexWithIdentifier:(id)arg1 clientPairingID:(id)arg2 ; -(void)acknowledgeUserInfoResultIndexWithIdentifier:(id)arg1 clientPairingID:(id)arg2 ; -(void)handleApplicationContextWithPairingID:(id)arg1 ; -(void)handleFileResultWithPairingID:(id)arg1 ; -(void)handleIncomingFileWithPairingID:(id)arg1 ; -(void)handleUserInfoResultWithPairingID:(id)arg1 ; -(void)handleIncomingUserInfoWithPairingID:(id)arg1 ; -(void)handleActiveDeviceSwitchStarted; -(void)handleSessionStateChanged:(id)arg1 ; -(void)handleMessageSendingAllowed; -(void)sendMessage:(id)arg1 clientPairingID:(id)arg2 acceptanceHandler:(/*^block*/id)arg3 errorHandler:(/*^block*/id)arg4 ; -(void)cancelAllOutstandingMessages; -(void)sendMessage:(id)arg1 clientPairingID:(id)arg2 acceptanceHandler:(/*^block*/id)arg3 ; -(void)setReconnectRetryCount:(unsigned long long)arg1 ; -(void)onqueue_retryConnectIfNecessary; -(void)handleInterruptedConnection; -(void)onqueue_reconnect; -(BOOL)reconnectFailed; -(unsigned long long)reconnectRetryCount; -(void)setReconnectFailed:(BOOL)arg1 ; -(void)setConnectionInvalidated:(BOOL)arg1 ; -(id)init; -(void)setDelegate:(NSObject*<WCXPCManagerDelegate>)arg1 ; -(NSObject*<WCXPCManagerDelegate>)delegate; -(NSXPCConnection *)connection; -(void)handleRequest:(id)arg1 ; -(void)connection:(id)arg1 handleInvocation:(id)arg2 isReply:(BOOL)arg3 ; @end
consulo/consulo-java
java-impl/src/main/java/com/intellij/javadoc/JavadocGenerationManager.java
<filename>java-impl/src/main/java/com/intellij/javadoc/JavadocGenerationManager.java /* * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.javadoc; import javax.annotation.Nonnull; import jakarta.inject.Inject; import jakarta.inject.Singleton; import org.jdom.Element; import com.intellij.CommonBundle; import com.intellij.analysis.AnalysisScope; import com.intellij.execution.ExecutionException; import com.intellij.execution.executors.DefaultRunExecutor; import com.intellij.execution.runners.ExecutionEnvironmentBuilder; import com.intellij.execution.util.ExecutionErrorDialog; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.project.Project; import com.intellij.util.xmlb.XmlSerializer; @Singleton @State(name = "JavadocGenerationManager", storages = @Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/misc.xml")) public final class JavadocGenerationManager implements PersistentStateComponent<Element> { private final JavadocConfiguration myConfiguration = new JavadocConfiguration(); private final Project myProject; public static JavadocGenerationManager getInstance(@Nonnull Project project) { return ServiceManager.getService(project, JavadocGenerationManager.class); } @Inject JavadocGenerationManager(Project project) { myProject = project; } @Override public Element getState() { return XmlSerializer.serialize(myConfiguration, JavadocConfiguration.FILTER); } @Override public void loadState(Element state) { XmlSerializer.deserializeInto(myConfiguration, state); } @Nonnull public JavadocConfiguration getConfiguration() { return myConfiguration; } public void generateJavadoc(AnalysisScope scope) { try { JavadocGeneratorRunProfile profile = new JavadocGeneratorRunProfile(myProject, scope, myConfiguration); ExecutionEnvironmentBuilder.create(myProject, DefaultRunExecutor.getRunExecutorInstance(), profile).buildAndExecute(); } catch(ExecutionException e) { ExecutionErrorDialog.show(e, CommonBundle.getErrorTitle(), myProject); } } }
projectPiki/pikmin2
unsorted_include_todo/ebi/FileSelect/FSMState_ScreenFileSelect.h
#ifndef _EBI_FILESELECT_FSMSTATE_SCREENFILESELECT_H #define _EBI_FILESELECT_FSMSTATE_SCREENFILESELECT_H /* __vt__Q33ebi10FileSelect25FSMState_ScreenFileSelect: .4byte 0 .4byte 0 .4byte init__Q33ebi10FileSelect8FSMStateFPQ33ebi10FileSelect4TMgrPQ24Game8StateArg .4byte exec__Q33ebi10FileSelect8FSMStateFPQ33ebi10FileSelect4TMgr .4byte "cleanup__Q24Game33FSMState<Q33ebi10FileSelect4TMgr>FPQ33ebi10FileSelect4TMgr" .4byte "resume__Q24Game33FSMState<Q33ebi10FileSelect4TMgr>FPQ33ebi10FileSelect4TMgr" .4byte "restart__Q24Game33FSMState<Q33ebi10FileSelect4TMgr>FPQ33ebi10FileSelect4TMgr" .4byte "transit__Q24Game33FSMState<Q33ebi10FileSelect4TMgr>FPQ33ebi10FileSelect4TMgriPQ24Game8StateArg" .4byte do_init__Q33ebi10FileSelect25FSMState_ScreenFileSelectFPQ33ebi10FileSelect4TMgrPQ24Game8StateArg .4byte do_exec__Q33ebi10FileSelect25FSMState_ScreenFileSelectFPQ33ebi10FileSelect4TMgr */ namespace ebi { namespace FileSelect { struct FSMState { virtual void init(TMgr*, Game::StateArg*); // _00 virtual void exec(TMgr*); // _04 // _00 VTBL }; } // namespace FileSelect } // namespace ebi namespace Game { namespace FSMState < ebi { namespace FileSelect { struct TMgr > { virtual void _00() = 0; // _00 virtual void _04() = 0; // _04 virtual void cleanup(ebi::TMgr*); // _08 virtual void resume(ebi::TMgr*); // _0C virtual void restart(ebi::TMgr*); // _10 virtual void transit(ebi::TMgr*, int, StateArg*); // _14 // _00 VTBL }; } // namespace FileSelect } // namespace ebi } // namespace Game namespace ebi { namespace FileSelect { struct FSMState_ScreenFileSelect : public FSMState, public TMgr > { virtual void init(TMgr*, Game::StateArg*); // _00 virtual void exec(TMgr*); // _04 virtual void cleanup(ebi::TMgr*); // _08 virtual void resume(ebi::TMgr*); // _0C virtual void restart(ebi::TMgr*); // _10 virtual void transit(ebi::TMgr*, int, StateArg*); // _14 virtual void FSMState_Screendo_init(TMgr*, Game::StateArg*); // _18 virtual void FSMState_Screendo_exec(TMgr*); // _1C // _00 VTBL }; } // namespace FileSelect } // namespace ebi #endif
fstltna/conquest_bbs_source
nHistl.c
/* * $Id$ * * Copyright 1999-2004 <NAME> under the ARTISTIC LICENSE. (See LICENSE). */ #include "c_defs.h" #include "context.h" #include "global.h" #include "datatypes.h" #include "color.h" #include "conf.h" #include "conqcom.h" #include "gldisplay.h" #include "node.h" #include "client.h" #include "packet.h" #include "conqutil.h" #include "nCP.h" #include "nMenu.h" #include "nDead.h" #include "nHistl.h" static int nHistlDisplay(dspConfig_t *); static int nHistlIdle(void); static int nHistlInput(int ch); static scrNode_t nHistlNode = { nHistlDisplay, /* display */ nHistlIdle, /* idle */ nHistlInput, /* input */ NULL, /* minput */ NULL /* animQue */ }; static int retnode; /* the node to return to */ scrNode_t *nHistlInit(int nodeid, int setnode) { retnode = nodeid; if (setnode) setNode(&nHistlNode); return(&nHistlNode); } static int nHistlDisplay(dspConfig_t *dsp) { int i, j, unum, lin, col, fline, lline, thistptr = 0; char *hd0="C O N Q U E S T U S E R H I S T O R Y"; char connecttm[BUFFER_SIZE]; char histentrytm[DATESIZE + 1]; /* Do some screen setup. */ fline = 1; lline = MSG_LIN1 - 1; cprintf(fline,0,ALIGN_CENTER,"#%d#%s",LabelColor, hd0); fline = fline + 2; thistptr = ConqInfo->histptr; lin = fline; col = 1; i = thistptr + 1; for ( j = 0; j < MAXHISTLOG; j++ ) { i = utModPlusOne( i - 1, MAXHISTLOG ); unum = History[i].histunum; if ( unum < 0 || unum >= MAXUSERS ) continue; if ( ! Users[unum].live ) continue; /* entry time */ utFormatTime( histentrytm, History[i].histlog); /* now elapsed time */ utFormatSeconds((int) History[i].elapsed, connecttm); /* strip off seconds, or for long times, anything after 7 bytes */ connecttm[7] = '\0'; cprintf( lin, col, ALIGN_NONE, "#%d#%-10.10s #%d#%16s#%d#-#%d#%7s", YellowLevelColor, Users[unum].username, GreenLevelColor, histentrytm, NoColor, RedLevelColor, connecttm); lin++; if ( lin > lline ) { col = 40; lin = fline; } } cprintf(MSG_LIN2, 0, ALIGN_CENTER, MTXT_DONE); return NODE_OK; } static int nHistlIdle(void) { int pkttype; char buf[PKT_MAXSIZE]; while ((pkttype = pktWaitForPacket(PKT_ANYPKT, buf, PKT_MAXSIZE, 0, NULL)) > 0) processPacket(buf); if (pkttype < 0) /* some error */ { utLog("nHistlIdle: waiForPacket returned %d", pkttype); Ships[Context.snum].status = SS_OFF; return NODE_EXIT; } if (clientFlags & SPCLNTSTAT_FLAG_KILLED && retnode == DSP_NODE_CP) { /* time to die properly. */ setONode(NULL); nDeadInit(); return NODE_OK; } return NODE_OK; } static int nHistlInput(int ch) { /* go back */ switch (retnode) { case DSP_NODE_CP: setONode(NULL); nCPInit(FALSE); break; case DSP_NODE_MENU: setONode(NULL); nMenuInit(); break; default: utLog("nHistlInput: invalid return node: %d, going to DSP_NODE_MENU", retnode); setONode(NULL); nMenuInit(); break; } /* NOTREACHED */ return NODE_OK; }